Yet more i2c driver changes for 2.5.65

Yet more i2c driver changes for 2.5.65

Post by Greg K » Mon, 24 Mar 2003 10:20:04



Hi,

Here are some more i2c driver changes, they include the stuff I sent out
Friday, but haven't ended up in your tree yet, and 4 patches to fix up
some drivers in the rest of the kernel tree that were broken by my
previous i2c changes.

Please pull from:  bk://kernel.bkbits.net/gregkh/linux/i2c-2.5

I'll post just the new patches to the mailing lists.

thanks,

greg k-h

 drivers/acorn/char/i2c.c                  |    4
 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/chips/adm1021.c               |   21 +--
 drivers/i2c/chips/lm75.c                  |   14 +-
 drivers/i2c/i2c-algo-bit.c                |   13 +-
 drivers/i2c/i2c-algo-pcf.c                |   19 +--
 drivers/i2c/i2c-core.c                    |   99 ++++++++--------
 drivers/i2c/i2c-dev.c                     |   21 +--
 drivers/i2c/i2c-elektor.c                 |   10 +
 drivers/i2c/i2c-elv.c                     |    6 -
 drivers/i2c/i2c-philips-par.c             |    4
 drivers/i2c/i2c-proc.c                    |  180 +++++++-----------------------
 drivers/i2c/i2c-velleman.c                |    4
 drivers/i2c/scx200_acb.c                  |   32 ++---
 drivers/ieee1394/pcilynx.c                |    4
 drivers/media/video/adv7175.c             |   22 ++-
 drivers/media/video/bt819.c               |   33 +++--
 drivers/media/video/bt856.c               |   27 ++--
 drivers/media/video/bttv-if.c             |   22 ++-
 drivers/media/video/msp3400.c             |   32 ++---
 drivers/media/video/saa5249.c             |   13 +-
 drivers/media/video/saa7110.c             |   19 +--
 drivers/media/video/saa7111.c             |   21 ++-
 drivers/media/video/saa7134/saa7134-i2c.c |   10 +
 drivers/media/video/saa7185.c             |   19 +--
 drivers/media/video/tda7432.c             |   16 +-
 drivers/media/video/tda9875.c             |   16 +-
 drivers/media/video/tda9887.c             |   14 +-
 drivers/media/video/tuner-3036.c          |    6 -
 drivers/media/video/tuner.c               |   29 ++--
 drivers/media/video/tvaudio.c             |   44 +++----
 drivers/video/matrox/i2c-matroxfb.c       |   11 +
 include/linux/i2c.h                       |   33 +++--
 38 files changed, 424 insertions(+), 432 deletions(-)
