aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/via686a.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/via686a.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/via686a.c')
-rw-r--r--drivers/hwmon/via686a.c41
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);
50MODULE_PARM_DESC(force_addr, 50MODULE_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 */
56static unsigned short normal_i2c[] = { I2C_CLIENT_END }; 56static unsigned short address;
57static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
58
59/* Insmod parameters */
60SENSORS_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
320static struct pci_dev *s_bridge; /* pointer to the (only) via686a */ 316static struct pci_dev *s_bridge; /* pointer to the (only) via686a */
321 317
322static int via686a_attach_adapter(struct i2c_adapter *adapter); 318static int via686a_detect(struct i2c_adapter *adapter);
323static int via686a_detect(struct i2c_adapter *adapter, int address, int kind);
324static int via686a_detach_client(struct i2c_client *client); 319static int via686a_detach_client(struct i2c_client *client);
325 320
326static inline int via686a_read_value(struct i2c_client *client, u8 reg) 321static inline int via686a_read_value(struct i2c_client *client, u8 reg)
@@ -580,22 +575,13 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
580static struct i2c_driver via686a_driver = { 575static 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 */
591static int via686a_attach_adapter(struct i2c_adapter *adapter) 584static 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
598static 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)) {