aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-06-30 00:42:21 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-07-02 17:04:29 -0400
commit2d95d8158b5ab51339f8482c98c01469c45ff6d7 (patch)
tree59d8edd1e277112baee013d185792a0d79a1d3c4 /drivers/edac
parentbda142890e6bdd9b1115715e50b0276ea4b9978a (diff)
i7core_edac: Avoid doing multiple probes for the same card
As Nehalem/Nehalem-EP/Westmere devices uses several devices for the same functionality (memory controller), the default way of proping devices doesn't work. So, instead of a per-device probe, all devices should be probed at once. This means that we should block any new attempt of probe, otherwise, it will try to register the same device several times. Acked-by: Doug Thompson <dougthompson@xmission.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index d7c76800988e..cc9357da0e34 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1947,21 +1947,26 @@ fail:
1947 * 0 for FOUND a device 1947 * 0 for FOUND a device
1948 * < 0 for error code 1948 * < 0 for error code
1949 */ 1949 */
1950
1951static int probed = 0;
1952
1950static int __devinit i7core_probe(struct pci_dev *pdev, 1953static int __devinit i7core_probe(struct pci_dev *pdev,
1951 const struct pci_device_id *id) 1954 const struct pci_device_id *id)
1952{ 1955{
1953 int dev_idx = id->driver_data;
1954 int rc; 1956 int rc;
1955 struct i7core_dev *i7core_dev; 1957 struct i7core_dev *i7core_dev;
1956 1958
1959 /* get the pci devices we want to reserve for our use */
1960 mutex_lock(&i7core_edac_lock);
1961
1957 /* 1962 /*
1958 * All memory controllers are allocated at the first pass. 1963 * All memory controllers are allocated at the first pass.
1959 */ 1964 */
1960 if (unlikely(dev_idx >= 1)) 1965 if (unlikely(probed >= 1)) {
1966 mutex_unlock(&i7core_edac_lock);
1961 return -EINVAL; 1967 return -EINVAL;
1962 1968 }
1963 /* get the pci devices we want to reserve for our use */ 1969 probed++;
1964 mutex_lock(&i7core_edac_lock);
1965 1970
1966 rc = i7core_get_devices(pci_dev_table); 1971 rc = i7core_get_devices(pci_dev_table);
1967 if (unlikely(rc < 0)) 1972 if (unlikely(rc < 0))
@@ -2033,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
2033 i7core_dev->socket); 2038 i7core_dev->socket);
2034 } 2039 }
2035 } 2040 }
2041 probed--;
2042
2036 mutex_unlock(&i7core_edac_lock); 2043 mutex_unlock(&i7core_edac_lock);
2037} 2044}
2038 2045