aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/sis5595.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-19 17:56:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:10 -0400
commit2d8672c5a6ba0d3f1d8d3ad61ef67868941364f0 (patch)
treef01f038198bad63fee4c7d23af806ad0ab4e5071 /drivers/hwmon/sis5595.c
parent5042c7d752fe72c6924037058367f63902e68c5c (diff)
[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>
Diffstat (limited to 'drivers/hwmon/sis5595.c')
-rw-r--r--drivers/hwmon/sis5595.c41
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);
71MODULE_PARM_DESC(force_addr, 71MODULE_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 */
77static unsigned short normal_i2c[] = { I2C_CLIENT_END }; 77static unsigned short address;
78static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
79
80/* Insmod parameters */
81SENSORS_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
195static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */ 191static struct pci_dev *s_bridge; /* pointer to the (only) sis5595 */
196 192
197static int sis5595_attach_adapter(struct i2c_adapter *adapter); 193static int sis5595_detect(struct i2c_adapter *adapter);
198static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind);
199static int sis5595_detach_client(struct i2c_client *client); 194static int sis5595_detach_client(struct i2c_client *client);
200 195
201static int sis5595_read_value(struct i2c_client *client, u8 register); 196static int sis5595_read_value(struct i2c_client *client, u8 register);
@@ -206,9 +201,7 @@ static void sis5595_init_client(struct i2c_client *client);
206static struct i2c_driver sis5595_driver = { 201static 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
480static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 473static 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 */
483static int sis5595_attach_adapter(struct i2c_adapter *adapter) 476static 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
490int 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)) {