Commit 2d8672c5a6ba0d3f1d8d3ad61ef67868941364f0

Authored by Jean Delvare
Committed by Greg Kroah-Hartman
1 parent 5042c7d752

[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)

Call the ISA chip drivers detection function directly instead of relying
on i2c_detect. The net effect is that address lists won't be handled
anymore, but they were mostly useless in the ISA case anyway (pc87360,
smsc47m1, smsc47b397 had already dropped them).

We don't need to handle multiple devices, all we may need is a way to
force a given address instead of the original one (some drivers already
do: sis5595, via686a, w83627hf), and, for drivers supporting multiple
chips, a way to force one given kind. All this may be added later on
demand, but I actually don't think there will be much demand.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 10 changed files with 98 additions and 235 deletions Side-by-side Diff

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