diff mbox

[2/2] net: fec: Improve logging

Message ID 1361055207-22870-2-git-send-email-festevam@gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Fabio Estevam Feb. 16, 2013, 10:53 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

In case the request of the GPIO reset fails it is interesting to log
such error even if DEBUG is not enabled, so promote the message to dev_err. 

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/net/ethernet/freescale/fec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Feb. 17, 2013, 10:33 a.m. UTC | #1
Dear Fabio Estevam,

> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> In case the request of the GPIO reset fails it is interesting to log
> such error even if DEBUG is not enabled, so promote the message to dev_err.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Guo Feb. 17, 2013, 11:55 a.m. UTC | #2
On Sat, Feb 16, 2013 at 08:53:27PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> In case the request of the GPIO reset fails it is interesting to log
> such error even if DEBUG is not enabled, so promote the message to dev_err. 
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/net/ethernet/freescale/fec.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> index 5864a67..29d82cf 100644
> --- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -1695,7 +1695,7 @@ static void fec_reset_phy(struct platform_device *pdev)
>  	err = devm_gpio_request_one(&pdev->dev, phy_reset,
>  				    GPIOF_OUT_INIT_LOW, "phy-reset");
>  	if (err) {
> -		pr_debug("FEC: failed to get gpio phy-reset: %d\n", err);
> +		dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);

Shouldn't dev_dbg be more like a equivalent of pr_debug?  The reason
why it's taken as a debug message rather than an error is that some
board design may not have reset line for phy.

Shawn

>  		return;
>  	}
>  	msleep(msec);
> -- 
> 1.7.9.5
> 

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fabio Estevam Feb. 17, 2013, 1:41 p.m. UTC | #3
On Sun, Feb 17, 2013 at 8:55 AM, Shawn Guo <shawn.guo@linaro.org> wrote:

>> --- a/drivers/net/ethernet/freescale/fec.c
>> +++ b/drivers/net/ethernet/freescale/fec.c
>> @@ -1695,7 +1695,7 @@ static void fec_reset_phy(struct platform_device *pdev)
>>       err = devm_gpio_request_one(&pdev->dev, phy_reset,
>>                                   GPIOF_OUT_INIT_LOW, "phy-reset");
>>       if (err) {
>> -             pr_debug("FEC: failed to get gpio phy-reset: %d\n", err);
>> +             dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
>
> Shouldn't dev_dbg be more like a equivalent of pr_debug?  The reason
> why it's taken as a debug message rather than an error is that some
> board design may not have reset line for phy.

If a board does not have a reset line for the PHY then it will not try
to request the GPIO as per patch 1/2 of this series.

I sent a v2 with dev_dbg, but I think that the first version with
dev_err is more useful.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Guo Feb. 17, 2013, 3:08 p.m. UTC | #4
On Sun, Feb 17, 2013 at 10:41:11AM -0300, Fabio Estevam wrote:
> On Sun, Feb 17, 2013 at 8:55 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> 
> >> --- a/drivers/net/ethernet/freescale/fec.c
> >> +++ b/drivers/net/ethernet/freescale/fec.c
> >> @@ -1695,7 +1695,7 @@ static void fec_reset_phy(struct platform_device *pdev)
> >>       err = devm_gpio_request_one(&pdev->dev, phy_reset,
> >>                                   GPIOF_OUT_INIT_LOW, "phy-reset");
> >>       if (err) {
> >> -             pr_debug("FEC: failed to get gpio phy-reset: %d\n", err);
> >> +             dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
> >
> > Shouldn't dev_dbg be more like a equivalent of pr_debug?  The reason
> > why it's taken as a debug message rather than an error is that some
> > board design may not have reset line for phy.
> 
> If a board does not have a reset line for the PHY then it will not try
> to request the GPIO as per patch 1/2 of this series.

Argh, yes, you're right.  The pr_debug makes no sense any more with the
first patch in place, and it should become a error message.  But they
should be one patch rather than a series to make the most sense, IMO.

Shawn

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 5864a67..29d82cf 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1695,7 +1695,7 @@  static void fec_reset_phy(struct platform_device *pdev)
 	err = devm_gpio_request_one(&pdev->dev, phy_reset,
 				    GPIOF_OUT_INIT_LOW, "phy-reset");
 	if (err) {
-		pr_debug("FEC: failed to get gpio phy-reset: %d\n", err);
+		dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
 		return;
 	}
 	msleep(msec);