aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/edac/i7core_edac.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index a5cbea5abd62..19faeffac9dc 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1255,7 +1255,7 @@ static const struct mcidev_sysfs_attribute i7core_sysfs_udimm_attrs[] = {
1255 ****************************************************************************/ 1255 ****************************************************************************/
1256 1256
1257/* 1257/*
1258 * i7core_put_devices 'put' all the devices that we have 1258 * i7core_put_all_devices 'put' all the devices that we have
1259 * reserved via 'get' 1259 * reserved via 'get'
1260 */ 1260 */
1261static void i7core_put_devices(struct i7core_dev *i7core_dev) 1261static void i7core_put_devices(struct i7core_dev *i7core_dev)
@@ -1323,7 +1323,7 @@ static unsigned i7core_pci_lastbus(void)
1323} 1323}
1324 1324
1325/* 1325/*
1326 * i7core_get_devices Find and perform 'get' operation on the MCH's 1326 * i7core_get_all_devices Find and perform 'get' operation on the MCH's
1327 * device/functions we want to reference for this driver 1327 * device/functions we want to reference for this driver
1328 * 1328 *
1329 * Need to 'get' device 16 func 1 and func 2 1329 * Need to 'get' device 16 func 1 and func 2
@@ -1432,14 +1432,16 @@ static int i7core_get_onedevice(struct pci_dev **prev,
1432 return 0; 1432 return 0;
1433} 1433}
1434 1434
1435static int i7core_get_devices(const struct pci_id_table *table) 1435static int i7core_get_all_devices(void)
1436{ 1436{
1437 int i, rc, last_bus; 1437 int i, j, rc, last_bus;
1438 struct pci_dev *pdev = NULL; 1438 struct pci_dev *pdev = NULL;
1439 const struct pci_id_table *table;
1439 1440
1440 last_bus = i7core_pci_lastbus(); 1441 last_bus = i7core_pci_lastbus();
1441 1442
1442 while (table && table->descr) { 1443 for (j = 0; j < ARRAY_SIZE(pci_dev_table); j++) {
1444 table = &pci_dev_table[j];
1443 for (i = 0; i < table->n_devs; i++) { 1445 for (i = 0; i < table->n_devs; i++) {
1444 pdev = NULL; 1446 pdev = NULL;
1445 do { 1447 do {
@@ -1455,7 +1457,6 @@ static int i7core_get_devices(const struct pci_id_table *table)
1455 } 1457 }
1456 } while (pdev); 1458 } while (pdev);
1457 } 1459 }
1458 table++;
1459 } 1460 }
1460 1461
1461 return 0; 1462 return 0;
@@ -2033,7 +2034,7 @@ static int __devinit i7core_probe(struct pci_dev *pdev,
2033 } 2034 }
2034 probed++; 2035 probed++;
2035 2036
2036 rc = i7core_get_devices(pci_dev_table); 2037 rc = i7core_get_all_devices();
2037 if (unlikely(rc < 0)) 2038 if (unlikely(rc < 0))
2038 goto fail0; 2039 goto fail0;
2039 2040
@@ -2071,7 +2072,7 @@ fail0:
2071static void __devexit i7core_remove(struct pci_dev *pdev) 2072static void __devexit i7core_remove(struct pci_dev *pdev)
2072{ 2073{
2073 struct mem_ctl_info *mci; 2074 struct mem_ctl_info *mci;
2074 struct i7core_dev *i7core_dev, *tmp; 2075 struct i7core_dev *i7core_dev;
2075 struct i7core_pvt *pvt; 2076 struct i7core_pvt *pvt;
2076 2077
2077 debugf0(__FILE__ ": %s()\n", __func__); 2078 debugf0(__FILE__ ": %s()\n", __func__);
@@ -2085,7 +2086,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
2085 */ 2086 */
2086 2087
2087 mutex_lock(&i7core_edac_lock); 2088 mutex_lock(&i7core_edac_lock);
2088 list_for_each_entry_safe(i7core_dev, tmp, &i7core_edac_list, list) { 2089 list_for_each_entry(i7core_dev, &i7core_edac_list, list) {
2089 mci = find_mci_by_dev(&i7core_dev->pdev[0]->dev); 2090 mci = find_mci_by_dev(&i7core_dev->pdev[0]->dev);
2090 if (unlikely(!mci || !mci->pvt_info)) { 2091 if (unlikely(!mci || !mci->pvt_info)) {
2091 debugf0("MC: " __FILE__ ": %s(): dev = %p\n", 2092 debugf0("MC: " __FILE__ ": %s(): dev = %p\n",
@@ -2112,12 +2113,12 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
2112 debugf1("%s: free mci struct\n", mci->ctl_name); 2113 debugf1("%s: free mci struct\n", mci->ctl_name);
2113 kfree(mci->ctl_name); 2114 kfree(mci->ctl_name);
2114 edac_mc_free(mci); 2115 edac_mc_free(mci);
2115
2116 /* Release PCI resources */
2117 i7core_put_devices(i7core_dev);
2118 free_i7core_dev(i7core_dev);
2119 } 2116 }
2120 } 2117 }
2118
2119 /* Release PCI resources */
2120 i7core_put_all_devices();
2121
2121 probed--; 2122 probed--;
2122 2123
2123 mutex_unlock(&i7core_edac_lock); 2124 mutex_unlock(&i7core_edac_lock);