Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing
@ 2017-07-04 12:37 Quentin Schulz
  2017-07-04 12:53 ` Mylene Josserand
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Quentin Schulz @ 2017-07-04 12:37 UTC (permalink / raw)
  To: linux-arm-kernel

When phy-sun4i-usb's probing fails, it does not print the reason in
kernel log, forcing the developer to edit this driver to add info logs.
This commit makes the kernel print the reason of phy-sun4i-usb's probing
failure or a success message.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---

Nothing new in v3, the driver has just been moved to the directory
allwinner so updating the patch to reflect this change. Sorry for the
delay, completely forgot it hadn't been merged/acked back then.

v2:
  - removing (from v1) debug message when devm_ioremap_resource fails,
  - changing dev_info to dev_dbg when driver is successfully loaded,

 drivers/phy/allwinner/phy-sun4i-usb.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index bbf06cfe5898..3bea17b9405a 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -653,19 +653,25 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 
 	data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
 						    GPIOD_IN);
-	if (IS_ERR(data->id_det_gpio))
+	if (IS_ERR(data->id_det_gpio)) {
+		dev_err(dev, "Couldn't request ID GPIO\n");
 		return PTR_ERR(data->id_det_gpio);
+	}
 
 	data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det",
 						      GPIOD_IN);
-	if (IS_ERR(data->vbus_det_gpio))
+	if (IS_ERR(data->vbus_det_gpio)) {
+		dev_err(dev, "Couldn't request VBUS detect GPIO\n");
 		return PTR_ERR(data->vbus_det_gpio);
+	}
 
 	if (of_find_property(np, "usb0_vbus_power-supply", NULL)) {
 		data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,
 						     "usb0_vbus_power-supply");
-		if (IS_ERR(data->vbus_power_supply))
+		if (IS_ERR(data->vbus_power_supply)) {
+			dev_err(dev, "Couldn't get the VBUS power supply\n");
 			return PTR_ERR(data->vbus_power_supply);
+		}
 
 		if (!data->vbus_power_supply)
 			return -EPROBE_DEFER;
@@ -674,8 +680,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0);
 
 	data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable);
-	if (IS_ERR(data->extcon))
+	if (IS_ERR(data->extcon)) {
+		dev_err(dev, "Couldn't allocate our extcon device\n");
 		return PTR_ERR(data->extcon);
+	}
 
 	ret = devm_extcon_dev_register(dev, data->extcon);
 	if (ret) {
@@ -690,8 +698,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		snprintf(name, sizeof(name), "usb%d_vbus", i);
 		phy->vbus = devm_regulator_get_optional(dev, name);
 		if (IS_ERR(phy->vbus)) {
-			if (PTR_ERR(phy->vbus) == -EPROBE_DEFER)
+			if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) {
+				dev_err(dev,
+					"Couldn't get regulator %s... Deferring probe\n",
+					name);
 				return -EPROBE_DEFER;
+			}
+
 			phy->vbus = NULL;
 		}
 
@@ -775,6 +788,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 		return PTR_ERR(phy_provider);
 	}
 
+	dev_dbg(dev, "successfully loaded\n");
+
 	return 0;
 }
 
-- 
2.11.0

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

* [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing
  2017-07-04 12:37 [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing Quentin Schulz
@ 2017-07-04 12:53 ` Mylene Josserand
  2017-07-04 13:01 ` Maxime Ripard
  2017-07-19  6:27 ` Quentin Schulz
  2 siblings, 0 replies; 4+ messages in thread
From: Mylene Josserand @ 2017-07-04 12:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 04/07/2017 14:37, Quentin Schulz wrote:
> When phy-sun4i-usb's probing fails, it does not print the reason in
> kernel log, forcing the developer to edit this driver to add info logs.
> This commit makes the kernel print the reason of phy-sun4i-usb's probing
> failure or a success message.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

Tested-by: Myl?ne Josserand <mylene.josserand@free-electrons.com>

Thanks!

