diff options
author | Daniel Axtens <dja@axtens.net> | 2015-03-31 01:00:45 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-04-11 06:49:13 -0400 |
commit | b31e79f8d92ca115a935e37cfd4da74048739689 (patch) | |
tree | 15152735740773a6145bc929bd291e3a456a55df /arch | |
parent | ff9df8c87d6807e90c5c3b0e1fd1649d09fd3bcd (diff) |
powerpc: Create pci_controller_ops.enable_device_hook and shim
Add pci_controller_ops.enable_device_hook,
shadowing ppc_md.pcibios_enable_device_hook.
Add a shim, and changes the callsites to use the shim.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 15 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 5 |
2 files changed, 17 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 278f48978bad..9d02ea6255ff 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -27,6 +27,10 @@ struct pci_controller_ops { | |||
27 | void (*dma_bus_setup)(struct pci_bus *bus); | 27 | void (*dma_bus_setup)(struct pci_bus *bus); |
28 | 28 | ||
29 | int (*probe_mode)(struct pci_bus *); | 29 | int (*probe_mode)(struct pci_bus *); |
30 | |||
31 | /* Called when pci_enable_device() is called. Returns true to | ||
32 | * allow assignment/enabling of the device. */ | ||
33 | bool (*enable_device_hook)(struct pci_dev *); | ||
30 | }; | 34 | }; |
31 | 35 | ||
32 | /* | 36 | /* |
@@ -310,5 +314,16 @@ static inline int pci_probe_mode(struct pci_bus *bus) | |||
310 | return PCI_PROBE_NORMAL; | 314 | return PCI_PROBE_NORMAL; |
311 | } | 315 | } |
312 | 316 | ||
317 | static inline bool pcibios_enable_device_hook(struct pci_dev *dev) | ||
318 | { | ||
319 | struct pci_controller *phb = pci_bus_to_host(dev->bus); | ||
320 | |||
321 | if (phb->controller_ops.enable_device_hook) | ||
322 | return phb->controller_ops.enable_device_hook(dev); | ||
323 | if (ppc_md.pcibios_enable_device_hook) | ||
324 | return ppc_md.pcibios_enable_device_hook(dev); | ||
325 | return true; | ||
326 | } | ||
327 | |||
313 | #endif /* __KERNEL__ */ | 328 | #endif /* __KERNEL__ */ |
314 | #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ | 329 | #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index b0de23c89ca5..8639e9cd65d5 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1448,9 +1448,8 @@ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); | |||
1448 | 1448 | ||
1449 | int pcibios_enable_device(struct pci_dev *dev, int mask) | 1449 | int pcibios_enable_device(struct pci_dev *dev, int mask) |
1450 | { | 1450 | { |
1451 | if (ppc_md.pcibios_enable_device_hook) | 1451 | if (!pcibios_enable_device_hook(dev)) |
1452 | if (!ppc_md.pcibios_enable_device_hook(dev)) | 1452 | return -EINVAL; |
1453 | return -EINVAL; | ||
1454 | 1453 | ||
1455 | return pci_enable_resources(dev, mask); | 1454 | return pci_enable_resources(dev, mask); |
1456 | } | 1455 | } |