diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-06-30 01:42:21 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-07-02 18:04:29 -0300 |
commit | 2d95d8158b5ab51339f8482c98c01469c45ff6d7 (patch) | |
tree | 59d8edd1e277112baee013d185792a0d79a1d3c4 /drivers/edac | |
parent | bda142890e6bdd9b1115715e50b0276ea4b9978a (diff) | |
download | linux-2d95d8158b5ab51339f8482c98c01469c45ff6d7.tar.gz linux-2d95d8158b5ab51339f8482c98c01469c45ff6d7.tar.bz2 linux-2d95d8158b5ab51339f8482c98c01469c45ff6d7.zip |
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.c | 17 |
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: * 0 for FOUND a device * < 0 for error code */ + +static int probed = 0; + static int __devinit i7core_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - int dev_idx = id->driver_data; int rc; struct i7core_dev *i7core_dev; + /* get the pci devices we want to reserve for our use */ + mutex_lock(&i7core_edac_lock); + /* * All memory controllers are allocated at the first pass. */ - if (unlikely(dev_idx >= 1)) + if (unlikely(probed >= 1)) { + mutex_unlock(&i7core_edac_lock); return -EINVAL; - - /* get the pci devices we want to reserve for our use */ - mutex_lock(&i7core_edac_lock); + } + probed++; rc = i7core_get_devices(pci_dev_table); if (unlikely(rc < 0)) @@ -2033,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev) i7core_dev->socket); } } + probed--; + mutex_unlock(&i7core_edac_lock); } |