]> err.no Git - linux-2.6/blobdiff - drivers/i2c/chips/ds1337.c
[PATCH] I2C: remove <linux/delay.h> from via686a
[linux-2.6] / drivers / i2c / chips / ds1337.c
index c4762ac980a3beab2caaf68df94c06e744c48ef0..74ece8ac1c2355b214af3e4481eddf3c747a5fd6 100644 (file)
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
- * Driver for Dallas Semiconductor DS1337 real time clock chip
+ * Driver for Dallas Semiconductor DS1337 and DS1339 real time clock chip
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -69,13 +68,11 @@ static struct i2c_driver ds1337_driver = {
 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 +210,7 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
  * 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 +218,7 @@ int ds1337_do_command(int id, int cmd, void *arg)
 
        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 +328,6 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
        ds1337_init_client(new_client);
 
        /* Add client to local list */
-       data->id = ds1337_id++;
        list_add(&data->list, &ds1337_clients);
 
        return 0;
@@ -383,5 +379,7 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
 MODULE_DESCRIPTION("DS1337 RTC driver");
 MODULE_LICENSE("GPL");
 
+EXPORT_SYMBOL_GPL(ds1337_do_command);
+
 module_init(ds1337_init);
 module_exit(ds1337_exit);