From 377be956dab0b7663ee485f2a72062e3dbb0277d Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 3 Feb 2001 20:48:43 +0000 Subject: [PATCH] PCI chip detection cleanup. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1011 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + kernel/busses/i2c-i801.c | 40 ++++++++++++++++++---------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/CHANGES b/CHANGES index 3925b785..fb7e77e2 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ ask CVS about it: File doc/FAQ: Updates File doc/chips/via686a: Claim support for 686b. File sensors.conf.eg: Adjust as99127f -12V calculation + Module i2c-i801: Chip detection cleanup Module lm78: Recognize chipid=0x20 Module lm87: Fix in0, in1 (2.5V and Vccp1) calculations Module sensors: Add xxx_init() calls for drivers added to mkpatch in 2.5.5. diff --git a/kernel/busses/i2c-i801.c b/kernel/busses/i2c-i801.c index 806b852b..52423f2b 100644 --- a/kernel/busses/i2c-i801.c +++ b/kernel/busses/i2c-i801.c @@ -1,7 +1,7 @@ /* i801.c - Part of lm_sensors, Linux kernel modules for hardware monitoring - Copyright (c) 1998, 1999 Frodo Looijaard , + Copyright (c) 1998 - 2001 Frodo Looijaard , Philip Edelbrock , and Mark D. Studebaker @@ -51,6 +51,11 @@ #define PCI_DEVICE_ID_INTEL_82801BA_3 0x2443 #endif +static int supported[] = {PCI_DEVICE_ID_INTEL_82801AA_3, + PCI_DEVICE_ID_INTEL_82801AB_3, + PCI_DEVICE_ID_INTEL_82801BA_3, + 0 }; + /* I801 SMBus address offsets */ #define SMBHSTSTS (0 + i801_smba) #define SMBHSTCNT (2 + i801_smba) @@ -158,6 +163,7 @@ static struct pci_dev *I801_dev = NULL; int i801_setup(void) { int error_return = 0; + int *num = supported; unsigned char temp; /* First check whether we can access PCI at all */ @@ -167,29 +173,19 @@ int i801_setup(void) goto END; } - /* Look for the I801, function 3 */ - /* Have to check for both the 82801AA and 82801AB */ + /* Look for each chip */ /* Note: we keep on searching until we have found 'function 3' */ I801_dev = NULL; - do - I801_dev = pci_find_device(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82801AA_3, - I801_dev); - while (I801_dev && (PCI_FUNC(I801_dev->devfn) != 3)); - if (I801_dev == NULL) { - do - I801_dev = pci_find_device(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82801AB_3, - I801_dev); - while (I801_dev && (PCI_FUNC(I801_dev->devfn) != 3)); - } - if (I801_dev == NULL) { - do - I801_dev = pci_find_device(PCI_VENDOR_ID_INTEL, - PCI_DEVICE_ID_INTEL_82801BA_3, - I801_dev); - while (I801_dev && (PCI_FUNC(I801_dev->devfn) != 3)); - } + do { + if((I801_dev = pci_find_device(PCI_VENDOR_ID_INTEL, + *num, I801_dev))) { + if(PCI_FUNC(I801_dev->devfn) != 3) + continue; + break; + } + num++; + } while (*num != 0); + if (I801_dev == NULL) { printk ("i2c-i801.o: Error: Can't detect I801, function 3!\n");