aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-01 17:26:28 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-01 17:26:28 -0400
commit2096b956d24c4b5950b808fc23b218425d79ebb1 (patch)
tree9e2c09c2e40c65bd56cbfd50955d5c7355474655 /drivers
parent4ad4eac60667f7c321faae28a3437f7a8b3d17cb (diff)
i2c: Shrink struct i2c_client
This shrinks the size of "struct i2c_client" by 40 bytes: - Substantially shrinks the string used to identify the chip type - The "flags" don't need to be so big - Removes some internal padding It also adds kerneldoc for that struct, explaining how "name" is really a chip type identifier; it's otherwise potentially confusing. Because the I2C_NAME_SIZE symbol was abused for both i2c_client.name and for i2c_adapter.name, this needed to affect i2c_adapter too. The adapters which used that symbol now use the more-obviously-correct idiom of taking the size of that field. JD: Shorten i2c_adapter.name from 50 to 48 bytes while we're here, to avoid wasting space in padding. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c2
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c2
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c2
-rw-r--r--drivers/i2c/busses/i2c-i801.c2
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c2
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c2
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c2
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c2
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c2
-rw-r--r--drivers/i2c/busses/i2c-piix4.c2
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c2
-rw-r--r--drivers/i2c/busses/i2c-viapro.c2
-rw-r--r--drivers/i2c/busses/scx200_acb.c2
-rw-r--r--drivers/media/dvb/b2c2/flexcop-i2c.c3
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c2
-rw-r--r--drivers/media/dvb/frontends/dibx000_common.c4
-rw-r--r--drivers/video/intelfb/intelfb_i2c.c3
-rw-r--r--drivers/video/matrox/i2c-matroxfb.c2
18 files changed, 21 insertions, 19 deletions
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 1e277ba5a9f3..f14372ac2fc5 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -497,7 +497,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
497 /* set up the sysfs linkage to our parent device */ 497 /* set up the sysfs linkage to our parent device */
498 ali1535_adapter.dev.parent = &dev->dev; 498 ali1535_adapter.dev.parent = &dev->dev;
499 499
500 snprintf(ali1535_adapter.name, I2C_NAME_SIZE, 500 snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name),
501 "SMBus ALI1535 adapter at %04x", ali1535_smba); 501 "SMBus ALI1535 adapter at %04x", ali1535_smba);
502 return i2c_add_adapter(&ali1535_adapter); 502 return i2c_add_adapter(&ali1535_adapter);
503} 503}
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index e47fe01bf42a..93bf87d70961 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -492,7 +492,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
492 /* set up the sysfs linkage to our parent device */ 492 /* set up the sysfs linkage to our parent device */
493 ali15x3_adapter.dev.parent = &dev->dev; 493 ali15x3_adapter.dev.parent = &dev->dev;
494 494
495 snprintf(ali15x3_adapter.name, I2C_NAME_SIZE, 495 snprintf(ali15x3_adapter.name, sizeof(ali15x3_adapter.name),
496 "SMBus ALI15X3 adapter at %04x", ali15x3_smba); 496 "SMBus ALI15X3 adapter at %04x", ali15x3_smba);
497 return i2c_add_adapter(&ali15x3_adapter); 497 return i2c_add_adapter(&ali15x3_adapter);
498} 498}
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0c70f8293341..c9fca7b49267 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -365,7 +365,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
365 } 365 }
366 366
367 smbus->adapter.owner = THIS_MODULE; 367 smbus->adapter.owner = THIS_MODULE;
368 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 368 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
369 "SMBus2 AMD8111 adapter at %04x", smbus->base); 369 "SMBus2 AMD8111 adapter at %04x", smbus->base);
370 smbus->adapter.id = I2C_HW_SMBUS_AMD8111; 370 smbus->adapter.id = I2C_HW_SMBUS_AMD8111;
371 smbus->adapter.class = I2C_CLASS_HWMON; 371 smbus->adapter.class = I2C_CLASS_HWMON;
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index a320e7d82c1f..611b57192c96 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -527,7 +527,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
527 /* set up the sysfs linkage to our parent device */ 527 /* set up the sysfs linkage to our parent device */
528 i801_adapter.dev.parent = &dev->dev; 528 i801_adapter.dev.parent = &dev->dev;
529 529
530 snprintf(i801_adapter.name, I2C_NAME_SIZE, 530 snprintf(i801_adapter.name, sizeof(i801_adapter.name),
531 "SMBus I801 adapter at %04lx", i801_smba); 531 "SMBus I801 adapter at %04lx", i801_smba);
532 err = i2c_add_adapter(&i801_adapter); 532 err = i2c_add_adapter(&i801_adapter);
533 if (err) { 533 if (err) {
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index efa3ecc5522a..6352121a2827 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -118,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
118 118
119 drv_data->adapter.id = I2C_HW_B_IXP2000, 119 drv_data->adapter.id = I2C_HW_B_IXP2000,
120 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, 120 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
121 I2C_NAME_SIZE); 121 sizeof(drv_data->adapter.name));
122 drv_data->adapter.algo_data = &drv_data->algo_data, 122 drv_data->adapter.algo_data = &drv_data->algo_data,
123 123
124 drv_data->adapter.dev.parent = &plat_dev->dev; 124 drv_data->adapter.dev.parent = &plat_dev->dev;
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index 08e89b83984a..069ed7f3b395 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -127,7 +127,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
127 drv_data->adapter.id = I2C_HW_B_IXP4XX; 127 drv_data->adapter.id = I2C_HW_B_IXP4XX;
128 drv_data->adapter.class = I2C_CLASS_HWMON; 128 drv_data->adapter.class = I2C_CLASS_HWMON;
129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, 129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
130 I2C_NAME_SIZE); 130 sizeof(drv_data->adapter.name));
131 drv_data->adapter.algo_data = &drv_data->algo_data; 131 drv_data->adapter.algo_data = &drv_data->algo_data;
132 132
133 drv_data->adapter.dev.parent = &plat_dev->dev; 133 drv_data->adapter.dev.parent = &plat_dev->dev;
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index a3283b907eb8..a55b3335d1be 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -508,7 +508,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
508 } 508 }
509 509
510 strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", 510 strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
511 I2C_NAME_SIZE); 511 sizeof(drv_data->adapter.name));
512 512
513 init_waitqueue_head(&drv_data->waitq); 513 init_waitqueue_head(&drv_data->waitq);
514 spin_lock_init(&drv_data->lock); 514 spin_lock_init(&drv_data->lock);
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 1514ec5b77f8..cdc67dc914c3 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -240,7 +240,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
240 smbus->adapter.algo = &smbus_algorithm; 240 smbus->adapter.algo = &smbus_algorithm;
241 smbus->adapter.algo_data = smbus; 241 smbus->adapter.algo_data = smbus;
242 smbus->adapter.dev.parent = &dev->dev; 242 smbus->adapter.dev.parent = &dev->dev;
243 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 243 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
244 "SMBus nForce2 adapter at %04x", smbus->base); 244 "SMBus nForce2 adapter at %04x", smbus->base);
245 245
246 error = i2c_add_adapter(&smbus->adapter); 246 error = i2c_add_adapter(&smbus->adapter);
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index bf89eeef74e9..58e32714afb5 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -358,7 +358,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
358 } 358 }
359 359
360 smbus->adapter.owner = THIS_MODULE; 360 smbus->adapter.owner = THIS_MODULE;
361 snprintf(smbus->adapter.name, I2C_NAME_SIZE, 361 snprintf(smbus->adapter.name, sizeof(smbus->adapter.name),
362 "PA Semi SMBus adapter at 0x%lx", smbus->base); 362 "PA Semi SMBus adapter at 0x%lx", smbus->base);
363 smbus->adapter.class = I2C_CLASS_HWMON; 363 smbus->adapter.class = I2C_CLASS_HWMON;
364 smbus->adapter.algo = &smbus_algorithm; 364 smbus->adapter.algo = &smbus_algorithm;
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 21b180904085..5a52bf5e3fb0 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -428,7 +428,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,
428 /* set up the sysfs linkage to our parent device */ 428 /* set up the sysfs linkage to our parent device */
429 piix4_adapter.dev.parent = &dev->dev; 429 piix4_adapter.dev.parent = &dev->dev;
430 430
431 snprintf(piix4_adapter.name, I2C_NAME_SIZE, 431 snprintf(piix4_adapter.name, sizeof(piix4_adapter.name),
432 "SMBus PIIX4 adapter at %04x", piix4_smba); 432 "SMBus PIIX4 adapter at %04x", piix4_smba);
433 433
434 if ((retval = i2c_add_adapter(&piix4_adapter))) { 434 if ((retval = i2c_add_adapter(&piix4_adapter))) {
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 4157b0cd604c..dc235bb8e24d 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -300,7 +300,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
300 /* set up the sysfs linkage to our parent device */ 300 /* set up the sysfs linkage to our parent device */
301 sis96x_adapter.dev.parent = &dev->dev; 301 sis96x_adapter.dev.parent = &dev->dev;
302 302
303 snprintf(sis96x_adapter.name, I2C_NAME_SIZE, 303 snprintf(sis96x_adapter.name, sizeof(sis96x_adapter.name),
304 "SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base); 304 "SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
305 305
306 if ((retval = i2c_add_adapter(&sis96x_adapter))) { 306 if ((retval = i2c_add_adapter(&sis96x_adapter))) {
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 03c5fc868548..7a2bc06304fc 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -404,7 +404,7 @@ found:
404 } 404 }
405 405
406 vt596_adapter.dev.parent = &pdev->dev; 406 vt596_adapter.dev.parent = &pdev->dev;
407 snprintf(vt596_adapter.name, I2C_NAME_SIZE, 407 snprintf(vt596_adapter.name, sizeof(vt596_adapter.name),
408 "SMBus Via Pro adapter at %04x", vt596_smba); 408 "SMBus Via Pro adapter at %04x", vt596_smba);
409 409
410 vt596_pdev = pci_dev_get(pdev); 410 vt596_pdev = pci_dev_get(pdev);
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 0b082c5a0195..d816ab089fe2 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -441,7 +441,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text,
441 441
442 adapter = &iface->adapter; 442 adapter = &iface->adapter;
443 i2c_set_adapdata(adapter, iface); 443 i2c_set_adapdata(adapter, iface);
444 snprintf(adapter->name, I2C_NAME_SIZE, "%s ACB%d", text, index); 444 snprintf(adapter->name, sizeof(adapter->name), "%s ACB%d", text, index);
445 adapter->owner = THIS_MODULE; 445 adapter->owner = THIS_MODULE;
446 adapter->id = I2C_HW_SMBUS_SCX200; 446 adapter->id = I2C_HW_SMBUS_SCX200;
447 adapter->algo = &scx200_acb_algorithm; 447 adapter->algo = &scx200_acb_algorithm;
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c
index 5347a406fff7..02a0ea6e1c17 100644
--- a/drivers/media/dvb/b2c2/flexcop-i2c.c
+++ b/drivers/media/dvb/b2c2/flexcop-i2c.c
@@ -183,7 +183,8 @@ int flexcop_i2c_init(struct flexcop_device *fc)
183 mutex_init(&fc->i2c_mutex); 183 mutex_init(&fc->i2c_mutex);
184 184
185 memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter)); 185 memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter));
186 strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",I2C_NAME_SIZE); 186 strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",
187 sizeof(fc->i2c_adap.name));
187 188
188 i2c_set_adapdata(&fc->i2c_adap,fc); 189 i2c_set_adapdata(&fc->i2c_adap,fc);
189 190
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 70df31b0a8a9..088b6dee3a7f 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -19,7 +19,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
19 return -EINVAL; 19 return -EINVAL;
20 } 20 }
21 21
22 strncpy(d->i2c_adap.name,d->desc->name,I2C_NAME_SIZE); 22 strncpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name));
23#ifdef I2C_ADAP_CLASS_TV_DIGITAL 23#ifdef I2C_ADAP_CLASS_TV_DIGITAL
24 d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, 24 d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL,
25#else 25#else
diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c
index a18c8f45a2ee..315e09e95b0c 100644
--- a/drivers/media/dvb/frontends/dibx000_common.c
+++ b/drivers/media/dvb/frontends/dibx000_common.c
@@ -105,9 +105,9 @@ struct i2c_adapter * dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, enu
105} 105}
106EXPORT_SYMBOL(dibx000_get_i2c_adapter); 106EXPORT_SYMBOL(dibx000_get_i2c_adapter);
107 107
108static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *algo, const char name[I2C_NAME_SIZE], struct dibx000_i2c_master *mst) 108static int i2c_adapter_init(struct i2c_adapter *i2c_adap, struct i2c_algorithm *algo, const char *name, struct dibx000_i2c_master *mst)
109{ 109{
110 strncpy(i2c_adap->name, name, I2C_NAME_SIZE); 110 strncpy(i2c_adap->name, name, sizeof(i2c_adap->name));
111 i2c_adap->class = I2C_CLASS_TV_DIGITAL, 111 i2c_adap->class = I2C_CLASS_TV_DIGITAL,
112 i2c_adap->algo = algo; 112 i2c_adap->algo = algo;
113 i2c_adap->algo_data = NULL; 113 i2c_adap->algo_data = NULL;
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c
index f4ede5f6b588..61e4c8759b23 100644
--- a/drivers/video/intelfb/intelfb_i2c.c
+++ b/drivers/video/intelfb/intelfb_i2c.c
@@ -104,7 +104,8 @@ static int intelfb_setup_i2c_bus(struct intelfb_info *dinfo,
104 104
105 chan->dinfo = dinfo; 105 chan->dinfo = dinfo;
106 chan->reg = reg; 106 chan->reg = reg;
107 snprintf(chan->adapter.name, I2C_NAME_SIZE, "intelfb %s", name); 107 snprintf(chan->adapter.name, sizeof(chan->adapter.name),
108 "intelfb %s", name);
108 chan->adapter.owner = THIS_MODULE; 109 chan->adapter.owner = THIS_MODULE;
109 chan->adapter.id = I2C_HW_B_INTELFB; 110 chan->adapter.id = I2C_HW_B_INTELFB;
110 chan->adapter.algo_data = &chan->algo; 111 chan->adapter.algo_data = &chan->algo;
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
index 5ec718a5fe22..4baab7be58de 100644
--- a/drivers/video/matrox/i2c-matroxfb.c
+++ b/drivers/video/matrox/i2c-matroxfb.c
@@ -111,7 +111,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo,
111 b->mask.data = data; 111 b->mask.data = data;
112 b->mask.clock = clock; 112 b->mask.clock = clock;
113 b->adapter = matrox_i2c_adapter_template; 113 b->adapter = matrox_i2c_adapter_template;
114 snprintf(b->adapter.name, I2C_NAME_SIZE, name, 114 snprintf(b->adapter.name, sizeof(b->adapter.name), name,
115 minfo->fbcon.node); 115 minfo->fbcon.node);
116 i2c_set_adapdata(&b->adapter, b); 116 i2c_set_adapdata(&b->adapter, b);
117 b->adapter.algo_data = &b->bac; 117 b->adapter.algo_data = &b->bac;