diff options
-rw-r--r-- | drivers/hwmon/it87.c | 16 | ||||
-rw-r--r-- | drivers/hwmon/lm78.c | 11 | ||||
-rw-r--r-- | drivers/hwmon/pc87360.c | 38 | ||||
-rw-r--r-- | drivers/hwmon/sis5595.c | 41 | ||||
-rw-r--r-- | drivers/hwmon/smsc47b397.c | 48 | ||||
-rw-r--r-- | drivers/hwmon/smsc47m1.c | 42 | ||||
-rw-r--r-- | drivers/hwmon/via686a.c | 41 | ||||
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 35 | ||||
-rw-r--r-- | drivers/hwmon/w83627hf.c | 49 | ||||
-rw-r--r-- | drivers/hwmon/w83781d.c | 12 |
10 files changed, 98 insertions, 235 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index a438adb4b09f..722ef0cd5c00 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -48,7 +48,8 @@ | |||
48 | /* Addresses to scan */ | 48 | /* Addresses to scan */ |
49 | static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, | 49 | static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, |
50 | 0x2e, 0x2f, I2C_CLIENT_END }; | 50 | 0x2e, 0x2f, I2C_CLIENT_END }; |
51 | static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END }; | 51 | static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END }; |
52 | static unsigned short isa_address = 0x290; | ||
52 | 53 | ||
53 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
54 | SENSORS_INSMOD_2(it87, it8712); | 55 | SENSORS_INSMOD_2(it87, it8712); |
@@ -222,7 +223,7 @@ struct it87_data { | |||
222 | 223 | ||
223 | 224 | ||
224 | static int it87_attach_adapter(struct i2c_adapter *adapter); | 225 | static int it87_attach_adapter(struct i2c_adapter *adapter); |
225 | static int it87_find(int *address); | 226 | static int it87_isa_attach_adapter(struct i2c_adapter *adapter); |
226 | static int it87_detect(struct i2c_adapter *adapter, int address, int kind); | 227 | static int it87_detect(struct i2c_adapter *adapter, int address, int kind); |
227 | static int it87_detach_client(struct i2c_client *client); | 228 | static int it87_detach_client(struct i2c_client *client); |
228 | 229 | ||
@@ -246,7 +247,7 @@ static struct i2c_driver it87_driver = { | |||
246 | static struct i2c_driver it87_isa_driver = { | 247 | static struct i2c_driver it87_isa_driver = { |
247 | .owner = THIS_MODULE, | 248 | .owner = THIS_MODULE, |
248 | .name = "it87-isa", | 249 | .name = "it87-isa", |
249 | .attach_adapter = it87_attach_adapter, | 250 | .attach_adapter = it87_isa_attach_adapter, |
250 | .detach_client = it87_detach_client, | 251 | .detach_client = it87_detach_client, |
251 | }; | 252 | }; |
252 | 253 | ||
@@ -701,7 +702,12 @@ static int it87_attach_adapter(struct i2c_adapter *adapter) | |||
701 | return i2c_detect(adapter, &addr_data, it87_detect); | 702 | return i2c_detect(adapter, &addr_data, it87_detect); |
702 | } | 703 | } |
703 | 704 | ||
704 | /* SuperIO detection - will change normal_isa[0] if a chip is found */ | 705 | static int it87_isa_attach_adapter(struct i2c_adapter *adapter) |
706 | { | ||
707 | return it87_detect(adapter, isa_address, -1); | ||
708 | } | ||
709 | |||
710 | /* SuperIO detection - will change isa_address if a chip is found */ | ||
705 | static int it87_find(int *address) | 711 | static int it87_find(int *address) |
706 | { | 712 | { |
707 | int err = -ENODEV; | 713 | int err = -ENODEV; |
@@ -1184,7 +1190,7 @@ static int __init sm_it87_init(void) | |||
1184 | int addr, res; | 1190 | int addr, res; |
1185 | 1191 | ||
1186 | if (!it87_find(&addr)) { | 1192 | if (!it87_find(&addr)) { |
1187 | normal_isa[0] = addr; | 1193 | isa_address = addr; |
1188 | } | 1194 | } |
1189 | 1195 | ||
1190 | res = i2c_add_driver(&it87_driver); | 1196 | res = i2c_add_driver(&it87_driver); |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index a69e7d4670ad..c3712f8d9964 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -34,7 +34,8 @@ static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, | |||
34 | 0x25, 0x26, 0x27, 0x28, 0x29, | 34 | 0x25, 0x26, 0x27, 0x28, 0x29, |
35 | 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, | 35 | 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, |
36 | 0x2f, I2C_CLIENT_END }; | 36 | 0x2f, I2C_CLIENT_END }; |
37 | static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END }; | 37 | static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END }; |
38 | static unsigned short isa_address = 0x290; | ||
38 | 39 | ||
39 | /* Insmod parameters */ | 40 | /* Insmod parameters */ |
40 | SENSORS_INSMOD_2(lm78, lm79); | 41 | SENSORS_INSMOD_2(lm78, lm79); |
@@ -160,6 +161,7 @@ struct lm78_data { | |||
160 | 161 | ||
161 | 162 | ||
162 | static int lm78_attach_adapter(struct i2c_adapter *adapter); | 163 | static int lm78_attach_adapter(struct i2c_adapter *adapter); |
164 | static int lm78_isa_attach_adapter(struct i2c_adapter *adapter); | ||
163 | static int lm78_detect(struct i2c_adapter *adapter, int address, int kind); | 165 | static int lm78_detect(struct i2c_adapter *adapter, int address, int kind); |
164 | static int lm78_detach_client(struct i2c_client *client); | 166 | static int lm78_detach_client(struct i2c_client *client); |
165 | 167 | ||
@@ -181,7 +183,7 @@ static struct i2c_driver lm78_driver = { | |||
181 | static struct i2c_driver lm78_isa_driver = { | 183 | static struct i2c_driver lm78_isa_driver = { |
182 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
183 | .name = "lm78-isa", | 185 | .name = "lm78-isa", |
184 | .attach_adapter = lm78_attach_adapter, | 186 | .attach_adapter = lm78_isa_attach_adapter, |
185 | .detach_client = lm78_detach_client, | 187 | .detach_client = lm78_detach_client, |
186 | }; | 188 | }; |
187 | 189 | ||
@@ -480,6 +482,11 @@ static int lm78_attach_adapter(struct i2c_adapter *adapter) | |||
480 | return i2c_detect(adapter, &addr_data, lm78_detect); | 482 | return i2c_detect(adapter, &addr_data, lm78_detect); |
481 | } | 483 | } |
482 | 484 | ||
485 | static int lm78_isa_attach_adapter(struct i2c_adapter *adapter) | ||
486 | { | ||
487 | return lm78_detect(adapter, isa_address, -1); | ||
488 | } | ||
489 | |||
483 | /* This function is called by i2c_detect */ | 490 | /* This function is called by i2c_detect */ |
484 | int lm78_detect(struct i2c_adapter *adapter, int address, int kind) | 491 | int lm78_detect(struct i2c_adapter *adapter, int address, int kind) |
485 | { | 492 | { |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 97ffe5b5cf83..4041488de6f1 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -39,25 +39,17 @@ | |||
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-isa.h> |
42 | #include <linux/i2c-sensor.h> | ||
43 | #include <linux/i2c-vid.h> | 42 | #include <linux/i2c-vid.h> |
44 | #include <linux/hwmon.h> | 43 | #include <linux/hwmon.h> |
45 | #include <linux/err.h> | 44 | #include <linux/err.h> |
46 | #include <asm/io.h> | 45 | #include <asm/io.h> |
47 | 46 | ||
48 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
49 | static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END }; | ||
50 | static struct i2c_force_data forces[] = {{ NULL }}; | ||
51 | static u8 devid; | 47 | static u8 devid; |
52 | static unsigned int extra_isa[3]; | 48 | static unsigned short address; |
49 | static unsigned short extra_isa[3]; | ||
53 | static u8 confreg[4]; | 50 | static u8 confreg[4]; |
54 | 51 | ||
55 | enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 }; | 52 | enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 }; |
56 | static struct i2c_address_data addr_data = { | ||
57 | .normal_i2c = normal_i2c, | ||
58 | .normal_isa = normal_isa, | ||
59 | .forces = forces, | ||
60 | }; | ||
61 | 53 | ||
62 | static int init = 1; | 54 | static int init = 1; |
63 | module_param(init, int, 0); | 55 | module_param(init, int, 0); |
@@ -228,8 +220,7 @@ struct pc87360_data { | |||
228 | * Functions declaration | 220 | * Functions declaration |
229 | */ | 221 | */ |
230 | 222 | ||
231 | static int pc87360_attach_adapter(struct i2c_adapter *adapter); | 223 | static int pc87360_detect(struct i2c_adapter *adapter); |
232 | static int pc87360_detect(struct i2c_adapter *adapter, int address, int kind); | ||
233 | static int pc87360_detach_client(struct i2c_client *client); | 224 | static int pc87360_detach_client(struct i2c_client *client); |
234 | 225 | ||
235 | static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, | 226 | static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, |
@@ -246,8 +237,7 @@ static struct pc87360_data *pc87360_update_device(struct device *dev); | |||
246 | static struct i2c_driver pc87360_driver = { | 237 | static struct i2c_driver pc87360_driver = { |
247 | .owner = THIS_MODULE, | 238 | .owner = THIS_MODULE, |
248 | .name = "pc87360", | 239 | .name = "pc87360", |
249 | .flags = I2C_DF_NOTIFY, | 240 | .attach_adapter = pc87360_detect, |
250 | .attach_adapter = pc87360_attach_adapter, | ||
251 | .detach_client = pc87360_detach_client, | 241 | .detach_client = pc87360_detach_client, |
252 | }; | 242 | }; |
253 | 243 | ||
@@ -636,12 +626,7 @@ static DEVICE_ATTR(alarms_temp, S_IRUGO, show_temp_alarms, NULL); | |||
636 | * Device detection, registration and update | 626 | * Device detection, registration and update |
637 | */ | 627 | */ |
638 | 628 | ||
639 | static int pc87360_attach_adapter(struct i2c_adapter *adapter) | 629 | static int pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses) |
640 | { | ||
641 | return i2c_detect(adapter, &addr_data, pc87360_detect); | ||
642 | } | ||
643 | |||
644 | static int pc87360_find(int sioaddr, u8 *devid, int *address) | ||
645 | { | 630 | { |
646 | u16 val; | 631 | u16 val; |
647 | int i; | 632 | int i; |
@@ -687,7 +672,7 @@ static int pc87360_find(int sioaddr, u8 *devid, int *address) | |||
687 | continue; | 672 | continue; |
688 | } | 673 | } |
689 | 674 | ||
690 | address[i] = val; | 675 | addresses[i] = val; |
691 | 676 | ||
692 | if (i==0) { /* Fans */ | 677 | if (i==0) { /* Fans */ |
693 | confreg[0] = superio_inb(sioaddr, 0xF0); | 678 | confreg[0] = superio_inb(sioaddr, 0xF0); |
@@ -731,9 +716,7 @@ static int pc87360_find(int sioaddr, u8 *devid, int *address) | |||
731 | return 0; | 716 | return 0; |
732 | } | 717 | } |
733 | 718 | ||
734 | /* We don't really care about the address. | 719 | static int pc87360_detect(struct i2c_adapter *adapter) |
735 | Read from extra_isa instead. */ | ||
736 | int pc87360_detect(struct i2c_adapter *adapter, int address, int kind) | ||
737 | { | 720 | { |
738 | int i; | 721 | int i; |
739 | struct i2c_client *new_client; | 722 | struct i2c_client *new_client; |
@@ -742,9 +725,6 @@ int pc87360_detect(struct i2c_adapter *adapter, int address, int kind) | |||
742 | const char *name = "pc87360"; | 725 | const char *name = "pc87360"; |
743 | int use_thermistors = 0; | 726 | int use_thermistors = 0; |
744 | 727 | ||
745 | if (!i2c_is_isa_adapter(adapter)) | ||
746 | return -ENODEV; | ||
747 | |||
748 | if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL))) | 728 | if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL))) |
749 | return -ENOMEM; | 729 | return -ENOMEM; |
750 | memset(data, 0x00, sizeof(struct pc87360_data)); | 730 | memset(data, 0x00, sizeof(struct pc87360_data)); |
@@ -1334,12 +1314,12 @@ static int __init pc87360_init(void) | |||
1334 | /* Arbitrarily pick one of the addresses */ | 1314 | /* Arbitrarily pick one of the addresses */ |
1335 | for (i = 0; i < 3; i++) { | 1315 | for (i = 0; i < 3; i++) { |
1336 | if (extra_isa[i] != 0x0000) { | 1316 | if (extra_isa[i] != 0x0000) { |
1337 | normal_isa[0] = extra_isa[i]; | 1317 | address = extra_isa[i]; |
1338 | break; | 1318 | break; |
1339 | } | 1319 | } |
1340 | } | 1320 | } |
1341 | 1321 | ||
1342 | if (normal_isa[0] == 0x0000) { | 1322 | if (address == 0x0000) { |
1343 | printk(KERN_WARNING "pc87360: No active logical device, " | 1323 | printk(KERN_WARNING "pc87360: No active logical device, " |
1344 | "module not inserted.\n"); | 1324 | "module not inserted.\n"); |
1345 | return -ENODEV; | 1325 | return -ENODEV; |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index e5db835d63f0..67246299a308 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -71,14 +71,10 @@ module_param(force_addr, ushort, 0); | |||
71 | MODULE_PARM_DESC(force_addr, | 71 | MODULE_PARM_DESC(force_addr, |
72 | "Initialize the base address of the sensors"); | 72 | "Initialize the base address of the sensors"); |
73 | 73 | ||
74 | /* Addresses to scan. | 74 | /* Device address |
75 | Note that we can't determine the ISA address until we have initialized | 75 | Note that we can't determine the ISA address until we have initialized |
76 | our module */ | 76 | our module */ |
77 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | 77 | static unsigned short address; |
78 | static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END }; | ||
79 | |||
80 | /* Insmod parameters */ | ||
81 | SENSORS_INSMOD_1(sis5595); | ||
82 | 78 | ||
83 | /* Many SIS5595 constants specified below */ | 79 | /* Many SIS5595 constants specified below */ |
84 | 80 | ||
@@ -194,8 +190,7 @@ struct sis5595_data { | |||
194 | 190 | ||
195 | static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ | 191 | static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ |
196 | 192 | ||
197 | static int sis5595_attach_adapter(struct i2c_adapter *adapter); | 193 | static int sis5595_detect(struct i2c_adapter *adapter); |
198 | static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind); | ||
199 | static int sis5595_detach_client(struct i2c_client *client); | 194 | static int sis5595_detach_client(struct i2c_client *client); |
200 | 195 | ||
201 | static int sis5595_read_value(struct i2c_client *client, u8 register); | 196 | static int sis5595_read_value(struct i2c_client *client, u8 register); |
@@ -206,9 +201,7 @@ static void sis5595_init_client(struct i2c_client *client); | |||
206 | static struct i2c_driver sis5595_driver = { | 201 | static struct i2c_driver sis5595_driver = { |
207 | .owner = THIS_MODULE, | 202 | .owner = THIS_MODULE, |
208 | .name = "sis5595", | 203 | .name = "sis5595", |
209 | .id = I2C_DRIVERID_SIS5595, | 204 | .attach_adapter = sis5595_detect, |
210 | .flags = I2C_DF_NOTIFY, | ||
211 | .attach_adapter = sis5595_attach_adapter, | ||
212 | .detach_client = sis5595_detach_client, | 205 | .detach_client = sis5595_detach_client, |
213 | }; | 206 | }; |
214 | 207 | ||
@@ -480,14 +473,7 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, ch | |||
480 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | 473 | static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); |
481 | 474 | ||
482 | /* This is called when the module is loaded */ | 475 | /* This is called when the module is loaded */ |
483 | static int sis5595_attach_adapter(struct i2c_adapter *adapter) | 476 | static int sis5595_detect(struct i2c_adapter *adapter) |
484 | { | ||
485 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
486 | return 0; | ||
487 | return i2c_detect(adapter, &addr_data, sis5595_detect); | ||
488 | } | ||
489 | |||
490 | int sis5595_detect(struct i2c_adapter *adapter, int address, int kind) | ||
491 | { | 477 | { |
492 | int err = 0; | 478 | int err = 0; |
493 | int i; | 479 | int i; |
@@ -496,10 +482,6 @@ int sis5595_detect(struct i2c_adapter *adapter, int address, int kind) | |||
496 | char val; | 482 | char val; |
497 | u16 a; | 483 | u16 a; |
498 | 484 | ||
499 | /* Make sure we are probing the ISA bus!! */ | ||
500 | if (!i2c_is_isa_adapter(adapter)) | ||
501 | goto exit; | ||
502 | |||
503 | if (force_addr) | 485 | if (force_addr) |
504 | address = force_addr & ~(SIS5595_EXTENT - 1); | 486 | address = force_addr & ~(SIS5595_EXTENT - 1); |
505 | /* Reserve the ISA region */ | 487 | /* Reserve the ISA region */ |
@@ -642,8 +624,7 @@ static int sis5595_detach_client(struct i2c_client *client) | |||
642 | return err; | 624 | return err; |
643 | } | 625 | } |
644 | 626 | ||
645 | if (i2c_is_isa_client(client)) | 627 | release_region(client->addr, SIS5595_EXTENT); |
646 | release_region(client->addr, SIS5595_EXTENT); | ||
647 | 628 | ||
648 | kfree(data); | 629 | kfree(data); |
649 | 630 | ||
@@ -760,7 +741,6 @@ static int __devinit sis5595_pci_probe(struct pci_dev *dev, | |||
760 | { | 741 | { |
761 | u16 val; | 742 | u16 val; |
762 | int *i; | 743 | int *i; |
763 | int addr = 0; | ||
764 | 744 | ||
765 | for (i = blacklist; *i != 0; i++) { | 745 | for (i = blacklist; *i != 0; i++) { |
766 | struct pci_dev *dev; | 746 | struct pci_dev *dev; |
@@ -776,19 +756,16 @@ static int __devinit sis5595_pci_probe(struct pci_dev *dev, | |||
776 | pci_read_config_word(dev, SIS5595_BASE_REG, &val)) | 756 | pci_read_config_word(dev, SIS5595_BASE_REG, &val)) |
777 | return -ENODEV; | 757 | return -ENODEV; |
778 | 758 | ||
779 | addr = val & ~(SIS5595_EXTENT - 1); | 759 | address = val & ~(SIS5595_EXTENT - 1); |
780 | if (addr == 0 && force_addr == 0) { | 760 | if (address == 0 && force_addr == 0) { |
781 | dev_err(&dev->dev, "Base address not set - upgrade BIOS or use force_addr=0xaddr\n"); | 761 | dev_err(&dev->dev, "Base address not set - upgrade BIOS or use force_addr=0xaddr\n"); |
782 | return -ENODEV; | 762 | return -ENODEV; |
783 | } | 763 | } |
784 | if (force_addr) | ||
785 | addr = force_addr; /* so detect will get called */ | ||
786 | 764 | ||
787 | if (!addr) { | 765 | if (!address) { |
788 | dev_err(&dev->dev,"No SiS 5595 sensors found.\n"); | 766 | dev_err(&dev->dev,"No SiS 5595 sensors found.\n"); |
789 | return -ENODEV; | 767 | return -ENODEV; |
790 | } | 768 | } |
791 | normal_isa[0] = addr; | ||
792 | 769 | ||
793 | s_bridge = pci_dev_get(dev); | 770 | s_bridge = pci_dev_get(dev); |
794 | if (i2c_isa_add_driver(&sis5595_driver)) { | 771 | if (i2c_isa_add_driver(&sis5595_driver)) { |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 0f965921b8ed..dddc94a7649b 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -32,25 +32,13 @@ | |||
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/i2c-isa.h> | 34 | #include <linux/i2c-isa.h> |
35 | #include <linux/i2c-sensor.h> | ||
36 | #include <linux/hwmon.h> | 35 | #include <linux/hwmon.h> |
37 | #include <linux/err.h> | 36 | #include <linux/err.h> |
38 | #include <linux/init.h> | 37 | #include <linux/init.h> |
39 | #include <asm/io.h> | 38 | #include <asm/io.h> |
40 | 39 | ||
41 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
42 | /* Address is autodetected, there is no default value */ | 40 | /* Address is autodetected, there is no default value */ |
43 | static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END }; | 41 | static unsigned short address; |
44 | static struct i2c_force_data forces[] = {{NULL}}; | ||
45 | |||
46 | enum chips { any_chip, smsc47b397 }; | ||
47 | static struct i2c_address_data addr_data = { | ||
48 | .normal_i2c = normal_i2c, | ||
49 | .normal_isa = normal_isa, | ||
50 | .probe = normal_i2c, /* cheat */ | ||
51 | .ignore = normal_i2c, /* cheat */ | ||
52 | .forces = forces, | ||
53 | }; | ||
54 | 42 | ||
55 | /* Super-I/0 registers and commands */ | 43 | /* Super-I/0 registers and commands */ |
56 | 44 | ||
@@ -219,15 +207,6 @@ sysfs_fan(4); | |||
219 | #define device_create_file_fan(client, num) \ | 207 | #define device_create_file_fan(client, num) \ |
220 | device_create_file(&client->dev, &dev_attr_fan##num##_input) | 208 | device_create_file(&client->dev, &dev_attr_fan##num##_input) |
221 | 209 | ||
222 | static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind); | ||
223 | |||
224 | static int smsc47b397_attach_adapter(struct i2c_adapter *adapter) | ||
225 | { | ||
226 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
227 | return 0; | ||
228 | return i2c_detect(adapter, &addr_data, smsc47b397_detect); | ||
229 | } | ||
230 | |||
231 | static int smsc47b397_detach_client(struct i2c_client *client) | 210 | static int smsc47b397_detach_client(struct i2c_client *client) |
232 | { | 211 | { |
233 | struct smsc47b397_data *data = i2c_get_clientdata(client); | 212 | struct smsc47b397_data *data = i2c_get_clientdata(client); |
@@ -247,27 +226,24 @@ static int smsc47b397_detach_client(struct i2c_client *client) | |||
247 | return 0; | 226 | return 0; |
248 | } | 227 | } |
249 | 228 | ||
229 | static int smsc47b397_detect(struct i2c_adapter *adapter); | ||
230 | |||
250 | static struct i2c_driver smsc47b397_driver = { | 231 | static struct i2c_driver smsc47b397_driver = { |
251 | .owner = THIS_MODULE, | 232 | .owner = THIS_MODULE, |
252 | .name = "smsc47b397", | 233 | .name = "smsc47b397", |
253 | .id = I2C_DRIVERID_SMSC47B397, | 234 | .attach_adapter = smsc47b397_detect, |
254 | .flags = I2C_DF_NOTIFY, | ||
255 | .attach_adapter = smsc47b397_attach_adapter, | ||
256 | .detach_client = smsc47b397_detach_client, | 235 | .detach_client = smsc47b397_detach_client, |
257 | }; | 236 | }; |
258 | 237 | ||
259 | static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind) | 238 | static int smsc47b397_detect(struct i2c_adapter *adapter) |
260 | { | 239 | { |
261 | struct i2c_client *new_client; | 240 | struct i2c_client *new_client; |
262 | struct smsc47b397_data *data; | 241 | struct smsc47b397_data *data; |
263 | int err = 0; | 242 | int err = 0; |
264 | 243 | ||
265 | if (!i2c_is_isa_adapter(adapter)) { | 244 | if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) { |
266 | return 0; | 245 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", |
267 | } | 246 | address); |
268 | |||
269 | if (!request_region(addr, SMSC_EXTENT, smsc47b397_driver.name)) { | ||
270 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", addr); | ||
271 | return -EBUSY; | 247 | return -EBUSY; |
272 | } | 248 | } |
273 | 249 | ||
@@ -279,7 +255,7 @@ static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind) | |||
279 | 255 | ||
280 | new_client = &data->client; | 256 | new_client = &data->client; |
281 | i2c_set_clientdata(new_client, data); | 257 | i2c_set_clientdata(new_client, data); |
282 | new_client->addr = addr; | 258 | new_client->addr = address; |
283 | init_MUTEX(&data->lock); | 259 | init_MUTEX(&data->lock); |
284 | new_client->adapter = adapter; | 260 | new_client->adapter = adapter; |
285 | new_client->driver = &smsc47b397_driver; | 261 | new_client->driver = &smsc47b397_driver; |
@@ -315,11 +291,11 @@ error_detach: | |||
315 | error_free: | 291 | error_free: |
316 | kfree(data); | 292 | kfree(data); |
317 | error_release: | 293 | error_release: |
318 | release_region(addr, SMSC_EXTENT); | 294 | release_region(address, SMSC_EXTENT); |
319 | return err; | 295 | return err; |
320 | } | 296 | } |
321 | 297 | ||
322 | static int __init smsc47b397_find(unsigned int *addr) | 298 | static int __init smsc47b397_find(unsigned short *addr) |
323 | { | 299 | { |
324 | u8 id, rev; | 300 | u8 id, rev; |
325 | 301 | ||
@@ -348,7 +324,7 @@ static int __init smsc47b397_init(void) | |||
348 | { | 324 | { |
349 | int ret; | 325 | int ret; |
350 | 326 | ||
351 | if ((ret = smsc47b397_find(normal_isa))) | 327 | if ((ret = smsc47b397_find(&address))) |
352 | return ret; | 328 | return ret; |
353 | 329 | ||
354 | return i2c_isa_add_driver(&smsc47b397_driver); | 330 | return i2c_isa_add_driver(&smsc47b397_driver); |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index b07d01ecd2e3..8126fdd7cbee 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -37,17 +37,8 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | 39 | ||
40 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
41 | /* Address is autodetected, there is no default value */ | 40 | /* Address is autodetected, there is no default value */ |
42 | static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END }; | 41 | static unsigned short address; |
43 | static struct i2c_force_data forces[] = {{NULL}}; | ||
44 | |||
45 | enum chips { any_chip, smsc47m1 }; | ||
46 | static struct i2c_address_data addr_data = { | ||
47 | .normal_i2c = normal_i2c, | ||
48 | .normal_isa = normal_isa, | ||
49 | .forces = forces, | ||
50 | }; | ||
51 | 42 | ||
52 | /* Super-I/0 registers and commands */ | 43 | /* Super-I/0 registers and commands */ |
53 | 44 | ||
@@ -125,9 +116,7 @@ struct smsc47m1_data { | |||
125 | }; | 116 | }; |
126 | 117 | ||
127 | 118 | ||
128 | static int smsc47m1_attach_adapter(struct i2c_adapter *adapter); | 119 | static int smsc47m1_detect(struct i2c_adapter *adapter); |
129 | static int smsc47m1_find(int *address); | ||
130 | static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind); | ||
131 | static int smsc47m1_detach_client(struct i2c_client *client); | 120 | static int smsc47m1_detach_client(struct i2c_client *client); |
132 | 121 | ||
133 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg); | 122 | static int smsc47m1_read_value(struct i2c_client *client, u8 reg); |
@@ -140,9 +129,7 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | |||
140 | static struct i2c_driver smsc47m1_driver = { | 129 | static struct i2c_driver smsc47m1_driver = { |
141 | .owner = THIS_MODULE, | 130 | .owner = THIS_MODULE, |
142 | .name = "smsc47m1", | 131 | .name = "smsc47m1", |
143 | .id = I2C_DRIVERID_SMSC47M1, | 132 | .attach_adapter = smsc47m1_detect, |
144 | .flags = I2C_DF_NOTIFY, | ||
145 | .attach_adapter = smsc47m1_attach_adapter, | ||
146 | .detach_client = smsc47m1_detach_client, | 133 | .detach_client = smsc47m1_detach_client, |
147 | }; | 134 | }; |
148 | 135 | ||
@@ -358,14 +345,7 @@ fan_present(2); | |||
358 | 345 | ||
359 | static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL); | 346 | static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL); |
360 | 347 | ||
361 | static int smsc47m1_attach_adapter(struct i2c_adapter *adapter) | 348 | static int smsc47m1_find(unsigned short *addr) |
362 | { | ||
363 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
364 | return 0; | ||
365 | return i2c_detect(adapter, &addr_data, smsc47m1_detect); | ||
366 | } | ||
367 | |||
368 | static int smsc47m1_find(int *address) | ||
369 | { | 349 | { |
370 | u8 val; | 350 | u8 val; |
371 | 351 | ||
@@ -392,10 +372,10 @@ static int smsc47m1_find(int *address) | |||
392 | } | 372 | } |
393 | 373 | ||
394 | superio_select(); | 374 | superio_select(); |
395 | *address = (superio_inb(SUPERIO_REG_BASE) << 8) | 375 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
396 | | superio_inb(SUPERIO_REG_BASE + 1); | 376 | | superio_inb(SUPERIO_REG_BASE + 1); |
397 | val = superio_inb(SUPERIO_REG_ACT); | 377 | val = superio_inb(SUPERIO_REG_ACT); |
398 | if (*address == 0 || (val & 0x01) == 0) { | 378 | if (*addr == 0 || (val & 0x01) == 0) { |
399 | printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n"); | 379 | printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n"); |
400 | superio_exit(); | 380 | superio_exit(); |
401 | return -ENODEV; | 381 | return -ENODEV; |
@@ -405,17 +385,13 @@ static int smsc47m1_find(int *address) | |||
405 | return 0; | 385 | return 0; |
406 | } | 386 | } |
407 | 387 | ||
408 | static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind) | 388 | static int smsc47m1_detect(struct i2c_adapter *adapter) |
409 | { | 389 | { |
410 | struct i2c_client *new_client; | 390 | struct i2c_client *new_client; |
411 | struct smsc47m1_data *data; | 391 | struct smsc47m1_data *data; |
412 | int err = 0; | 392 | int err = 0; |
413 | int fan1, fan2, pwm1, pwm2; | 393 | int fan1, fan2, pwm1, pwm2; |
414 | 394 | ||
415 | if (!i2c_is_isa_adapter(adapter)) { | ||
416 | return 0; | ||
417 | } | ||
418 | |||
419 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { | 395 | if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { |
420 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); | 396 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); |
421 | return -EBUSY; | 397 | return -EBUSY; |
@@ -589,7 +565,7 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, | |||
589 | 565 | ||
590 | static int __init sm_smsc47m1_init(void) | 566 | static int __init sm_smsc47m1_init(void) |
591 | { | 567 | { |
592 | if (smsc47m1_find(normal_isa)) { | 568 | if (smsc47m1_find(&address)) { |
593 | return -ENODEV; | 569 | return -ENODEV; |
594 | } | 570 | } |
595 | 571 | ||
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index e6fc43a8ba47..cd3732c36671 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -50,14 +50,10 @@ module_param(force_addr, ushort, 0); | |||
50 | MODULE_PARM_DESC(force_addr, | 50 | MODULE_PARM_DESC(force_addr, |
51 | "Initialize the base address of the sensors"); | 51 | "Initialize the base address of the sensors"); |
52 | 52 | ||
53 | /* Addresses to scan. | 53 | /* Device address |
54 | Note that we can't determine the ISA address until we have initialized | 54 | Note that we can't determine the ISA address until we have initialized |
55 | our module */ | 55 | our module */ |
56 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | 56 | static unsigned short address; |
57 | static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END }; | ||
58 | |||
59 | /* Insmod parameters */ | ||
60 | SENSORS_INSMOD_1(via686a); | ||
61 | 57 | ||
62 | /* | 58 | /* |
63 | The Via 686a southbridge has a LM78-like chip integrated on the same IC. | 59 | The Via 686a southbridge has a LM78-like chip integrated on the same IC. |
@@ -319,8 +315,7 @@ struct via686a_data { | |||
319 | 315 | ||
320 | static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ | 316 | static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ |
321 | 317 | ||
322 | static int via686a_attach_adapter(struct i2c_adapter *adapter); | 318 | static int via686a_detect(struct i2c_adapter *adapter); |
323 | static int via686a_detect(struct i2c_adapter *adapter, int address, int kind); | ||
324 | static int via686a_detach_client(struct i2c_client *client); | 319 | static int via686a_detach_client(struct i2c_client *client); |
325 | 320 | ||
326 | static inline int via686a_read_value(struct i2c_client *client, u8 reg) | 321 | static inline int via686a_read_value(struct i2c_client *client, u8 reg) |
@@ -580,22 +575,13 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); | |||
580 | static struct i2c_driver via686a_driver = { | 575 | static struct i2c_driver via686a_driver = { |
581 | .owner = THIS_MODULE, | 576 | .owner = THIS_MODULE, |
582 | .name = "via686a", | 577 | .name = "via686a", |
583 | .id = I2C_DRIVERID_VIA686A, | 578 | .attach_adapter = via686a_detect, |
584 | .flags = I2C_DF_NOTIFY, | ||
585 | .attach_adapter = via686a_attach_adapter, | ||
586 | .detach_client = via686a_detach_client, | 579 | .detach_client = via686a_detach_client, |
587 | }; | 580 | }; |
588 | 581 | ||
589 | 582 | ||
590 | /* This is called when the module is loaded */ | 583 | /* This is called when the module is loaded */ |
591 | static int via686a_attach_adapter(struct i2c_adapter *adapter) | 584 | static int via686a_detect(struct i2c_adapter *adapter) |
592 | { | ||
593 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
594 | return 0; | ||
595 | return i2c_detect(adapter, &addr_data, via686a_detect); | ||
596 | } | ||
597 | |||
598 | static int via686a_detect(struct i2c_adapter *adapter, int address, int kind) | ||
599 | { | 585 | { |
600 | struct i2c_client *new_client; | 586 | struct i2c_client *new_client; |
601 | struct via686a_data *data; | 587 | struct via686a_data *data; |
@@ -603,13 +589,6 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind) | |||
603 | const char client_name[] = "via686a"; | 589 | const char client_name[] = "via686a"; |
604 | u16 val; | 590 | u16 val; |
605 | 591 | ||
606 | /* Make sure we are probing the ISA bus!! */ | ||
607 | if (!i2c_is_isa_adapter(adapter)) { | ||
608 | dev_err(&adapter->dev, | ||
609 | "via686a_detect called for an I2C bus adapter?!?\n"); | ||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | /* 8231 requires multiple of 256, we enforce that on 686 as well */ | 592 | /* 8231 requires multiple of 256, we enforce that on 686 as well */ |
614 | if (force_addr) | 593 | if (force_addr) |
615 | address = force_addr & 0xFF00; | 594 | address = force_addr & 0xFF00; |
@@ -825,26 +804,22 @@ static int __devinit via686a_pci_probe(struct pci_dev *dev, | |||
825 | const struct pci_device_id *id) | 804 | const struct pci_device_id *id) |
826 | { | 805 | { |
827 | u16 val; | 806 | u16 val; |
828 | int addr = 0; | ||
829 | 807 | ||
830 | if (PCIBIOS_SUCCESSFUL != | 808 | if (PCIBIOS_SUCCESSFUL != |
831 | pci_read_config_word(dev, VIA686A_BASE_REG, &val)) | 809 | pci_read_config_word(dev, VIA686A_BASE_REG, &val)) |
832 | return -ENODEV; | 810 | return -ENODEV; |
833 | 811 | ||
834 | addr = val & ~(VIA686A_EXTENT - 1); | 812 | address = val & ~(VIA686A_EXTENT - 1); |
835 | if (addr == 0 && force_addr == 0) { | 813 | if (address == 0 && force_addr == 0) { |
836 | dev_err(&dev->dev, "base address not set - upgrade BIOS " | 814 | dev_err(&dev->dev, "base address not set - upgrade BIOS " |
837 | "or use force_addr=0xaddr\n"); | 815 | "or use force_addr=0xaddr\n"); |
838 | return -ENODEV; | 816 | return -ENODEV; |
839 | } | 817 | } |
840 | if (force_addr) | ||
841 | addr = force_addr; /* so detect will get called */ | ||
842 | 818 | ||
843 | if (!addr) { | 819 | if (!address) { |
844 | dev_err(&dev->dev, "No Via 686A sensors found.\n"); | 820 | dev_err(&dev->dev, "No Via 686A sensors found.\n"); |
845 | return -ENODEV; | 821 | return -ENODEV; |
846 | } | 822 | } |
847 | normal_isa[0] = addr; | ||
848 | 823 | ||
849 | s_bridge = pci_dev_get(dev); | 824 | s_bridge = pci_dev_get(dev); |
850 | if (i2c_isa_add_driver(&via686a_driver)) { | 825 | if (i2c_isa_add_driver(&via686a_driver)) { |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a3c642ef5c42..b14801cd615d 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -41,19 +41,13 @@ | |||
41 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/i2c.h> | 42 | #include <linux/i2c.h> |
43 | #include <linux/i2c-isa.h> | 43 | #include <linux/i2c-isa.h> |
44 | #include <linux/i2c-sensor.h> | ||
45 | #include <linux/hwmon.h> | 44 | #include <linux/hwmon.h> |
46 | #include <linux/err.h> | 45 | #include <linux/err.h> |
47 | #include <asm/io.h> | 46 | #include <asm/io.h> |
48 | #include "lm75.h" | 47 | #include "lm75.h" |
49 | 48 | ||
50 | /* Addresses to scan | 49 | /* The actual ISA address is read from Super-I/O configuration space */ |
51 | The actual ISA address is read from Super-I/O configuration space */ | 50 | static unsigned short address; |
52 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
53 | static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END }; | ||
54 | |||
55 | /* Insmod parameters */ | ||
56 | SENSORS_INSMOD_1(w83627ehf); | ||
57 | 51 | ||
58 | /* | 52 | /* |
59 | * Super-I/O constants and functions | 53 | * Super-I/O constants and functions |
@@ -673,15 +667,12 @@ static void w83627ehf_init_client(struct i2c_client *client) | |||
673 | } | 667 | } |
674 | } | 668 | } |
675 | 669 | ||
676 | static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind) | 670 | static int w83627ehf_detect(struct i2c_adapter *adapter) |
677 | { | 671 | { |
678 | struct i2c_client *client; | 672 | struct i2c_client *client; |
679 | struct w83627ehf_data *data; | 673 | struct w83627ehf_data *data; |
680 | int i, err = 0; | 674 | int i, err = 0; |
681 | 675 | ||
682 | if (!i2c_is_isa_adapter(adapter)) | ||
683 | return 0; | ||
684 | |||
685 | if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { | 676 | if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { |
686 | err = -EBUSY; | 677 | err = -EBUSY; |
687 | goto exit; | 678 | goto exit; |
@@ -776,13 +767,6 @@ exit: | |||
776 | return err; | 767 | return err; |
777 | } | 768 | } |
778 | 769 | ||
779 | static int w83627ehf_attach_adapter(struct i2c_adapter *adapter) | ||
780 | { | ||
781 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
782 | return 0; | ||
783 | return i2c_detect(adapter, &addr_data, w83627ehf_detect); | ||
784 | } | ||
785 | |||
786 | static int w83627ehf_detach_client(struct i2c_client *client) | 770 | static int w83627ehf_detach_client(struct i2c_client *client) |
787 | { | 771 | { |
788 | struct w83627ehf_data *data = i2c_get_clientdata(client); | 772 | struct w83627ehf_data *data = i2c_get_clientdata(client); |
@@ -804,12 +788,11 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
804 | static struct i2c_driver w83627ehf_driver = { | 788 | static struct i2c_driver w83627ehf_driver = { |
805 | .owner = THIS_MODULE, | 789 | .owner = THIS_MODULE, |
806 | .name = "w83627ehf", | 790 | .name = "w83627ehf", |
807 | .flags = I2C_DF_NOTIFY, | 791 | .attach_adapter = w83627ehf_detect, |
808 | .attach_adapter = w83627ehf_attach_adapter, | ||
809 | .detach_client = w83627ehf_detach_client, | 792 | .detach_client = w83627ehf_detach_client, |
810 | }; | 793 | }; |
811 | 794 | ||
812 | static int __init w83627ehf_find(int sioaddr, int *address) | 795 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr) |
813 | { | 796 | { |
814 | u16 val; | 797 | u16 val; |
815 | 798 | ||
@@ -827,8 +810,8 @@ static int __init w83627ehf_find(int sioaddr, int *address) | |||
827 | superio_select(W83627EHF_LD_HWM); | 810 | superio_select(W83627EHF_LD_HWM); |
828 | val = (superio_inb(SIO_REG_ADDR) << 8) | 811 | val = (superio_inb(SIO_REG_ADDR) << 8) |
829 | | superio_inb(SIO_REG_ADDR + 1); | 812 | | superio_inb(SIO_REG_ADDR + 1); |
830 | *address = val & ~(REGION_LENGTH - 1); | 813 | *addr = val & ~(REGION_LENGTH - 1); |
831 | if (*address == 0) { | 814 | if (*addr == 0) { |
832 | superio_exit(); | 815 | superio_exit(); |
833 | return -ENODEV; | 816 | return -ENODEV; |
834 | } | 817 | } |
@@ -844,8 +827,8 @@ static int __init w83627ehf_find(int sioaddr, int *address) | |||
844 | 827 | ||
845 | static int __init sensors_w83627ehf_init(void) | 828 | static int __init sensors_w83627ehf_init(void) |
846 | { | 829 | { |
847 | if (w83627ehf_find(0x2e, &normal_isa[0]) | 830 | if (w83627ehf_find(0x2e, &address) |
848 | && w83627ehf_find(0x4e, &normal_isa[0])) | 831 | && w83627ehf_find(0x4e, &address)) |
849 | return -ENODEV; | 832 | return -ENODEV; |
850 | 833 | ||
851 | return i2c_isa_add_driver(&w83627ehf_driver); | 834 | return i2c_isa_add_driver(&w83627ehf_driver); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index a2c7cea502cb..9e31f5559ccc 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -59,12 +59,11 @@ module_param(force_i2c, byte, 0); | |||
59 | MODULE_PARM_DESC(force_i2c, | 59 | MODULE_PARM_DESC(force_i2c, |
60 | "Initialize the i2c address of the sensors"); | 60 | "Initialize the i2c address of the sensors"); |
61 | 61 | ||
62 | /* Addresses to scan */ | 62 | /* The actual ISA address is read from Super-I/O configuration space */ |
63 | static unsigned short normal_i2c[] = { I2C_CLIENT_END }; | 63 | static unsigned short address; |
64 | static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END }; | ||
65 | 64 | ||
66 | /* Insmod parameters */ | 65 | /* Insmod parameters */ |
67 | SENSORS_INSMOD_4(w83627hf, w83627thf, w83697hf, w83637hf); | 66 | enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf }; |
68 | 67 | ||
69 | static int init = 1; | 68 | static int init = 1; |
70 | module_param(init, bool, 0); | 69 | module_param(init, bool, 0); |
@@ -318,9 +317,7 @@ struct w83627hf_data { | |||
318 | }; | 317 | }; |
319 | 318 | ||
320 | 319 | ||
321 | static int w83627hf_attach_adapter(struct i2c_adapter *adapter); | 320 | static int w83627hf_detect(struct i2c_adapter *adapter); |
322 | static int w83627hf_detect(struct i2c_adapter *adapter, int address, | ||
323 | int kind); | ||
324 | static int w83627hf_detach_client(struct i2c_client *client); | 321 | static int w83627hf_detach_client(struct i2c_client *client); |
325 | 322 | ||
326 | static int w83627hf_read_value(struct i2c_client *client, u16 register); | 323 | static int w83627hf_read_value(struct i2c_client *client, u16 register); |
@@ -332,9 +329,7 @@ static void w83627hf_init_client(struct i2c_client *client); | |||
332 | static struct i2c_driver w83627hf_driver = { | 329 | static struct i2c_driver w83627hf_driver = { |
333 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
334 | .name = "w83627hf", | 331 | .name = "w83627hf", |
335 | .id = I2C_DRIVERID_W83627HF, | 332 | .attach_adapter = w83627hf_detect, |
336 | .flags = I2C_DF_NOTIFY, | ||
337 | .attach_adapter = w83627hf_attach_adapter, | ||
338 | .detach_client = w83627hf_detach_client, | 333 | .detach_client = w83627hf_detach_client, |
339 | }; | 334 | }; |
340 | 335 | ||
@@ -963,16 +958,7 @@ device_create_file(&client->dev, &dev_attr_temp##offset##_type); \ | |||
963 | } while (0) | 958 | } while (0) |
964 | 959 | ||
965 | 960 | ||
966 | /* This function is called when: | 961 | static int w83627hf_find(int sioaddr, unsigned short *addr) |
967 | * w83627hf_driver is inserted (when this module is loaded), for each | ||
968 | available adapter | ||
969 | * when a new adapter is inserted (and w83627hf_driver is still present) */ | ||
970 | static int w83627hf_attach_adapter(struct i2c_adapter *adapter) | ||
971 | { | ||
972 | return i2c_detect(adapter, &addr_data, w83627hf_detect); | ||
973 | } | ||
974 | |||
975 | static int w83627hf_find(int sioaddr, int *address) | ||
976 | { | 962 | { |
977 | u16 val; | 963 | u16 val; |
978 | 964 | ||
@@ -992,32 +978,24 @@ static int w83627hf_find(int sioaddr, int *address) | |||
992 | superio_select(W83627HF_LD_HWM); | 978 | superio_select(W83627HF_LD_HWM); |
993 | val = (superio_inb(WINB_BASE_REG) << 8) | | 979 | val = (superio_inb(WINB_BASE_REG) << 8) | |
994 | superio_inb(WINB_BASE_REG + 1); | 980 | superio_inb(WINB_BASE_REG + 1); |
995 | *address = val & ~(WINB_EXTENT - 1); | 981 | *addr = val & ~(WINB_EXTENT - 1); |
996 | if (*address == 0 && force_addr == 0) { | 982 | if (*addr == 0 && force_addr == 0) { |
997 | superio_exit(); | 983 | superio_exit(); |
998 | return -ENODEV; | 984 | return -ENODEV; |
999 | } | 985 | } |
1000 | if (force_addr) | ||
1001 | *address = force_addr; /* so detect will get called */ | ||
1002 | 986 | ||
1003 | superio_exit(); | 987 | superio_exit(); |
1004 | return 0; | 988 | return 0; |
1005 | } | 989 | } |
1006 | 990 | ||
1007 | int w83627hf_detect(struct i2c_adapter *adapter, int address, | 991 | static int w83627hf_detect(struct i2c_adapter *adapter) |
1008 | int kind) | ||
1009 | { | 992 | { |
1010 | int val; | 993 | int val, kind; |
1011 | struct i2c_client *new_client; | 994 | struct i2c_client *new_client; |
1012 | struct w83627hf_data *data; | 995 | struct w83627hf_data *data; |
1013 | int err = 0; | 996 | int err = 0; |
1014 | const char *client_name = ""; | 997 | const char *client_name = ""; |
1015 | 998 | ||
1016 | if (!i2c_is_isa_adapter(adapter)) { | ||
1017 | err = -ENODEV; | ||
1018 | goto ERROR0; | ||
1019 | } | ||
1020 | |||
1021 | if(force_addr) | 999 | if(force_addr) |
1022 | address = force_addr & ~(WINB_EXTENT - 1); | 1000 | address = force_addr & ~(WINB_EXTENT - 1); |
1023 | 1001 | ||
@@ -1500,13 +1478,10 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1500 | 1478 | ||
1501 | static int __init sensors_w83627hf_init(void) | 1479 | static int __init sensors_w83627hf_init(void) |
1502 | { | 1480 | { |
1503 | int addr; | 1481 | if (w83627hf_find(0x2e, &address) |
1504 | 1482 | && w83627hf_find(0x4e, &address)) { | |
1505 | if (w83627hf_find(0x2e, &addr) | ||
1506 | && w83627hf_find(0x4e, &addr)) { | ||
1507 | return -ENODEV; | 1483 | return -ENODEV; |
1508 | } | 1484 | } |
1509 | normal_isa[0] = addr; | ||
1510 | 1485 | ||
1511 | return i2c_isa_add_driver(&w83627hf_driver); | 1486 | return i2c_isa_add_driver(&w83627hf_driver); |
1512 | } | 1487 | } |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 69b061e2dc00..a4ab819ac360 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -50,7 +50,8 @@ | |||
50 | static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, | 50 | static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, |
51 | 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, | 51 | 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, |
52 | 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; | 52 | 0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END }; |
53 | static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END }; | 53 | static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END }; |
54 | static unsigned short isa_address = 0x290; | ||
54 | 55 | ||
55 | /* Insmod parameters */ | 56 | /* Insmod parameters */ |
56 | SENSORS_INSMOD_5(w83781d, w83782d, w83783s, w83627hf, as99127f); | 57 | SENSORS_INSMOD_5(w83781d, w83782d, w83783s, w83627hf, as99127f); |
@@ -259,6 +260,7 @@ struct w83781d_data { | |||
259 | }; | 260 | }; |
260 | 261 | ||
261 | static int w83781d_attach_adapter(struct i2c_adapter *adapter); | 262 | static int w83781d_attach_adapter(struct i2c_adapter *adapter); |
263 | static int w83781d_isa_attach_adapter(struct i2c_adapter *adapter); | ||
262 | static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind); | 264 | static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind); |
263 | static int w83781d_detach_client(struct i2c_client *client); | 265 | static int w83781d_detach_client(struct i2c_client *client); |
264 | 266 | ||
@@ -280,7 +282,7 @@ static struct i2c_driver w83781d_driver = { | |||
280 | static struct i2c_driver w83781d_isa_driver = { | 282 | static struct i2c_driver w83781d_isa_driver = { |
281 | .owner = THIS_MODULE, | 283 | .owner = THIS_MODULE, |
282 | .name = "w83781d-isa", | 284 | .name = "w83781d-isa", |
283 | .attach_adapter = w83781d_attach_adapter, | 285 | .attach_adapter = w83781d_isa_attach_adapter, |
284 | .detach_client = w83781d_detach_client, | 286 | .detach_client = w83781d_detach_client, |
285 | }; | 287 | }; |
286 | 288 | ||
@@ -871,6 +873,12 @@ w83781d_attach_adapter(struct i2c_adapter *adapter) | |||
871 | return i2c_detect(adapter, &addr_data, w83781d_detect); | 873 | return i2c_detect(adapter, &addr_data, w83781d_detect); |
872 | } | 874 | } |
873 | 875 | ||
876 | static int | ||
877 | w83781d_isa_attach_adapter(struct i2c_adapter *adapter) | ||
878 | { | ||
879 | return w83781d_detect(adapter, isa_address, -1); | ||
880 | } | ||
881 | |||
874 | /* Assumes that adapter is of I2C, not ISA variety. | 882 | /* Assumes that adapter is of I2C, not ISA variety. |
875 | * OTHERWISE DON'T CALL THIS | 883 | * OTHERWISE DON'T CALL THIS |
876 | */ | 884 | */ |