i2c driver changes for 2.5.66

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:09




i2c: fix up drivers/acorn/char/i2c.c due to previous i2c changes

I'm not going to touch the other driver in this directory, as it will
need more than just minor fixups to get correct.

 drivers/acorn/char/i2c.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -Nru a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c
--- a/drivers/acorn/char/i2c.c  Mon Mar 24 17:27:25 2003

 }

 static struct i2c_adapter ioc_ops = {
-       .name                   = "IOC/IOMD",
        .id                     = I2C_HW_B_IOC,
        .algo_data              = &ioc_data,
        .client_register        = ioc_client_reg,
        .client_unregister      = ioc_client_unreg
+       .dev                    = {
+               .name           = "IOC/IOMD",
+       },
 };

 static int __init i2c_ioc_init(void)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:11



[PATCH] i2c: remove the data field from struct i2c_client

It's no longer needed, as the struct device should be used instead.

Created i2c_get_clientdata() and i2c_set_clientdata() to access the data.

 drivers/i2c/chips/adm1021.c |   15 +++++++--------
 drivers/i2c/chips/lm75.c    |    8 ++++----
 include/linux/i2c.h         |   11 ++++++++++-
 3 files changed, 21 insertions(+), 13 deletions(-)

diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c       Mon Mar 24 17:28:15 2003

        }

        data = (struct adm1021_data *) (new_client + 1);
+       i2c_set_clientdata(new_client, data);
        new_client->addr = address;
-       new_client->data = data;
        new_client->adapter = adapter;
        new_client->driver = &adm1021_driver;

        int err;

