Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303028 > unrolled thread

[PATCH 0/2] PCI: designware: Simplify config accessors

Started byBjorn Helgaas <bhelgaas@google.com>
First post2016-01-06 21:00 +0100
Last post2016-01-07 18:30 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] PCI: designware: Simplify config accessors Bjorn Helgaas <bhelgaas@google.com> - 2016-01-06 21:00 +0100
    [PATCH 2/2] PCI: designware: Make config accessor override checking  symmetric Bjorn Helgaas <bhelgaas@google.com> - 2016-01-06 21:00 +0100
    Re: [PATCH 0/2] PCI: designware: Simplify config accessors Pratyush Anand <pratyush.anand@gmail.com> - 2016-01-07 11:30 +0100
    Re: [PATCH 0/2] PCI: designware: Simplify config accessors Bjorn Helgaas <helgaas@kernel.org> - 2016-01-07 18:30 +0100

#1303028 — [PATCH 0/2] PCI: designware: Simplify config accessors

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-01-06 21:00 +0100
Subject[PATCH 0/2] PCI: designware: Simplify config accessors
Message-ID<qO2ps-5zb-5@gated-at.bofh.it>
These make the code slightly smaller and easier to read but shouldn't make
any functional difference.

---

Bjorn Helgaas (2):
      PCI: designware: Simplify control flow
      PCI: designware: Make config accessor override checking symmetric


 drivers/pci/host/pcie-designware.c |   53 ++++++++++++------------------------
 1 file changed, 18 insertions(+), 35 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1303029 — [PATCH 2/2] PCI: designware: Make config accessor override checking symmetric

FromBjorn Helgaas <bhelgaas@google.com>
Date2016-01-06 21:00 +0100
Subject[PATCH 2/2] PCI: designware: Make config accessor override checking symmetric
Message-ID<qO2ps-5zb-7@gated-at.bofh.it>
In reply to#1303028
Drivers based on the DesignWare core can override the config read accessors
by supplying rd_own_conf() and rd_other_conf() function pointers.
dw_pcie_rd_conf() calls dw_pcie_rd_own_conf() (for accesses to the root
bus) or dw_pcie_rd_other_conf():

  dw_pcie_rd_conf
    dw_pcie_rd_own_conf                # if on root bus
    dw_pcie_rd_other_conf              # if not on root bus

Previously we checked for rd_other_conf() directly in dw_pcie_rd_conf(),
but we checked for rd_own_conf() in dw_pcie_rd_own_conf().

Check for rd_other_conf() in dw_pcie_rd_other_conf() to make this symmetric
with the rd_own_conf() checking, and similarly for the write path.

No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-designware.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index c104bad..7a4ee06 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -564,6 +564,9 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
 	u64 cpu_addr;
 	void __iomem *va_cfg_base;
 
+	if (pp->ops->rd_other_conf)
+		return pp->ops->rd_other_conf(pp, bus, devfn, where, size, val);
+
 	busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) |
 		 PCIE_ATU_FUNC(PCI_FUNC(devfn));
 
@@ -598,6 +601,9 @@ static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
 	u64 cpu_addr;
 	void __iomem *va_cfg_base;
 
+	if (pp->ops->wr_other_conf)
+		return pp->ops->wr_other_conf(pp, bus, devfn, where, size, val);
+
 	busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) |
 		 PCIE_ATU_FUNC(PCI_FUNC(devfn));
 
@@ -660,9 +666,6 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
 	if (bus->number == pp->root_bus_nr)
 		return dw_pcie_rd_own_conf(pp, where, size, val);
 
-	if (pp->ops->rd_other_conf)
-		return pp->ops->rd_other_conf(pp, bus, devfn, where, size, val);
-
 	return dw_pcie_rd_other_conf(pp, bus, devfn, where, size, val);
 }
 
@@ -678,9 +681,6 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
 	if (bus->number == pp->root_bus_nr)
 		return dw_pcie_wr_own_conf(pp, where, size, val);
 
-	if (pp->ops->wr_other_conf)
-		return pp->ops->wr_other_conf(pp, bus, devfn, where, size, val);
-
 	return dw_pcie_wr_other_conf(pp, bus, devfn, where, size, val);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1303463

FromPratyush Anand <pratyush.anand@gmail.com>
Date2016-01-07 11:30 +0100
Message-ID<qOfZo-6MT-5@gated-at.bofh.it>
In reply to#1303028
On Thu, Jan 7, 2016 at 1:24 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> These make the code slightly smaller and easier to read but shouldn't make
> any functional difference.
>
> ---
>
> Bjorn Helgaas (2):
>       PCI: designware: Simplify control flow
>       PCI: designware: Make config accessor override checking symmetric
>

For both the patches
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>

>
>  drivers/pci/host/pcie-designware.c |   53 ++++++++++++------------------------
>  1 file changed, 18 insertions(+), 35 deletions(-)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1303751

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-01-07 18:30 +0100
Message-ID<qOmxQ-2P2-19@gated-at.bofh.it>
In reply to#1303028
On Wed, Jan 06, 2016 at 01:54:59PM -0600, Bjorn Helgaas wrote:
> These make the code slightly smaller and easier to read but shouldn't make
> any functional difference.
> 
> ---
> 
> Bjorn Helgaas (2):
>       PCI: designware: Simplify control flow
>       PCI: designware: Make config accessor override checking symmetric

Applied with Pratyush's ack to pci/host-designware for v4.5.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web