diff options
author | Gavin Shan <shangw@linux.vnet.ibm.com> | 2012-09-07 18:44:23 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-09-09 19:59:00 -0400 |
commit | 3ab96a02e829131c19db8ed99239289acdb4e3dc (patch) | |
tree | 62297fb6878c446de16ed601c00e679831d4c94b /arch/powerpc/platforms | |
parent | f8f7d63fd96ead101415a1302035137a866f8998 (diff) |
powerpc/eeh: Cleanup on EEH PCI address cache
The patch does cleanup on EEH PCI address cache based on the fact
EEH core is the only user of the component.
* Cleanup on function names so that they all have prefix
"eeh" and looks more short.
* Function printk() has been replaced with pr_debug() or
pr_warning() accordingly.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/eeh_cache.c | 46 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/pci.c | 2 |
3 files changed, 27 insertions, 27 deletions
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 9e618424b187..18c168b752da 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -411,7 +411,7 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon | |||
411 | 411 | ||
412 | /* Finding the phys addr + pci device; this is pretty quick. */ | 412 | /* Finding the phys addr + pci device; this is pretty quick. */ |
413 | addr = eeh_token_to_phys((unsigned long __force) token); | 413 | addr = eeh_token_to_phys((unsigned long __force) token); |
414 | edev = pci_addr_cache_get_device(addr); | 414 | edev = eeh_addr_cache_get_dev(addr); |
415 | if (!edev) { | 415 | if (!edev) { |
416 | eeh_stats.no_device++; | 416 | eeh_stats.no_device++; |
417 | return val; | 417 | return val; |
@@ -787,7 +787,7 @@ static void eeh_add_device_late(struct pci_dev *dev) | |||
787 | edev->pdev = dev; | 787 | edev->pdev = dev; |
788 | dev->dev.archdata.edev = edev; | 788 | dev->dev.archdata.edev = edev; |
789 | 789 | ||
790 | pci_addr_cache_insert_device(dev); | 790 | eeh_addr_cache_insert_dev(dev); |
791 | eeh_sysfs_add_device(dev); | 791 | eeh_sysfs_add_device(dev); |
792 | } | 792 | } |
793 | 793 | ||
@@ -844,7 +844,7 @@ static void eeh_remove_device(struct pci_dev *dev) | |||
844 | pci_dev_put(dev); | 844 | pci_dev_put(dev); |
845 | 845 | ||
846 | eeh_rmv_from_parent_pe(edev); | 846 | eeh_rmv_from_parent_pe(edev); |
847 | pci_addr_cache_remove_device(dev); | 847 | eeh_addr_cache_rmv_dev(dev); |
848 | eeh_sysfs_remove_device(dev); | 848 | eeh_sysfs_remove_device(dev); |
849 | } | 849 | } |
850 | 850 | ||
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c index 6c5ef757f4d4..5a4c87903057 100644 --- a/arch/powerpc/platforms/pseries/eeh_cache.c +++ b/arch/powerpc/platforms/pseries/eeh_cache.c | |||
@@ -60,7 +60,7 @@ static struct pci_io_addr_cache { | |||
60 | spinlock_t piar_lock; | 60 | spinlock_t piar_lock; |
61 | } pci_io_addr_cache_root; | 61 | } pci_io_addr_cache_root; |
62 | 62 | ||
63 | static inline struct eeh_dev *__pci_addr_cache_get_device(unsigned long addr) | 63 | static inline struct eeh_dev *__eeh_addr_cache_get_device(unsigned long addr) |
64 | { | 64 | { |
65 | struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; | 65 | struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; |
66 | 66 | ||
@@ -84,7 +84,7 @@ static inline struct eeh_dev *__pci_addr_cache_get_device(unsigned long addr) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * pci_addr_cache_get_device - Get device, given only address | 87 | * eeh_addr_cache_get_dev - Get device, given only address |
88 | * @addr: mmio (PIO) phys address or i/o port number | 88 | * @addr: mmio (PIO) phys address or i/o port number |
89 | * | 89 | * |
90 | * Given an mmio phys address, or a port number, find a pci device | 90 | * Given an mmio phys address, or a port number, find a pci device |
@@ -93,13 +93,13 @@ static inline struct eeh_dev *__pci_addr_cache_get_device(unsigned long addr) | |||
93 | * from zero (that is, they do *not* have pci_io_addr added in). | 93 | * from zero (that is, they do *not* have pci_io_addr added in). |
94 | * It is safe to call this function within an interrupt. | 94 | * It is safe to call this function within an interrupt. |
95 | */ | 95 | */ |
96 | struct eeh_dev *pci_addr_cache_get_device(unsigned long addr) | 96 | struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr) |
97 | { | 97 | { |
98 | struct eeh_dev *edev; | 98 | struct eeh_dev *edev; |
99 | unsigned long flags; | 99 | unsigned long flags; |
100 | 100 | ||
101 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); | 101 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); |
102 | edev = __pci_addr_cache_get_device(addr); | 102 | edev = __eeh_addr_cache_get_device(addr); |
103 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); | 103 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); |
104 | return edev; | 104 | return edev; |
105 | } | 105 | } |
@@ -109,7 +109,7 @@ struct eeh_dev *pci_addr_cache_get_device(unsigned long addr) | |||
109 | * Handy-dandy debug print routine, does nothing more | 109 | * Handy-dandy debug print routine, does nothing more |
110 | * than print out the contents of our addr cache. | 110 | * than print out the contents of our addr cache. |
111 | */ | 111 | */ |
112 | static void pci_addr_cache_print(struct pci_io_addr_cache *cache) | 112 | static void eeh_addr_cache_print(struct pci_io_addr_cache *cache) |
113 | { | 113 | { |
114 | struct rb_node *n; | 114 | struct rb_node *n; |
115 | int cnt = 0; | 115 | int cnt = 0; |
@@ -118,7 +118,7 @@ static void pci_addr_cache_print(struct pci_io_addr_cache *cache) | |||
118 | while (n) { | 118 | while (n) { |
119 | struct pci_io_addr_range *piar; | 119 | struct pci_io_addr_range *piar; |
120 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); | 120 | piar = rb_entry(n, struct pci_io_addr_range, rb_node); |
121 | printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n", | 121 | pr_debug("PCI: %s addr range %d [%lx-%lx]: %s\n", |
122 | (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, | 122 | (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, |
123 | piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); | 123 | piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); |
124 | cnt++; | 124 | cnt++; |
@@ -129,7 +129,7 @@ static void pci_addr_cache_print(struct pci_io_addr_cache *cache) | |||
129 | 129 | ||
130 | /* Insert address range into the rb tree. */ | 130 | /* Insert address range into the rb tree. */ |
131 | static struct pci_io_addr_range * | 131 | static struct pci_io_addr_range * |
132 | pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | 132 | eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo, |
133 | unsigned long ahi, unsigned int flags) | 133 | unsigned long ahi, unsigned int flags) |
134 | { | 134 | { |
135 | struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; | 135 | struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; |
@@ -147,7 +147,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
147 | } else { | 147 | } else { |
148 | if (dev != piar->pcidev || | 148 | if (dev != piar->pcidev || |
149 | alo != piar->addr_lo || ahi != piar->addr_hi) { | 149 | alo != piar->addr_lo || ahi != piar->addr_hi) { |
150 | printk(KERN_WARNING "PIAR: overlapping address range\n"); | 150 | pr_warning("PIAR: overlapping address range\n"); |
151 | } | 151 | } |
152 | return piar; | 152 | return piar; |
153 | } | 153 | } |
@@ -164,7 +164,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
164 | piar->flags = flags; | 164 | piar->flags = flags; |
165 | 165 | ||
166 | #ifdef DEBUG | 166 | #ifdef DEBUG |
167 | printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", | 167 | pr_debug("PIAR: insert range=[%lx:%lx] dev=%s\n", |
168 | alo, ahi, pci_name(dev)); | 168 | alo, ahi, pci_name(dev)); |
169 | #endif | 169 | #endif |
170 | 170 | ||
@@ -174,7 +174,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, | |||
174 | return piar; | 174 | return piar; |
175 | } | 175 | } |
176 | 176 | ||
177 | static void __pci_addr_cache_insert_device(struct pci_dev *dev) | 177 | static void __eeh_addr_cache_insert_dev(struct pci_dev *dev) |
178 | { | 178 | { |
179 | struct device_node *dn; | 179 | struct device_node *dn; |
180 | struct eeh_dev *edev; | 180 | struct eeh_dev *edev; |
@@ -182,7 +182,7 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) | |||
182 | 182 | ||
183 | dn = pci_device_to_OF_node(dev); | 183 | dn = pci_device_to_OF_node(dev); |
184 | if (!dn) { | 184 | if (!dn) { |
185 | printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev)); | 185 | pr_warning("PCI: no pci dn found for dev=%s\n", pci_name(dev)); |
186 | return; | 186 | return; |
187 | } | 187 | } |
188 | 188 | ||
@@ -213,19 +213,19 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev) | |||
213 | continue; | 213 | continue; |
214 | if (start == 0 || ~start == 0 || end == 0 || ~end == 0) | 214 | if (start == 0 || ~start == 0 || end == 0 || ~end == 0) |
215 | continue; | 215 | continue; |
216 | pci_addr_cache_insert(dev, start, end, flags); | 216 | eeh_addr_cache_insert(dev, start, end, flags); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | /** | 220 | /** |
221 | * pci_addr_cache_insert_device - Add a device to the address cache | 221 | * eeh_addr_cache_insert_dev - Add a device to the address cache |
222 | * @dev: PCI device whose I/O addresses we are interested in. | 222 | * @dev: PCI device whose I/O addresses we are interested in. |
223 | * | 223 | * |
224 | * In order to support the fast lookup of devices based on addresses, | 224 | * In order to support the fast lookup of devices based on addresses, |
225 | * we maintain a cache of devices that can be quickly searched. | 225 | * we maintain a cache of devices that can be quickly searched. |
226 | * This routine adds a device to that cache. | 226 | * This routine adds a device to that cache. |
227 | */ | 227 | */ |
228 | void pci_addr_cache_insert_device(struct pci_dev *dev) | 228 | void eeh_addr_cache_insert_dev(struct pci_dev *dev) |
229 | { | 229 | { |
230 | unsigned long flags; | 230 | unsigned long flags; |
231 | 231 | ||
@@ -234,11 +234,11 @@ void pci_addr_cache_insert_device(struct pci_dev *dev) | |||
234 | return; | 234 | return; |
235 | 235 | ||
236 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); | 236 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); |
237 | __pci_addr_cache_insert_device(dev); | 237 | __eeh_addr_cache_insert_dev(dev); |
238 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); | 238 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); |
239 | } | 239 | } |
240 | 240 | ||
241 | static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) | 241 | static inline void __eeh_addr_cache_rmv_dev(struct pci_dev *dev) |
242 | { | 242 | { |
243 | struct rb_node *n; | 243 | struct rb_node *n; |
244 | 244 | ||
@@ -259,7 +259,7 @@ restart: | |||
259 | } | 259 | } |
260 | 260 | ||
261 | /** | 261 | /** |
262 | * pci_addr_cache_remove_device - remove pci device from addr cache | 262 | * eeh_addr_cache_rmv_dev - remove pci device from addr cache |
263 | * @dev: device to remove | 263 | * @dev: device to remove |
264 | * | 264 | * |
265 | * Remove a device from the addr-cache tree. | 265 | * Remove a device from the addr-cache tree. |
@@ -267,17 +267,17 @@ restart: | |||
267 | * the tree multiple times (once per resource). | 267 | * the tree multiple times (once per resource). |
268 | * But so what; device removal doesn't need to be that fast. | 268 | * But so what; device removal doesn't need to be that fast. |
269 | */ | 269 | */ |
270 | void pci_addr_cache_remove_device(struct pci_dev *dev) | 270 | void eeh_addr_cache_rmv_dev(struct pci_dev *dev) |
271 | { | 271 | { |
272 | unsigned long flags; | 272 | unsigned long flags; |
273 | 273 | ||
274 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); | 274 | spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); |
275 | __pci_addr_cache_remove_device(dev); | 275 | __eeh_addr_cache_rmv_dev(dev); |
276 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); | 276 | spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); |
277 | } | 277 | } |
278 | 278 | ||
279 | /** | 279 | /** |
280 | * pci_addr_cache_build - Build a cache of I/O addresses | 280 | * eeh_addr_cache_build - Build a cache of I/O addresses |
281 | * | 281 | * |
282 | * Build a cache of pci i/o addresses. This cache will be used to | 282 | * Build a cache of pci i/o addresses. This cache will be used to |
283 | * find the pci device that corresponds to a given address. | 283 | * find the pci device that corresponds to a given address. |
@@ -285,7 +285,7 @@ void pci_addr_cache_remove_device(struct pci_dev *dev) | |||
285 | * Must be run late in boot process, after the pci controllers | 285 | * Must be run late in boot process, after the pci controllers |
286 | * have been scanned for devices (after all device resources are known). | 286 | * have been scanned for devices (after all device resources are known). |
287 | */ | 287 | */ |
288 | void __init pci_addr_cache_build(void) | 288 | void __init eeh_addr_cache_build(void) |
289 | { | 289 | { |
290 | struct device_node *dn; | 290 | struct device_node *dn; |
291 | struct eeh_dev *edev; | 291 | struct eeh_dev *edev; |
@@ -294,7 +294,7 @@ void __init pci_addr_cache_build(void) | |||
294 | spin_lock_init(&pci_io_addr_cache_root.piar_lock); | 294 | spin_lock_init(&pci_io_addr_cache_root.piar_lock); |
295 | 295 | ||
296 | for_each_pci_dev(dev) { | 296 | for_each_pci_dev(dev) { |
297 | pci_addr_cache_insert_device(dev); | 297 | eeh_addr_cache_insert_dev(dev); |
298 | 298 | ||
299 | dn = pci_device_to_OF_node(dev); | 299 | dn = pci_device_to_OF_node(dev); |
300 | if (!dn) | 300 | if (!dn) |
@@ -313,7 +313,7 @@ void __init pci_addr_cache_build(void) | |||
313 | 313 | ||
314 | #ifdef DEBUG | 314 | #ifdef DEBUG |
315 | /* Verify tree built up above, echo back the list of addrs. */ | 315 | /* Verify tree built up above, echo back the list of addrs. */ |
316 | pci_addr_cache_print(&pci_io_addr_cache_root); | 316 | eeh_addr_cache_print(&pci_io_addr_cache_root); |
317 | #endif | 317 | #endif |
318 | } | 318 | } |
319 | 319 | ||
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index 2c6ded29f73d..56b864d777ee 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c | |||
@@ -73,7 +73,7 @@ void __init pSeries_final_fixup(void) | |||
73 | { | 73 | { |
74 | pSeries_request_regions(); | 74 | pSeries_request_regions(); |
75 | 75 | ||
76 | pci_addr_cache_build(); | 76 | eeh_addr_cache_build(); |
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |