提交 2d95d815 编写于 作者: M Mauro Carvalho Chehab

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: NDoug Thompson <dougthompson@xmission.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 bda14289
...@@ -1947,21 +1947,26 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev, ...@@ -1947,21 +1947,26 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev,
* 0 for FOUND a device * 0 for FOUND a device
* < 0 for error code * < 0 for error code
*/ */
static int probed = 0;
static int __devinit i7core_probe(struct pci_dev *pdev, static int __devinit i7core_probe(struct pci_dev *pdev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
int dev_idx = id->driver_data;
int rc; int rc;
struct i7core_dev *i7core_dev; 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. * 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; return -EINVAL;
}
/* get the pci devices we want to reserve for our use */ probed++;
mutex_lock(&i7core_edac_lock);
rc = i7core_get_devices(pci_dev_table); rc = i7core_get_devices(pci_dev_table);
if (unlikely(rc < 0)) if (unlikely(rc < 0))
...@@ -2033,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev) ...@@ -2033,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
i7core_dev->socket); i7core_dev->socket);
} }
} }
probed--;
mutex_unlock(&i7core_edac_lock); mutex_unlock(&i7core_edac_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册