aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rs5c372.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 17:48:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 17:48:31 -0400
commitb57ab7632b8fc1eef139bbbb7a89002be61f99e1 (patch)
tree19d4eeea0dbf721312c4e33a423ed29ff70aff88 /drivers/rtc/rtc-rs5c372.c
parentf12c03722045882a50c270f6332cf2c7b16a83d2 (diff)
parent3760f736716f74bdc62a4ba5406934338da93eb2 (diff)
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: i2c: Convert most new-style drivers to use module aliasing i2c: Add support for device alias names i2c-amd756-s4882: Fix an error path i2c: Drop unused RTC driver IDs i2c/tps65010: Add missing intialization of client data i2c-sis5595: Minor cleanups in sis5595_access i2c-piix4: Minor cleanups i2c: Spelling fix (successful) i2c-stub: No newline in parameter description
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r--drivers/rtc/rtc-rs5c372.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 7e63074708eb..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);
@@ -494,7 +503,8 @@ static void rs5c_sysfs_unregister(struct device *dev)
494 503
495static struct i2c_driver rs5c372_driver; 504static struct i2c_driver rs5c372_driver;
496 505
497static int rs5c372_probe(struct i2c_client *client) 506static int rs5c372_probe(struct i2c_client *client,
507 const struct i2c_device_id *id)
498{ 508{
499 int err = 0; 509 int err = 0;
500 struct rs5c372 *rs5c372; 510 struct rs5c372 *rs5c372;
@@ -514,6 +524,7 @@ static int rs5c372_probe(struct i2c_client *client)
514 524
515 rs5c372->client = client; 525 rs5c372->client = client;
516 i2c_set_clientdata(client, rs5c372); 526 i2c_set_clientdata(client, rs5c372);
527 rs5c372->type = id->driver_data;
517 528
518 /* we read registers 0x0f then 0x00-0x0f; skip the first one */ 529 /* we read registers 0x0f then 0x00-0x0f; skip the first one */
519 rs5c372->regs = &rs5c372->buf[1]; 530 rs5c372->regs = &rs5c372->buf[1];
@@ -522,19 +533,6 @@ static int rs5c372_probe(struct i2c_client *client)
522 if (err < 0) 533 if (err < 0)
523 goto exit_kfree; 534 goto exit_kfree;
524 535
525 if (strcmp(client->name, "rs5c372a") == 0)
526 rs5c372->type = rtc_rs5c372a;
527 else if (strcmp(client->name, "rs5c372b") == 0)
528 rs5c372->type = rtc_rs5c372b;
529 else if (strcmp(client->name, "rv5c386") == 0)
530 rs5c372->type = rtc_rv5c386;
531 else if (strcmp(client->name, "rv5c387a") == 0)
532 rs5c372->type = rtc_rv5c387a;
533 else {
534 rs5c372->type = rtc_rs5c372b;
535 dev_warn(&client->dev, "assuming rs5c372b\n");
536 }
537
538 /* clock may be set for am/pm or 24 hr time */ 536 /* clock may be set for am/pm or 24 hr time */
539 switch (rs5c372->type) { 537 switch (rs5c372->type) {
540 case rtc_rs5c372a: 538 case rtc_rs5c372a:
@@ -651,6 +649,7 @@ static struct i2c_driver rs5c372_driver = {
651 }, 649 },
652 .probe = rs5c372_probe, 650 .probe = rs5c372_probe,
653 .remove = rs5c372_remove, 651 .remove = rs5c372_remove,
652 .id_table = rs5c372_id,
654}; 653};
655 654
656static __init int rs5c372_init(void) 655static __init int rs5c372_init(void)