From: Krzysztof Kozlowski <krzk@kernel.org>
To: "Pali Rohár" <pali@kernel.org>, "Andrew F. Davis" <afd@ti.com>,
"Sebastian Reichel" <sre@kernel.org>,
"Paul Cercueil" <paul@crapouillou.net>,
"David Lechner" <david@lechnology.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH 3/5] power: supply: gpio-charger: Simplify with dev_err_probe()
Date: Wed, 26 Aug 2020 16:48:56 +0200 [thread overview]
Message-ID: <20200826144858.9584-3-krzk@kernel.org> (raw)
In-Reply-To: <20200826144858.9584-1-krzk@kernel.org>
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
drivers/power/supply/gpio-charger.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c
index 875735d50716..557f879a6499 100644
--- a/drivers/power/supply/gpio-charger.c
+++ b/drivers/power/supply/gpio-charger.c
@@ -173,10 +173,8 @@ static int gpio_charger_probe(struct platform_device *pdev)
gpio_charger->gpiod = gpio_to_desc(pdata->gpio);
} else if (IS_ERR(gpio_charger->gpiod)) {
/* Just try again if this happens */
- if (PTR_ERR(gpio_charger->gpiod) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dev_err(dev, "error getting GPIO descriptor\n");
- return PTR_ERR(gpio_charger->gpiod);
+ return dev_err_probe(dev, PTR_ERR(gpio_charger->gpiod),
+ "error getting GPIO descriptor\n");
}
if (gpio_charger->gpiod) {
--
2.17.1
next prev parent reply other threads:[~2020-08-26 14:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 14:48 [PATCH 1/5] power: supply: bq27xxx: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-26 14:48 ` [PATCH 2/5] power: supply: cpcap: " Krzysztof Kozlowski
2020-08-26 14:48 ` Krzysztof Kozlowski [this message]
2020-08-26 14:48 ` [PATCH 4/5] power: supply: ingenic: " Krzysztof Kozlowski
2020-08-26 14:48 ` [PATCH 5/5] power: supply: lego_ev3: " Krzysztof Kozlowski
2020-08-26 15:11 ` David Lechner
2020-08-26 16:01 ` 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=20200826144858.9584-3-krzk@kernel.org \
--to=krzk@kernel.org \
--cc=afd@ti.com \
--cc=david@lechnology.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pali@kernel.org \
--cc=paul@crapouillou.net \
--cc=sre@kernel.org \
/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).