diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-04-29 17:11:40 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-04-29 17:11:40 -0400 |
commit | 3760f736716f74bdc62a4ba5406934338da93eb2 (patch) | |
tree | e28e22c6655dd62566f1b7a99f9354a31bf9d06e /drivers/i2c | |
parent | d2653e92732bd3911feff6bee5e23dbf959381db (diff) |
i2c: Convert most new-style drivers to use module aliasing
Based on earlier work by Jon Smirl and Jochen Friedrich.
Update most new-style i2c drivers to use standard module aliasing
instead of the old driver_name/type driver matching scheme. I've
left the video drivers apart (except for SoC camera drivers) as
they're a bit more diffcult to deal with, they'll have their own
patch later.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Jon Smirl <jonsmirl@gmail.com>
Cc: Jochen Friedrich <jochen@scram.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-taos-evm.c | 3 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1682.c | 7 | ||||
-rw-r--r-- | drivers/i2c/chips/menelaus.c | 7 | ||||
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 29 | ||||
-rw-r--r-- | drivers/i2c/chips/tsl2550.c | 7 |
5 files changed, 33 insertions, 20 deletions
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c index 1b0cfd5472f..de9db49e54d 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 */ |
52 | static struct i2c_board_info tsl2550_info = { | 52 | static 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 3070821030e..23be4d42cb0 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 | ||
238 | static const struct i2c_device_id ds1682_id[] = { | ||
239 | { "ds1682", 0 }, | ||
240 | { } | ||
241 | }; | ||
242 | MODULE_DEVICE_TABLE(i2c, ds1682_id); | ||
243 | |||
238 | static struct i2c_driver ds1682_driver = { | 244 | static 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 | ||
246 | static int __init ds1682_init(void) | 253 | static int __init ds1682_init(void) |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 3b8ba7e7584..b36db1797c1 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 | ||
1246 | static const struct i2c_device_id menelaus_id[] = { | ||
1247 | { "menelaus", 0 }, | ||
1248 | { } | ||
1249 | }; | ||
1250 | MODULE_DEVICE_TABLE(i2c, menelaus_id); | ||
1251 | |||
1246 | static struct i2c_driver menelaus_i2c_driver = { | 1252 | static 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 | ||
1254 | static int __init menelaus_init(void) | 1261 | static int __init menelaus_init(void) |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 6ab3619a49d..85949685191 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 | */ |
66 | enum tps_model { | 66 | enum 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 | ||
671 | static const struct i2c_device_id tps65010_id[] = { | ||
672 | { "tps65010", TPS65010 }, | ||
673 | { "tps65011", TPS65011 }, | ||
674 | { "tps65012", TPS65012 }, | ||
675 | { "tps65013", TPS65013 }, | ||
676 | { } | ||
677 | }; | ||
678 | MODULE_DEVICE_TABLE(i2c, tps65010_id); | ||
679 | |||
688 | static struct i2c_driver tps65010_driver = { | 680 | static 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 59c2c662cc4..1a9cc135219 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 | ||
455 | static const struct i2c_device_id tsl2550_id[] = { | ||
456 | { "tsl2550", 0 }, | ||
457 | { } | ||
458 | }; | ||
459 | MODULE_DEVICE_TABLE(i2c, tsl2550_id); | ||
460 | |||
455 | static struct i2c_driver tsl2550_driver = { | 461 | static 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 | ||
466 | static int __init tsl2550_init(void) | 473 | static int __init tsl2550_init(void) |