------


  o i2c: fix up drivers/video/matrox/i2c-matroxfb.c due to previous i2c changes
  o i2c: fix up drivers/ieee1394/pcilynx.c due to previous i2c changes
  o i2c: fix up drivers/acorn/char/i2c.c due to previous i2c changes
  o i2c: fix up drivers/media/video/* due to previous i2c changes
  o i2c: ugh, clean up lindent mess in i2c-proc.c::i2c_detect()
  o i2c: fix up the chip driver names to play nice with sysfs
  o i2c: actually register the i2c client device with the driver core
  o i2c: Removed the name variable from i2c_client as the dev one should be used instead
  o i2c: remove the data field from struct i2c_client
  o i2c: add struct device to i2c_client structure
  o i2c: remove *data from i2c_adapter, as dev->data should be used instead
  o i2c: remove i2c_adapter->name and use dev->name instead


  o Fix kobject_get oopses triggered by i2c in 2.5.65-bk

-
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/

 
 
 

Yet more i2c driver changes for 2.5.65

Post by Greg K » Mon, 24 Mar 2003 10:20: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.

diff -Nru a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c
--- a/drivers/acorn/char/i2c.c  Sun Mar 23 00:10:55 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/

 
 
 

Yet more i2c driver changes for 2.5.65

Post by Greg K » Mon, 24 Mar 2003 10:20:08


ChangeSet 1.889.354.14, 2003/03/22 23:20:40-08:00, g...@kroah.com

i2c: fix up drivers/media/video/* due to previous i2c changes.

diff -Nru a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
--- a/drivers/media/video/adv7175.c     Sun Mar 23 00:11:01 2003
+++ b/drivers/media/video/adv7175.c     Sun Mar 23 00:11:01 2003
@@ -170,6 +170,7 @@
        client=kmalloc(sizeof(*client), GFP_KERNEL);
        if(client == NULL)
                return -ENOMEM;
+       memset(client, 0, sizeof(*client));

        client_template.adapter = adap;
        client_template.addr = addr;
@@ -190,9 +191,10 @@
                // We should never get here!!!
                dname = unknown_name;
        }
-       strcpy(client->name, dname);
+       strncpy(client->dev.name, dname, DEVICE_NAME_SIZE);
        init_MUTEX(&encoder->lock);
        encoder->client = client;
+       i2c_set_clientdata(client, encoder);
        encoder->addr = addr;
        encoder->norm = VIDEO_MODE_PAL;
        encoder->input = 0;
@@ -201,7 +203,7 @@
        for (i=1; i<x_common; i++) {
                rv = i2c_smbus_write_byte(client,init_common[i]);
                if (rv < 0) {
-                       printk(KERN_ERR "%s_attach: init error %d\n", client->name, rv);
+                       printk(KERN_ERR "%s_attach: init error %d\n", client->dev.name, rv);
                        break;
                }
        }
@@ -211,7 +213,7 @@
                i2c_smbus_write_byte_data(client,0x07, TR0MODE);
                i2c_smbus_read_byte_data(client,0x12);
                printk(KERN_INFO "%s_attach: %s rev. %d at 0x%02x\n",
-                      client->name, dname, rv & 1, client->addr);
+                      client->dev.name, dname, rv & 1, client->addr);
        }

        i2c_attach_client(client);
@@ -229,7 +231,7 @@
 static int adv717x_detach(struct i2c_client *client)
 {
        i2c_detach_client(client);
-       kfree(client->data);
+       i2c_get_clientdata(client);
        kfree(client);
        return 0;
 }
@@ -237,7 +239,7 @@
 static int adv717x_command(struct i2c_client *client, unsigned int cmd,
                           void *arg)
 {
-       struct adv7175 *encoder = client->data;
+       struct adv7175 *encoder = i2c_get_clientdata(client);
        int i, x_ntsc=13, x_pal=13;
                /* x_ntsc is number of entries in init_ntsc -1 */
                /* x_pal is number of entries in init_pal -1 */
@@ -297,7 +299,7 @@
                                default:
                                        printk(KERN_ERR
                                               "%s: illegal norm: %d\n",
-                                              client->name, iarg);
+                                              client->dev.name, iarg);
                                        return -EINVAL;

                                }
@@ -353,7 +355,7 @@
                                default:
                                        printk(KERN_ERR
                                               "%s: illegal input: %d\n",
-                                              client->name, iarg);
+                                              client->dev.name, iarg);
                                        return -EINVAL;

                                }
@@ -419,8 +421,10 @@
 };

 static struct i2c_client client_template = {
-       .name           = "adv7175_client",
-       .driver         = &i2c_driver_adv7175
+       .driver         = &i2c_driver_adv7175,
+       .dev            = {
+               .name   = "adv7175_client",
+       },
 };

 static int adv717x_init(void)
diff -Nru a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
--- a/drivers/media/video/bt819.c       Sun Mar 23 00:11:01 2003
+++ b/drivers/media/video/bt819.c       Sun Mar 23 00:11:01 2003
@@ -128,7 +128,7 @@

        struct timing *timing;

-       decoder = client->data;
+       decoder = i2c_get_clientdata(client);
        timing = &timing_data[decoder->norm];

        init[3 * 2 - 1] = (((timing->vdelay >> 8) & 0x03) << 6) |
@@ -159,6 +159,7 @@
        client = kmalloc(sizeof(*client), GFP_KERNEL);
        if(client == NULL)
                return -ENOMEM;
+       memset(client, 0, sizeof(*client));
        client_template.adapter = adap;
        client_template.addr = addr;
        memcpy(client, &client_template, sizeof(*client));
@@ -170,8 +171,8 @@
        }

        memset(decoder, 0, sizeof(struct bt819));
-       strcpy(client->name, "bt819");
-       client->data = decoder;
+       strncpy(client->dev.name, "bt819", DEVICE_NAME_SIZE);
+       i2c_set_clientdata(client, decoder);
        decoder->client = client;
        decoder->addr = addr;
        decoder->norm = VIDEO_MODE_NTSC;
@@ -186,10 +187,10 @@
        i = bt819_init(client);
        if (i < 0) {
                printk(KERN_ERR "%s: bt819_attach: init status %d\n",
-                      decoder->client->name, i);
+                      decoder->client->dev.name, i);
        } else {
                printk(KERN_INFO "%s: bt819_attach: chip version %x\n",
-                      decoder->client->name, i2c_smbus_read_byte_data(client,
+                      decoder->client->dev.name, i2c_smbus_read_byte_data(client,
                                                      0x17) & 0x0f);
        }
        init_MUTEX(&decoder->lock);
@@ -205,7 +206,7 @@
 static int bt819_detach(struct i2c_client *client)
 {
        i2c_detach_client(client);
-       kfree(client->data);
+       i2c_get_clientdata(client);
        kfree(client);
        MOD_DEC_USE_COUNT;
        return 0;
@@ -215,7 +216,7 @@
 {
        int temp;

-       struct bt819 *decoder = client->data;
+       struct bt819 *decoder = i2c_get_clientdata(client);
        //return 0;

        if (!decoder->initialized) { // First call to bt819_init could be
@@ -268,7 +269,7 @@
                        *iarg = res;

                        DEBUG(printk(KERN_INFO "%s-bt819: get status %x\n",
-                                    decoder->client->name, *iarg));
+                                    decoder->client->dev.name, *iarg));
                }
                break;

@@ -278,7 +279,7 @@
                        struct timing *timing;

                        DEBUG(printk(KERN_INFO "%s-bt819: set norm %x\n",
-                                    decoder->client->name, *iarg));
+                                    decoder->client->dev.name, *iarg));

                        if (*iarg == VIDEO_MODE_NTSC) {
                                bt819_setbit(decoder, 0x01, 0, 1);
@@ -319,7 +320,7 @@
                        int *iarg = arg;

                        DEBUG(printk(KERN_INFO "%s-bt819: set input %x\n",
-                                    decoder->client->name, *iarg));
+                                    decoder->client->dev.name, *iarg));

                        if (*iarg < 0 || *iarg > 7) {
                                return -EINVAL;
@@ -344,7 +345,7 @@
                        int *iarg = arg;

                        DEBUG(printk(KERN_INFO "%s-bt819: set output %x\n",
-                                    decoder->client->name, *iarg));
+                                    decoder->client->dev.name, *iarg));

                        /* not much choice of outputs */
                        if (*iarg != 0) {
@@ -360,7 +361,7 @@

                        DEBUG(printk
                              (KERN_INFO "%s-bt819: enable output %x\n",
-                              decoder->client->name, *iarg));
+                              decoder->client->dev.name, *iarg));

                        if (decoder->enable != enable) {
                                decoder->enable = enable;
@@ -381,7 +382,7 @@
                        DEBUG(printk
                              (KERN_INFO
                               "%s-bt819: set picture brightness %d contrast %d colour %d\n",
-                              decoder->client->name, pic->brightness,
+                              decoder->client->dev.name, pic->brightness,
                               pic->contrast, pic->colour));

@@ -448,9 +449,11 @@
 };

 static struct i2c_client client_template = {
-       .name = "bt819_client",
        .id = -1,
-       .driver = &i2c_driver_bt819
+       .driver = &i2c_driver_bt819,
+       .dev = {
+               .name = "bt819_client",
+       },
 };

 static int bt819_setup(void)
diff -Nru a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
--- a/drivers/media/video/bt856.c       Sun Mar 23 00:11:01 2003
+++ b/drivers/media/video/bt856.c       Sun Mar 23 00:11:01 2003
@@ -106,6 +106,7 @@
        client = kmalloc(sizeof(*client), GFP_KERNEL);
        if(client == NULL)
                return -ENOMEM;
+       memset(client, 0, sizeof(*client));
        client_template.adapter = adap;
        client_template.addr = addr;
        memcpy(client, &client_template, sizeof(*client));  
@@ -123,14 +124,14 @@

        memset(encoder, 0, sizeof(struct bt856));
-       strcpy(client->name, "bt856");
+       strncpy(client->dev.name, "bt856", DEVICE_NAME_SIZE);
        encoder->client = client;
-       client->data = encoder;
+       i2c_set_clientdata(client, encoder);
        encoder->addr = client->addr;
        encoder->norm = VIDEO_MODE_NTSC;
        encoder->enable = 1;

