diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-05 11:15:20 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-10 10:44:59 -0400 |
commit | 13d6e9b653e6f714024c67287c7d7eac54d8417b (patch) | |
tree | 9ce3a9e6621c97e96d6638ffb88957b398ca4757 /drivers/edac | |
parent | d88b85072fa7d406f54c30ceeabcd37e5a2ec21a (diff) |
i7core_edac: at remove, don't remove all pci devices at once
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r-- | drivers/edac/i7core_edac.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 821e8a1a09cf..c2266f820b0f 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1135,22 +1135,24 @@ static struct mcidev_sysfs_attribute i7core_inj_attrs[] = { | |||
1135 | * i7core_put_devices 'put' all the devices that we have | 1135 | * i7core_put_devices 'put' all the devices that we have |
1136 | * reserved via 'get' | 1136 | * reserved via 'get' |
1137 | */ | 1137 | */ |
1138 | static void i7core_put_devices(void) | 1138 | static void i7core_put_devices(struct i7core_dev *i7core_dev) |
1139 | { | 1139 | { |
1140 | int i, j; | 1140 | int i; |
1141 | 1141 | ||
1142 | for (i = 0; i < max_num_sockets; i++) { | 1142 | for (i = 0; i < N_DEVS; i++) |
1143 | struct i7core_dev *i7core_dev = get_i7core_dev(i); | 1143 | pci_dev_put(i7core_dev->pdev[i]); |
1144 | if (!i7core_dev) | ||
1145 | continue; | ||
1146 | 1144 | ||
1147 | for (j = 0; j < N_DEVS; j++) | 1145 | list_del(&i7core_dev->list); |
1148 | pci_dev_put(i7core_dev->pdev[j]); | 1146 | kfree(i7core_dev->pdev); |
1147 | kfree(i7core_dev); | ||
1148 | } | ||
1149 | 1149 | ||
1150 | list_del(&i7core_dev->list); | 1150 | static void i7core_put_all_devices(void) |
1151 | kfree(i7core_dev->pdev); | 1151 | { |
1152 | kfree(i7core_dev); | 1152 | struct i7core_dev *i7core_dev; |
1153 | } | 1153 | |
1154 | list_for_each_entry(i7core_dev, &i7core_edac_list, list) | ||
1155 | i7core_put_devices(i7core_dev); | ||
1154 | } | 1156 | } |
1155 | 1157 | ||
1156 | static void i7core_xeon_pci_fixup(void) | 1158 | static void i7core_xeon_pci_fixup(void) |
@@ -1292,7 +1294,7 @@ static int i7core_get_devices(void) | |||
1292 | pdev = NULL; | 1294 | pdev = NULL; |
1293 | do { | 1295 | do { |
1294 | if (i7core_get_onedevice(&pdev, i) < 0) { | 1296 | if (i7core_get_onedevice(&pdev, i) < 0) { |
1295 | i7core_put_devices(); | 1297 | i7core_put_all_devices(); |
1296 | return -ENODEV; | 1298 | return -ENODEV; |
1297 | } | 1299 | } |
1298 | } while (pdev); | 1300 | } while (pdev); |
@@ -1849,7 +1851,7 @@ static int __devinit i7core_probe(struct pci_dev *pdev, | |||
1849 | return 0; | 1851 | return 0; |
1850 | 1852 | ||
1851 | fail1: | 1853 | fail1: |
1852 | i7core_put_devices(); | 1854 | i7core_put_all_devices(); |
1853 | fail0: | 1855 | fail0: |
1854 | mutex_unlock(&i7core_edac_lock); | 1856 | mutex_unlock(&i7core_edac_lock); |
1855 | return rc; | 1857 | return rc; |
@@ -1863,6 +1865,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev) | |||
1863 | { | 1865 | { |
1864 | struct mem_ctl_info *mci; | 1866 | struct mem_ctl_info *mci; |
1865 | struct i7core_pvt *pvt; | 1867 | struct i7core_pvt *pvt; |
1868 | struct i7core_dev *i7core_dev; | ||
1866 | 1869 | ||
1867 | debugf0(__FILE__ ": %s()\n", __func__); | 1870 | debugf0(__FILE__ ": %s()\n", __func__); |
1868 | 1871 | ||
@@ -1876,13 +1879,12 @@ static void __devexit i7core_remove(struct pci_dev *pdev) | |||
1876 | 1879 | ||
1877 | /* Unregisters on edac_mce in order to receive memory errors */ | 1880 | /* Unregisters on edac_mce in order to receive memory errors */ |
1878 | pvt = mci->pvt_info; | 1881 | pvt = mci->pvt_info; |
1882 | i7core_dev = pvt->i7core_dev; | ||
1879 | edac_mce_unregister(&pvt->edac_mce); | 1883 | edac_mce_unregister(&pvt->edac_mce); |
1880 | 1884 | ||
1881 | /* retrieve references to resources, and free those resources */ | 1885 | /* retrieve references to resources, and free those resources */ |
1882 | mutex_lock(&i7core_edac_lock); | 1886 | mutex_lock(&i7core_edac_lock); |
1883 | 1887 | i7core_put_devices(i7core_dev); | |
1884 | /* FIXME: This should put the devices only for this mci!!! */ | ||
1885 | i7core_put_devices(); | ||
1886 | mutex_unlock(&i7core_edac_lock); | 1888 | mutex_unlock(&i7core_edac_lock); |
1887 | 1889 | ||
1888 | kfree(mci->ctl_name); | 1890 | kfree(mci->ctl_name); |