aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm78.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/lm78.c')
-rw-r--r--drivers/hwmon/lm78.c29
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 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/jiffies.h> 24#include <linux/jiffies.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/i2c-isa.h>
26#include <linux/i2c-sensor.h> 27#include <linux/i2c-sensor.h>
27#include <linux/hwmon.h> 28#include <linux/hwmon.h>
28#include <linux/err.h> 29#include <linux/err.h>
@@ -177,6 +178,14 @@ static struct i2c_driver lm78_driver = {
177 .detach_client = lm78_detach_client, 178 .detach_client = lm78_detach_client,
178}; 179};
179 180
181static struct i2c_driver lm78_isa_driver = {
182 .owner = THIS_MODULE,
183 .name = "lm78-isa",
184 .attach_adapter = lm78_attach_adapter,
185 .detach_client = lm78_detach_client,
186};
187
188
180/* 7 Voltages */ 189/* 7 Voltages */
181static ssize_t show_in(struct device *dev, char *buf, int nr) 190static ssize_t show_in(struct device *dev, char *buf, int nr)
182{ 191{
@@ -488,7 +497,8 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
488 497
489 /* Reserve the ISA region */ 498 /* Reserve the ISA region */
490 if (is_isa) 499 if (is_isa)
491 if (!request_region(address, LM78_EXTENT, lm78_driver.name)) { 500 if (!request_region(address, LM78_EXTENT,
501 lm78_isa_driver.name)) {
492 err = -EBUSY; 502 err = -EBUSY;
493 goto ERROR0; 503 goto ERROR0;
494 } 504 }
@@ -543,7 +553,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
543 i2c_set_clientdata(new_client, data); 553 i2c_set_clientdata(new_client, data);
544 new_client->addr = address; 554 new_client->addr = address;
545 new_client->adapter = adapter; 555 new_client->adapter = adapter;
546 new_client->driver = &lm78_driver; 556 new_client->driver = is_isa ? &lm78_isa_driver : &lm78_driver;
547 new_client->flags = 0; 557 new_client->flags = 0;
548 558
549 /* Now, we do the remaining detection. */ 559 /* Now, we do the remaining detection. */
@@ -788,11 +798,24 @@ static struct lm78_data *lm78_update_device(struct device *dev)
788 798
789static int __init sm_lm78_init(void) 799static int __init sm_lm78_init(void)
790{ 800{
791 return i2c_add_driver(&lm78_driver); 801 int res;
802
803 res = i2c_add_driver(&lm78_driver);
804 if (res)
805 return res;
806
807 res = i2c_isa_add_driver(&lm78_isa_driver);
808 if (res) {
809 i2c_del_driver(&lm78_driver);
810 return res;
811 }
812
813 return 0;
792} 814}
793 815
794static void __exit sm_lm78_exit(void) 816static void __exit sm_lm78_exit(void)
795{ 817{
818 i2c_isa_del_driver(&lm78_isa_driver);
796 i2c_del_driver(&lm78_driver); 819 i2c_del_driver(&lm78_driver);
797} 820}
798 821