-- 
Myl?ne Josserand, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing
  2017-07-04 12:37 [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing Quentin Schulz
  2017-07-04 12:53 ` Mylene Josserand
@ 2017-07-04 13:01 ` Maxime Ripard
  2017-07-19  6:27 ` Quentin Schulz
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2017-07-04 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 04, 2017 at 02:37:03PM +0200, Quentin Schulz wrote:
> When phy-sun4i-usb's probing fails, it does not print the reason in
> kernel log, forcing the developer to edit this driver to add info logs.
> This commit makes the kernel print the reason of phy-sun4i-usb's probing
> failure or a success message.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170704/4077db37/attachment.sig>

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

* [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing
  2017-07-04 12:37 [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing Quentin Schulz
  2017-07-04 12:53 ` Mylene Josserand
  2017-07-04 13:01 ` Maxime Ripard
@ 2017-07-19  6:27 ` Quentin Schulz
  2 siblings, 0 replies; 4+ messages in thread
From: Quentin Schulz @ 2017-07-19  6:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Kindly pinging since the merge window is now closed and I haven;t
received any update in the last two weeks,

Thanks,
Quentin

On 04/07/2017 14:37, Quentin Schulz wrote:
> When phy-sun4i-usb's probing fails, it does not print the reason in
> kernel log, forcing the developer to edit this driver to add info logs.
> This commit makes the kernel print the reason of phy-sun4i-usb's probing
> failure or a success message.
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> ---
> 
> Nothing new in v3, the driver has just been moved to the directory
> allwinner so updating the patch to reflect this change. Sorry for the
> delay, completely forgot it hadn't been merged/acked back then.
> 
> v2:
>   - removing (from v1) debug message when devm_ioremap_resource fails,
>   - changing dev_info to dev_dbg when driver is successfully loaded,
> 
>  drivers/phy/allwinner/phy-sun4i-usb.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
> index bbf06cfe5898..3bea17b9405a 100644
> --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> @@ -653,19 +653,25 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>  
>  	data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
>  						    GPIOD_IN);
> -	if (IS_ERR(data->id_det_gpio))
> +	if (IS_ERR(data->id_det_gpio)) {
> +		dev_err(dev, "Couldn't request ID GPIO\n");
>  		return PTR_ERR(data->id_det_gpio);
> +	}
>  
>  	data->vbus_det_gpio = devm_gpiod_get_optional(dev, "usb0_vbus_det",
>  						      GPIOD_IN);
> -	if (IS_ERR(data->vbus_det_gpio))
> +	if (IS_ERR(data->vbus_det_gpio)) {
> +		dev_err(dev, "Couldn't request VBUS detect GPIO\n");
>  		return PTR_ERR(data->vbus_det_gpio);
> +	}
>  
>  	if (of_find_property(np, "usb0_vbus_power-supply", NULL)) {
>  		data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,
>  						     "usb0_vbus_power-supply");
> -		if (IS_ERR(data->vbus_power_supply))
> +		if (IS_ERR(data->vbus_power_supply)) {
> +			dev_err(dev, "Couldn't get the VBUS power supply\n");
>  			return PTR_ERR(data->vbus_power_supply);
> +		}
>  
>  		if (!data->vbus_power_supply)
>  			return -EPROBE_DEFER;
> @@ -674,8 +680,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>  	data->dr_mode = of_usb_get_dr_mode_by_phy(np, 0);
>  
>  	data->extcon = devm_extcon_dev_allocate(dev, sun4i_usb_phy0_cable);
> -	if (IS_ERR(data->extcon))
> +	if (IS_ERR(data->extcon)) {
> +		dev_err(dev, "Couldn't allocate our extcon device\n");
>  		return PTR_ERR(data->extcon);
> +	}
>  
>  	ret = devm_extcon_dev_register(dev, data->extcon);
>  	if (ret) {
> @@ -690,8 +698,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>  		snprintf(name, sizeof(name), "usb%d_vbus", i);
>  		phy->vbus = devm_regulator_get_optional(dev, name);
>  		if (IS_ERR(phy->vbus)) {
> -			if (PTR_ERR(phy->vbus) == -EPROBE_DEFER)
> +			if (PTR_ERR(phy->vbus) == -EPROBE_DEFER) {
> +				dev_err(dev,
> +					"Couldn't get regulator %s... Deferring probe\n",
> +					name);
>  				return -EPROBE_DEFER;
> +			}
> +
>  			phy->vbus = NULL;
>  		}
>  
> @@ -775,6 +788,8 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>  		return PTR_ERR(phy_provider);
>  	}
>  
> +	dev_dbg(dev, "successfully loaded\n");
> +
>  	return 0;
>  }
>  
> 

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2017-07-19  6:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-04 12:37 [PATCH v3] phy: allwinner: phy-sun4i-usb: Add log when probing Quentin Schulz
2017-07-04 12:53 ` Mylene Josserand
2017-07-04 13:01 ` Maxime Ripard
2017-07-19  6:27 ` Quentin Schulz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox