diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2015-10-07 23:58:58 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-10-21 05:42:15 -0400 |
commit | 4d6186ca6f55b2f71be643af8a112c25e58ac516 (patch) | |
tree | daab7c37b1f1c276f4ed6a356c4d2e56d8817339 | |
parent | 608fb9c29660aca2845ba0730c514032c493a28f (diff) |
powerpc/powernv: Remove pnv_eeh_cap_start()
This moves the logic of pnv_eeh_cap_start() to pnv_eeh_find_cap()
as the function is only called by pnv_eeh_find_cap(). The logic
of both functions are pretty simple. No need to have separate
functions.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/platforms/powernv/eeh-powernv.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c index 2032936bdc62..2b5c70b54814 100644 --- a/arch/powerpc/platforms/powernv/eeh-powernv.c +++ b/arch/powerpc/platforms/powernv/eeh-powernv.c | |||
@@ -281,29 +281,20 @@ static int pnv_eeh_post_init(void) | |||
281 | return ret; | 281 | return ret; |
282 | } | 282 | } |
283 | 283 | ||
284 | static int pnv_eeh_cap_start(struct pci_dn *pdn) | 284 | static int pnv_eeh_find_cap(struct pci_dn *pdn, int cap) |
285 | { | 285 | { |
286 | u32 status; | 286 | int pos = PCI_CAPABILITY_LIST; |
287 | int cnt = 48; /* Maximal number of capabilities */ | ||
288 | u32 status, id; | ||
287 | 289 | ||
288 | if (!pdn) | 290 | if (!pdn) |
289 | return 0; | 291 | return 0; |
290 | 292 | ||
293 | /* Check if the device supports capabilities */ | ||
291 | pnv_pci_cfg_read(pdn, PCI_STATUS, 2, &status); | 294 | pnv_pci_cfg_read(pdn, PCI_STATUS, 2, &status); |
292 | if (!(status & PCI_STATUS_CAP_LIST)) | 295 | if (!(status & PCI_STATUS_CAP_LIST)) |
293 | return 0; | 296 | return 0; |
294 | 297 | ||
295 | return PCI_CAPABILITY_LIST; | ||
296 | } | ||
297 | |||
298 | static int pnv_eeh_find_cap(struct pci_dn *pdn, int cap) | ||
299 | { | ||
300 | int pos = pnv_eeh_cap_start(pdn); | ||
301 | int cnt = 48; /* Maximal number of capabilities */ | ||
302 | u32 id; | ||
303 | |||
304 | if (!pos) | ||
305 | return 0; | ||
306 | |||
307 | while (cnt--) { | 298 | while (cnt--) { |
308 | pnv_pci_cfg_read(pdn, pos, 1, &pos); | 299 | pnv_pci_cfg_read(pdn, pos, 1, &pos); |
309 | if (pos < 0x40) | 300 | if (pos < 0x40) |