]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/powernv/pci: Add pci_bus_to_pnvhb() helper
authorOliver O'Halloran <oohall@gmail.com>
Wed, 22 Jul 2020 06:57:00 +0000 (16:57 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 26 Jul 2020 13:34:21 +0000 (23:34 +1000)
commit01c5fb4cd7683b119fee9b294e276a5e4a0cbb85
tree49e13b428f96dabcaf50159849bc90a7b3004274
parent9ab8816afbdafdba547376596fd2c2608e045e88
powerpc/powernv/pci: Add pci_bus_to_pnvhb() helper

Add a helper to go from a pci_bus structure to the pnv_phb that hosts
that bus. There's a lot of instances of the following pattern:

struct pci_controller *hose = pci_bus_to_host(pdev->bus);
struct pnv_phb *phb = hose->private_data;

Without any other uses of the pci_controller inside the function. This
is hard to read since it requires you to memorise the contents of the
private data fields and kind of error prone since it involves blindly
assigning a void pointer. Add a helper to make it more concise and
explicit.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200722065715.1432738-1-oohall@gmail.com
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/powernv/pci.c
arch/powerpc/platforms/powernv/pci.h