diff options
author | Jean Delvare | 2005-07-19 23:51:07 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2005-09-05 09:14:09 -0700 |
commit | fde0950903ce8cc38a91dd095280decceda2ff82 (patch) | |
tree | 5a970459793ac46ad7082f0d722616730b0589c2 /drivers/hwmon/lm78.c | |
parent | 400c455eaa0d0819d18cd42a74070e0e238a73dc (diff) |
[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9)
Convert the 10 ISA hardware monitoring drivers (it87, lm78, pc87360,
sis5595, smsc47b397, smsc47m1, via686a, w83627hf, w83627ehf, w83781d) to
explicitely register with i2c-isa. For hybrid drivers (it87, lm78,
w83781d), we now have two separate instances of i2c_driver, one for the
I2C interface of the chip, and one for ISA interface. In the long run,
the one for ISA will be replaced with a different driver type.
At this point, all drivers are working again, except for missing
dependencies in Kconfig.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/lm78.c')
-rw-r--r-- | drivers/hwmon/lm78.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 570098e15366..a69e7d4670ad 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <linux/jiffies.h> #include <linux/i2c.h> +#include <linux/i2c-isa.h> #include <linux/i2c-sensor.h> #include <linux/hwmon.h> #include <linux/err.h> @@ -177,6 +178,14 @@ static struct i2c_driver lm78_driver = { .detach_client = lm78_detach_client, }; +static struct i2c_driver lm78_isa_driver = { + .owner = THIS_MODULE, + .name = "lm78-isa", + .attach_adapter = lm78_attach_adapter, + .detach_client = lm78_detach_client, +}; + + /* 7 Voltages */ static ssize_t show_in(struct device *dev, char *buf, int nr) { @@ -488,7 +497,8 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) /* Reserve the ISA region */ if (is_isa) - if (!request_region(address, LM78_EXTENT, lm78_driver.name)) { + if (!request_region(address, LM78_EXTENT, + lm78_isa_driver.name)) { err = -EBUSY; goto ERROR0; } @@ -543,7 +553,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) i2c_set_clientdata(new_client, data); new_client->addr = address; new_client->adapter = adapter; - new_client->driver = &lm78_driver; + new_client->driver = is_isa ? &lm78_isa_driver : &lm78_driver; new_client->flags = 0; /* Now, we do the remaining detection. */ @@ -788,11 +798,24 @@ static struct lm78_data *lm78_update_device(struct device *dev) static int __init sm_lm78_init(void) { - return i2c_add_driver(&lm78_driver); + int res; + + res = i2c_add_driver(&lm78_driver); + if (res) + return res; + + res = i2c_isa_add_driver(&lm78_isa_driver); + if (res) { + i2c_del_driver(&lm78_driver); + return res; + } + + return 0; } static void __exit sm_lm78_exit(void) { + i2c_isa_del_driver(&lm78_isa_driver); i2c_del_driver(&lm78_driver); } |