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