linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] PCI: imx6: Return the real error code
@ 2015-09-11 12:08 Fabio Estevam
  2015-09-11 12:08 ` [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
  2015-09-24 22:15 ` [PATCH v2 1/2] PCI: imx6: Return the real error code Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2015-09-11 12:08 UTC (permalink / raw)
  To: bhelgaas; +Cc: l.stach, linux-pci, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

When devm_request_irq() fails we should better return the real
error code instead of returning a 'fake' one.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
---
Changes since v1:
- None

 drivers/pci/host/pci-imx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 8f3a981..2d0d0fe 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -539,7 +539,7 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
 				       IRQF_SHARED, "mx6-pcie-msi", pp);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to request MSI irq\n");
-			return -ENODEV;
+			return ret;
 		}
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability
  2015-09-11 12:08 [PATCH v2 1/2] PCI: imx6: Return the real error code Fabio Estevam
@ 2015-09-11 12:08 ` Fabio Estevam
  2015-09-11 12:15   ` Lucas Stach
  2015-09-24 22:15 ` [PATCH v2 1/2] PCI: imx6: Return the real error code Bjorn Helgaas
  1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-09-11 12:08 UTC (permalink / raw)
  To: bhelgaas; +Cc: l.stach, linux-pci, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Instead of having some hardcoded values, it is preferred to use
defines when possible.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Make clear that the defines represent bitfields (Lucas)

 drivers/pci/host/pci-imx6.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 2d0d0fe..6f43086 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -55,6 +55,7 @@ struct imx6_pcie {
 #define PCIE_PL_PFLR_LINK_STATE_MASK		(0x3f << 16)
 #define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
+#define PCIE_PHY_DEBUG_R0_LTSSM_MASK		(0x3f << 0)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
 #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
 #define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
@@ -74,6 +75,7 @@ struct imx6_pcie {
 
 /* PHY registers (not memory-mapped) */
 #define PCIE_PHY_RX_ASIC_OUT 0x100D
+#define PCIE_PHY_RX_ASIC_OUT_VALID	(1 << 0)
 
 #define PHY_RX_OVRD_IN_LO 0x1005
 #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
@@ -503,10 +505,10 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
 	pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
 	debug_r0 = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0);
 
-	if (rx_valid & 0x01)
+	if (rx_valid & PCIE_PHY_RX_ASIC_OUT_VALID)
 		return 0;
 
-	if ((debug_r0 & 0x3f) != 0x0d)
+	if ((debug_r0 & PCIE_PHY_DEBUG_R0_LTSSM_MASK) != 0x0d)
 		return 0;
 
 	dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability
  2015-09-11 12:08 ` [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
@ 2015-09-11 12:15   ` Lucas Stach
  0 siblings, 0 replies; 4+ messages in thread
From: Lucas Stach @ 2015-09-11 12:15 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: bhelgaas, linux-pci, Fabio Estevam

Am Freitag, den 11.09.2015, 09:08 -0300 schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Instead of having some hardcoded values, it is preferred to use
> defines when possible.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
> Changes since v1:
> - Make clear that the defines represent bitfields (Lucas)
> 
>  drivers/pci/host/pci-imx6.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index 2d0d0fe..6f43086 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -55,6 +55,7 @@ struct imx6_pcie {
>  #define PCIE_PL_PFLR_LINK_STATE_MASK		(0x3f << 16)
>  #define PCIE_PL_PFLR_FORCE_LINK			(1 << 15)
>  #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
> +#define PCIE_PHY_DEBUG_R0_LTSSM_MASK		(0x3f << 0)
>  #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
>  #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING	(1 << 29)
>  #define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP		(1 << 4)
> @@ -74,6 +75,7 @@ struct imx6_pcie {
>  
>  /* PHY registers (not memory-mapped) */
>  #define PCIE_PHY_RX_ASIC_OUT 0x100D
> +#define PCIE_PHY_RX_ASIC_OUT_VALID	(1 << 0)
>  
>  #define PHY_RX_OVRD_IN_LO 0x1005
>  #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5)
> @@ -503,10 +505,10 @@ static int imx6_pcie_link_up(struct pcie_port *pp)
>  	pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid);
>  	debug_r0 = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0);
>  
> -	if (rx_valid & 0x01)
> +	if (rx_valid & PCIE_PHY_RX_ASIC_OUT_VALID)
>  		return 0;
>  
> -	if ((debug_r0 & 0x3f) != 0x0d)
> +	if ((debug_r0 & PCIE_PHY_DEBUG_R0_LTSSM_MASK) != 0x0d)
>  		return 0;
>  
>  	dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] PCI: imx6: Return the real error code
  2015-09-11 12:08 [PATCH v2 1/2] PCI: imx6: Return the real error code Fabio Estevam
  2015-09-11 12:08 ` [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
@ 2015-09-24 22:15 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2015-09-24 22:15 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: bhelgaas, l.stach, linux-pci, Fabio Estevam

On Fri, Sep 11, 2015 at 09:08:52AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> When devm_request_irq() fails we should better return the real
> error code instead of returning a 'fake' one.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

Applied both of these to pci/host-imx6 for v4.4 with changelogs:

  commit 89b2d4f14b147bcb499f5e7b1c6e6ce082a58e8f
  Author: Fabio Estevam <fabio.estevam@freescale.com>
  Date:   Fri Sep 11 09:08:52 2015 -0300

    PCI: imx6: Return real error code from imx6_add_pcie_port()
    
    When devm_request_irq() fails, imx6_add_pcie_port() should return the real
    error code instead of always returning -ENODEV.
    
    Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
    Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
    Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

  commit 80ec3f14471dfb2536bfc4de36980fb42361b6e4
  Author: Fabio Estevam <fabio.estevam@freescale.com>
  Date:   Fri Sep 11 09:08:53 2015 -0300

    PCI: imx6: Add #defines to improve code readability
    
    Add #defines and use them instead of hardcoded values.
    
    Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
    Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
    Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

Thanks!

> ---
> Changes since v1:
> - None
> 
>  drivers/pci/host/pci-imx6.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
> index 8f3a981..2d0d0fe 100644
> --- a/drivers/pci/host/pci-imx6.c
> +++ b/drivers/pci/host/pci-imx6.c
> @@ -539,7 +539,7 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
>  				       IRQF_SHARED, "mx6-pcie-msi", pp);
>  		if (ret) {
>  			dev_err(&pdev->dev, "failed to request MSI irq\n");
> -			return -ENODEV;
> +			return ret;
>  		}
>  	}
>  
> -- 
> 1.9.1
> 
> --
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-24 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 12:08 [PATCH v2 1/2] PCI: imx6: Return the real error code Fabio Estevam
2015-09-11 12:08 ` [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability Fabio Estevam
2015-09-11 12:15   ` Lucas Stach
2015-09-24 22:15 ` [PATCH v2 1/2] PCI: imx6: Return the real error code Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).