diff options
Diffstat (limited to 'drivers/i2c')
34 files changed, 0 insertions, 910 deletions
diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c index 75089febbc13..9fee3ca17344 100644 --- a/drivers/i2c/busses/i2c-acorn.c +++ b/drivers/i2c/busses/i2c-acorn.c | |||
@@ -83,7 +83,6 @@ static struct i2c_algo_bit_data ioc_data = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct i2c_adapter ioc_ops = { | 85 | static struct i2c_adapter ioc_ops = { |
86 | .id = I2C_HW_B_IOC, | ||
87 | .algo_data = &ioc_data, | 86 | .algo_data = &ioc_data, |
88 | }; | 87 | }; |
89 | 88 | ||
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index 9cead9b9458e..981e080b32ae 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -476,7 +476,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
476 | 476 | ||
477 | static struct i2c_adapter ali1535_adapter = { | 477 | static struct i2c_adapter ali1535_adapter = { |
478 | .owner = THIS_MODULE, | 478 | .owner = THIS_MODULE, |
479 | .id = I2C_HW_SMBUS_ALI1535, | ||
480 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 479 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
481 | .algo = &smbus_algorithm, | 480 | .algo = &smbus_algorithm, |
482 | }; | 481 | }; |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index dd9e796fad69..f70f46582c6c 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -386,7 +386,6 @@ static const struct i2c_algorithm ali1563_algorithm = { | |||
386 | 386 | ||
387 | static struct i2c_adapter ali1563_adapter = { | 387 | static struct i2c_adapter ali1563_adapter = { |
388 | .owner = THIS_MODULE, | 388 | .owner = THIS_MODULE, |
389 | .id = I2C_HW_SMBUS_ALI1563, | ||
390 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 389 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
391 | .algo = &ali1563_algorithm, | 390 | .algo = &ali1563_algorithm, |
392 | }; | 391 | }; |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 234fdde7d40e..39066dee46e3 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -473,7 +473,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
473 | 473 | ||
474 | static struct i2c_adapter ali15x3_adapter = { | 474 | static struct i2c_adapter ali15x3_adapter = { |
475 | .owner = THIS_MODULE, | 475 | .owner = THIS_MODULE, |
476 | .id = I2C_HW_SMBUS_ALI15X3, | ||
477 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 476 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
478 | .algo = &smbus_algorithm, | 477 | .algo = &smbus_algorithm, |
479 | }; | 478 | }; |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 36bee5b9c952..220f4a1eee1d 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -298,7 +298,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
298 | 298 | ||
299 | struct i2c_adapter amd756_smbus = { | 299 | struct i2c_adapter amd756_smbus = { |
300 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
301 | .id = I2C_HW_SMBUS_AMD756, | ||
302 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 301 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
303 | .algo = &smbus_algorithm, | 302 | .algo = &smbus_algorithm, |
304 | }; | 303 | }; |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 3972208876b3..edab51973bf5 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -387,7 +387,6 @@ static int __devinit amd8111_probe(struct pci_dev *dev, | |||
387 | smbus->adapter.owner = THIS_MODULE; | 387 | smbus->adapter.owner = THIS_MODULE; |
388 | snprintf(smbus->adapter.name, sizeof(smbus->adapter.name), | 388 | snprintf(smbus->adapter.name, sizeof(smbus->adapter.name), |
389 | "SMBus2 AMD8111 adapter at %04x", smbus->base); | 389 | "SMBus2 AMD8111 adapter at %04x", smbus->base); |
390 | smbus->adapter.id = I2C_HW_SMBUS_AMD8111; | ||
391 | smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 390 | smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
392 | smbus->adapter.algo = &smbus_algorithm; | 391 | smbus->adapter.algo = &smbus_algorithm; |
393 | smbus->adapter.algo_data = smbus; | 392 | smbus->adapter.algo_data = smbus; |
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index 66a04c2c660f..f78ce523e3db 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c | |||
@@ -400,7 +400,6 @@ i2c_au1550_probe(struct platform_device *pdev) | |||
400 | priv->xfer_timeout = 200; | 400 | priv->xfer_timeout = 200; |
401 | priv->ack_timeout = 200; | 401 | priv->ack_timeout = 200; |
402 | 402 | ||
403 | priv->adap.id = I2C_HW_AU1550_PSC; | ||
404 | priv->adap.nr = pdev->id; | 403 | priv->adap.nr = pdev->id; |
405 | priv->adap.algo = &au1550_algo; | 404 | priv->adap.algo = &au1550_algo; |
406 | priv->adap.algo_data = priv; | 405 | priv->adap.algo_data = priv; |
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 3fd2c417c1e0..fc548b3d002e 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -651,7 +651,6 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) | |||
651 | iface->timeout_timer.data = (unsigned long)iface; | 651 | iface->timeout_timer.data = (unsigned long)iface; |
652 | 652 | ||
653 | p_adap = &iface->adap; | 653 | p_adap = &iface->adap; |
654 | p_adap->id = I2C_HW_BLACKFIN; | ||
655 | p_adap->nr = pdev->id; | 654 | p_adap->nr = pdev->id; |
656 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); | 655 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); |
657 | p_adap->algo = &bfin_twi_algorithm; | 656 | p_adap->algo = &bfin_twi_algorithm; |
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index 0ed3ccb81b63..448b4bf35eb7 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c | |||
@@ -202,7 +202,6 @@ static struct i2c_algo_pcf_data pcf_isa_data = { | |||
202 | static struct i2c_adapter pcf_isa_ops = { | 202 | static struct i2c_adapter pcf_isa_ops = { |
203 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
204 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 204 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
205 | .id = I2C_HW_P_ELEK, | ||
206 | .algo_data = &pcf_isa_data, | 205 | .algo_data = &pcf_isa_data, |
207 | .name = "i2c-elektor", | 206 | .name = "i2c-elektor", |
208 | }; | 207 | }; |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index 648aa7baff83..bec9b845dd16 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -102,7 +102,6 @@ static struct i2c_algo_bit_data hydra_bit_data = { | |||
102 | static struct i2c_adapter hydra_adap = { | 102 | static struct i2c_adapter hydra_adap = { |
103 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
104 | .name = "Hydra i2c", | 104 | .name = "Hydra i2c", |
105 | .id = I2C_HW_B_HYDRA, | ||
106 | .algo_data = &hydra_bit_data, | 105 | .algo_data = &hydra_bit_data, |
107 | }; | 106 | }; |
108 | 107 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 526625eaa84b..230238df56c4 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -556,7 +556,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
556 | 556 | ||
557 | static struct i2c_adapter i801_adapter = { | 557 | static struct i2c_adapter i801_adapter = { |
558 | .owner = THIS_MODULE, | 558 | .owner = THIS_MODULE, |
559 | .id = I2C_HW_SMBUS_I801, | ||
560 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 559 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
561 | .algo = &smbus_algorithm, | 560 | .algo = &smbus_algorithm, |
562 | }; | 561 | }; |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 651f2f1ae5b7..88f0db73b364 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -746,7 +746,6 @@ static int __devinit iic_probe(struct of_device *ofdev, | |||
746 | adap->dev.parent = &ofdev->dev; | 746 | adap->dev.parent = &ofdev->dev; |
747 | strlcpy(adap->name, "IBM IIC", sizeof(adap->name)); | 747 | strlcpy(adap->name, "IBM IIC", sizeof(adap->name)); |
748 | i2c_set_adapdata(adap, dev); | 748 | i2c_set_adapdata(adap, dev); |
749 | adap->id = I2C_HW_OCP; | ||
750 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 749 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
751 | adap->algo = &iic_algo; | 750 | adap->algo = &iic_algo; |
752 | adap->timeout = 1; | 751 | adap->timeout = 1; |
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index fc2714ac0c0f..3190690c26ce 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -480,7 +480,6 @@ iop3xx_i2c_probe(struct platform_device *pdev) | |||
480 | } | 480 | } |
481 | 481 | ||
482 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); | 482 | memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); |
483 | new_adapter->id = I2C_HW_IOP3XX; | ||
484 | new_adapter->owner = THIS_MODULE; | 483 | new_adapter->owner = THIS_MODULE; |
485 | new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 484 | new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
486 | new_adapter->dev.parent = &pdev->dev; | 485 | new_adapter->dev.parent = &pdev->dev; |
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index 05d72e981353..8e8467970481 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -116,7 +116,6 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) | |||
116 | drv_data->algo_data.udelay = 6; | 116 | drv_data->algo_data.udelay = 6; |
117 | drv_data->algo_data.timeout = 100; | 117 | drv_data->algo_data.timeout = 100; |
118 | 118 | ||
119 | drv_data->adapter.id = I2C_HW_B_IXP2000, | ||
120 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, | 119 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
121 | sizeof(drv_data->adapter.name)); | 120 | sizeof(drv_data->adapter.name)); |
122 | drv_data->adapter.algo_data = &drv_data->algo_data, | 121 | drv_data->adapter.algo_data = &drv_data->algo_data, |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index a9a45fcc8544..aedbbe6618db 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -310,7 +310,6 @@ static const struct i2c_algorithm mpc_algo = { | |||
310 | static struct i2c_adapter mpc_ops = { | 310 | static struct i2c_adapter mpc_ops = { |
311 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
312 | .name = "MPC adapter", | 312 | .name = "MPC adapter", |
313 | .id = I2C_HW_MPC107, | ||
314 | .algo = &mpc_algo, | 313 | .algo = &mpc_algo, |
315 | .timeout = 1, | 314 | .timeout = 1, |
316 | }; | 315 | }; |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 9e8118d2fe64..eeda276f8f16 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -527,7 +527,6 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
527 | goto exit_unmap_regs; | 527 | goto exit_unmap_regs; |
528 | } | 528 | } |
529 | drv_data->adapter.dev.parent = &pd->dev; | 529 | drv_data->adapter.dev.parent = &pd->dev; |
530 | drv_data->adapter.id = I2C_HW_MV64XXX; | ||
531 | drv_data->adapter.algo = &mv64xxx_i2c_algo; | 530 | drv_data->adapter.algo = &mv64xxx_i2c_algo; |
532 | drv_data->adapter.owner = THIS_MODULE; | 531 | drv_data->adapter.owner = THIS_MODULE; |
533 | drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 532 | drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 3b19bc41a60b..05af6cd7f270 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -355,7 +355,6 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
355 | return -EBUSY; | 355 | return -EBUSY; |
356 | } | 356 | } |
357 | smbus->adapter.owner = THIS_MODULE; | 357 | smbus->adapter.owner = THIS_MODULE; |
358 | smbus->adapter.id = I2C_HW_SMBUS_NFORCE2; | ||
359 | smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 358 | smbus->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
360 | smbus->adapter.algo = &smbus_algorithm; | 359 | smbus->adapter.algo = &smbus_algorithm; |
361 | smbus->adapter.algo_data = smbus; | 360 | smbus->adapter.algo_data = smbus; |
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index b2b8380f6602..322c5691e38e 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -115,7 +115,6 @@ static struct i2c_algo_bit_data parport_algo_data = { | |||
115 | static struct i2c_adapter parport_adapter = { | 115 | static struct i2c_adapter parport_adapter = { |
116 | .owner = THIS_MODULE, | 116 | .owner = THIS_MODULE, |
117 | .class = I2C_CLASS_HWMON, | 117 | .class = I2C_CLASS_HWMON, |
118 | .id = I2C_HW_B_LP, | ||
119 | .algo_data = &parport_algo_data, | 118 | .algo_data = &parport_algo_data, |
120 | .name = "Parallel port adapter (light)", | 119 | .name = "Parallel port adapter (light)", |
121 | }; | 120 | }; |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index a257cd5cd134..0d8998610c74 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -164,7 +164,6 @@ static void i2c_parport_attach (struct parport *port) | |||
164 | /* Fill the rest of the structure */ | 164 | /* Fill the rest of the structure */ |
165 | adapter->adapter.owner = THIS_MODULE; | 165 | adapter->adapter.owner = THIS_MODULE; |
166 | adapter->adapter.class = I2C_CLASS_HWMON; | 166 | adapter->adapter.class = I2C_CLASS_HWMON; |
167 | adapter->adapter.id = I2C_HW_B_LP; | ||
168 | strlcpy(adapter->adapter.name, "Parallel port adapter", | 167 | strlcpy(adapter->adapter.name, "Parallel port adapter", |
169 | sizeof(adapter->adapter.name)); | 168 | sizeof(adapter->adapter.name)); |
170 | adapter->algo_data = parport_algo_data; | 169 | adapter->algo_data = parport_algo_data; |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index 9eb76268ec78..4aa8138cb0a9 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -101,7 +101,6 @@ static struct i2c_algo_pca_data pca_isa_data = { | |||
101 | 101 | ||
102 | static struct i2c_adapter pca_isa_ops = { | 102 | static struct i2c_adapter pca_isa_ops = { |
103 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
104 | .id = I2C_HW_A_ISA, | ||
105 | .algo_data = &pca_isa_data, | 104 | .algo_data = &pca_isa_data, |
106 | .name = "PCA9564 ISA Adapter", | 105 | .name = "PCA9564 ISA Adapter", |
107 | .timeout = 100, | 106 | .timeout = 100, |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index eaa9b387543e..761f9dd53620 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -403,7 +403,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
403 | 403 | ||
404 | static struct i2c_adapter piix4_adapter = { | 404 | static struct i2c_adapter piix4_adapter = { |
405 | .owner = THIS_MODULE, | 405 | .owner = THIS_MODULE, |
406 | .id = I2C_HW_SMBUS_PIIX4, | ||
407 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 406 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
408 | .algo = &smbus_algorithm, | 407 | .algo = &smbus_algorithm, |
409 | }; | 408 | }; |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 4ddefbf238e9..98b1ec489159 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -155,7 +155,6 @@ static struct i2c_algo_sibyte_data sibyte_board_data[2] = { | |||
155 | static struct i2c_adapter sibyte_board_adapter[2] = { | 155 | static struct i2c_adapter sibyte_board_adapter[2] = { |
156 | { | 156 | { |
157 | .owner = THIS_MODULE, | 157 | .owner = THIS_MODULE, |
158 | .id = I2C_HW_SIBYTE, | ||
159 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 158 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
160 | .algo = NULL, | 159 | .algo = NULL, |
161 | .algo_data = &sibyte_board_data[0], | 160 | .algo_data = &sibyte_board_data[0], |
@@ -164,7 +163,6 @@ static struct i2c_adapter sibyte_board_adapter[2] = { | |||
164 | }, | 163 | }, |
165 | { | 164 | { |
166 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
167 | .id = I2C_HW_SIBYTE, | ||
168 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 166 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
169 | .algo = NULL, | 167 | .algo = NULL, |
170 | .algo_data = &sibyte_board_data[1], | 168 | .algo_data = &sibyte_board_data[1], |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 8ce2daff985c..f320ab27da46 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -365,7 +365,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
365 | 365 | ||
366 | static struct i2c_adapter sis5595_adapter = { | 366 | static struct i2c_adapter sis5595_adapter = { |
367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
368 | .id = I2C_HW_SMBUS_SIS5595, | ||
369 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 368 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
370 | .algo = &smbus_algorithm, | 369 | .algo = &smbus_algorithm, |
371 | }; | 370 | }; |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 9c9c016ff2b5..50c3610e6028 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -464,7 +464,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
464 | 464 | ||
465 | static struct i2c_adapter sis630_adapter = { | 465 | static struct i2c_adapter sis630_adapter = { |
466 | .owner = THIS_MODULE, | 466 | .owner = THIS_MODULE, |
467 | .id = I2C_HW_SMBUS_SIS630, | ||
468 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 467 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
469 | .algo = &smbus_algorithm, | 468 | .algo = &smbus_algorithm, |
470 | }; | 469 | }; |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index f1bba6396641..7e1594b40579 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -241,7 +241,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
241 | 241 | ||
242 | static struct i2c_adapter sis96x_adapter = { | 242 | static struct i2c_adapter sis96x_adapter = { |
243 | .owner = THIS_MODULE, | 243 | .owner = THIS_MODULE, |
244 | .id = I2C_HW_SMBUS_SIS96X, | ||
245 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 244 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
246 | .algo = &smbus_algorithm, | 245 | .algo = &smbus_algorithm, |
247 | }; | 246 | }; |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 29cef0433f34..8b24f192103a 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -83,7 +83,6 @@ static struct i2c_algo_bit_data bit_data = { | |||
83 | 83 | ||
84 | static struct i2c_adapter vt586b_adapter = { | 84 | static struct i2c_adapter vt586b_adapter = { |
85 | .owner = THIS_MODULE, | 85 | .owner = THIS_MODULE, |
86 | .id = I2C_HW_B_VIA, | ||
87 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 86 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
88 | .name = "VIA i2c", | 87 | .name = "VIA i2c", |
89 | .algo_data = &bit_data, | 88 | .algo_data = &bit_data, |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 9f194d9efd91..02e6f724b05f 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -321,7 +321,6 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
321 | 321 | ||
322 | static struct i2c_adapter vt596_adapter = { | 322 | static struct i2c_adapter vt596_adapter = { |
323 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
324 | .id = I2C_HW_SMBUS_VIA2, | ||
325 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 324 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
326 | .algo = &smbus_algorithm, | 325 | .algo = &smbus_algorithm, |
327 | }; | 326 | }; |
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index 1d4ae26ba73d..1a474acc0ddd 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -163,7 +163,6 @@ static struct i2c_algo_bit_data voo_i2c_bit_data = { | |||
163 | 163 | ||
164 | static struct i2c_adapter voodoo3_i2c_adapter = { | 164 | static struct i2c_adapter voodoo3_i2c_adapter = { |
165 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
166 | .id = I2C_HW_B_VOO, | ||
167 | .class = I2C_CLASS_TV_ANALOG, | 166 | .class = I2C_CLASS_TV_ANALOG, |
168 | .name = "I2C Voodoo3/Banshee adapter", | 167 | .name = "I2C Voodoo3/Banshee adapter", |
169 | .algo_data = &voo_i2c_bit_data, | 168 | .algo_data = &voo_i2c_bit_data, |
@@ -180,7 +179,6 @@ static struct i2c_algo_bit_data voo_ddc_bit_data = { | |||
180 | 179 | ||
181 | static struct i2c_adapter voodoo3_ddc_adapter = { | 180 | static struct i2c_adapter voodoo3_ddc_adapter = { |
182 | .owner = THIS_MODULE, | 181 | .owner = THIS_MODULE, |
183 | .id = I2C_HW_B_VOO, | ||
184 | .class = I2C_CLASS_DDC, | 182 | .class = I2C_CLASS_DDC, |
185 | .name = "DDC Voodoo3/Banshee adapter", | 183 | .name = "DDC Voodoo3/Banshee adapter", |
186 | .algo_data = &voo_ddc_bit_data, | 184 | .algo_data = &voo_ddc_bit_data, |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index ed794b145a11..648ecc6f60e6 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -440,7 +440,6 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | |||
440 | i2c_set_adapdata(adapter, iface); | 440 | i2c_set_adapdata(adapter, iface); |
441 | snprintf(adapter->name, sizeof(adapter->name), "%s ACB%d", text, index); | 441 | snprintf(adapter->name, sizeof(adapter->name), "%s ACB%d", text, index); |
442 | adapter->owner = THIS_MODULE; | 442 | adapter->owner = THIS_MODULE; |
443 | adapter->id = I2C_HW_SMBUS_SCX200; | ||
444 | adapter->algo = &scx200_acb_algorithm; | 443 | adapter->algo = &scx200_acb_algorithm; |
445 | adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | 444 | adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
446 | adapter->dev.parent = dev; | 445 | adapter->dev.parent = dev; |
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index e4c98539c517..162b74a04886 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c | |||
@@ -82,7 +82,6 @@ static struct i2c_algo_bit_data scx200_i2c_data = { | |||
82 | static struct i2c_adapter scx200_i2c_ops = { | 82 | static struct i2c_adapter scx200_i2c_ops = { |
83 | .owner = THIS_MODULE, | 83 | .owner = THIS_MODULE, |
84 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, | 84 | .class = I2C_CLASS_HWMON | I2C_CLASS_SPD, |
85 | .id = I2C_HW_B_SCX200, | ||
86 | .algo_data = &scx200_i2c_data, | 85 | .algo_data = &scx200_i2c_data, |
87 | .name = "NatSemi SCx200 I2C", | 86 | .name = "NatSemi SCx200 I2C", |
88 | }; | 87 | }; |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index b9bef04b7be4..c80312c1f382 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -16,43 +16,6 @@ config DS1682 | |||
16 | This driver can also be built as a module. If so, the module | 16 | This driver can also be built as a module. If so, the module |
17 | will be called ds1682. | 17 | will be called ds1682. |
18 | 18 | ||
19 | config AT24 | ||
20 | tristate "EEPROMs from most vendors" | ||
21 | depends on SYSFS && EXPERIMENTAL | ||
22 | help | ||
23 | Enable this driver to get read/write support to most I2C EEPROMs, | ||
24 | after you configure the driver to know about each EEPROM on | ||
25 | your target board. Use these generic chip names, instead of | ||
26 | vendor-specific ones like at24c64 or 24lc02: | ||
27 | |||
28 | 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08, | ||
29 | 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024 | ||
30 | |||
31 | Unless you like data loss puzzles, always be sure that any chip | ||
32 | you configure as a 24c32 (32 kbit) or larger is NOT really a | ||
33 | 24c16 (16 kbit) or smaller, and vice versa. Marking the chip | ||
34 | as read-only won't help recover from this. Also, if your chip | ||
35 | has any software write-protect mechanism you may want to review the | ||
36 | code to make sure this driver won't turn it on by accident. | ||
37 | |||
38 | If you use this with an SMBus adapter instead of an I2C adapter, | ||
39 | full functionality is not available. Only smaller devices are | ||
40 | supported (24c16 and below, max 4 kByte). | ||
41 | |||
42 | This driver can also be built as a module. If so, the module | ||
43 | will be called at24. | ||
44 | |||
45 | config SENSORS_EEPROM | ||
46 | tristate "EEPROM reader" | ||
47 | depends on EXPERIMENTAL | ||
48 | help | ||
49 | If you say yes here you get read-only access to the EEPROM data | ||
50 | available on modern memory DIMMs and Sony Vaio laptops. Such | ||
51 | EEPROMs could theoretically be available on other devices as well. | ||
52 | |||
53 | This driver can also be built as a module. If so, the module | ||
54 | will be called eeprom. | ||
55 | |||
56 | config SENSORS_PCF8574 | 19 | config SENSORS_PCF8574 |
57 | tristate "Philips PCF8574 and PCF8574A (DEPRECATED)" | 20 | tristate "Philips PCF8574 and PCF8574A (DEPRECATED)" |
58 | depends on EXPERIMENTAL && GPIO_PCF857X = "n" | 21 | depends on EXPERIMENTAL && GPIO_PCF857X = "n" |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 00fcb5193ac2..d142f238a2de 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -11,8 +11,6 @@ | |||
11 | # | 11 | # |
12 | 12 | ||
13 | obj-$(CONFIG_DS1682) += ds1682.o | 13 | obj-$(CONFIG_DS1682) += ds1682.o |
14 | obj-$(CONFIG_AT24) += at24.o | ||
15 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o | ||
16 | obj-$(CONFIG_SENSORS_MAX6875) += max6875.o | 14 | obj-$(CONFIG_SENSORS_MAX6875) += max6875.o |
17 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o | 15 | obj-$(CONFIG_SENSORS_PCA9539) += pca9539.o |
18 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o | 16 | obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o |
diff --git a/drivers/i2c/chips/at24.c b/drivers/i2c/chips/at24.c deleted file mode 100644 index d4775528abc6..000000000000 --- a/drivers/i2c/chips/at24.c +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
1 | /* | ||
2 | * at24.c - handle most I2C EEPROMs | ||
3 | * | ||
4 | * Copyright (C) 2005-2007 David Brownell | ||
5 | * Copyright (C) 2008 Wolfram Sang, Pengutronix | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/mutex.h> | ||
18 | #include <linux/sysfs.h> | ||
19 | #include <linux/mod_devicetable.h> | ||
20 | #include <linux/log2.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/jiffies.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/i2c/at24.h> | ||
25 | |||
26 | /* | ||
27 | * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. | ||
28 | * Differences between different vendor product lines (like Atmel AT24C or | ||
29 | * MicroChip 24LC, etc) won't much matter for typical read/write access. | ||
30 | * There are also I2C RAM chips, likewise interchangeable. One example | ||
31 | * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). | ||
32 | * | ||
33 | * However, misconfiguration can lose data. "Set 16-bit memory address" | ||
34 | * to a part with 8-bit addressing will overwrite data. Writing with too | ||
35 | * big a page size also loses data. And it's not safe to assume that the | ||
36 | * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC | ||
37 | * uses 0x51, for just one example. | ||
38 | * | ||
39 | * Accordingly, explicit board-specific configuration data should be used | ||
40 | * in almost all cases. (One partial exception is an SMBus used to access | ||
41 | * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) | ||
42 | * | ||
43 | * So this driver uses "new style" I2C driver binding, expecting to be | ||
44 | * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or | ||
45 | * similar kernel-resident tables; or, configuration data coming from | ||
46 | * a bootloader. | ||
47 | * | ||
48 | * Other than binding model, current differences from "eeprom" driver are | ||
49 | * that this one handles write access and isn't restricted to 24c02 devices. | ||
50 | * It also handles larger devices (32 kbit and up) with two-byte addresses, | ||
51 | * which won't work on pure SMBus systems. | ||
52 | */ | ||
53 | |||
54 | struct at24_data { | ||
55 | struct at24_platform_data chip; | ||
56 | bool use_smbus; | ||
57 | |||
58 | /* | ||
59 | * Lock protects against activities from other Linux tasks, | ||
60 | * but not from changes by other I2C masters. | ||
61 | */ | ||
62 | struct mutex lock; | ||
63 | struct bin_attribute bin; | ||
64 | |||
65 | u8 *writebuf; | ||
66 | unsigned write_max; | ||
67 | unsigned num_addresses; | ||
68 | |||
69 | /* | ||
70 | * Some chips tie up multiple I2C addresses; dummy devices reserve | ||
71 | * them for us, and we'll use them with SMBus calls. | ||
72 | */ | ||
73 | struct i2c_client *client[]; | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * This parameter is to help this driver avoid blocking other drivers out | ||
78 | * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C | ||
79 | * clock, one 256 byte read takes about 1/43 second which is excessive; | ||
80 | * but the 1/170 second it takes at 400 kHz may be quite reasonable; and | ||
81 | * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. | ||
82 | * | ||
83 | * This value is forced to be a power of two so that writes align on pages. | ||
84 | */ | ||
85 | static unsigned io_limit = 128; | ||
86 | module_param(io_limit, uint, 0); | ||
87 | MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); | ||
88 | |||
89 | /* | ||
90 | * Specs often allow 5 msec for a page write, sometimes 20 msec; | ||
91 | * it's important to recover from write timeouts. | ||
92 | */ | ||
93 | static unsigned write_timeout = 25; | ||
94 | module_param(write_timeout, uint, 0); | ||
95 | MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); | ||
96 | |||
97 | #define AT24_SIZE_BYTELEN 5 | ||
98 | #define AT24_SIZE_FLAGS 8 | ||
99 | |||
100 | #define AT24_BITMASK(x) (BIT(x) - 1) | ||
101 | |||
102 | /* create non-zero magic value for given eeprom parameters */ | ||
103 | #define AT24_DEVICE_MAGIC(_len, _flags) \ | ||
104 | ((1 << AT24_SIZE_FLAGS | (_flags)) \ | ||
105 | << AT24_SIZE_BYTELEN | ilog2(_len)) | ||
106 | |||
107 | static const struct i2c_device_id at24_ids[] = { | ||
108 | /* needs 8 addresses as A0-A2 are ignored */ | ||
109 | { "24c00", AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR) }, | ||
110 | /* old variants can't be handled with this generic entry! */ | ||
111 | { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) }, | ||
112 | { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) }, | ||
113 | /* spd is a 24c02 in memory DIMMs */ | ||
114 | { "spd", AT24_DEVICE_MAGIC(2048 / 8, | ||
115 | AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, | ||
116 | { "24c04", AT24_DEVICE_MAGIC(4096 / 8, 0) }, | ||
117 | /* 24rf08 quirk is handled at i2c-core */ | ||
118 | { "24c08", AT24_DEVICE_MAGIC(8192 / 8, 0) }, | ||
119 | { "24c16", AT24_DEVICE_MAGIC(16384 / 8, 0) }, | ||
120 | { "24c32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, | ||
121 | { "24c64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, | ||
122 | { "24c128", AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16) }, | ||
123 | { "24c256", AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16) }, | ||
124 | { "24c512", AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16) }, | ||
125 | { "24c1024", AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16) }, | ||
126 | { "at24", 0 }, | ||
127 | { /* END OF LIST */ } | ||
128 | }; | ||
129 | MODULE_DEVICE_TABLE(i2c, at24_ids); | ||
130 | |||
131 | /*-------------------------------------------------------------------------*/ | ||
132 | |||
133 | /* | ||
134 | * This routine supports chips which consume multiple I2C addresses. It | ||
135 | * computes the addressing information to be used for a given r/w request. | ||
136 | * Assumes that sanity checks for offset happened at sysfs-layer. | ||
137 | */ | ||
138 | static struct i2c_client *at24_translate_offset(struct at24_data *at24, | ||
139 | unsigned *offset) | ||
140 | { | ||
141 | unsigned i; | ||
142 | |||
143 | if (at24->chip.flags & AT24_FLAG_ADDR16) { | ||
144 | i = *offset >> 16; | ||
145 | *offset &= 0xffff; | ||
146 | } else { | ||
147 | i = *offset >> 8; | ||
148 | *offset &= 0xff; | ||
149 | } | ||
150 | |||
151 | return at24->client[i]; | ||
152 | } | ||
153 | |||
154 | static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, | ||
155 | unsigned offset, size_t count) | ||
156 | { | ||
157 | struct i2c_msg msg[2]; | ||
158 | u8 msgbuf[2]; | ||
159 | struct i2c_client *client; | ||
160 | int status, i; | ||
161 | |||
162 | memset(msg, 0, sizeof(msg)); | ||
163 | |||
164 | /* | ||
165 | * REVISIT some multi-address chips don't rollover page reads to | ||
166 | * the next slave address, so we may need to truncate the count. | ||
167 | * Those chips might need another quirk flag. | ||
168 | * | ||
169 | * If the real hardware used four adjacent 24c02 chips and that | ||
170 | * were misconfigured as one 24c08, that would be a similar effect: | ||
171 | * one "eeprom" file not four, but larger reads would fail when | ||
172 | * they crossed certain pages. | ||
173 | */ | ||
174 | |||
175 | /* | ||
176 | * Slave address and byte offset derive from the offset. Always | ||
177 | * set the byte address; on a multi-master board, another master | ||
178 | * may have changed the chip's "current" address pointer. | ||
179 | */ | ||
180 | client = at24_translate_offset(at24, &offset); | ||
181 | |||
182 | if (count > io_limit) | ||
183 | count = io_limit; | ||
184 | |||
185 | /* Smaller eeproms can work given some SMBus extension calls */ | ||
186 | if (at24->use_smbus) { | ||
187 | if (count > I2C_SMBUS_BLOCK_MAX) | ||
188 | count = I2C_SMBUS_BLOCK_MAX; | ||
189 | status = i2c_smbus_read_i2c_block_data(client, offset, | ||
190 | count, buf); | ||
191 | dev_dbg(&client->dev, "smbus read %zu@%d --> %d\n", | ||
192 | count, offset, status); | ||
193 | return (status < 0) ? -EIO : status; | ||
194 | } | ||
195 | |||
196 | /* | ||
197 | * When we have a better choice than SMBus calls, use a combined | ||
198 | * I2C message. Write address; then read up to io_limit data bytes. | ||
199 | * Note that read page rollover helps us here (unlike writes). | ||
200 | * msgbuf is u8 and will cast to our needs. | ||
201 | */ | ||
202 | i = 0; | ||
203 | if (at24->chip.flags & AT24_FLAG_ADDR16) | ||
204 | msgbuf[i++] = offset >> 8; | ||
205 | msgbuf[i++] = offset; | ||
206 | |||
207 | msg[0].addr = client->addr; | ||
208 | msg[0].buf = msgbuf; | ||
209 | msg[0].len = i; | ||
210 | |||
211 | msg[1].addr = client->addr; | ||
212 | msg[1].flags = I2C_M_RD; | ||
213 | msg[1].buf = buf; | ||
214 | msg[1].len = count; | ||
215 | |||
216 | status = i2c_transfer(client->adapter, msg, 2); | ||
217 | dev_dbg(&client->dev, "i2c read %zu@%d --> %d\n", | ||
218 | count, offset, status); | ||
219 | |||
220 | if (status == 2) | ||
221 | return count; | ||
222 | else if (status >= 0) | ||
223 | return -EIO; | ||
224 | else | ||
225 | return status; | ||
226 | } | ||
227 | |||
228 | static ssize_t at24_bin_read(struct kobject *kobj, struct bin_attribute *attr, | ||
229 | char *buf, loff_t off, size_t count) | ||
230 | { | ||
231 | struct at24_data *at24; | ||
232 | ssize_t retval = 0; | ||
233 | |||
234 | at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); | ||
235 | |||
236 | if (unlikely(!count)) | ||
237 | return count; | ||
238 | |||
239 | /* | ||
240 | * Read data from chip, protecting against concurrent updates | ||
241 | * from this host, but not from other I2C masters. | ||
242 | */ | ||
243 | mutex_lock(&at24->lock); | ||
244 | |||
245 | while (count) { | ||
246 | ssize_t status; | ||
247 | |||
248 | status = at24_eeprom_read(at24, buf, off, count); | ||
249 | if (status <= 0) { | ||
250 | if (retval == 0) | ||
251 | retval = status; | ||
252 | break; | ||
253 | } | ||
254 | buf += status; | ||
255 | off += status; | ||
256 | count -= status; | ||
257 | retval += status; | ||
258 | } | ||
259 | |||
260 | mutex_unlock(&at24->lock); | ||
261 | |||
262 | return retval; | ||
263 | } | ||
264 | |||
265 | |||
266 | /* | ||
267 | * REVISIT: export at24_bin{read,write}() to let other kernel code use | ||
268 | * eeprom data. For example, it might hold a board's Ethernet address, or | ||
269 | * board-specific calibration data generated on the manufacturing floor. | ||
270 | */ | ||
271 | |||
272 | |||
273 | /* | ||
274 | * Note that if the hardware write-protect pin is pulled high, the whole | ||
275 | * chip is normally write protected. But there are plenty of product | ||
276 | * variants here, including OTP fuses and partial chip protect. | ||
277 | * | ||
278 | * We only use page mode writes; the alternative is sloooow. This routine | ||
279 | * writes at most one page. | ||
280 | */ | ||
281 | static ssize_t at24_eeprom_write(struct at24_data *at24, char *buf, | ||
282 | unsigned offset, size_t count) | ||
283 | { | ||
284 | struct i2c_client *client; | ||
285 | struct i2c_msg msg; | ||
286 | ssize_t status; | ||
287 | unsigned long timeout, write_time; | ||
288 | unsigned next_page; | ||
289 | |||
290 | /* Get corresponding I2C address and adjust offset */ | ||
291 | client = at24_translate_offset(at24, &offset); | ||
292 | |||
293 | /* write_max is at most a page */ | ||
294 | if (count > at24->write_max) | ||
295 | count = at24->write_max; | ||
296 | |||
297 | /* Never roll over backwards, to the start of this page */ | ||
298 | next_page = roundup(offset + 1, at24->chip.page_size); | ||
299 | if (offset + count > next_page) | ||
300 | count = next_page - offset; | ||
301 | |||
302 | /* If we'll use I2C calls for I/O, set up the message */ | ||
303 | if (!at24->use_smbus) { | ||
304 | int i = 0; | ||
305 | |||
306 | msg.addr = client->addr; | ||
307 | msg.flags = 0; | ||
308 | |||
309 | /* msg.buf is u8 and casts will mask the values */ | ||
310 | msg.buf = at24->writebuf; | ||
311 | if (at24->chip.flags & AT24_FLAG_ADDR16) | ||
312 | msg.buf[i++] = offset >> 8; | ||
313 | |||
314 | msg.buf[i++] = offset; | ||
315 | memcpy(&msg.buf[i], buf, count); | ||
316 | msg.len = i + count; | ||
317 | } | ||
318 | |||
319 | /* | ||
320 | * Writes fail if the previous one didn't complete yet. We may | ||
321 | * loop a few times until this one succeeds, waiting at least | ||
322 | * long enough for one entire page write to work. | ||
323 | */ | ||
324 | timeout = jiffies + msecs_to_jiffies(write_timeout); | ||
325 | do { | ||
326 | write_time = jiffies; | ||
327 | if (at24->use_smbus) { | ||
328 | status = i2c_smbus_write_i2c_block_data(client, | ||
329 | offset, count, buf); | ||
330 | if (status == 0) | ||
331 | status = count; | ||
332 | } else { | ||
333 | status = i2c_transfer(client->adapter, &msg, 1); | ||
334 | if (status == 1) | ||
335 | status = count; | ||
336 | } | ||
337 | dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", | ||
338 | count, offset, status, jiffies); | ||
339 | |||
340 | if (status == count) | ||
341 | return count; | ||
342 | |||
343 | /* REVISIT: at HZ=100, this is sloooow */ | ||
344 | msleep(1); | ||
345 | } while (time_before(write_time, timeout)); | ||
346 | |||
347 | return -ETIMEDOUT; | ||
348 | } | ||
349 | |||
350 | static ssize_t at24_bin_write(struct kobject *kobj, struct bin_attribute *attr, | ||
351 | char *buf, loff_t off, size_t count) | ||
352 | { | ||
353 | struct at24_data *at24; | ||
354 | ssize_t retval = 0; | ||
355 | |||
356 | at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); | ||
357 | |||
358 | if (unlikely(!count)) | ||
359 | return count; | ||
360 | |||
361 | /* | ||
362 | * Write data to chip, protecting against concurrent updates | ||
363 | * from this host, but not from other I2C masters. | ||
364 | */ | ||
365 | mutex_lock(&at24->lock); | ||
366 | |||
367 | while (count) { | ||
368 | ssize_t status; | ||
369 | |||
370 | status = at24_eeprom_write(at24, buf, off, count); | ||
371 | if (status <= 0) { | ||
372 | if (retval == 0) | ||
373 | retval = status; | ||
374 | break; | ||
375 | } | ||
376 | buf += status; | ||
377 | off += status; | ||
378 | count -= status; | ||
379 | retval += status; | ||
380 | } | ||
381 | |||
382 | mutex_unlock(&at24->lock); | ||
383 | |||
384 | return retval; | ||
385 | } | ||
386 | |||
387 | /*-------------------------------------------------------------------------*/ | ||
388 | |||
389 | static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
390 | { | ||
391 | struct at24_platform_data chip; | ||
392 | bool writable; | ||
393 | bool use_smbus = false; | ||
394 | struct at24_data *at24; | ||
395 | int err; | ||
396 | unsigned i, num_addresses; | ||
397 | kernel_ulong_t magic; | ||
398 | |||
399 | if (client->dev.platform_data) { | ||
400 | chip = *(struct at24_platform_data *)client->dev.platform_data; | ||
401 | } else { | ||
402 | if (!id->driver_data) { | ||
403 | err = -ENODEV; | ||
404 | goto err_out; | ||
405 | } | ||
406 | magic = id->driver_data; | ||
407 | chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); | ||
408 | magic >>= AT24_SIZE_BYTELEN; | ||
409 | chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); | ||
410 | /* | ||
411 | * This is slow, but we can't know all eeproms, so we better | ||
412 | * play safe. Specifying custom eeprom-types via platform_data | ||
413 | * is recommended anyhow. | ||
414 | */ | ||
415 | chip.page_size = 1; | ||
416 | } | ||
417 | |||
418 | if (!is_power_of_2(chip.byte_len)) | ||
419 | dev_warn(&client->dev, | ||
420 | "byte_len looks suspicious (no power of 2)!\n"); | ||
421 | if (!is_power_of_2(chip.page_size)) | ||
422 | dev_warn(&client->dev, | ||
423 | "page_size looks suspicious (no power of 2)!\n"); | ||
424 | |||
425 | /* Use I2C operations unless we're stuck with SMBus extensions. */ | ||
426 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | ||
427 | if (chip.flags & AT24_FLAG_ADDR16) { | ||
428 | err = -EPFNOSUPPORT; | ||
429 | goto err_out; | ||
430 | } | ||
431 | if (!i2c_check_functionality(client->adapter, | ||
432 | I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { | ||
433 | err = -EPFNOSUPPORT; | ||
434 | goto err_out; | ||
435 | } | ||
436 | use_smbus = true; | ||
437 | } | ||
438 | |||
439 | if (chip.flags & AT24_FLAG_TAKE8ADDR) | ||
440 | num_addresses = 8; | ||
441 | else | ||
442 | num_addresses = DIV_ROUND_UP(chip.byte_len, | ||
443 | (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); | ||
444 | |||
445 | at24 = kzalloc(sizeof(struct at24_data) + | ||
446 | num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); | ||
447 | if (!at24) { | ||
448 | err = -ENOMEM; | ||
449 | goto err_out; | ||
450 | } | ||
451 | |||
452 | mutex_init(&at24->lock); | ||
453 | at24->use_smbus = use_smbus; | ||
454 | at24->chip = chip; | ||
455 | at24->num_addresses = num_addresses; | ||
456 | |||
457 | /* | ||
458 | * Export the EEPROM bytes through sysfs, since that's convenient. | ||
459 | * By default, only root should see the data (maybe passwords etc) | ||
460 | */ | ||
461 | at24->bin.attr.name = "eeprom"; | ||
462 | at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; | ||
463 | at24->bin.read = at24_bin_read; | ||
464 | at24->bin.size = chip.byte_len; | ||
465 | |||
466 | writable = !(chip.flags & AT24_FLAG_READONLY); | ||
467 | if (writable) { | ||
468 | if (!use_smbus || i2c_check_functionality(client->adapter, | ||
469 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { | ||
470 | |||
471 | unsigned write_max = chip.page_size; | ||
472 | |||
473 | at24->bin.write = at24_bin_write; | ||
474 | at24->bin.attr.mode |= S_IWUSR; | ||
475 | |||
476 | if (write_max > io_limit) | ||
477 | write_max = io_limit; | ||
478 | if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) | ||
479 | write_max = I2C_SMBUS_BLOCK_MAX; | ||
480 | at24->write_max = write_max; | ||
481 | |||
482 | /* buffer (data + address at the beginning) */ | ||
483 | at24->writebuf = kmalloc(write_max + 2, GFP_KERNEL); | ||
484 | if (!at24->writebuf) { | ||
485 | err = -ENOMEM; | ||
486 | goto err_struct; | ||
487 | } | ||
488 | } else { | ||
489 | dev_warn(&client->dev, | ||
490 | "cannot write due to controller restrictions."); | ||
491 | } | ||
492 | } | ||
493 | |||
494 | at24->client[0] = client; | ||
495 | |||
496 | /* use dummy devices for multiple-address chips */ | ||
497 | for (i = 1; i < num_addresses; i++) { | ||
498 | at24->client[i] = i2c_new_dummy(client->adapter, | ||
499 | client->addr + i); | ||
500 | if (!at24->client[i]) { | ||
501 | dev_err(&client->dev, "address 0x%02x unavailable\n", | ||
502 | client->addr + i); | ||
503 | err = -EADDRINUSE; | ||
504 | goto err_clients; | ||
505 | } | ||
506 | } | ||
507 | |||
508 | err = sysfs_create_bin_file(&client->dev.kobj, &at24->bin); | ||
509 | if (err) | ||
510 | goto err_clients; | ||
511 | |||
512 | i2c_set_clientdata(client, at24); | ||
513 | |||
514 | dev_info(&client->dev, "%zu byte %s EEPROM %s\n", | ||
515 | at24->bin.size, client->name, | ||
516 | writable ? "(writable)" : "(read-only)"); | ||
517 | dev_dbg(&client->dev, | ||
518 | "page_size %d, num_addresses %d, write_max %d%s\n", | ||
519 | chip.page_size, num_addresses, | ||
520 | at24->write_max, | ||
521 | use_smbus ? ", use_smbus" : ""); | ||
522 | |||
523 | return 0; | ||
524 | |||
525 | err_clients: | ||
526 | for (i = 1; i < num_addresses; i++) | ||
527 | if (at24->client[i]) | ||
528 | i2c_unregister_device(at24->client[i]); | ||
529 | |||
530 | kfree(at24->writebuf); | ||
531 | err_struct: | ||
532 | kfree(at24); | ||
533 | err_out: | ||
534 | dev_dbg(&client->dev, "probe error %d\n", err); | ||
535 | return err; | ||
536 | } | ||
537 | |||
538 | static int __devexit at24_remove(struct i2c_client *client) | ||
539 | { | ||
540 | struct at24_data *at24; | ||
541 | int i; | ||
542 | |||
543 | at24 = i2c_get_clientdata(client); | ||
544 | sysfs_remove_bin_file(&client->dev.kobj, &at24->bin); | ||
545 | |||
546 | for (i = 1; i < at24->num_addresses; i++) | ||
547 | i2c_unregister_device(at24->client[i]); | ||
548 | |||
549 | kfree(at24->writebuf); | ||
550 | kfree(at24); | ||
551 | i2c_set_clientdata(client, NULL); | ||
552 | return 0; | ||
553 | } | ||
554 | |||
555 | /*-------------------------------------------------------------------------*/ | ||
556 | |||
557 | static struct i2c_driver at24_driver = { | ||
558 | .driver = { | ||
559 | .name = "at24", | ||
560 | .owner = THIS_MODULE, | ||
561 | }, | ||
562 | .probe = at24_probe, | ||
563 | .remove = __devexit_p(at24_remove), | ||
564 | .id_table = at24_ids, | ||
565 | }; | ||
566 | |||
567 | static int __init at24_init(void) | ||
568 | { | ||
569 | io_limit = rounddown_pow_of_two(io_limit); | ||
570 | return i2c_add_driver(&at24_driver); | ||
571 | } | ||
572 | module_init(at24_init); | ||
573 | |||
574 | static void __exit at24_exit(void) | ||
575 | { | ||
576 | i2c_del_driver(&at24_driver); | ||
577 | } | ||
578 | module_exit(at24_exit); | ||
579 | |||
580 | MODULE_DESCRIPTION("Driver for most I2C EEPROMs"); | ||
581 | MODULE_AUTHOR("David Brownell and Wolfram Sang"); | ||
582 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c deleted file mode 100644 index 2c27193aeaa0..000000000000 --- a/drivers/i2c/chips/eeprom.c +++ /dev/null | |||
@@ -1,257 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (C) 1998, 1999 Frodo Looijaard <frodol@dds.nl> and | ||
3 | Philip Edelbrock <phil@netroedge.com> | ||
4 | Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com> | ||
5 | Copyright (C) 2003 IBM Corp. | ||
6 | Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/jiffies.h> | ||
28 | #include <linux/i2c.h> | ||
29 | #include <linux/mutex.h> | ||
30 | |||
31 | /* Addresses to scan */ | ||
32 | static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, | ||
33 | 0x55, 0x56, 0x57, I2C_CLIENT_END }; | ||
34 | |||
35 | /* Insmod parameters */ | ||
36 | I2C_CLIENT_INSMOD_1(eeprom); | ||
37 | |||
38 | |||
39 | /* Size of EEPROM in bytes */ | ||
40 | #define EEPROM_SIZE 256 | ||
41 | |||
42 | /* possible types of eeprom devices */ | ||
43 | enum eeprom_nature { | ||
44 | UNKNOWN, | ||
45 | VAIO, | ||
46 | }; | ||
47 | |||
48 | /* Each client has this additional data */ | ||
49 | struct eeprom_data { | ||
50 | struct mutex update_lock; | ||
51 | u8 valid; /* bitfield, bit!=0 if slice is valid */ | ||
52 | unsigned long last_updated[8]; /* In jiffies, 8 slices */ | ||
53 | u8 data[EEPROM_SIZE]; /* Register values */ | ||
54 | enum eeprom_nature nature; | ||
55 | }; | ||
56 | |||
57 | |||
58 | static void eeprom_update_client(struct i2c_client *client, u8 slice) | ||
59 | { | ||
60 | struct eeprom_data *data = i2c_get_clientdata(client); | ||
61 | int i; | ||
62 | |||
63 | mutex_lock(&data->update_lock); | ||
64 | |||
65 | if (!(data->valid & (1 << slice)) || | ||
66 | time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { | ||
67 | dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice); | ||
68 | |||
69 | if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { | ||
70 | for (i = slice << 5; i < (slice + 1) << 5; i += 32) | ||
71 | if (i2c_smbus_read_i2c_block_data(client, i, | ||
72 | 32, data->data + i) | ||
73 | != 32) | ||
74 | goto exit; | ||
75 | } else { | ||
76 | for (i = slice << 5; i < (slice + 1) << 5; i += 2) { | ||
77 | int word = i2c_smbus_read_word_data(client, i); | ||
78 | if (word < 0) | ||
79 | goto exit; | ||
80 | data->data[i] = word & 0xff; | ||
81 | data->data[i + 1] = word >> 8; | ||
82 | } | ||
83 | } | ||
84 | data->last_updated[slice] = jiffies; | ||
85 | data->valid |= (1 << slice); | ||
86 | } | ||
87 | exit: | ||
88 | mutex_unlock(&data->update_lock); | ||
89 | } | ||
90 | |||
91 | static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, | ||
92 | char *buf, loff_t off, size_t count) | ||
93 | { | ||
94 | struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj)); | ||
95 | struct eeprom_data *data = i2c_get_clientdata(client); | ||
96 | u8 slice; | ||
97 | |||
98 | if (off > EEPROM_SIZE) | ||
99 | return 0; | ||
100 | if (off + count > EEPROM_SIZE) | ||
101 | count = EEPROM_SIZE - off; | ||
102 | |||
103 | /* Only refresh slices which contain requested bytes */ | ||
104 | for (slice = off >> 5; slice <= (off + count - 1) >> 5; slice++) | ||
105 | eeprom_update_client(client, slice); | ||
106 | |||
107 | /* Hide Vaio private settings to regular users: | ||
108 | - BIOS passwords: bytes 0x00 to 0x0f | ||
109 | - UUID: bytes 0x10 to 0x1f | ||
110 | - Serial number: 0xc0 to 0xdf */ | ||
111 | if (data->nature == VAIO && !capable(CAP_SYS_ADMIN)) { | ||
112 | int i; | ||
113 | |||
114 | for (i = 0; i < count; i++) { | ||
115 | if ((off + i <= 0x1f) || | ||
116 | (off + i >= 0xc0 && off + i <= 0xdf)) | ||
117 | buf[i] = 0; | ||
118 | else | ||
119 | buf[i] = data->data[off + i]; | ||
120 | } | ||
121 | } else { | ||
122 | memcpy(buf, &data->data[off], count); | ||
123 | } | ||
124 | |||
125 | return count; | ||
126 | } | ||
127 | |||
128 | static struct bin_attribute eeprom_attr = { | ||
129 | .attr = { | ||
130 | .name = "eeprom", | ||
131 | .mode = S_IRUGO, | ||
132 | }, | ||
133 | .size = EEPROM_SIZE, | ||
134 | .read = eeprom_read, | ||
135 | }; | ||
136 | |||
137 | /* Return 0 if detection is successful, -ENODEV otherwise */ | ||
138 | static int eeprom_detect(struct i2c_client *client, int kind, | ||
139 | struct i2c_board_info *info) | ||
140 | { | ||
141 | struct i2c_adapter *adapter = client->adapter; | ||
142 | |||
143 | /* EDID EEPROMs are often 24C00 EEPROMs, which answer to all | ||
144 | addresses 0x50-0x57, but we only care about 0x50. So decline | ||
145 | attaching to addresses >= 0x51 on DDC buses */ | ||
146 | if (!(adapter->class & I2C_CLASS_SPD) && client->addr >= 0x51) | ||
147 | return -ENODEV; | ||
148 | |||
149 | /* There are four ways we can read the EEPROM data: | ||
150 | (1) I2C block reads (faster, but unsupported by most adapters) | ||
151 | (2) Word reads (128% overhead) | ||
152 | (3) Consecutive byte reads (88% overhead, unsafe) | ||
153 | (4) Regular byte data reads (265% overhead) | ||
154 | The third and fourth methods are not implemented by this driver | ||
155 | because all known adapters support one of the first two. */ | ||
156 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_WORD_DATA) | ||
157 | && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) | ||
158 | return -ENODEV; | ||
159 | |||
160 | strlcpy(info->type, "eeprom", I2C_NAME_SIZE); | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int eeprom_probe(struct i2c_client *client, | ||
166 | const struct i2c_device_id *id) | ||
167 | { | ||
168 | struct i2c_adapter *adapter = client->adapter; | ||
169 | struct eeprom_data *data; | ||
170 | int err; | ||
171 | |||
172 | if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { | ||
173 | err = -ENOMEM; | ||
174 | goto exit; | ||
175 | } | ||
176 | |||
177 | memset(data->data, 0xff, EEPROM_SIZE); | ||
178 | i2c_set_clientdata(client, data); | ||
179 | mutex_init(&data->update_lock); | ||
180 | data->nature = UNKNOWN; | ||
181 | |||
182 | /* Detect the Vaio nature of EEPROMs. | ||
183 | We use the "PCG-" or "VGN-" prefix as the signature. */ | ||
184 | if (client->addr == 0x57 | ||
185 | && i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) { | ||
186 | char name[4]; | ||
187 | |||
188 | name[0] = i2c_smbus_read_byte_data(client, 0x80); | ||
189 | name[1] = i2c_smbus_read_byte_data(client, 0x81); | ||
190 | name[2] = i2c_smbus_read_byte_data(client, 0x82); | ||
191 | name[3] = i2c_smbus_read_byte_data(client, 0x83); | ||
192 | |||
193 | if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) { | ||
194 | dev_info(&client->dev, "Vaio EEPROM detected, " | ||
195 | "enabling privacy protection\n"); | ||
196 | data->nature = VAIO; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | /* create the sysfs eeprom file */ | ||
201 | err = sysfs_create_bin_file(&client->dev.kobj, &eeprom_attr); | ||
202 | if (err) | ||
203 | goto exit_kfree; | ||
204 | |||
205 | return 0; | ||
206 | |||
207 | exit_kfree: | ||
208 | kfree(data); | ||
209 | exit: | ||
210 | return err; | ||
211 | } | ||
212 | |||
213 | static int eeprom_remove(struct i2c_client *client) | ||
214 | { | ||
215 | sysfs_remove_bin_file(&client->dev.kobj, &eeprom_attr); | ||
216 | kfree(i2c_get_clientdata(client)); | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static const struct i2c_device_id eeprom_id[] = { | ||
222 | { "eeprom", 0 }, | ||
223 | { } | ||
224 | }; | ||
225 | |||
226 | static struct i2c_driver eeprom_driver = { | ||
227 | .driver = { | ||
228 | .name = "eeprom", | ||
229 | }, | ||
230 | .probe = eeprom_probe, | ||
231 | .remove = eeprom_remove, | ||
232 | .id_table = eeprom_id, | ||
233 | |||
234 | .class = I2C_CLASS_DDC | I2C_CLASS_SPD, | ||
235 | .detect = eeprom_detect, | ||
236 | .address_data = &addr_data, | ||
237 | }; | ||
238 | |||
239 | static int __init eeprom_init(void) | ||
240 | { | ||
241 | return i2c_add_driver(&eeprom_driver); | ||
242 | } | ||
243 | |||
244 | static void __exit eeprom_exit(void) | ||
245 | { | ||
246 | i2c_del_driver(&eeprom_driver); | ||
247 | } | ||
248 | |||
249 | |||
250 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " | ||
251 | "Philip Edelbrock <phil@netroedge.com> and " | ||
252 | "Greg Kroah-Hartman <greg@kroah.com>"); | ||
253 | MODULE_DESCRIPTION("I2C EEPROM driver"); | ||
254 | MODULE_LICENSE("GPL"); | ||
255 | |||
256 | module_init(eeprom_init); | ||
257 | module_exit(eeprom_exit); | ||