-       DEBUG(printk(KERN_INFO "%s-bt856: attach\n", encoder->client->name));
+       DEBUG(printk(KERN_INFO "%s-bt856: attach\n", encoder->client->dev.name));

        i2c_smbus_write_byte_data(client, 0xdc, 0x18);
        encoder->reg[0xdc] = 0x18;
@@ -171,7 +172,7 @@
 static int bt856_detach(struct i2c_client *client)
 {
        i2c_detach_client(client);
-       kfree(client->data);
+       i2c_get_clientdata(client);
        kfree(client);
        MOD_DEC_USE_COUNT;
        return 0;
@@ -180,7 +181,7 @@
 static int bt856_command(struct i2c_client *client, unsigned int cmd,
                         void *arg)
 {
-       struct bt856 *encoder = client->data;
+       struct bt856 *encoder = i2c_get_clientdata(client);

        switch (cmd) {

@@ -190,7 +191,7 @@

                        DEBUG(printk
                              (KERN_INFO "%s-bt856: get capabilities\n",
-                              encoder->client->name));
+                              encoder->client->dev.name));

                        cap->flags
                            = VIDEO_ENCODER_PAL
@@ -205,7 +206,7 @@
                        int *iarg = arg;

                        DEBUG(printk(KERN_INFO "%s-bt856: set norm %d\n",
-                                    encoder->client->name, *iarg));
+                                    encoder->client->dev.name, *iarg));

                        switch (*iarg) {

@@ -232,7 +233,7 @@
                        int *iarg = arg;

                        DEBUG(printk(KERN_INFO "%s-bt856: set input %d\n",
-                                    encoder->client->name, *iarg));
+                                    encoder->client->dev.name, *iarg));

                        /*     We only have video bus.
                           *iarg = 0: input is from bt819
@@ -268,7 +269,7 @@
                        int *iarg = arg;

                        DEBUG(printk(KERN_INFO "%s-bt856: set output %d\n",
-                                    encoder->client->name, *iarg));
+                                    encoder->client->dev.name, *iarg));

                        /* not much choice of outputs */
                        if (*iarg != 0) {
@@ -285,7 +286,7 @@

                        DEBUG(printk
                              (KERN_INFO "%s-bt856: enable output %d\n",
-                              encoder->client->name, encoder->enable));
+                              encoder->client->dev.name, encoder->enable));
                }
                break;

@@ -309,9 +310,11 @@
 };

 static struct i2c_client client_template = {
-       .name = "bt856_client",
        .id = -1,
-       .driver = &i2c_driver_bt856
+       .driver = &i2c_driver_bt856,
+       .dev = {
+               .name = "bt856_client",
+       },
 };

 static int bt856_init(void)
diff -Nru a/drivers/media/video/bttv-if.c b/drivers/media/video/bttv-if.c
--- a/drivers/media/video/bttv-if.c     Sun Mar 23 00:11:01 2003
+++ b/drivers/media/video/bttv-if.c     Sun Mar 23 00:11:01 2003
@@ -194,7 +194,7 @@

 static int attach_inform(struct i2c_client *client)
 {
-        struct bttv *btv = (struct bttv*)client->adapter->data;
+        struct bttv *btv = i2c_get_adapdata(client->adapter);
        int i;

        for (i = 0; i < I2C_CLIENTS_MAX; i++) {
@@ -207,13 +207,13 @@
                bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
         if (bttv_verbose)
                printk("bttv%d: i2c attach [client=%s,%s]\n",btv->nr,
-                      client->name, (i < I2C_CLIENTS_MAX) ?  "ok" : "failed");
+                      client->dev.name, (i < I2C_CLIENTS_MAX) ?  "ok" : "failed");
         return 0;
 }

 static int detach_inform(struct i2c_client *client)
 {
-      
...

read more »

 
 
 

Yet more i2c driver changes for 2.5.65

Post by Greg K » Mon, 24 Mar 2003 10:30:05



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

diff -Nru a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
--- a/drivers/video/matrox/i2c-matroxfb.c       Sun Mar 23 00:10:43 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/

 
 
 

Yet more i2c driver changes for 2.5.65

Post by Greg K » Mon, 24 Mar 2003 10:30:08



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

diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
--- a/drivers/ieee1394/pcilynx.c        Sun Mar 23 00:10:49 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/