[lm-sensors] [PATCH 0/3] improve i2c probing

Alessandro Zummo azummo-lists at towertech.it
Wed Nov 9 22:14:49 CET 2005


  I've took the patch series proposed by Nathan Lutchansky [1]
  in august, applied some of the suggestions which were emerged
 from its discussion and added a little improvement.

  The original patches are available at [2]. I added some
 more code in order to let an adapter specify which of its
 addresses should be probed for which driver.
  This is useful for platform devices and, probably, video

  quoting Nathan..

"Currently, when a new i2c bus needs to be probed, the i2c subsystem
calls the attach_adapter callback for each loaded i2c client driver,
which must call the i2c_probe function with a list of addresses to be
probed and another callback for reporting detected devices:

    static int foo_attach_adapter(struct i2c_adapter *adapter)
            if (!(adapter->class & I2C_CLASS_HWMON))
                    return 0;
            return i2c_probe(adapter, &addr_data, foo_detect);

Virtually every i2c client driver uses exactly the same code, so there's
little point in requiring them all to implement this callback.  The
first patch in this series adds two new fields to the i2c_driver
structure, `address_data' and `detect_client', and if they are set by
the driver, the i2c core will automatically call i2c_probe using those
fields as the second and third argument.  If the `class' field of the
i2c_driver structure is set, it will be compared with the adapter class

Patches 2 and 3 add these fields to the i2c_driver initializer in the
i2c hwmon and misc i2c chip drivers and remove the corresponding
attach_adapter callbacks."




 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy


More information about the lm-sensors mailing list