-       i2c_deregister_entry(((struct adm1021_data *) (client->data))->
-                                sysctl_id);
+       i2c_deregister_entry(((struct adm1021_data *) (i2c_get_clientdata(client)))->sysctl_id);

        if ((err = i2c_detach_client(client))) {

 static void adm1021_update_client(struct i2c_client *client)
 {
-       struct adm1021_data *data = client->data;
+       struct adm1021_data *data = i2c_get_clientdata(client);

        down(&data->update_lock);

 static void adm1021_temp(struct i2c_client *client, int operation,
                         int ctl_name, int *nrels_mag, long *results)
 {
-       struct adm1021_data *data = client->data;
+       struct adm1021_data *data = i2c_get_clientdata(client);

        if (operation == SENSORS_PROC_REAL_INFO)

 static void adm1021_remote_temp(struct i2c_client *client, int operation,
                                int ctl_name, int *nrels_mag, long *results)
 {
-       struct adm1021_data *data = client->data;
+       struct adm1021_data *data = i2c_get_clientdata(client);
        int prec = 0;


 static void adm1021_die_code(struct i2c_client *client, int operation,
                             int ctl_name, int *nrels_mag, long *results)
 {
-       struct adm1021_data *data = client->data;
+       struct adm1021_data *data = i2c_get_clientdata(client);

        if (operation == SENSORS_PROC_REAL_INFO)

 static void adm1021_alarms(struct i2c_client *client, int operation,
                           int ctl_name, int *nrels_mag, long *results)
 {
-       struct adm1021_data *data = client->data;
+       struct adm1021_data *data = i2c_get_clientdata(client);
        if (operation == SENSORS_PROC_REAL_INFO)
                *nrels_mag = 0;
        else if (operation == SENSORS_PROC_REAL_READ) {
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c  Mon Mar 24 17:28:15 2003

        }

        data = (struct lm75_data *) (new_client + 1);
+       i2c_set_clientdata(new_client, data);
        new_client->addr = address;
-       new_client->data = data;
        new_client->adapter = adapter;
        new_client->driver = &lm75_driver;

 static int lm75_detach_client(struct i2c_client *client)
 {
-       struct lm75_data *data = client->data;
+       struct lm75_data *data = i2c_get_clientdata(client);

        i2c_deregister_entry(data->sysctl_id);

 static void lm75_update_client(struct i2c_client *client)
 {
-       struct lm75_data *data = client->data;
+       struct lm75_data *data = i2c_get_clientdata(client);

        down(&data->update_lock);

 static void lm75_temp(struct i2c_client *client, int operation, int ctl_name,
                      int *nrels_mag, long *results)
 {
-       struct lm75_data *data = client->data;
+       struct lm75_data *data = i2c_get_clientdata(client);
        if (operation == SENSORS_PROC_REAL_INFO)
                *nrels_mag = 1;
        else if (operation == SENSORS_PROC_REAL_READ) {
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h       Mon Mar 24 17:28:15 2003

          alignment considerations */
        struct i2c_adapter *adapter;    /* the adapter we sit on        */
        struct i2c_driver *driver;      /* and our access routines      */
-       void *data;                     /* for the clients              */
        int usage_count;                /* How many accesses currently  */
                                        /* to the client                */
        struct device dev;              /* the device structure         */
 };
 #define to_i2c_client(d) container_of(d, struct i2c_client, dev)
+
+static inline void *i2c_get_clientdata (struct i2c_client *dev)
+{
+       return dev_get_drvdata (&dev->dev);
+}
+
+static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
+{
+       return dev_set_drvdata (&dev->dev, data);
+}

 /*
  * The following structs are for those who like to implement new bus drivers:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:12



i2c: fix up drivers/video/matrox/i2c-matroxfb.c due to previous i2c changes

 drivers/video/matrox/i2c-matroxfb.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff -Nru a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
--- a/drivers/video/matrox/i2c-matroxfb.c       Mon Mar 24 17:27:08 2003

        b->mask.data = data;
        b->mask.clock = clock;
        b->adapter = matrox_i2c_adapter_template;
-       sprintf(b->adapter.name, name, minor(minfo->fbcon.node));
+       snprintf(b->adapter.dev.name, DEVICE_NAME_SIZE, name,
+               minor(minfo->fbcon.node));
        b->adapter.data = b;
        b->adapter.algo_data = &b->bac;

        switch (ACCESS_FBINFO(chip)) {
                case MGA_2064:
                case MGA_2164:
-                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0 on i2c-matroxfb");
+                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1B_DATA, DDC1B_CLK, "DDC:fb%u #0");
                        break;
                default:
-                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0 on i2c-matroxfb");
+                       err = i2c_bus_reg(&m2info->ddc1, minfo, DDC1_DATA, DDC1_CLK, "DDC:fb%u #0");
                        break;
        }
        if (err)
                goto fail_ddc1;
        if (ACCESS_FBINFO(devflags.dualhead)) {
-               err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1 on i2c-matroxfb");
+               err = i2c_bus_reg(&m2info->ddc2, minfo, DDC2_DATA, DDC2_CLK, "DDC:fb%u #1");
                if (err == -ENODEV) {
                        printk(KERN_INFO "i2c-matroxfb: VGA->TV plug detected, DDC unavailable.\n");
                } else if (err)
                        printk(KERN_INFO "i2c-matroxfb: Could not register secondary output i2c bus. Continuing anyway.\n");
                /* Register maven bus even on G450/G550 */
-               err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u on i2c-matroxfb");
+               err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u");
                if (err)
                        printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
        }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:12



[PATCH] i2c: fix up the chip driver names to play nice with sysfs

 drivers/i2c/chips/adm1021.c |    2 +-
 drivers/i2c/chips/lm75.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c       Mon Mar 24 17:27:50 2003

 /* This is the driver that will be inserted */
 static struct i2c_driver adm1021_driver = {
        .owner          = THIS_MODULE,
-       .name           = "ADM1021, MAX1617 sensor driver",
+       .name           = "ADM1021-MAX1617",
        .id             = I2C_DRIVERID_ADM1021,
        .flags          = I2C_DF_NOTIFY,
        .attach_adapter = adm1021_attach_adapter,
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c  Mon Mar 24 17:27:50 2003

 /* This is the driver that will be inserted */
 static struct i2c_driver lm75_driver = {
        .owner          = THIS_MODULE,
-       .name           = "LM75 sensor chip driver",
+       .name           = "LM75 sensor",
        .id             = I2C_DRIVERID_LM75,
        .flags          = I2C_DF_NOTIFY,
        .attach_adapter = lm75_attach_adapter,

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:13



[PATCH] i2c: fix typo that newer versions of gcc catch.

 drivers/i2c/scx200_acb.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -Nru a/drivers/i2c/scx200_acb.c b/drivers/i2c/scx200_acb.c
--- a/drivers/i2c/scx200_acb.c  Mon Mar 24 17:27:00 2003

        switch (iface->state) {
        case state_idle:
-               dev_warn(&iface->adapter.dev, "interrupt in idle state\n",);
+               dev_warn(&iface->adapter.dev, "interrupt in idle state\n");
                break;

        case state_address:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:13



[PATCH] i2c: set up a "generic" i2c driver to prevent oopses when devices are registering.

This is needed as we are still not using the driver core model for
matching up devices to drivers, but doing it by hand.  Once that is
changed, this will not be needed.

 drivers/i2c/i2c-core.c |    9 +++++++++
 1 files changed, 9 insertions(+)

diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c    Mon Mar 24 17:26:51 2003

        return 0;
 }

+static struct device_driver i2c_generic_driver = {
+       .name = "i2c",
+       .bus = &i2c_bus_type,
+       .probe = i2c_device_probe,
+       .remove = i2c_device_remove,
+};
+
+
 /* ---------------------------------------------------
  * registering functions

        if (adap->dev.parent == NULL)
                adap->dev.parent = &legacy_bus;
        sprintf(adap->dev.bus_id, "i2c-%d", i);
+       adap->dev.driver = &i2c_generic_driver;
        device_register(&adap->dev);

        /* inform drivers of new adapters */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 03:50:14



i2c: add struct device to i2c_client structure

Not quite ready to hook it up to the driver core yet.

 include/linux/i2c.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h       Mon Mar 24 17:28:24 2003

        void *data;                     /* for the clients              */
        int usage_count;                /* How many accesses currently  */
                                        /* to the client                */
+       struct device dev;              /* the device structure         */
 };
-
+#define to_i2c_client(d) container_of(d, struct i2c_client, dev)

 /*
  * The following structs are for those who like to implement new bus drivers:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:07


ChangeSet 1.889.357.9, 2003/03/21 16:45:59-08:00, g...@kroah.com

i2c: ugh, clean up lindent mess in i2c-proc.c::i2c_detect()

Yes, this function now goes beyond 80 columns, but it's almost
readable, while the previous version was not.

Also removed some #ifdefs

 drivers/i2c/i2c-proc.c |  180 ++++++++++++-------------------------------------
 1 files changed, 47 insertions(+), 133 deletions(-)

diff -Nru a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c
--- a/drivers/i2c/i2c-proc.c    Mon Mar 24 17:27:42 2003
+++ b/drivers/i2c/i2c-proc.c    Mon Mar 24 17:27:42 2003
@@ -23,6 +23,8 @@
     This driver puts entries in /proc/sys/dev/sensors for each I2C device
 */

+/* #define DEBUG 1 */
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -581,9 +583,9 @@
            is_isa ? SENSORS_ISA_BUS : i2c_adapter_id(adapter);

        /* Forget it if we can't probe using SMBUS_QUICK */
-       if ((!is_isa)
-           && !i2c_check_functionality(adapter,
-                                       I2C_FUNC_SMBUS_QUICK)) return -1;
+       if ((!is_isa) &&
+           !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
+               return -1;

        for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
                /* XXX: WTF is going on here??? */
@@ -594,31 +596,14 @@
                /* If it is in one of the force entries, we don't do any
                   detection at all */
                found = 0;
-               for (i = 0;
-                    !found
-                    && (this_force =
-                        address_data->forces + i, this_force->force); i++) {
-                       for (j = 0;
-                            !found
-                            && (this_force->force[j] != SENSORS_I2C_END);
-                            j += 2) {
-                               if (
-                                   ((adapter_id == this_force->force[j])
-                                    ||
-                                    ((this_force->
-                                      force[j] == SENSORS_ANY_I2C_BUS)
-                                     && !is_isa))
-                                   && (addr == this_force->force[j + 1])) {
-#ifdef DEBUG
-                                       printk
-                                           (KERN_DEBUG "i2c-proc.o: found force parameter for adapter %d, addr %04x\n",
-                                            adapter_id, addr);
-#endif
-                                       if (
-                                           (err =
-                                            found_proc(adapter, addr, 0,
-                                                       this_force->
-                                                       kind))) return err;
+               for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) {
+                       for (j = 0; !found && (this_force->force[j] != SENSORS_I2C_END); j += 2) {
+                               if ( ((adapter_id == this_force->force[j]) ||
+                                     ((this_force->force[j] == SENSORS_ANY_I2C_BUS) && !is_isa)) &&
+                                     (addr == this_force->force[j + 1]) ) {
+                                       dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr);
+                                       if ((err = found_proc(adapter, addr, 0, this_force->kind)))
+                                               return err;
                                        found = 1;
                                }
                        }
@@ -628,42 +613,22 @@

                /* If this address is in one of the ignores, we can forget about it
                   right now */
-               for (i = 0;
-                    !found
-                    && (address_data->ignore[i] != SENSORS_I2C_END);
-                    i += 2) {
-                       if (
-                           ((adapter_id == address_data->ignore[i])
-                            ||
-                            ((address_data->
-                              ignore[i] == SENSORS_ANY_I2C_BUS)
-                             && !is_isa))
-                           && (addr == address_data->ignore[i + 1])) {
-#ifdef DEBUG
-                               printk
-                                   (KERN_DEBUG "i2c-proc.o: found ignore parameter for adapter %d, "
-                                    "addr %04x\n", adapter_id, addr);
-#endif
+               for (i = 0; !found && (address_data->ignore[i] != SENSORS_I2C_END); i += 2) {
+                       if ( ((adapter_id == address_data->ignore[i]) ||
+                             ((address_data->ignore[i] == SENSORS_ANY_I2C_BUS) &&
+                              !is_isa)) &&
+                             (addr == address_data->ignore[i + 1])) {
+                               dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr);
                                found = 1;
                        }
                }
-               for (i = 0;
-                    !found
-                    && (address_data->ignore_range[i] != SENSORS_I2C_END);
-                    i += 3) {
-                       if (
-                           ((adapter_id == address_data->ignore_range[i])
-                            ||
-                            ((address_data->
-                              ignore_range[i] ==
-                              SENSORS_ANY_I2C_BUS) & !is_isa))
-                           && (addr >= address_data->ignore_range[i + 1])
-                           && (addr <= address_data->ignore_range[i + 2])) {
-#ifdef DEBUG
-                               printk
-                                   (KERN_DEBUG "i2c-proc.o: found ignore_range parameter for adapter %d, "
-                                    "addr %04x\n", adapter_id, addr);
-#endif
+               for (i = 0; !found && (address_data->ignore_range[i] != SENSORS_I2C_END); i += 3) {
+                       if ( ((adapter_id == address_data->ignore_range[i]) ||
+                             ((address_data-> ignore_range[i] == SENSORS_ANY_I2C_BUS) &
+                              !is_isa)) &&
+                            (addr >= address_data->ignore_range[i + 1]) &&
+                            (addr <= address_data->ignore_range[i + 2])) {
+                               dev_dbg(&adapter->dev,  "found ignore_range parameter for adapter %d, addr %04x\n", adapter_id, addr);
                                found = 1;
                        }
                }
@@ -673,68 +638,31 @@
                /* Now, we will do a detection, but only if it is in the normal or
                   probe entries */
                if (is_isa) {
-                       for (i = 0;
-                            !found
-                            && (address_data->normal_isa[i] !=
-                                SENSORS_ISA_END); i += 1) {
+                       for (i = 0; !found && (address_data->normal_isa[i] != SENSORS_ISA_END); i += 1) {
                                if (addr == address_data->normal_isa[i]) {
-#ifdef DEBUG
-                                       printk
-                                           (KERN_DEBUG "i2c-proc.o: found normal isa entry for adapter %d, "
-                                            "addr %04x\n", adapter_id,
-                                            addr);
-#endif
+                                       dev_dbg(&adapter->dev, "found normal isa entry for adapter %d, addr %04x\n", adapter_id, addr);
                                        found = 1;
                                }
                        }
-                       for (i = 0;
-                            !found
-                            && (address_data->normal_isa_range[i] !=
-                                SENSORS_ISA_END); i += 3) {
-                               if ((addr >=
-                                    address_data->normal_isa_range[i])
-                                   && (addr <=
-                                       address_data->normal_isa_range[i + 1])
-                                   &&
-                                   ((addr -
-                                     address_data->normal_isa_range[i]) %
-                                    address_data->normal_isa_range[i + 2] ==
-                                    0)) {
-#ifdef DEBUG
-                                       printk
-                                           (KERN_DEBUG "i2c-proc.o: found normal isa_range entry for adapter %d, "
-                                            "addr %04x", adapter_id, addr);
-#endif
+                       for (i = 0; !found && (address_data->normal_isa_range[i] != SENSORS_ISA_END); i += 3) {
+                               if ((addr >= address_data->normal_isa_range[i]) &&
+                                   (addr <= address_data->normal_isa_range[i + 1]) &&
+                                   ((addr - address_data->normal_isa_range[i]) % address_data->normal_isa_range[i + 2] == 0)) {
+                                       dev_dbg(&adapter->dev, "found normal isa_range entry for adapter %d, addr %04x", adapter_id, addr);
                                        found = 1;
                                }
                        }
                } else {
-                       for (i = 0;
-                            !found && (address_data->normal_i2c[i] !=
-                                SENSORS_I2C_END); i += 1) {
+                       for (i = 0; !found && (address_data->normal_i2c[i] != SENSORS_I2C_END); i += 1) {
                                if (addr == address_data->normal_i2c[i]) {
                                        found = 1;
-#ifdef DEBUG
-                                       printk
-                                           (KERN_DEBUG "i2c-proc.o: found normal i2c entry for adapter %d, "
-                                            "addr %02x", adapter_id, addr);
-#endif
+                                       dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x", adapter_id, addr);
                                }
                        }
-                       for (i = 0;
-                            !found
-                            && (address_data->normal_i2c_range[i] !=
-                                SENSORS_I2C_END); i += 2) {
-                               if ((addr >=
-                                    address_data->normal_i2c_range[i])
-                                   && (addr <=
-                                       address_data->normal_i2c_range[i + 1]))
-                               {
-#ifdef DEBUG
-                                       printk
-                                           (KERN_DEBUG "i2c-proc.o: found normal i2c_range entry for adapter %d, "
-                                            "addr %04x\n", adapter_id, addr);
-#endif
+                       for (i = 0; !found && (address_data->normal_i2c_range[i] != SENSORS_I2C_END); i += 2) {
+                               if ((addr >= address_data->normal_i2c_range[i]) &&
+                                   (addr <= address_data->normal_i2c_range[i + 1])) {
+                                       dev_dbg(&adapter->dev, "found normal i2c_range entry for adapter %d, addr %04x\n", adapter_id, addr);
                                        found = 1;
                                }
                        }
@@ -747,30 +675,17 @@
                             ((address_data->
                               probe[i] == SENSORS_ANY_I2C_BUS) & !is_isa))
                            && (addr == address_data->probe[i + 1])) {
-#ifdef DEBUG
-                               printk
-                                   (KERN_DEBUG "i2c-proc.o: found probe parameter for adapter %d, "
-                                    "addr %04x\n", adapter_id, addr);
-#endif
+                               dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr);
                                found = 1;
                        }
                }
-               for (i = 0; !found &&
-                          (address_data->probe_range[i] != SENSORS_I2C_END);
-                    i += 3) {
-                       if (
-                           ((adapter_id == address_data->probe_range[i])
-                            ||
-                            ((address_data->probe_range[i] ==
-                              SENSORS_ANY_I2C_BUS) & !is_isa))
-                           && (addr >= address_data->probe_range[i + 1])
-                           && (addr <= address_data->probe_range[i + 2])) {
+               for (i = 0; !found && (address_data->probe_range[i] != SENSORS_I2C_END); i += 3) {
+                       if ( ((adapter_id == address_data->probe_range[i]) ||
+                             ((address_data->probe_range[i] == SENSORS_ANY_I2C_BUS) & !is_isa)) &&
+                            (addr >= address_data->probe_range[i + 1]) &&
+                            (addr <= address_data->probe_range[i + 2])) {
                                found = 1;
-#ifdef DEBUG
-                               printk
-                                   (KERN_DEBUG "i2c-proc.o: found probe_range parameter for adapter %d, "
-                                    "addr %04x\n", adapter_id, addr);
-#endif
+                               dev_dbg(&adapter->dev, "found probe_range parameter for adapter %d, addr %04x\n", adapter_id, addr);
                        }
                }
                if (!found)
@@ -779,8 +694,7 @@
                /* OK, so we really should examine this address. First check
                   whether there is some client here at all! */
                if (is_isa ||
-                   (i2c_smbus_xfer
-                    (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0))
+                   (i2c_smbus_xfer (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0))
                        if ((err = found_proc(adapter, addr, 0, -1)))
                                return err;
        }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:10


ChangeSet 1.889.357.6, 2003/03/21 16:16:01-08:00, g...@kroah.com

i2c: Removed the name variable from i2c_client as the dev one should be used instead.

 drivers/i2c/chips/adm1021.c |    2 +-
 drivers/i2c/chips/lm75.c    |    2 +-
 drivers/i2c/i2c-core.c      |   14 +++++++-------
 drivers/i2c/i2c-dev.c       |    4 +++-
 include/linux/i2c.h         |    1 -
 5 files changed, 12 insertions(+), 11 deletions(-)

diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c       Mon Mar 24 17:28:07 2003
+++ b/drivers/i2c/chips/adm1021.c       Mon Mar 24 17:28:07 2003
@@ -299,7 +299,7 @@
        }

        /* Fill in the remaining client fields and put it into the global list */
-       strcpy(new_client->name, client_name);
+       strncpy(new_client->dev.name, client_name, DEVICE_NAME_SIZE);
        data->type = kind;

        new_client->id = adm1021_id++;
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c  Mon Mar 24 17:28:07 2003
+++ b/drivers/i2c/chips/lm75.c  Mon Mar 24 17:28:07 2003
@@ -180,7 +180,7 @@
        }

        /* Fill in the remaining client fields and put it into the global list */
-       strcpy(new_client->name, client_name);
+       strncpy(new_client->dev.name, client_name, DEVICE_NAME_SIZE);

        new_client->id = lm75_id++;
        data->valid = 0;
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c    Mon Mar 24 17:28:07 2003
+++ b/drivers/i2c/i2c-core.c    Mon Mar 24 17:28:07 2003
@@ -291,9 +291,9 @@
                                    client->driver == driver) {
                                        DEB2(printk(KERN_DEBUG "i2c-core.o: "
                                                    "detaching client %s:\n",
-                                                   client->name));
+                                                   client->dev.name));
                                        if ((res = driver->detach_client(client))) {
-                                               dev_err(&adap->dev, "while "
+                                               dev_err(&adap->dev, "while "
                                                       "unregistering driver "
                                                       "`%s', the client at "
                                                       "address %02x of "
@@ -355,7 +355,7 @@

        printk(KERN_WARNING
               " i2c-core.o: attach_client(%s) - enlarge I2C_CLIENT_MAX.\n",
-              client->name);
+              client->dev.name);

  out_unlock_list:
        up(&adapter->list);
@@ -374,7 +374,7 @@
        }

        DEB(dev_dbg(&adapter->dev, "client [%s] registered to adapter "
-                       "(pos. %d).\n", client->name, i));
+                       "(pos. %d).\n", client->dev.name, i));

        if (client->flags & I2C_CLIENT_ALLOW_USE)
                client->usage_count = 0;
@@ -395,7 +395,7 @@
                if (res) {
                        printk(KERN_ERR
                               "i2c-core.o: client_unregister [%s] failed, "
-                              "client not detached", client->name);
+                              "client not detached", client->dev.name);
                        goto out;
                }
        }
@@ -410,7 +410,7 @@

        printk(KERN_WARNING
               " i2c-core.o: unregister_client [%s] not found\n",
-              client->name);
+              client->dev.name);
        res = -ENODEV;

  out_unlock:
@@ -522,7 +522,7 @@
                                client = adapters[i]->clients[order[j]];
                                len += sprintf(kbuf+len,"%02x\t%-32s\t%-32s\n",
                                              client->addr,
-                                             client->name,
+                                             client->dev.name,
                                              client->driver->name);
                        }
                        len = len - file->f_pos;
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c     Mon Mar 24 17:28:07 2003
+++ b/drivers/i2c/i2c-dev.c     Mon Mar 24 17:28:07 2003
@@ -86,7 +86,9 @@
 };

 static struct i2c_client i2cdev_client_template = {
-       .name           = "I2C /dev entry",
+       .dev            = {
+               .name   = "I2C /dev entry",
+       },
        .id             = 1,
        .addr           = -1,
        .driver         = &i2cdev_driver,
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h       Mon Mar 24 17:28:07 2003
+++ b/include/linux/i2c.h       Mon Mar 24 17:28:07 2003
@@ -156,7 +156,6 @@
  * function is mainly used for lookup & other admin. functions.
  */
 struct i2c_client {
-       char name[32];
        int id;
        unsigned int flags;             /* div., see below              */
        unsigned int addr;              /* chip address - NOTE: 7bit    */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:15



[PATCH] i2c: remove *data from i2c_adapter, as dev->data should be used instead.

 drivers/i2c/i2c-elv.c    |    2 +-
 drivers/i2c/scx200_acb.c |    4 ++--
 include/linux/i2c.h      |   17 +++++++++++------
 3 files changed, 14 insertions(+), 9 deletions(-)

diff -Nru a/drivers/i2c/i2c-elv.c b/drivers/i2c/i2c-elv.c
--- a/drivers/i2c/i2c-elv.c     Mon Mar 24 17:28:32 2003

                        return -ENODEV;
                }
        } else {
-               bit_elv_ops.data=(void*)base;
+               i2c_set_adapdata(&bit_elv_ops, (void *)base);
                if (bit_elv_init()==0) {
                        if(i2c_bit_add_bus(&bit_elv_ops) < 0)
                                return -ENODEV;
diff -Nru a/drivers/i2c/scx200_acb.c b/drivers/i2c/scx200_acb.c
--- a/drivers/i2c/scx200_acb.c  Mon Mar 24 17:28:32 2003

                                char rw, u8 command, int size,
                                union i2c_smbus_data *data)
 {
-       struct scx200_acb_iface *iface = adapter->data;
+       struct scx200_acb_iface *iface = i2c_get_adapdata(adapter);
        int len;
        u8 *buffer;

        memset(iface, 0, sizeof(*iface));
        adapter = &iface->adapter;
-       adapter->data = iface;
+       i2c_set_adapdata(adapter, iface);
        snprintf(adapter->dev.name, DEVICE_NAME_SIZE, "SCx200 ACB%d", index);
        adapter->owner = THIS_MODULE;
        adapter->id = I2C_ALGO_SMBUS;
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h       Mon Mar 24 17:28:32 2003

        int (*client_register)(struct i2c_client *);
        int (*client_unregister)(struct i2c_client *);

-       void *data;     /* private data for the adapter                 */
-                       /* some data fields that are used by all types  */
-                       /* these data fields are readonly to the public */
-                       /* and can be set via the i2c_ioctl call        */
-
-                       /* data fields that are valid for all devices   */
+       /* data fields that are valid for all devices   */
        struct semaphore bus;
        struct semaphore list;  

 #endif /* def CONFIG_PROC_FS */
 };
 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
+
+static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
+{
+       return dev_get_drvdata (&dev->dev);
+}
+
+static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
+{
+       return dev_set_drvdata (&dev->dev, data);
+}

 /*flags for the driver struct: */
 #define I2C_DF_NOTIFY  0x01            /* notify on bus (de/a)ttaches  */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:16



i2c: actually register the i2c client device with the driver core.

We have to initialize the client structure with 0 to keep the
driver core from oopsing.

Now everything is hooked up enough to start removing the i2c sysctl
and proc crud.

 drivers/i2c/chips/adm1021.c |    2 ++
 drivers/i2c/chips/lm75.c    |    2 ++
 drivers/i2c/i2c-core.c      |   10 ++++++++++
 3 files changed, 14 insertions(+)

diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c       Mon Mar 24 17:27:59 2003

                err = -ENOMEM;
                goto error0;
        }
+       memset(new_client, 0x00, sizeof(struct i2c_client) +
+                                sizeof(struct adm1021_data));

        data = (struct adm1021_data *) (new_client + 1);
        i2c_set_clientdata(new_client, data);
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c  Mon Mar 24 17:27:59 2003

                err = -ENOMEM;
                goto error0;
        }
+       memset(new_client, 0x00, sizeof(struct i2c_client) +
+                                sizeof(struct lm75_data));

        data = (struct lm75_data *) (new_client + 1);
        i2c_set_clientdata(new_client, data);
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c    Mon Mar 24 17:27:59 2003

        if (client->flags & I2C_CLIENT_ALLOW_USE)
                client->usage_count = 0;
+
+       client->dev.parent = &client->adapter->dev;
+       client->dev.driver = &client->driver->driver;
+       client->dev.bus = &i2c_bus_type;
+      
+       snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "i2c_dev_%d", i);
+       printk("registering %s\n", client->dev.bus_id);
+       device_register(&client->dev);
+      
        return 0;
 }

        res = -ENODEV;

  out_unlock:
+       device_unregister(&client->dev);
        up(&adapter->list);
  out:
        return res;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:19


ChangeSet 1.889.357.2, 2003/03/21 12:45:28-08:00, g...@kroah.com

i2c: remove i2c_adapter->name and use dev->name instead.

 drivers/i2c/busses/i2c-ali15x3.c |    8 ++--
 drivers/i2c/busses/i2c-amd756.c  |    6 ++-
 drivers/i2c/busses/i2c-amd8111.c |    4 +-
 drivers/i2c/busses/i2c-i801.c    |    8 ++--
 drivers/i2c/busses/i2c-isa.c     |    4 +-
 drivers/i2c/busses/i2c-piix4.c   |    8 ++--
 drivers/i2c/i2c-algo-bit.c       |   13 +++---
 drivers/i2c/i2c-algo-pcf.c       |   19 ++++------
 drivers/i2c/i2c-core.c           |   73 ++++++++++++++++-----------------------
 drivers/i2c/i2c-dev.c            |   17 +++------
 drivers/i2c/i2c-elektor.c        |   10 +++--
 drivers/i2c/i2c-elv.c            |    4 +-
 drivers/i2c/i2c-philips-par.c    |    4 +-
 drivers/i2c/i2c-velleman.c       |    4 +-
 drivers/i2c/scx200_acb.c         |   28 ++++++--------
 include/linux/i2c.h              |    1
 16 files changed, 105 insertions(+), 106 deletions(-)

diff -Nru a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
--- a/drivers/i2c/busses/i2c-ali15x3.c  Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-ali15x3.c  Mon Mar 24 17:28:41 2003
@@ -474,9 +474,11 @@

 static struct i2c_adapter ali15x3_adapter = {
        .owner          = THIS_MODULE,
-       .name           = "unset",
        .id             = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI15X3,
        .algo           = &smbus_algorithm,
+       .dev            = {
+               .name   = "unset",
+       },
 };

 static struct pci_device_id ali15x3_ids[] __devinitdata = {
@@ -500,8 +502,8 @@
        /* set up the driverfs linkage to our parent device */
        ali15x3_adapter.dev.parent = &dev->dev;

-       sprintf(ali15x3_adapter.name, "SMBus ALI15X3 adapter at %04x",
-               ali15x3_smba);
+       snprintf(ali15x3_adapter.dev.name, DEVICE_NAME_SIZE,
+               "SMBus ALI15X3 adapter at %04x", ali15x3_smba);
        return i2c_add_adapter(&ali15x3_adapter);
 }

diff -Nru a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
--- a/drivers/i2c/busses/i2c-amd756.c   Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-amd756.c   Mon Mar 24 17:28:41 2003
@@ -312,9 +312,11 @@

 static struct i2c_adapter amd756_adapter = {
        .owner          = THIS_MODULE,
-       .name           = "unset",
        .id             = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD756,
        .algo           = &smbus_algorithm,
+       .dev            = {
+               .name   = "unset",
+       },
 };

 enum chiptype { AMD756, AMD766, AMD768, NFORCE };
@@ -376,7 +378,7 @@
        /* set up the driverfs linkage to our parent device */
        amd756_adapter.dev.parent = &pdev->dev;

-       sprintf(amd756_adapter.name,
+       snprintf(amd756_adapter.dev.name, DEVICE_NAME_SIZE,
                "SMBus AMD75x adapter at %04x", amd756_ioport);

        error = i2c_add_adapter(&amd756_adapter);
diff -Nru a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
--- a/drivers/i2c/busses/i2c-amd8111.c  Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-amd8111.c  Mon Mar 24 17:28:41 2003
@@ -357,8 +357,8 @@
                goto out_kfree;

        smbus->adapter.owner = THIS_MODULE;
-       sprintf(smbus->adapter.name,
-                       "SMBus2 AMD8111 adapter at %04x", smbus->base);
+       snprintf(smbus->adapter.dev.name, DEVICE_NAME_SIZE,
+               "SMBus2 AMD8111 adapter at %04x", smbus->base);
        smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111;
        smbus->adapter.algo = &smbus_algorithm;
        smbus->adapter.algo_data = smbus;
diff -Nru a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
--- a/drivers/i2c/busses/i2c-i801.c     Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-i801.c     Mon Mar 24 17:28:41 2003
@@ -546,9 +546,11 @@

 static struct i2c_adapter i801_adapter = {
        .owner          = THIS_MODULE,
-       .name           = "unset",
        .id             = I2C_ALGO_SMBUS | I2C_HW_SMBUS_I801,
        .algo           = &smbus_algorithm,
+       .dev            = {
+               .name   = "unset",
+       },
 };

 static struct pci_device_id i801_ids[] __devinitdata = {
@@ -597,8 +599,8 @@
        /* set up the driverfs linkage to our parent device */
        i801_adapter.dev.parent = &dev->dev;

-       sprintf(i801_adapter.name, "SMBus I801 adapter at %04x",
-               i801_smba);
+       snprintf(i801_adapter.dev.name, DEVICE_NAME_SIZE,
+               "SMBus I801 adapter at %04x", i801_smba);
        return i2c_add_adapter(&i801_adapter);
 }

diff -Nru a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
--- a/drivers/i2c/busses/i2c-isa.c      Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-isa.c      Mon Mar 24 17:28:41 2003
@@ -39,9 +39,11 @@
 /* There can only be one... */
 static struct i2c_adapter isa_adapter = {
        .owner          = THIS_MODULE,
-       .name           = "ISA main adapter",
        .id             = I2C_ALGO_ISA | I2C_HW_ISA,
        .algo           = &isa_algorithm,
+       .dev            = {
+               .name   = "ISA main adapter",
+       },
 };

 static int __init i2c_isa_init(void)
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
--- a/drivers/i2c/busses/i2c-piix4.c    Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/busses/i2c-piix4.c    Mon Mar 24 17:28:41 2003
@@ -394,9 +394,11 @@

 static struct i2c_adapter piix4_adapter = {
        .owner          = THIS_MODULE,
-       .name           = "unset",
        .id             = I2C_ALGO_SMBUS | I2C_HW_SMBUS_PIIX4,
        .algo           = &smbus_algorithm,
+       .dev            = {
+               .name   = "unset",
+       },
 };

 static struct pci_device_id piix4_ids[] __devinitdata = {
@@ -449,8 +451,8 @@
        /* set up the driverfs linkage to our parent device */
        piix4_adapter.dev.parent = &dev->dev;

-       sprintf(piix4_adapter.name, "SMBus PIIX4 adapter at %04x",
-               piix4_smba);
+       snprintf(piix4_adapter.dev.name, DEVICE_NAME_SIZE,
+               "SMBus PIIX4 adapter at %04x", piix4_smba);

        retval = i2c_add_adapter(&piix4_adapter);

diff -Nru a/drivers/i2c/i2c-algo-bit.c b/drivers/i2c/i2c-algo-bit.c
--- a/drivers/i2c/i2c-algo-bit.c        Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/i2c-algo-bit.c        Mon Mar 24 17:28:41 2003
@@ -23,6 +23,8 @@

 /* $Id: i2c-algo-bit.c,v 1.44 2003/01/21 08:08:16 kmalkki Exp $ */

+/* #define DEBUG 1 */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -338,16 +340,14 @@

        while (count > 0) {
                c = *temp;
-               DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: %s sendbytes: writing %2.2X\n",
-                           i2c_adap->name, c&0xff));
+               DEB2(dev_dbg(&i2c_adap->dev, "sendbytes: writing %2.2X\n", c&0xff));
                retval = i2c_outb(i2c_adap,c);
                if ((retval>0) || (nak_ok && (retval==0)))  { /* ok or ignored NAK */
                        count--;
                        temp++;
                        wrcount++;
                } else { /* arbitration or no acknowledge */
-                       printk(KERN_ERR "i2c-algo-bit.o: %s sendbytes: error - bailout.\n",
-                              i2c_adap->name);
+                       dev_err(&i2c_adap->dev, "sendbytes: error - bailout.\n");
                        i2c_stop(adap);
                        return (retval<0)? retval : -EFAULT;
                                /* got a better one ?? */
@@ -527,13 +527,12 @@
        struct i2c_algo_bit_data *bit_adap = adap->algo_data;

        if (bit_test) {
-               int ret = test_bus(bit_adap, adap->name);
+               int ret = test_bus(bit_adap, adap->dev.name);
                if (ret<0)
                        return -ENODEV;
        }

-       DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: hw routines for %s registered.\n",
-                   adap->name));
+       DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));

        /* register new adapter to i2c module... */

diff -Nru a/drivers/i2c/i2c-algo-pcf.c b/drivers/i2c/i2c-algo-pcf.c
--- a/drivers/i2c/i2c-algo-pcf.c        Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/i2c-algo-pcf.c        Mon Mar 24 17:28:41 2003
@@ -27,6 +27,8 @@
    messages, proper stop/repstart signaling during receive,
    added detect code */

+/* #define DEBUG 1 */          /* to pick up dev_dbg calls */
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -222,21 +224,19 @@
        int wrcount, status, timeout;

        for (wrcount=0; wrcount<count; ++wrcount) {
-               DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: %s i2c_write: writing %2.2X\n",
-                     i2c_adap->name, buf[wrcount]&0xff));
+               DEB2(dev_dbg(&i2c_adap->dev, "i2c_write: writing %2.2X\n",
+                               buf[wrcount]&0xff));
                i2c_outb(adap, buf[wrcount]);
                timeout = wait_for_pin(adap, &status);
                if (timeout) {
                        i2c_stop(adap);
-                       printk(KERN_ERR "i2c-algo-pcf.o: %s i2c_write: "
-                              "error - timeout.\n", i2c_adap->name);
+                       dev_err(&i2c_adap->dev, "i2c_write: error - timeout.\n");
                        return -EREMOTEIO; /* got a better one ?? */
                }
 #ifndef STUB_I2C
                if (status & I2C_PCF_LRB) {
                        i2c_stop(adap);
-                       printk(KERN_ERR "i2c-algo-pcf.o: %s i2c_write: "
-                              "error - no ack.\n", i2c_adap->name);
+                       dev_err(&i2c_adap->dev, "i2c_write: error - no ack.\n");
                        return -EREMOTEIO; /* got a better one ?? */
                }
 #endif
@@ -263,14 +263,14 @@

                if (wait_for_pin(adap, &status)) {
                        i2c_stop(adap);
-                       printk(KERN_ERR "i2c-algo-pcf.o: pcf_readbytes timed out.\n");
+                       dev_err(&i2c_adap->dev, "pcf_readbytes timed out.\n");
                        return (-1);
                }

 #ifndef STUB_I2C
                if ((status & I2C_PCF_LRB) && (i != count)) {
                        i2c_stop(adap);
-                       printk(KERN_ERR "i2c-algo-pcf.o: i2c_read: i2c_inb, No ack.\n");
+                       dev_err(&i2c_adap->dev, "i2c_read: i2c_inb, No ack.\n");
                        return (-1);
                }
 #endif
@@ -445,8 +445,7 @@
        struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
        int rval;

-       DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: hw routines for %s registered.\n",
-                   adap->name));
+       DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));

        /* register new adapter to i2c module... */

diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c    Mon Mar 24 17:28:41 2003
+++ b/drivers/i2c/i2c-core.c    Mon Mar 24 17:28:41 2003
@@ -23,6 +23,8 @@

 /* $Id: i2c-core.c,v 1.95 2003/01/22 05:25:08 kmalkki Exp $ */

+/* #define DEBUG 1 */          /* needed to pick up the dev_dbg() calls */
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -82,9 +84,8 @@
                if (NULL == adapters[i])
                        break;
        if (I2C_ADAP_MAX == i) {
-               printk(KERN_WARNING
-                      " i2c-core.o: register_adapter(%s) - enlarge I2C_ADAP_MAX.\n",
-                       adap->name);
+               dev_warn(&adap->dev,
+                       "register_adapter - enlarge I2C_ADAP_MAX.\n");
                res = -ENOMEM;
                goto out_unlock;
        }
@@ -105,7 +106,6 @@
        if (adap->dev.parent == NULL)
                adap->dev.parent = &legacy_bus;
        sprintf(adap->dev.bus_id, "i2c-%d", i);
-       strcpy(adap->dev.name, "i2c controller");
        device_register(&adap->dev);

        /* inform drivers of
...

read more »

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:00:20



i2c: fix up drivers/ieee1394/pcilynx.c due to previous i2c changes.

 drivers/ieee1394/pcilynx.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
--- a/drivers/ieee1394/pcilynx.c        Mon Mar 24 17:27:16 2003

 };

 static struct i2c_adapter bit_ops = {
-       .name                   = "PCILynx I2C adapter",
        .id                     = 0xAA, //FIXME: probably we should get an id in i2c-id.h
        .client_register        = bit_reg,
        .client_unregister      = bit_unreg,
+       .dev                    = {
+               .name           = "PCILynx I2C",
+       },
 };

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Greg K » Wed, 26 Mar 2003 04:10:08



[PATCH] Fix kobject_get oopses triggered by i2c in 2.5.65-bk

i2c initialization must not use module_init now, when it was converted
to the kobject interface. There are dozens of users which need it working
much sooner. i2c is subsystem after all, isn't it?

Fixes kernel oopses in kobject_get during system init which were happening
to me.

 drivers/i2c/i2c-core.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c    Mon Mar 24 17:28:49 2003

        bus_unregister(&i2c_bus_type);
 }

-module_init(i2c_init);
+subsys_initcall(i2c_init);
 module_exit(i2c_exit);

 /* ----------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

i2c driver changes for 2.5.66

Post by Russell Kin » Wed, 26 Mar 2003 11:00:10



>  static struct i2c_adapter ioc_ops = {
> -  .name                   = "IOC/IOMD",
>    .id                     = I2C_HW_B_IOC,
>    .algo_data              = &ioc_data,
>    .client_register        = ioc_client_reg,
>    .client_unregister      = ioc_client_unreg
> +  .dev                    = {
> +          .name           = "IOC/IOMD",
> +  },
>  };

Are you sure that "IOC/IOMD" is a good name to stick in sysfs?
s|/|,| would probably be a good idea.

--

             http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/