PCI: imx6: Do not output error message when devm_clk_get() failed with -EPROBE_DEFER
diff mbox series

Message ID 1596519481-28072-1-git-send-email-Anson.Huang@nxp.com
State Superseded
Headers show
Series
  • PCI: imx6: Do not output error message when devm_clk_get() failed with -EPROBE_DEFER
Related show

Commit Message

Anson Huang Aug. 4, 2020, 5:38 a.m. UTC
When devm_clk_get() returns -EPROBE_DEFER, i.MX6 PCI driver should
NOT print error message, just return -EPROBE_DEFER is enough.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

Comments

Richard Zhu Aug. 5, 2020, 5:45 a.m. UTC | #1
> -----Original Message-----
> From: Anson Huang <Anson.Huang@nxp.com>
> Sent: 2020年8月4日 13:38
> To: Richard Zhu <hongxing.zhu@nxp.com>; l.stach@pengutronix.de;
> lorenzo.pieralisi@arm.com; robh@kernel.org; bhelgaas@google.com;
> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; linux-pci@vger.kernel.org;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Cc: dl-linux-imx <linux-imx@nxp.com>
> Subject: [PATCH] PCI: imx6: Do not output error message when devm_clk_get()
> failed with -EPROBE_DEFER
> 
> When devm_clk_get() returns -EPROBE_DEFER, i.MX6 PCI driver should NOT print
> error message, just return -EPROBE_DEFER is enough.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

I'm fine with these changes. Thanks.
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>

Best Regards
Richard Zhu

> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> index 4e5c379..ee75d35 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1076,20 +1076,26 @@ static int imx6_pcie_probe(struct platform_device
> *pdev)
>  	/* Fetch clocks */
>  	imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy");
>  	if (IS_ERR(imx6_pcie->pcie_phy)) {
> -		dev_err(dev, "pcie_phy clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie_phy);
> +		ret = PTR_ERR(imx6_pcie->pcie_phy);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie_phy clock source missing or invalid\n");
> +		return ret;
>  	}
> 
>  	imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus");
>  	if (IS_ERR(imx6_pcie->pcie_bus)) {
> -		dev_err(dev, "pcie_bus clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie_bus);
> +		ret = PTR_ERR(imx6_pcie->pcie_bus);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie_bus clock source missing or invalid\n");
> +		return ret;
>  	}
> 
>  	imx6_pcie->pcie = devm_clk_get(dev, "pcie");
>  	if (IS_ERR(imx6_pcie->pcie)) {
> -		dev_err(dev, "pcie clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie);
> +		ret = PTR_ERR(imx6_pcie->pcie);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie clock source missing or invalid\n");
> +		return ret;
>  	}
> 
>  	switch (imx6_pcie->drvdata->variant) { @@ -1097,15 +1103,19 @@ static
> int imx6_pcie_probe(struct platform_device *pdev)
>  		imx6_pcie->pcie_inbound_axi = devm_clk_get(dev,
>  							   "pcie_inbound_axi");
>  		if (IS_ERR(imx6_pcie->pcie_inbound_axi)) {
> -			dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
> -			return PTR_ERR(imx6_pcie->pcie_inbound_axi);
> +			ret = PTR_ERR(imx6_pcie->pcie_inbound_axi);
> +			if (ret != -EPROBE_DEFER)
> +				dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
> +			return ret;
>  		}
>  		break;
>  	case IMX8MQ:
>  		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
>  		if (IS_ERR(imx6_pcie->pcie_aux)) {
> -			dev_err(dev, "pcie_aux clock source missing or invalid\n");
> -			return PTR_ERR(imx6_pcie->pcie_aux);
> +			ret = PTR_ERR(imx6_pcie->pcie_aux);
> +			if (ret != -EPROBE_DEFER)
> +				dev_err(dev, "pcie_aux clock source missing or invalid\n");
> +			return ret;
>  		}
>  		/* fall through */
>  	case IMX7D:
> --
> 2.7.4
Lucas Stach Aug. 10, 2020, 9:02 a.m. UTC | #2
Am Dienstag, den 04.08.2020, 13:38 +0800 schrieb Anson Huang:
> When devm_clk_get() returns -EPROBE_DEFER, i.MX6 PCI driver should
> NOT print error message, just return -EPROBE_DEFER is enough.

The reasoning behind this change is fine, but I think we should use the
recently merged dev_err_probe() helper to achieve the same goal.

Regards,
Lucas

> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 30 ++++++++++++++++++++----------
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 4e5c379..ee75d35 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1076,20 +1076,26 @@ static int imx6_pcie_probe(struct platform_device *pdev)
>  	/* Fetch clocks */
>  	imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy");
>  	if (IS_ERR(imx6_pcie->pcie_phy)) {
> -		dev_err(dev, "pcie_phy clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie_phy);
> +		ret = PTR_ERR(imx6_pcie->pcie_phy);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie_phy clock source missing or invalid\n");
> +		return ret;
>  	}
>  
>  	imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus");
>  	if (IS_ERR(imx6_pcie->pcie_bus)) {
> -		dev_err(dev, "pcie_bus clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie_bus);
> +		ret = PTR_ERR(imx6_pcie->pcie_bus);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie_bus clock source missing or invalid\n");
> +		return ret;
>  	}
>  
>  	imx6_pcie->pcie = devm_clk_get(dev, "pcie");
>  	if (IS_ERR(imx6_pcie->pcie)) {
> -		dev_err(dev, "pcie clock source missing or invalid\n");
> -		return PTR_ERR(imx6_pcie->pcie);
> +		ret = PTR_ERR(imx6_pcie->pcie);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "pcie clock source missing or invalid\n");
> +		return ret;
>  	}
>  
>  	switch (imx6_pcie->drvdata->variant) {
> @@ -1097,15 +1103,19 @@ static int imx6_pcie_probe(struct platform_device *pdev)
>  		imx6_pcie->pcie_inbound_axi = devm_clk_get(dev,
>  							   "pcie_inbound_axi");
>  		if (IS_ERR(imx6_pcie->pcie_inbound_axi)) {
> -			dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
> -			return PTR_ERR(imx6_pcie->pcie_inbound_axi);
> +			ret = PTR_ERR(imx6_pcie->pcie_inbound_axi);
> +			if (ret != -EPROBE_DEFER)
> +				dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
> +			return ret;
>  		}
>  		break;
>  	case IMX8MQ:
>  		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
>  		if (IS_ERR(imx6_pcie->pcie_aux)) {
> -			dev_err(dev, "pcie_aux clock source missing or invalid\n");
> -			return PTR_ERR(imx6_pcie->pcie_aux);
> +			ret = PTR_ERR(imx6_pcie->pcie_aux);
> +			if (ret != -EPROBE_DEFER)
> +				dev_err(dev, "pcie_aux clock source missing or invalid\n");
> +			return ret;
>  		}
>  		/* fall through */
>  	case IMX7D:
Anson Huang Aug. 11, 2020, 1:36 a.m. UTC | #3
Hi, Lucas


> Subject: Re: [PATCH] PCI: imx6: Do not output error message when
> devm_clk_get() failed with -EPROBE_DEFER
> 
> Am Dienstag, den 04.08.2020, 13:38 +0800 schrieb Anson Huang:
> > When devm_clk_get() returns -EPROBE_DEFER, i.MX6 PCI driver should NOT
> > print error message, just return -EPROBE_DEFER is enough.
> 
> The reasoning behind this change is fine, but I think we should use the recently
> merged dev_err_probe() helper to achieve the same goal.

Ah, yes, just notice this new API added, please help review V2, thanks.

Anson

Patch
diff mbox series

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 4e5c379..ee75d35 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -1076,20 +1076,26 @@  static int imx6_pcie_probe(struct platform_device *pdev)
 	/* Fetch clocks */
 	imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy");
 	if (IS_ERR(imx6_pcie->pcie_phy)) {
-		dev_err(dev, "pcie_phy clock source missing or invalid\n");
-		return PTR_ERR(imx6_pcie->pcie_phy);
+		ret = PTR_ERR(imx6_pcie->pcie_phy);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "pcie_phy clock source missing or invalid\n");
+		return ret;
 	}
 
 	imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus");
 	if (IS_ERR(imx6_pcie->pcie_bus)) {
-		dev_err(dev, "pcie_bus clock source missing or invalid\n");
-		return PTR_ERR(imx6_pcie->pcie_bus);
+		ret = PTR_ERR(imx6_pcie->pcie_bus);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "pcie_bus clock source missing or invalid\n");
+		return ret;
 	}
 
 	imx6_pcie->pcie = devm_clk_get(dev, "pcie");
 	if (IS_ERR(imx6_pcie->pcie)) {
-		dev_err(dev, "pcie clock source missing or invalid\n");
-		return PTR_ERR(imx6_pcie->pcie);
+		ret = PTR_ERR(imx6_pcie->pcie);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "pcie clock source missing or invalid\n");
+		return ret;
 	}
 
 	switch (imx6_pcie->drvdata->variant) {
@@ -1097,15 +1103,19 @@  static int imx6_pcie_probe(struct platform_device *pdev)
 		imx6_pcie->pcie_inbound_axi = devm_clk_get(dev,
 							   "pcie_inbound_axi");
 		if (IS_ERR(imx6_pcie->pcie_inbound_axi)) {
-			dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
-			return PTR_ERR(imx6_pcie->pcie_inbound_axi);
+			ret = PTR_ERR(imx6_pcie->pcie_inbound_axi);
+			if (ret != -EPROBE_DEFER)
+				dev_err(dev, "pcie_inbound_axi clock missing or invalid\n");
+			return ret;
 		}
 		break;
 	case IMX8MQ:
 		imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux");
 		if (IS_ERR(imx6_pcie->pcie_aux)) {
-			dev_err(dev, "pcie_aux clock source missing or invalid\n");
-			return PTR_ERR(imx6_pcie->pcie_aux);
+			ret = PTR_ERR(imx6_pcie->pcie_aux);
+			if (ret != -EPROBE_DEFER)
+				dev_err(dev, "pcie_aux clock source missing or invalid\n");
+			return ret;
 		}
 		/* fall through */
 	case IMX7D: