aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/pca953x.c23
-rw-r--r--drivers/gpio/pcf857x.c33
-rw-r--r--drivers/hwmon/f75375s.c23
-rw-r--r--drivers/i2c/busses/i2c-taos-evm.c3
-rw-r--r--drivers/i2c/chips/ds1682.c7
-rw-r--r--drivers/i2c/chips/menelaus.c7
-rw-r--r--drivers/i2c/chips/tps65010.c29
-rw-r--r--drivers/i2c/chips/tsl2550.c7
-rw-r--r--drivers/media/video/mt9m001.c7
-rw-r--r--drivers/media/video/mt9v022.c7
-rw-r--r--drivers/rtc/rtc-ds1307.c63
-rw-r--r--drivers/rtc/rtc-ds1374.c7
-rw-r--r--drivers/rtc/rtc-isl1208.c7
-rw-r--r--drivers/rtc/rtc-m41t80.c78
-rw-r--r--drivers/rtc/rtc-pcf8563.c7
-rw-r--r--drivers/rtc/rtc-rs5c372.c24
-rw-r--r--drivers/rtc/rtc-s35390a.c7
-rw-r--r--drivers/rtc/rtc-x1205.c7
18 files changed, 174 insertions, 172 deletions
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 2670519236e5..5a99e81d2784 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -23,13 +23,7 @@
23#define PCA953X_INVERT 2 23#define PCA953X_INVERT 2
24#define PCA953X_DIRECTION 3 24#define PCA953X_DIRECTION 3
25 25
26/* This is temporary - in 2.6.26 i2c_driver_data should replace it. */ 26static const struct i2c_device_id pca953x_id[] = {
27struct pca953x_desc {
28 char name[I2C_NAME_SIZE];
29 unsigned long driver_data;
30};
31
32static const struct pca953x_desc pca953x_descs[] = {
33 { "pca9534", 8, }, 27 { "pca9534", 8, },
34 { "pca9535", 16, }, 28 { "pca9535", 16, },
35 { "pca9536", 4, }, 29 { "pca9536", 4, },
@@ -37,7 +31,9 @@ static const struct pca953x_desc pca953x_descs[] = {
37 { "pca9538", 8, }, 31 { "pca9538", 8, },
38 { "pca9539", 16, }, 32 { "pca9539", 16, },
39 /* REVISIT several pca955x parts should work here too */ 33 /* REVISIT several pca955x parts should work here too */
34 { }
40}; 35};
36MODULE_DEVICE_TABLE(i2c, pca953x_id);
41 37
42struct pca953x_chip { 38struct pca953x_chip {
43 unsigned gpio_start; 39 unsigned gpio_start;
@@ -193,26 +189,16 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
193} 189}
194 190
195static int __devinit pca953x_probe(struct i2c_client *client, 191static int __devinit pca953x_probe(struct i2c_client *client,
196 const struct i2c_device_id *did) 192 const struct i2c_device_id *id)
197{ 193{
198 struct pca953x_platform_data *pdata; 194 struct pca953x_platform_data *pdata;
199 struct pca953x_chip *chip; 195 struct pca953x_chip *chip;
200 int ret, i; 196 int ret, i;
201 const struct pca953x_desc *id = NULL;
202 197
203 pdata = client->dev.platform_data; 198 pdata = client->dev.platform_data;
204 if (pdata == NULL) 199 if (pdata == NULL)
205 return -ENODEV; 200 return -ENODEV;
206 201
207 /* this loop vanishes when we get i2c_device_id */
208 for (i = 0; i < ARRAY_SIZE(pca953x_descs); i++)
209 if (!strcmp(pca953x_descs[i].name, client->name)) {
210 id = pca953x_descs + i;
211 break;
212 }
213 if (!id)
214 return -ENODEV;
215
216 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); 202 chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
217 if (chip == NULL) 203 if (chip == NULL)
218 return -ENOMEM; 204 return -ENOMEM;
@@ -292,6 +278,7 @@ static struct i2c_driver pca953x_driver = {
292 }, 278 },
293 .probe = pca953x_probe, 279 .probe = pca953x_probe,
294 .remove = pca953x_remove, 280 .remove = pca953x_remove,
281 .id_table = pca953x_id,
295}; 282};
296 283
297static int __init pca953x_init(void) 284static int __init pca953x_init(void)
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c
index 8856870dd738..aa6cc8b2a2bc 100644
--- a/drivers/gpio/pcf857x.c
+++ b/drivers/gpio/pcf857x.c
@@ -26,6 +26,21 @@
26#include <asm/gpio.h> 26#include <asm/gpio.h>
27 27
28 28
29static const struct i2c_device_id pcf857x_id[] = {
30 { "pcf8574", 8 },
31 { "pca8574", 8 },
32 { "pca9670", 8 },
33 { "pca9672", 8 },
34 { "pca9674", 8 },
35 { "pcf8575", 16 },
36 { "pca8575", 16 },
37 { "pca9671", 16 },
38 { "pca9673", 16 },
39 { "pca9675", 16 },
40 { }
41};
42MODULE_DEVICE_TABLE(i2c, pcf857x_id);
43
29/* 44/*
30 * The pcf857x, pca857x, and pca967x chips only expose one read and one 45 * The pcf857x, pca857x, and pca967x chips only expose one read and one
31 * write register. Writing a "one" bit (to match the reset state) lets 46 * write register. Writing a "one" bit (to match the reset state) lets
@@ -173,13 +188,8 @@ static int pcf857x_probe(struct i2c_client *client,
173 * 188 *
174 * NOTE: we don't distinguish here between *4 and *4a parts. 189 * NOTE: we don't distinguish here between *4 and *4a parts.
175 */ 190 */
176 if (strcmp(client->name, "pcf8574") == 0 191 gpio->chip.ngpio = id->driver_data;
177 || strcmp(client->name, "pca8574") == 0 192 if (gpio->chip.ngpio == 8) {
178 || strcmp(client->name, "pca9670") == 0
179 || strcmp(client->name, "pca9672") == 0
180 || strcmp(client->name, "pca9674") == 0
181 ) {
182 gpio->chip.ngpio = 8;
183 gpio->chip.direction_input = pcf857x_input8; 193 gpio->chip.direction_input = pcf857x_input8;
184 gpio->chip.get = pcf857x_get8; 194 gpio->chip.get = pcf857x_get8;
185 gpio->chip.direction_output = pcf857x_output8; 195 gpio->chip.direction_output = pcf857x_output8;
@@ -199,13 +209,7 @@ static int pcf857x_probe(struct i2c_client *client,
199 * 209 *
200 * NOTE: we don't distinguish here between '75 and '75c parts. 210 * NOTE: we don't distinguish here between '75 and '75c parts.
201 */ 211 */
202 } else if (strcmp(client->name, "pcf8575") == 0 212 } else if (gpio->chip.ngpio == 16) {
203 || strcmp(client->name, "pca8575") == 0
204 || strcmp(client->name, "pca9671") == 0
205 || strcmp(client->name, "pca9673") == 0
206 || strcmp(client->name, "pca9675") == 0
207 ) {
208 gpio->chip.ngpio = 16;
209 gpio->chip.direction_input = pcf857x_input16; 213 gpio->chip.direction_input = pcf857x_input16;
210 gpio->chip.get = pcf857x_get16; 214 gpio->chip.get = pcf857x_get16;
211 gpio->chip.direction_output = pcf857x_output16; 215 gpio->chip.direction_output = pcf857x_output16;
@@ -314,6 +318,7 @@ static struct i2c_driver pcf857x_driver = {
314 }, 318 },
315 .probe = pcf857x_probe, 319 .probe = pcf857x_probe,
316 .remove = pcf857x_remove, 320 .remove = pcf857x_remove,
321 .id_table = pcf857x_id,
317}; 322};
318 323
319static int __init pcf857x_init(void) 324static int __init pcf857x_init(void)
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 1f63bab05522..dc1f30e432ea 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -129,12 +129,20 @@ static struct i2c_driver f75375_legacy_driver = {
129 .detach_client = f75375_detach_client, 129 .detach_client = f75375_detach_client,
130}; 130};
131 131
132static const struct i2c_device_id f75375_id[] = {
133 { "f75373", f75373 },
134 { "f75375", f75375 },
135 { }
136};
137MODULE_DEVICE_TABLE(i2c, f75375_id);
138
132static struct i2c_driver f75375_driver = { 139static struct i2c_driver f75375_driver = {
133 .driver = { 140 .driver = {
134 .name = "f75375", 141 .name = "f75375",
135 }, 142 },
136 .probe = f75375_probe, 143 .probe = f75375_probe,
137 .remove = f75375_remove, 144 .remove = f75375_remove,
145 .id_table = f75375_id,
138}; 146};
139 147
140static inline int f75375_read8(struct i2c_client *client, u8 reg) 148static inline int f75375_read8(struct i2c_client *client, u8 reg)
@@ -645,15 +653,7 @@ static int f75375_probe(struct i2c_client *client,
645 i2c_set_clientdata(client, data); 653 i2c_set_clientdata(client, data);
646 data->client = client; 654 data->client = client;
647 mutex_init(&data->update_lock); 655 mutex_init(&data->update_lock);
648 656 data->kind = id->driver_data;
649 if (strcmp(client->name, "f75375") == 0)
650 data->kind = f75375;
651 else if (strcmp(client->name, "f75373") == 0)
652 data->kind = f75373;
653 else {
654 dev_err(&client->dev, "Unsupported device: %s\n", client->name);
655 return -ENODEV;
656 }
657 657
658 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) 658 if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group)))
659 goto exit_free; 659 goto exit_free;
@@ -714,6 +714,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
714 u8 version = 0; 714 u8 version = 0;
715 int err = 0; 715 int err = 0;
716 const char *name = ""; 716 const char *name = "";
717 struct i2c_device_id id;
717 718
718 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { 719 if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) {
719 err = -ENOMEM; 720 err = -ENOMEM;
@@ -750,7 +751,9 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
750 if ((err = i2c_attach_client(client))) 751 if ((err = i2c_attach_client(client)))
751 goto exit_free; 752 goto exit_free;
752 753
753 if ((err = f75375_probe(client, NULL)) < 0) 754 strlcpy(id.name, name, I2C_NAME_SIZE);
755 id.driver_data = kind;
756 if ((err = f75375_probe(client, &id)) < 0)
754 goto exit_detach; 757 goto exit_detach;
755 758
756 return 0; 759 return 0;
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c
index 1b0cfd5472fd..de9db49e54d9 100644
--- a/drivers/i2c/busses/i2c-taos-evm.c
+++ b/drivers/i2c/busses/i2c-taos-evm.c
@@ -51,7 +51,6 @@ struct taos_data {
51/* TAOS TSL2550 EVM */ 51/* TAOS TSL2550 EVM */
52static struct i2c_board_info tsl2550_info = { 52static struct i2c_board_info tsl2550_info = {
53 I2C_BOARD_INFO("tsl2550", 0x39), 53 I2C_BOARD_INFO("tsl2550", 0x39),
54 .type = "tsl2550",
55}; 54};
56 55
57/* Instantiate i2c devices based on the adapter name */ 56/* Instantiate i2c devices based on the adapter name */
@@ -59,7 +58,7 @@ static struct i2c_client *taos_instantiate_device(struct i2c_adapter *adapter)
59{ 58{
60 if (!strncmp(adapter->name, "TAOS TSL2550 EVM", 16)) { 59 if (!strncmp(adapter->name, "TAOS TSL2550 EVM", 16)) {
61 dev_info(&adapter->dev, "Instantiating device %s at 0x%02x\n", 60 dev_info(&adapter->dev, "Instantiating device %s at 0x%02x\n",
62 tsl2550_info.driver_name, tsl2550_info.addr); 61 tsl2550_info.type, tsl2550_info.addr);
63 return i2c_new_device(adapter, &tsl2550_info); 62 return i2c_new_device(adapter, &tsl2550_info);
64 } 63 }
65 64
diff --git a/drivers/i2c/chips/ds1682.c b/drivers/i2c/chips/ds1682.c
index 3070821030e4..23be4d42cb02 100644
--- a/drivers/i2c/chips/ds1682.c
+++ b/drivers/i2c/chips/ds1682.c
@@ -235,12 +235,19 @@ static int ds1682_remove(struct i2c_client *client)
235 return 0; 235 return 0;
236} 236}
237 237
238static const struct i2c_device_id ds1682_id[] = {
239 { "ds1682", 0 },
240 { }
241};
242MODULE_DEVICE_TABLE(i2c, ds1682_id);
243
238static struct i2c_driver ds1682_driver = { 244static struct i2c_driver ds1682_driver = {
239 .driver = { 245 .driver = {
240 .name = "ds1682", 246 .name = "ds1682",
241 }, 247 },
242 .probe = ds1682_probe, 248 .probe = ds1682_probe,
243 .remove = ds1682_remove, 249 .remove = ds1682_remove,
250 .id_table = ds1682_id,
244}; 251};
245 252
246static int __init ds1682_init(void) 253static int __init ds1682_init(void)
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index 3b8ba7e75843..b36db1797c11 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -1243,12 +1243,19 @@ static int __exit menelaus_remove(struct i2c_client *client)
1243 return 0; 1243 return 0;
1244} 1244}
1245 1245
1246static const struct i2c_device_id menelaus_id[] = {
1247 { "menelaus", 0 },
1248 { }
1249};
1250MODULE_DEVICE_TABLE(i2c, menelaus_id);
1251
1246static struct i2c_driver menelaus_i2c_driver = { 1252static struct i2c_driver menelaus_i2c_driver = {
1247 .driver = { 1253 .driver = {
1248 .name = DRIVER_NAME, 1254 .name = DRIVER_NAME,
1249 }, 1255 },
1250 .probe = menelaus_probe, 1256 .probe = menelaus_probe,
1251 .remove = __exit_p(menelaus_remove), 1257 .remove = __exit_p(menelaus_remove),
1258 .id_table = menelaus_id,
1252}; 1259};
1253 1260
1254static int __init menelaus_init(void) 1261static int __init menelaus_init(void)
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index 6ab3619a49de..85949685191b 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -64,7 +64,6 @@ static struct i2c_driver tps65010_driver;
64 * as part of board setup by a bootloader. 64 * as part of board setup by a bootloader.
65 */ 65 */
66enum tps_model { 66enum tps_model {
67 TPS_UNKNOWN = 0,
68 TPS65010, 67 TPS65010,
69 TPS65011, 68 TPS65011,
70 TPS65012, 69 TPS65012,
@@ -554,20 +553,7 @@ static int tps65010_probe(struct i2c_client *client,
554 mutex_init(&tps->lock); 553 mutex_init(&tps->lock);
555 INIT_DELAYED_WORK(&tps->work, tps65010_work); 554 INIT_DELAYED_WORK(&tps->work, tps65010_work);
556 tps->client = client; 555 tps->client = client;
557 556 tps->model = id->driver_data;
558 if (strcmp(client->name, "tps65010") == 0)
559 tps->model = TPS65010;
560 else if (strcmp(client->name, "tps65011") == 0)
561 tps->model = TPS65011;
562 else if (strcmp(client->name, "tps65012") == 0)
563 tps->model = TPS65012;
564 else if (strcmp(client->name, "tps65013") == 0)
565 tps->model = TPS65013;
566 else {
567 dev_warn(&client->dev, "unknown chip '%s'\n", client->name);
568 status = -ENODEV;
569 goto fail1;
570 }
571 557
572 /* the IRQ is active low, but many gpio lines can't support that 558 /* the IRQ is active low, but many gpio lines can't support that
573 * so this driver uses falling-edge triggers instead. 559 * so this driver uses falling-edge triggers instead.
@@ -596,9 +582,6 @@ static int tps65010_probe(struct i2c_client *client,
596 case TPS65012: 582 case TPS65012:
597 tps->por = 1; 583 tps->por = 1;
598 break; 584 break;
599 case TPS_UNKNOWN:
600 printk(KERN_WARNING "%s: unknown TPS chip\n", DRIVER_NAME);
601 break;
602 /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */ 585 /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */
603 } 586 }
604 tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); 587 tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG);
@@ -685,12 +668,22 @@ fail1:
685 return status; 668 return status;
686} 669}
687 670
671static const struct i2c_device_id tps65010_id[] = {
672 { "tps65010", TPS65010 },
673 { "tps65011", TPS65011 },
674 { "tps65012", TPS65012 },
675 { "tps65013", TPS65013 },
676 { }
677};
678MODULE_DEVICE_TABLE(i2c, tps65010_id);
679
688static struct i2c_driver tps65010_driver = { 680static struct i2c_driver tps65010_driver = {
689 .driver = { 681 .driver = {
690 .name = "tps65010", 682 .name = "tps65010",
691 }, 683 },
692 .probe = tps65010_probe, 684 .probe = tps65010_probe,
693 .remove = __exit_p(tps65010_remove), 685 .remove = __exit_p(tps65010_remove),
686 .id_table = tps65010_id,
694}; 687};
695 688
696/*-------------------------------------------------------------------------*/ 689/*-------------------------------------------------------------------------*/
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
index 59c2c662cc45..1a9cc135219f 100644
--- a/drivers/i2c/chips/tsl2550.c
+++ b/drivers/i2c/chips/tsl2550.c
@@ -452,6 +452,12 @@ static int tsl2550_resume(struct i2c_client *client)
452 452
453#endif /* CONFIG_PM */ 453#endif /* CONFIG_PM */
454 454
455static const struct i2c_device_id tsl2550_id[] = {
456 { "tsl2550", 0 },
457 { }
458};
459MODULE_DEVICE_TABLE(i2c, tsl2550_id);
460
455static struct i2c_driver tsl2550_driver = { 461static struct i2c_driver tsl2550_driver = {
456 .driver = { 462 .driver = {
457 .name = TSL2550_DRV_NAME, 463 .name = TSL2550_DRV_NAME,
@@ -461,6 +467,7 @@ static struct i2c_driver tsl2550_driver = {
461 .resume = tsl2550_resume, 467 .resume = tsl2550_resume,
462 .probe = tsl2550_probe, 468 .probe = tsl2550_probe,
463 .remove = __devexit_p(tsl2550_remove), 469 .remove = __devexit_p(tsl2550_remove),
470 .id_table = tsl2550_id,
464}; 471};
465 472
466static int __init tsl2550_init(void) 473static int __init tsl2550_init(void)
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 26cb27604e04..ba09826ddf48 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -697,12 +697,19 @@ static int mt9m001_remove(struct i2c_client *client)
697 return 0; 697 return 0;
698} 698}
699 699
700static const struct i2c_device_id mt9m001_id[] = {
701 { "mt9m001", 0 },
702 { }
703};
704MODULE_DEVICE_TABLE(i2c, mt9m001_id);
705
700static struct i2c_driver mt9m001_i2c_driver = { 706static struct i2c_driver mt9m001_i2c_driver = {
701 .driver = { 707 .driver = {
702 .name = "mt9m001", 708 .name = "mt9m001",
703 }, 709 },
704 .probe = mt9m001_probe, 710 .probe = mt9m001_probe,
705 .remove = mt9m001_remove, 711 .remove = mt9m001_remove,
712 .id_table = mt9m001_id,
706}; 713};
707 714
708static int __init mt9m001_mod_init(void) 715static int __init mt9m001_mod_init(void)
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 7b1dd7ede9d0..7b223691ce96 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -819,12 +819,19 @@ static int mt9v022_remove(struct i2c_client *client)
819 return 0; 819 return 0;
820} 820}
821 821
822static const struct i2c_device_id mt9v022_id[] = {
823 { "mt9v022", 0 },
824 { }
825};
826MODULE_DEVICE_TABLE(i2c, mt9v022_id);
827
822static struct i2c_driver mt9v022_i2c_driver = { 828static struct i2c_driver mt9v022_i2c_driver = {
823 .driver = { 829 .driver = {
824 .name = "mt9v022", 830 .name = "mt9v022",
825 }, 831 },
826 .probe = mt9v022_probe, 832 .probe = mt9v022_probe,
827 .remove = mt9v022_remove, 833 .remove = mt9v022_remove,
834 .id_table = mt9v022_id,
828}; 835};
829 836
830static int __init mt9v022_mod_init(void) 837static int __init mt9v022_mod_init(void)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 67ba8ae3217c..bbf97e65202a 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -99,45 +99,38 @@ struct ds1307 {
99}; 99};
100 100
101struct chip_desc { 101struct chip_desc {
102 char name[9];
103 unsigned nvram56:1; 102 unsigned nvram56:1;
104 unsigned alarm:1; 103 unsigned alarm:1;
105 enum ds_type type;
106}; 104};
107 105
108static const struct chip_desc chips[] = { { 106static const struct chip_desc chips[] = {
109 .name = "ds1307", 107[ds_1307] = {
110 .type = ds_1307,
111 .nvram56 = 1, 108 .nvram56 = 1,
112}, { 109},
113 .name = "ds1337", 110[ds_1337] = {
114 .type = ds_1337,
115 .alarm = 1, 111 .alarm = 1,
116}, { 112},
117 .name = "ds1338", 113[ds_1338] = {
118 .type = ds_1338,
119 .nvram56 = 1, 114 .nvram56 = 1,
120}, { 115},
121 .name = "ds1339", 116[ds_1339] = {
122 .type = ds_1339,
123 .alarm = 1, 117 .alarm = 1,
124}, { 118},
125 .name = "ds1340", 119[ds_1340] = {
126 .type = ds_1340, 120},
127}, { 121[m41t00] = {
128 .name = "m41t00",
129 .type = m41t00,
130}, }; 122}, };
131 123
132static inline const struct chip_desc *find_chip(const char *s) 124static const struct i2c_device_id ds1307_id[] = {
133{ 125 { "ds1307", ds_1307 },
134 unsigned i; 126 { "ds1337", ds_1337 },
135 127 { "ds1338", ds_1338 },
136 for (i = 0; i < ARRAY_SIZE(chips); i++) 128 { "ds1339", ds_1339 },
137 if (strnicmp(s, chips[i].name, sizeof chips[i].name) == 0) 129 { "ds1340", ds_1340 },
138 return &chips[i]; 130 { "m41t00", m41t00 },
139 return NULL; 131 { }
140} 132};
133MODULE_DEVICE_TABLE(i2c, ds1307_id);
141 134
142static int ds1307_get_time(struct device *dev, struct rtc_time *t) 135static int ds1307_get_time(struct device *dev, struct rtc_time *t)
143{ 136{
@@ -332,16 +325,9 @@ static int __devinit ds1307_probe(struct i2c_client *client,
332 struct ds1307 *ds1307; 325 struct ds1307 *ds1307;
333 int err = -ENODEV; 326 int err = -ENODEV;
334 int tmp; 327 int tmp;
335 const struct chip_desc *chip; 328 const struct chip_desc *chip = &chips[id->driver_data];
336 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 329 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
337 330
338 chip = find_chip(client->name);
339 if (!chip) {
340 dev_err(&client->dev, "unknown chip type '%s'\n",
341 client->name);
342 return -ENODEV;
343 }
344
345 if (!i2c_check_functionality(adapter, 331 if (!i2c_check_functionality(adapter,
346 I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) 332 I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
347 return -EIO; 333 return -EIO;
@@ -362,7 +348,7 @@ static int __devinit ds1307_probe(struct i2c_client *client,
362 ds1307->msg[1].len = sizeof(ds1307->regs); 348 ds1307->msg[1].len = sizeof(ds1307->regs);
363 ds1307->msg[1].buf = ds1307->regs; 349 ds1307->msg[1].buf = ds1307->regs;
364 350
365 ds1307->type = chip->type; 351 ds1307->type = id->driver_data;
366 352
367 switch (ds1307->type) { 353 switch (ds1307->type) {
368 case ds_1337: 354 case ds_1337:
@@ -551,6 +537,7 @@ static struct i2c_driver ds1307_driver = {
551 }, 537 },
552 .probe = ds1307_probe, 538 .probe = ds1307_probe,
553 .remove = __devexit_p(ds1307_remove), 539 .remove = __devexit_p(ds1307_remove),
540 .id_table = ds1307_id,
554}; 541};
555 542
556static int __init ds1307_init(void) 543static int __init ds1307_init(void)
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 104dcfd5d9a8..fa2d2f8b3f4d 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -41,6 +41,12 @@
41#define DS1374_REG_SR_AF 0x01 /* Alarm Flag */ 41#define DS1374_REG_SR_AF 0x01 /* Alarm Flag */
42#define DS1374_REG_TCR 0x09 /* Trickle Charge */ 42#define DS1374_REG_TCR 0x09 /* Trickle Charge */
43 43
44static const struct i2c_device_id ds1374_id[] = {
45 { "rtc-ds1374", 0 },
46 { }
47};
48MODULE_DEVICE_TABLE(i2c, ds1374_id);
49
44struct ds1374 { 50struct ds1374 {
45 struct i2c_client *client; 51 struct i2c_client *client;
46 struct rtc_device *rtc; 52 struct rtc_device *rtc;
@@ -430,6 +436,7 @@ static struct i2c_driver ds1374_driver = {
430 }, 436 },
431 .probe = ds1374_probe, 437 .probe = ds1374_probe,
432 .remove = __devexit_p(ds1374_remove), 438 .remove = __devexit_p(ds1374_remove),
439 .id_table = ds1374_id,
433}; 440};
434 441
435static int __init ds1374_init(void) 442static int __init ds1374_init(void)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index d75d8faeead0..fbb90b1e4098 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -545,12 +545,19 @@ isl1208_remove(struct i2c_client *client)
545 return 0; 545 return 0;
546} 546}
547 547
548static const struct i2c_device_id isl1208_id[] = {
549 { "isl1208", 0 },
550 { }
551};
552MODULE_DEVICE_TABLE(i2c, isl1208_id);
553
548static struct i2c_driver isl1208_driver = { 554static struct i2c_driver isl1208_driver = {
549 .driver = { 555 .driver = {
550 .name = "rtc-isl1208", 556 .name = "rtc-isl1208",
551 }, 557 },
552 .probe = isl1208_probe, 558 .probe = isl1208_probe,
553 .remove = isl1208_remove, 559 .remove = isl1208_remove,
560 .id_table = isl1208_id,
554}; 561};
555 562
556static int __init 563static int __init
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 2ee0d070095a..316bfaa80872 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -60,48 +60,21 @@
60 60
61#define DRV_VERSION "0.05" 61#define DRV_VERSION "0.05"
62 62
63struct m41t80_chip_info { 63static const struct i2c_device_id m41t80_id[] = {
64 const char *name; 64 { "m41t80", 0 },
65 u8 features; 65 { "m41t81", M41T80_FEATURE_HT },
66}; 66 { "m41t81s", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
67 67 { "m41t82", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
68static const struct m41t80_chip_info m41t80_chip_info_tbl[] = { 68 { "m41t83", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
69 { 69 { "m41st84", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
70 .name = "m41t80", 70 { "m41st85", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
71 .features = 0, 71 { "m41st87", M41T80_FEATURE_HT | M41T80_FEATURE_BL },
72 }, 72 { }
73 {
74 .name = "m41t81",
75 .features = M41T80_FEATURE_HT,
76 },
77 {
78 .name = "m41t81s",
79 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
80 },
81 {
82 .name = "m41t82",
83 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
84 },
85 {
86 .name = "m41t83",
87 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
88 },
89 {
90 .name = "m41st84",
91 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
92 },
93 {
94 .name = "m41st85",
95 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
96 },
97 {
98 .name = "m41st87",
99 .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL,
100 },
101}; 73};
74MODULE_DEVICE_TABLE(i2c, m41t80_id);
102 75
103struct m41t80_data { 76struct m41t80_data {
104 const struct m41t80_chip_info *chip; 77 u8 features;
105 struct rtc_device *rtc; 78 struct rtc_device *rtc;
106}; 79};
107 80
@@ -208,7 +181,7 @@ static int m41t80_rtc_proc(struct device *dev, struct seq_file *seq)
208 struct m41t80_data *clientdata = i2c_get_clientdata(client); 181 struct m41t80_data *clientdata = i2c_get_clientdata(client);
209 u8 reg; 182 u8 reg;
210 183
211 if (clientdata->chip->features & M41T80_FEATURE_BL) { 184 if (clientdata->features & M41T80_FEATURE_BL) {
212 reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); 185 reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS);
213 seq_printf(seq, "battery\t\t: %s\n", 186 seq_printf(seq, "battery\t\t: %s\n",
214 (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); 187 (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok");
@@ -759,10 +732,9 @@ static struct notifier_block wdt_notifier = {
759static int m41t80_probe(struct i2c_client *client, 732static int m41t80_probe(struct i2c_client *client,
760 const struct i2c_device_id *id) 733 const struct i2c_device_id *id)
761{ 734{
762 int i, rc = 0; 735 int rc = 0;
763 struct rtc_device *rtc = NULL; 736 struct rtc_device *rtc = NULL;
764 struct rtc_time tm; 737 struct rtc_time tm;
765 const struct m41t80_chip_info *chip;
766 struct m41t80_data *clientdata = NULL; 738 struct m41t80_data *clientdata = NULL;
767 739
768 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C 740 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C
@@ -774,19 +746,6 @@ static int m41t80_probe(struct i2c_client *client,
774 dev_info(&client->dev, 746 dev_info(&client->dev,
775 "chip found, driver version " DRV_VERSION "\n"); 747 "chip found, driver version " DRV_VERSION "\n");
776 748
777 chip = NULL;
778 for (i = 0; i < ARRAY_SIZE(m41t80_chip_info_tbl); i++) {
779 if (!strcmp(m41t80_chip_info_tbl[i].name, client->name)) {
780 chip = &m41t80_chip_info_tbl[i];
781 break;
782 }
783 }
784 if (!chip) {
785 dev_err(&client->dev, "%s is not supported\n", client->name);
786 rc = -ENODEV;
787 goto exit;
788 }
789
790 clientdata = kzalloc(sizeof(*clientdata), GFP_KERNEL); 749 clientdata = kzalloc(sizeof(*clientdata), GFP_KERNEL);
791 if (!clientdata) { 750 if (!clientdata) {
792 rc = -ENOMEM; 751 rc = -ENOMEM;
@@ -802,7 +761,7 @@ static int m41t80_probe(struct i2c_client *client,
802 } 761 }
803 762
804 clientdata->rtc = rtc; 763 clientdata->rtc = rtc;
805 clientdata->chip = chip; 764 clientdata->features = id->driver_data;
806 i2c_set_clientdata(client, clientdata); 765 i2c_set_clientdata(client, clientdata);
807 766
808 /* Make sure HT (Halt Update) bit is cleared */ 767 /* Make sure HT (Halt Update) bit is cleared */
@@ -811,7 +770,7 @@ static int m41t80_probe(struct i2c_client *client,
811 goto ht_err; 770 goto ht_err;
812 771
813 if (rc & M41T80_ALHOUR_HT) { 772 if (rc & M41T80_ALHOUR_HT) {
814 if (chip->features & M41T80_FEATURE_HT) { 773 if (clientdata->features & M41T80_FEATURE_HT) {
815 m41t80_get_datetime(client, &tm); 774 m41t80_get_datetime(client, &tm);
816 dev_info(&client->dev, "HT bit was set!\n"); 775 dev_info(&client->dev, "HT bit was set!\n");
817 dev_info(&client->dev, 776 dev_info(&client->dev,
@@ -843,7 +802,7 @@ static int m41t80_probe(struct i2c_client *client,
843 goto exit; 802 goto exit;
844 803
845#ifdef CONFIG_RTC_DRV_M41T80_WDT 804#ifdef CONFIG_RTC_DRV_M41T80_WDT
846 if (chip->features & M41T80_FEATURE_HT) { 805 if (clientdata->features & M41T80_FEATURE_HT) {
847 rc = misc_register(&wdt_dev); 806 rc = misc_register(&wdt_dev);
848 if (rc) 807 if (rc)
849 goto exit; 808 goto exit;
@@ -879,7 +838,7 @@ static int m41t80_remove(struct i2c_client *client)
879 struct rtc_device *rtc = clientdata->rtc; 838 struct rtc_device *rtc = clientdata->rtc;
880 839
881#ifdef CONFIG_RTC_DRV_M41T80_WDT 840#ifdef CONFIG_RTC_DRV_M41T80_WDT
882 if (clientdata->chip->features & M41T80_FEATURE_HT) { 841 if (clientdata->features & M41T80_FEATURE_HT) {
883 misc_deregister(&wdt_dev); 842 misc_deregister(&wdt_dev);
884 unregister_reboot_notifier(&wdt_notifier); 843 unregister_reboot_notifier(&wdt_notifier);
885 } 844 }
@@ -897,6 +856,7 @@ static struct i2c_driver m41t80_driver = {
897 }, 856 },
898 .probe = m41t80_probe, 857 .probe = m41t80_probe,
899 .remove = m41t80_remove, 858 .remove = m41t80_remove,
859 .id_table = m41t80_id,
900}; 860};
901 861
902static int __init m41t80_rtc_init(void) 862static int __init m41t80_rtc_init(void)
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 7b3c31db0fc0..0fc4c3630780 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -300,12 +300,19 @@ static int pcf8563_remove(struct i2c_client *client)
300 return 0; 300 return 0;
301} 301}
302 302
303static const struct i2c_device_id pcf8563_id[] = {
304 { "pcf8563", 0 },
305 { }
306};
307MODULE_DEVICE_TABLE(i2c, pcf8563_id);
308
303static struct i2c_driver pcf8563_driver = { 309static struct i2c_driver pcf8563_driver = {
304 .driver = { 310 .driver = {
305 .name = "rtc-pcf8563", 311 .name = "rtc-pcf8563",
306 }, 312 },
307 .probe = pcf8563_probe, 313 .probe = pcf8563_probe,
308 .remove = pcf8563_remove, 314 .remove = pcf8563_remove,
315 .id_table = pcf8563_id,
309}; 316};
310 317
311static int __init pcf8563_init(void) 318static int __init pcf8563_init(void)
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 47db289bb0a3..56caf6b2c3e5 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -69,6 +69,15 @@ enum rtc_type {
69 rtc_rv5c387a, 69 rtc_rv5c387a,
70}; 70};
71 71
72static const struct i2c_device_id rs5c372_id[] = {
73 { "rs5c372a", rtc_rs5c372a },
74 { "rs5c372b", rtc_rs5c372b },
75 { "rv5c386", rtc_rv5c386 },
76 { "rv5c387a", rtc_rv5c387a },
77 { }
78};
79MODULE_DEVICE_TABLE(i2c, rs5c372_id);
80
72/* REVISIT: this assumes that: 81/* REVISIT: this assumes that:
73 * - we're in the 21st century, so it's safe to ignore the century 82 * - we're in the 21st century, so it's safe to ignore the century
74 * bit for rv5c38[67] (REG_MONTH bit 7); 83 * bit for rv5c38[67] (REG_MONTH bit 7);
@@ -515,6 +524,7 @@ static int rs5c372_probe(struct i2c_client *client,
515 524
516 rs5c372->client = client; 525 rs5c372->client = client;
517 i2c_set_clientdata(client, rs5c372); 526 i2c_set_clientdata(client, rs5c372);
527 rs5c372->type = id->driver_data;
518 528
519 /* we read registers 0x0f then 0x00-0x0f; skip the first one */ 529 /* we read registers 0x0f then 0x00-0x0f; skip the first one */
520 rs5c372->regs = &rs5c372->buf[1]; 530 rs5c372->regs = &rs5c372->buf[1];
@@ -523,19 +533,6 @@ static int rs5c372_probe(struct i2c_client *client,
523 if (err < 0) 533 if (err < 0)
524 goto exit_kfree; 534 goto exit_kfree;
525 535
526 if (strcmp(client->name, "rs5c372a") == 0)
527 rs5c372->type = rtc_rs5c372a;
528 else if (strcmp(client->name, "rs5c372b") == 0)
529 rs5c372->type = rtc_rs5c372b;
530 else if (strcmp(client->name, "rv5c386") == 0)
531 rs5c372->type = rtc_rv5c386;
532 else if (strcmp(client->name, "rv5c387a") == 0)
533 rs5c372->type = rtc_rv5c387a;
534 else {
535 rs5c372->type = rtc_rs5c372b;
536 dev_warn(&client->dev, "assuming rs5c372b\n");
537 }
538
539 /* clock may be set for am/pm or 24 hr time */ 536 /* clock may be set for am/pm or 24 hr time */
540 switch (rs5c372->type) { 537 switch (rs5c372->type) {
541 case rtc_rs5c372a: 538 case rtc_rs5c372a:
@@ -652,6 +649,7 @@ static struct i2c_driver rs5c372_driver = {
652 }, 649 },
653 .probe = rs5c372_probe, 650 .probe = rs5c372_probe,
654 .remove = rs5c372_remove, 651 .remove = rs5c372_remove,
652 .id_table = rs5c372_id,
655}; 653};
656 654
657static __init int rs5c372_init(void) 655static __init int rs5c372_init(void)
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index ab0c6d221404..29f47bacfc77 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -34,6 +34,12 @@
34#define S35390A_FLAG_RESET 0x80 34#define S35390A_FLAG_RESET 0x80
35#define S35390A_FLAG_TEST 0x01 35#define S35390A_FLAG_TEST 0x01
36 36
37static const struct i2c_device_id s35390a_id[] = {
38 { "s35390a", 0 },
39 { }
40};
41MODULE_DEVICE_TABLE(i2c, s35390a_id);
42
37struct s35390a { 43struct s35390a {
38 struct i2c_client *client[8]; 44 struct i2c_client *client[8];
39 struct rtc_device *rtc; 45 struct rtc_device *rtc;
@@ -297,6 +303,7 @@ static struct i2c_driver s35390a_driver = {
297 }, 303 },
298 .probe = s35390a_probe, 304 .probe = s35390a_probe,
299 .remove = s35390a_remove, 305 .remove = s35390a_remove,
306 .id_table = s35390a_id,
300}; 307};
301 308
302static int __init s35390a_rtc_init(void) 309static int __init s35390a_rtc_init(void)
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index b792ad4dcaa9..eaf55945f21b 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -553,12 +553,19 @@ static int x1205_remove(struct i2c_client *client)
553 return 0; 553 return 0;
554} 554}
555 555
556static const struct i2c_device_id x1205_id[] = {
557 { "x1205", 0 },
558 { }
559};
560MODULE_DEVICE_TABLE(i2c, x1205_id);
561
556static struct i2c_driver x1205_driver = { 562static struct i2c_driver x1205_driver = {
557 .driver = { 563 .driver = {
558 .name = "rtc-x1205", 564 .name = "rtc-x1205",
559 }, 565 },
560 .probe = x1205_probe, 566 .probe = x1205_probe,
561 .remove = x1205_remove, 567 .remove = x1205_remove,
568 .id_table = x1205_id,
562}; 569};
563 570
564static int __init x1205_init(void) 571static int __init x1205_init(void)