[PATCH 05/10] PCI: ixp4xx: Use generic PCI Conf Type 0 helper

Ilpo Järvinen posted 10 patches 1 year, 7 months ago
[PATCH 05/10] PCI: ixp4xx: Use generic PCI Conf Type 0 helper
Posted by Ilpo Järvinen 1 year, 7 months ago
Convert Type 0 address calculation to use pci_conf0_offset() instead of
abusing PCI_CONF1_ADDRESS().

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/pci/controller/pci-ixp4xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pci-ixp4xx.c b/drivers/pci/controller/pci-ixp4xx.c
index acb85e0d5675..44639838df9c 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -188,8 +188,8 @@ static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
 	/* Root bus is always 0 in this hardware */
 	if (bus_num == 0) {
 		/* type 0 */
-		return (PCI_CONF1_ADDRESS(0, 0, PCI_FUNC(devfn), where) &
-			~PCI_CONF1_ENABLE) | BIT(32-PCI_SLOT(devfn));
+		return pci_conf0_addr(devfn, where) |
+		       BIT(32 - PCI_SLOT(devfn));
 	} else {
 		/* type 1 */
 		return (PCI_CONF1_ADDRESS(bus_num, PCI_SLOT(devfn),
-- 
2.39.2

Re: [PATCH 05/10] PCI: ixp4xx: Use generic PCI Conf Type 0 helper
Posted by Linus Walleij 1 year, 7 months ago
On Mon, Apr 29, 2024 at 12:47 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:

> Convert Type 0 address calculation to use pci_conf0_offset() instead of
> abusing PCI_CONF1_ADDRESS().
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Looks better indeed.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij