devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: "Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Pavel Machel" <pavel@ucw.cz>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	"Nishanth Menon" <nm@ti.com>
Cc: linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH 1/6] power_supply: isp1704_charger: Error messages when probe fail
Date: Sun, 21 Feb 2016 12:28:18 +0100	[thread overview]
Message-ID: <1456054103-19551-2-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1456054103-19551-1-git-send-email-pali.rohar@gmail.com>

This patch adds more detailed error messages when probe function fail.
It is useful for debbuging why driver refuse to register charger device.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/isp1704_charger.c |   18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index 46a292a..acaf7cf 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -411,8 +411,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	if (np) {
 		int gpio = of_get_named_gpio(np, "nxp,enable-gpio", 0);
 
-		if (gpio < 0)
+		if (gpio < 0) {
+			dev_err(&pdev->dev, "missing DT GPIO nxp,enable-gpio\n");
 			return gpio;
+		}
 
 		pdata = devm_kzalloc(&pdev->dev,
 			sizeof(struct isp1704_charger_data), GFP_KERNEL);
@@ -422,8 +424,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 
 		ret = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio,
 					GPIOF_OUT_INIT_HIGH, "isp1704_reset");
-		if (ret)
+		if (ret) {
+			dev_err(&pdev->dev, "gpio request failed\n");
 			goto fail0;
+		}
 	}
 
 	if (!pdata) {
@@ -443,6 +447,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 
 	if (IS_ERR(isp->phy)) {
 		ret = PTR_ERR(isp->phy);
+		dev_err(&pdev->dev, "usb_get_phy failed\n");
 		goto fail0;
 	}
 
@@ -452,8 +457,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp1704_charger_set_power(isp, 1);
 
 	ret = isp1704_test_ulpi(isp);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err(&pdev->dev, "isp1704_test_ulpi failed\n");
 		goto fail1;
+	}
 
 	isp->psy_desc.name		= "isp1704";
 	isp->psy_desc.type		= POWER_SUPPLY_TYPE_USB;
@@ -466,6 +473,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp->psy = power_supply_register(isp->dev, &isp->psy_desc, &psy_cfg);
 	if (IS_ERR(isp->psy)) {
 		ret = PTR_ERR(isp->psy);
+		dev_err(&pdev->dev, "power_supply_register failed\n");
 		goto fail1;
 	}
 
@@ -478,8 +486,10 @@ static int isp1704_charger_probe(struct platform_device *pdev)
 	isp->nb.notifier_call = isp1704_notifier_call;
 
 	ret = usb_register_notifier(isp->phy, &isp->nb);
-	if (ret)
+	if (ret) {
+		dev_err(&pdev->dev, "usb_register_notifier failed\n");
 		goto fail2;
+	}
 
 	dev_info(isp->dev, "registered with product id %s\n", isp->model);
 
-- 
1.7.9.5


  reply	other threads:[~2016-02-21 11:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-21 11:28 [PATCH 0/6] Small fixes for Nokia N900 power supply drivers Pali Rohár
2016-02-21 11:28 ` Pali Rohár [this message]
2016-02-21 13:32   ` [PATCH 1/6] power_supply: isp1704_charger: Error messages when probe fail Pavel Machek
2016-02-21 11:28 ` [PATCH 2/6] power_supply: isp1704_charger: Add compatible of match for nxp,isp1707 Pali Rohár
2016-02-21 11:28 ` [PATCH 3/6] power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled Pali Rohár
2016-02-21 13:33   ` Pavel Machek
2016-02-21 11:28 ` [PATCH 4/6] power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled Pali Rohár
2016-02-21 11:28 ` [PATCH 5/6] power_supply: bq27xxx_battery: " Pali Rohár
2016-02-21 11:28 ` [PATCH 6/6] ARM: dts: n900: Rename isp1704 to isp1707 to match correct name Pali Rohár
2016-02-21 14:05   ` Pavel Machek
2016-02-22 19:06     ` Tony Lindgren
2016-02-23  2:29       ` Sebastian Reichel
2016-02-21 19:41 ` [PATCH 0/6] Small fixes for Nokia N900 power supply drivers Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456054103-19551-2-git-send-email-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=bcousson@baylibre.com \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).