diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-07-19 17:51:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-05 12:14:09 -0400 |
commit | fde0950903ce8cc38a91dd095280decceda2ff82 (patch) | |
tree | 5a970459793ac46ad7082f0d722616730b0589c2 /drivers/hwmon/w83781d.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/w83781d.c')
-rw-r--r-- | drivers/hwmon/w83781d.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index c83ae769e362..69b061e2dc00 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/jiffies.h> | 39 | #include <linux/jiffies.h> |
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/i2c-isa.h> | ||
41 | #include <linux/i2c-sensor.h> | 42 | #include <linux/i2c-sensor.h> |
42 | #include <linux/i2c-vid.h> | 43 | #include <linux/i2c-vid.h> |
43 | #include <linux/hwmon.h> | 44 | #include <linux/hwmon.h> |
@@ -276,6 +277,14 @@ static struct i2c_driver w83781d_driver = { | |||
276 | .detach_client = w83781d_detach_client, | 277 | .detach_client = w83781d_detach_client, |
277 | }; | 278 | }; |
278 | 279 | ||
280 | static struct i2c_driver w83781d_isa_driver = { | ||
281 | .owner = THIS_MODULE, | ||
282 | .name = "w83781d-isa", | ||
283 | .attach_adapter = w83781d_attach_adapter, | ||
284 | .detach_client = w83781d_detach_client, | ||
285 | }; | ||
286 | |||
287 | |||
279 | /* following are the sysfs callback functions */ | 288 | /* following are the sysfs callback functions */ |
280 | #define show_in_reg(reg) \ | 289 | #define show_in_reg(reg) \ |
281 | static ssize_t show_##reg (struct device *dev, char *buf, int nr) \ | 290 | static ssize_t show_##reg (struct device *dev, char *buf, int nr) \ |
@@ -1002,7 +1011,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1002 | 1011 | ||
1003 | if (is_isa) | 1012 | if (is_isa) |
1004 | if (!request_region(address, W83781D_EXTENT, | 1013 | if (!request_region(address, W83781D_EXTENT, |
1005 | w83781d_driver.name)) { | 1014 | w83781d_isa_driver.name)) { |
1006 | dev_dbg(&adapter->dev, "Request of region " | 1015 | dev_dbg(&adapter->dev, "Request of region " |
1007 | "0x%x-0x%x for w83781d failed\n", address, | 1016 | "0x%x-0x%x for w83781d failed\n", address, |
1008 | address + W83781D_EXTENT - 1); | 1017 | address + W83781D_EXTENT - 1); |
@@ -1060,7 +1069,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1060 | new_client->addr = address; | 1069 | new_client->addr = address; |
1061 | init_MUTEX(&data->lock); | 1070 | init_MUTEX(&data->lock); |
1062 | new_client->adapter = adapter; | 1071 | new_client->adapter = adapter; |
1063 | new_client->driver = &w83781d_driver; | 1072 | new_client->driver = is_isa ? &w83781d_isa_driver : &w83781d_driver; |
1064 | new_client->flags = 0; | 1073 | new_client->flags = 0; |
1065 | 1074 | ||
1066 | /* Now, we do the remaining detection. */ | 1075 | /* Now, we do the remaining detection. */ |
@@ -1636,12 +1645,25 @@ static struct w83781d_data *w83781d_update_device(struct device *dev) | |||
1636 | static int __init | 1645 | static int __init |
1637 | sensors_w83781d_init(void) | 1646 | sensors_w83781d_init(void) |
1638 | { | 1647 | { |
1639 | return i2c_add_driver(&w83781d_driver); | 1648 | int res; |
1649 | |||
1650 | res = i2c_add_driver(&w83781d_driver); | ||
1651 | if (res) | ||
1652 | return res; | ||
1653 | |||
1654 | res = i2c_isa_add_driver(&w83781d_isa_driver); | ||
1655 | if (res) { | ||
1656 | i2c_del_driver(&w83781d_driver); | ||
1657 | return res; | ||
1658 | } | ||
1659 | |||
1660 | return 0; | ||
1640 | } | 1661 | } |
1641 | 1662 | ||
1642 | static void __exit | 1663 | static void __exit |
1643 | sensors_w83781d_exit(void) | 1664 | sensors_w83781d_exit(void) |
1644 | { | 1665 | { |
1666 | i2c_isa_del_driver(&w83781d_isa_driver); | ||
1645 | i2c_del_driver(&w83781d_driver); | 1667 | i2c_del_driver(&w83781d_driver); |
1646 | } | 1668 | } |
1647 | 1669 | ||