[PATCH 0/5] improve i2c probing

From: Nathan Lutchansky (lutchann_at_litech.org)
Date: 08/15/05

  • Next message: Nathan Lutchansky: "[PATCH 1/5] call i2c_probe from i2c core"
    Date:	Mon, 15 Aug 2005 13:51:06 -0400
    To: LKML <linux-kernel@vger.kernel.org>, lm-sensors <lm-sensors@lm-sensors.org>
    
    

    Hi everyone,

    This patch series makes a couple of improvements to the i2c device
    probing process.

    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
    first.

    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.

    The second improvement (which is really the point of this patch set) is
    to add the functions i2c_probe_device and i2c_remove_device for directly
    creating and destroying i2c clients on a particular adapter:

        int i2c_probe_device(struct i2c_adapter *adapter, int driver_id,
                             int addr, int kind);
        int i2c_remove_device(struct i2c_adapter *adapter, int driver_id,
                              int addr);

    These functions make the i2c subsystem usable for special-purpose i2c
    buses where probing isn't possible, either because probing is known to
    be dangerous for devices that are present on the bus, or because the i2c
    adapter lacks quick writes and/or error reporting.

    The final patch adds a new i2c adapter flag to indicate that the adapter
    should never be probed.

    This patch set applies cleanly to the end of Greg KH's i2c patch queue,
    as of 12-Aug-2005. -Nathan

     Documentation/i2c/writing-clients | 58 ++++++++++++++---------
     drivers/hwmon/adm1021.c | 12 +---
     drivers/hwmon/adm1025.c | 12 +---
     drivers/hwmon/adm1026.c | 13 +----
     drivers/hwmon/adm1031.c | 13 +----
     drivers/hwmon/adm9240.c | 12 +---
     drivers/hwmon/asb100.c | 17 +-----
     drivers/hwmon/atxp1.c | 9 ---
     drivers/hwmon/ds1621.c | 10 ----
     drivers/hwmon/fscher.c | 12 +---
     drivers/hwmon/fscpos.c | 12 +---
     drivers/hwmon/gl518sm.c | 12 +---
     drivers/hwmon/gl520sm.c | 12 +---
     drivers/hwmon/it87.c | 17 +-----
     drivers/hwmon/lm63.c | 12 +---
     drivers/hwmon/lm75.c | 13 +----
     drivers/hwmon/lm77.c | 13 +----
     drivers/hwmon/lm78.c | 17 +-----
     drivers/hwmon/lm80.c | 12 +---
     drivers/hwmon/lm83.c | 12 +---
     drivers/hwmon/lm85.c | 12 +---
     drivers/hwmon/lm87.c | 12 +---
     drivers/hwmon/lm90.c | 12 +---
     drivers/hwmon/lm92.c | 11 +---
     drivers/hwmon/max1619.c | 12 +---
     drivers/hwmon/w83781d.c | 17 +-----
     drivers/hwmon/w83792d.c | 18 +------
     drivers/hwmon/w83l785ts.c | 12 +---
     drivers/i2c/chips/ds1337.c | 9 ---
     drivers/i2c/chips/ds1374.c | 8 ---
     drivers/i2c/chips/eeprom.c | 10 ----
     drivers/i2c/chips/m41t00.c | 9 ---
     drivers/i2c/chips/max6875.c | 10 ----
     drivers/i2c/chips/pca9539.c | 10 ----
     drivers/i2c/chips/pcf8574.c | 10 ----
     drivers/i2c/chips/pcf8591.c | 10 ----
     drivers/i2c/chips/rtc8564.c | 8 ---
     drivers/i2c/i2c-core.c | 95 ++++++++++++++++++++++++++++++++++++--
     include/linux/i2c.h | 21 ++++++++
     39 files changed, 246 insertions(+), 360 deletions(-)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Nathan Lutchansky: "[PATCH 1/5] call i2c_probe from i2c core"

    Relevant Pages

    • PATCH, accessibility, adaptive modules, 2.6.0
      ... Yet that's what we must do today, if we want a kernel-resident adapter. ... This patch has been "in the works" for four years, ... it makes the kernel "accessible". ... +thanks to a standard interface that supports adaptive modules. ...
      (Linux-Kernel)
    • RE: kexec and aacraid broken
      ... I believe this issue is a result of the aacraid_commit_reset patch (as ... This is the adapter taking longer than 3 minutes to start after a reset. ... Subject: kexec and aacraid broken ...
      (Linux-Kernel)
    • Re: BizTalk 2006: Problem with "use temporary file while writing" .BTS
      ... Could you please update this post when the patch is released. ... Doug Girard [MSFT] wrote: ... Details:"The FILE send adapter cannot open file ...
      (microsoft.public.biztalk.general)
    • Re: Yes it did the trick - Re[3]: Re[2]: em0, VLAN and bpf(?) trouble w/RELENG_5
      ... > promiscuous mode toggle of vlan support. ... > modifies the if_em driver to track when vlan support is disabled, ... Still not the final patch, ... That patch excluded the addition of a new variable to the adapter ...
      (freebsd-current)
    • Re: 2.6 - sysfs sensor nameing inconsistency
      ... much like your patch did. ... > it is (chip, subclient, etc.) ... Libsensors expects as adapter identification either ... sysfs path except by rescanning /sys/class/i2c-adapter every time. ...
      (Linux-Kernel)