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>
struct ds1337_data {
struct i2c_client client;
struct list_head list;
struct ds1337_data {
struct i2c_client client;
struct list_head list;
};
/*
* Internal variables
*/
};
/*
* Internal variables
*/
static LIST_HEAD(ds1337_clients);
static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
static LIST_HEAD(ds1337_clients);
static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
* Public API for access to specific device. Useful for low-level
* RTC access from kernel code.
*/
* 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;
{
struct list_head *walk;
struct list_head *tmp;
list_for_each_safe(walk, tmp, &ds1337_clients) {
data = list_entry(walk, struct ds1337_data, list);
list_for_each_safe(walk, tmp, &ds1337_clients) {
data = list_entry(walk, struct ds1337_data, list);
+ if (data->client.adapter->nr == bus)
return ds1337_command(&data->client, cmd, arg);
}
return ds1337_command(&data->client, cmd, arg);
}
ds1337_init_client(new_client);
/* Add client to local list */
ds1337_init_client(new_client);
/* Add client to local list */
- data->id = ds1337_id++;
list_add(&data->list, &ds1337_clients);
return 0;
list_add(&data->list, &ds1337_clients);
return 0;