From ladis@linux-mips.org Wed May  4 00:32:55 2005
From: Ladislav Michl <ladis@linux-mips.org>
Date: Wed, 4 May 2005 08:14:38 +0200
To: Greg KH <greg@kroah.com>
Cc: Jean Delvare <khali@linux-fr.org>,
	James Chapman <jchapman@katalix.com>
Subject: I2C: ds1337: search by bus number
Message-ID: <20050504061438.GD1439@orphique>

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>

---
 drivers/i2c/chips/ds1337.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

--- gregkh-2.6.orig/drivers/i2c/chips/ds1337.c	2005-05-06 09:23:56.000000000 -0700
+++ gregkh-2.6/drivers/i2c/chips/ds1337.c	2005-05-06 09:23:59.000000000 -0700
@@ -69,13 +69,11 @@
 struct ds1337_data {
 	struct i2c_client client;
 	struct list_head list;
-	int id;
 };
 
 /*
  * Internal variables
  */
-static int ds1337_id;
 static LIST_HEAD(ds1337_clients);
 
 static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
@@ -213,7 +211,7 @@
  * Public API for access to specific device. Useful for low-level
  * RTC access from kernel code.
  */
-int ds1337_do_command(int id, int cmd, void *arg)
+int ds1337_do_command(int bus, int cmd, void *arg)
 {
 	struct list_head *walk;
 	struct list_head *tmp;
@@ -221,7 +219,7 @@
 
 	list_for_each_safe(walk, tmp, &ds1337_clients) {
 		data = list_entry(walk, struct ds1337_data, list);
-		if (data->id == id)
+		if (data->client.adapter->nr == bus)
 			return ds1337_command(&data->client, cmd, arg);
 	}
 
@@ -331,7 +329,6 @@
 	ds1337_init_client(new_client);
 
 	/* Add client to local list */
-	data->id = ds1337_id++;
 	list_add(&data->list, &ds1337_clients);
 
 	return 0;
