diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2013-07-23 22:24:51 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-07-24 00:18:46 -0400 |
commit | 0ba178888b05a4efdaca7da528c170bd09f9687b (patch) | |
tree | 9dbd6b9d409357ff207e3ed7b762b9f494bbba7b | |
parent | ee1dd1e3dc774cf257012215d996e8e7e370c162 (diff) |
powerpc/eeh: Remove reference to PCI device
We will rely on pcibios_release_device() to remove the EEH cache
and unbind EEH device for the specific PCI device. So we shouldn't
hold the reference to the PCI device from EEH cache and EEH device.
Otherwise, pcibios_release_device() won't be called as we expected.
The patch removes the reference to the PCI device in EEH core.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/eeh.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/eeh_cache.c | 18 |
2 files changed, 5 insertions, 17 deletions
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c index 39954fe941b8..b5c425ea2974 100644 --- a/arch/powerpc/kernel/eeh.c +++ b/arch/powerpc/kernel/eeh.c | |||
@@ -499,8 +499,6 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon | |||
499 | } | 499 | } |
500 | 500 | ||
501 | eeh_dev_check_failure(edev); | 501 | eeh_dev_check_failure(edev); |
502 | |||
503 | pci_dev_put(eeh_dev_to_pci_dev(edev)); | ||
504 | return val; | 502 | return val; |
505 | } | 503 | } |
506 | 504 | ||
@@ -904,7 +902,6 @@ static void eeh_add_device_late(struct pci_dev *dev) | |||
904 | } | 902 | } |
905 | WARN_ON(edev->pdev); | 903 | WARN_ON(edev->pdev); |
906 | 904 | ||
907 | pci_dev_get(dev); | ||
908 | edev->pdev = dev; | 905 | edev->pdev = dev; |
909 | dev->dev.archdata.edev = edev; | 906 | dev->dev.archdata.edev = edev; |
910 | 907 | ||
@@ -992,7 +989,6 @@ static void eeh_remove_device(struct pci_dev *dev, int purge_pe) | |||
992 | } | 989 | } |
993 | edev->pdev = NULL; | 990 | edev->pdev = NULL; |
994 | dev->dev.archdata.edev = NULL; | 991 | dev->dev.archdata.edev = NULL; |
995 | pci_dev_put(dev); | ||
996 | 992 | ||
997 | eeh_rmv_from_parent_pe(edev, purge_pe); | 993 | eeh_rmv_from_parent_pe(edev, purge_pe); |
998 | eeh_addr_cache_rmv_dev(dev); | 994 | eeh_addr_cache_rmv_dev(dev); |
diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c index f9ac1232a746..e8c9fd546a5c 100644 --- a/arch/powerpc/kernel/eeh_cache.c +++ b/arch/powerpc/kernel/eeh_cache.c | |||
@@ -68,16 +68,12 @@ static inline struct eeh_dev *__eeh_addr_cache_get_device(unsigned long addr) | |||
68 | struct pci_io_addr_range *piar; | 68 | struct pci_io_addr_range *piar; |
69 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); | 69 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); |
70 | 70 | ||
71 | if (addr < piar->addr_lo) { | 71 | if (addr < piar->addr_lo) |
72 | n = n->rb_left; | 72 | n = n->rb_left; |
73 | } else { | 73 | else if (addr > piar->addr_hi) |
74 | if (addr > piar->addr_hi) { | 74 | n = n->rb_right; |
75 | n = n->rb_right; | 75 | else |
76 | } else { | 76 | return piar->edev; |
77 | pci_dev_get(piar->pcidev); | ||
78 | return piar->edev; | ||
79 | } | ||
80 | } | ||
81 | } | 77 | } |
82 | 78 | ||
83 | return NULL; | 79 | return NULL; |
@@ -156,7 +152,6 @@ eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
156 | if (!piar) | 152 | if (!piar) |
157 | return NULL; | 153 | return NULL; |
158 | 154 | ||
159 | pci_dev_get(dev); | ||
160 | piar->addr_lo = alo; | 155 | piar->addr_lo = alo; |
161 | piar->addr_hi = ahi; | 156 | piar->addr_hi = ahi; |
162 | piar->edev = pci_dev_to_eeh_dev(dev); | 157 | piar->edev = pci_dev_to_eeh_dev(dev); |
@@ -250,7 +245,6 @@ restart: | |||
250 | 245 | ||
251 | if (piar->pcidev == dev) { | 246 | if (piar->pcidev == dev) { |
252 | rb_erase(n, &pci_io_addr_cache_root.rb_root); | 247 | rb_erase(n, &pci_io_addr_cache_root.rb_root); |
253 | pci_dev_put(piar->pcidev); | ||
254 | kfree(piar); | 248 | kfree(piar); |
255 | goto restart; | 249 | goto restart; |
256 | } | 250 | } |
@@ -302,12 +296,10 @@ void eeh_addr_cache_build(void) | |||
302 | if (!edev) | 296 | if (!edev) |
303 | continue; | 297 | continue; |
304 | 298 | ||
305 | pci_dev_get(dev); /* matching put is in eeh_remove_device() */ | ||
306 | dev->dev.archdata.edev = edev; | 299 | dev->dev.archdata.edev = edev; |
307 | edev->pdev = dev; | 300 | edev->pdev = dev; |
308 | 301 | ||
309 | eeh_addr_cache_insert_dev(dev); | 302 | eeh_addr_cache_insert_dev(dev); |
310 | |||
311 | eeh_sysfs_add_device(dev); | 303 | eeh_sysfs_add_device(dev); |
312 | } | 304 | } |
313 | 305 | ||