aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2005-05-04 02:14:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:52 -0400
commit86919833dbeac668762ae7056ead2d35d070f622 (patch)
tree5c704a3c8fb85f44cde1102d7e6f09508427be4d /drivers
parent00588243053bb40d0406c7843833f8fae81294ab (diff)
[PATCH] I2C: ds1337: search by bus number
Chip is searched by bus number rather than its own proprietary id. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: James Chapman <jchapman@katalix.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/chips/ds1337.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index c4762ac980a3..8ee818ce0135 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -69,13 +69,11 @@ static struct i2c_driver ds1337_driver = {
69struct ds1337_data { 69struct ds1337_data {
70 struct i2c_client client; 70 struct i2c_client client;
71 struct list_head list; 71 struct list_head list;
72 int id;
73}; 72};
74 73
75/* 74/*
76 * Internal variables 75 * Internal variables
77 */ 76 */
78static int ds1337_id;
79static LIST_HEAD(ds1337_clients); 77static LIST_HEAD(ds1337_clients);
80 78
81static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value) 79static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
@@ -213,7 +211,7 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
213 * Public API for access to specific device. Useful for low-level 211 * Public API for access to specific device. Useful for low-level
214 * RTC access from kernel code. 212 * RTC access from kernel code.
215 */ 213 */
216int ds1337_do_command(int id, int cmd, void *arg) 214int ds1337_do_command(int bus, int cmd, void *arg)
217{ 215{
218 struct list_head *walk; 216 struct list_head *walk;
219 struct list_head *tmp; 217 struct list_head *tmp;
@@ -221,7 +219,7 @@ int ds1337_do_command(int id, int cmd, void *arg)
221 219
222 list_for_each_safe(walk, tmp, &ds1337_clients) { 220 list_for_each_safe(walk, tmp, &ds1337_clients) {
223 data = list_entry(walk, struct ds1337_data, list); 221 data = list_entry(walk, struct ds1337_data, list);
224 if (data->id == id) 222 if (data->client.adapter->nr == bus)
225 return ds1337_command(&data->client, cmd, arg); 223 return ds1337_command(&data->client, cmd, arg);
226 } 224 }
227 225
@@ -331,7 +329,6 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
331 ds1337_init_client(new_client); 329 ds1337_init_client(new_client);
332 330
333 /* Add client to local list */ 331 /* Add client to local list */
334 data->id = ds1337_id++;
335 list_add(&data->list, &ds1337_clients); 332 list_add(&data->list, &ds1337_clients);
336 333
337 return 0; 334 return 0;