diff mbox series

[10/13] PCI: aardvark: Simplify initialization of rootcap on virtual bridge

Message ID 20211001195856.10081-11-kabel@kernel.org (mailing list archive)
State Superseded
Delegated to: Lorenzo Pieralisi
Headers show
Series PCI: aardvark controller fixes | expand

Commit Message

Marek Behún Oct. 1, 2021, 7:58 p.m. UTC
From: Pali Rohár <pali@kernel.org>

PCIe config space can be initialized also before pci_bridge_emul_init()
call, so move rootcap initialization after PCI config space initialization.

This simplifies the function a little since it removes one if (ret < 0)
check.

Fixes: 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/pci/controller/pci-aardvark.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Lorenzo Pieralisi Oct. 4, 2021, 9:44 a.m. UTC | #1
On Fri, Oct 01, 2021 at 09:58:53PM +0200, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> PCIe config space can be initialized also before pci_bridge_emul_init()
> call, so move rootcap initialization after PCI config space initialization.
> 
> This simplifies the function a little since it removes one if (ret < 0)
> check.
> 
> Fixes: 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value")

Is this a fix ? If not I will remove this tag.

Lorenzo

> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Marek Behún <kabel@kernel.org>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
>  drivers/pci/controller/pci-aardvark.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
> index 7b9870d0b81f..74d1ec7eff16 100644
> --- a/drivers/pci/controller/pci-aardvark.c
> +++ b/drivers/pci/controller/pci-aardvark.c
> @@ -822,7 +822,6 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = {
>  static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
>  {
>  	struct pci_bridge_emul *bridge = &pcie->bridge;
> -	int ret;
>  
>  	bridge->conf.vendor =
>  		cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff);
> @@ -842,19 +841,14 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
>  	/* Support interrupt A for MSI feature */
>  	bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE;
>  
> +	/* Indicates supports for Completion Retry Status */
> +	bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
> +
>  	bridge->has_pcie = true;
>  	bridge->data = pcie;
>  	bridge->ops = &advk_pci_bridge_emul_ops;
>  
> -	/* PCIe config space can be initialized after pci_bridge_emul_init() */
> -	ret = pci_bridge_emul_init(bridge, 0);
> -	if (ret < 0)
> -		return ret;
> -
> -	/* Indicates supports for Completion Retry Status */
> -	bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
> -
> -	return 0;
> +	return pci_bridge_emul_init(bridge, 0);
>  }
>  
>  static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
> -- 
> 2.32.0
>
Marek Behún Oct. 4, 2021, 9:56 a.m. UTC | #2
On Mon, 4 Oct 2021 10:44:22 +0100
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:

> On Fri, Oct 01, 2021 at 09:58:53PM +0200, Marek Behún wrote:
> > From: Pali Rohár <pali@kernel.org>
> > 
> > PCIe config space can be initialized also before pci_bridge_emul_init()
> > call, so move rootcap initialization after PCI config space initialization.
> > 
> > This simplifies the function a little since it removes one if (ret < 0)
> > check.
> > 
> > Fixes: 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value")  
> 
> Is this a fix ? If not I will remove this tag.

It is not a fix, but we put the Fixes patch there because another patch
that is a fix depends on it. But that another patch will come in
another batch, after this was is applied. So maybe we could drop this
patch now.

Or you can remove the Fixes tag, but then we will have to send this by
hand to stable.

Marek
Lorenzo Pieralisi Oct. 4, 2021, 10:10 a.m. UTC | #3
On Mon, Oct 04, 2021 at 11:56:56AM +0200, Marek Behún wrote:
> On Mon, 4 Oct 2021 10:44:22 +0100
> Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> 
> > On Fri, Oct 01, 2021 at 09:58:53PM +0200, Marek Behún wrote:
> > > From: Pali Rohár <pali@kernel.org>
> > > 
> > > PCIe config space can be initialized also before pci_bridge_emul_init()
> > > call, so move rootcap initialization after PCI config space initialization.
> > > 
> > > This simplifies the function a little since it removes one if (ret < 0)
> > > check.
> > > 
> > > Fixes: 43f5c77bcbd2 ("PCI: aardvark: Fix reporting CRS value")  
> > 
> > Is this a fix ? If not I will remove this tag.
> 
> It is not a fix, but we put the Fixes patch there because another patch
> that is a fix depends on it. But that another patch will come in
> another batch, after this was is applied. So maybe we could drop this
> patch now.
> 
> Or you can remove the Fixes tag, but then we will have to send this by
> hand to stable.

It would help me to focus on a series at a time please, I understand
it has been taking a while to get them reviewed and it is complicated
to handle a big patch stack, let's focus on a self-contained series
at a time please.

I'd keep this patch and remove the Fixes: tag, stable dependencies
can be specified if and when required.

Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index 7b9870d0b81f..74d1ec7eff16 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -822,7 +822,6 @@  static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = {
 static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
 {
 	struct pci_bridge_emul *bridge = &pcie->bridge;
-	int ret;
 
 	bridge->conf.vendor =
 		cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff);
@@ -842,19 +841,14 @@  static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
 	/* Support interrupt A for MSI feature */
 	bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE;
 
+	/* Indicates supports for Completion Retry Status */
+	bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
+
 	bridge->has_pcie = true;
 	bridge->data = pcie;
 	bridge->ops = &advk_pci_bridge_emul_ops;
 
-	/* PCIe config space can be initialized after pci_bridge_emul_init() */
-	ret = pci_bridge_emul_init(bridge, 0);
-	if (ret < 0)
-		return ret;
-
-	/* Indicates supports for Completion Retry Status */
-	bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);
-
-	return 0;
+	return pci_bridge_emul_init(bridge, 0);
 }
 
 static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,