diff options
Diffstat (limited to 'drivers/hwmon/via686a.c')
-rw-r--r-- | drivers/hwmon/via686a.c | 41 |
1 files changed, 8 insertions, 33 deletions
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)) { |