From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-fbdev@vger.kernel.org>, <linux-pwm@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>
Cc: <thierry.reding@gmail.com>, <u.kleine-koenig@pengutronix.de>,
<lee@kernel.org>, <daniel.thompson@linaro.org>
Subject: [PATCH -next] backlight: pwm_bl: Switch to use dev_err_probe() helper
Date: Mon, 26 Sep 2022 21:32:58 +0800 [thread overview]
Message-ID: <20220926133258.1104850-1-yangyingliang@huawei.com> (raw)
In the probe path, dev_err() can be replaced with dev_err_probe()
which will check if error code is -EPROBE_DEFER and prints the
error name. It also sets the defer probe reason which can be
checked later through debugfs. It's more simple in error path.
---
drivers/video/backlight/pwm_bl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index c0523a0269ee..ae858e3bd38f 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -513,9 +513,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
}
if (IS_ERR(pb->pwm)) {
- ret = PTR_ERR(pb->pwm);
- if (ret != -EPROBE_DEFER)
- dev_err(&pdev->dev, "unable to request PWM\n");
+ ret = dev_err_probe(&pdev->dev, PTR_ERR(pb->pwm),
+ "unable to request PWM\n");
goto err_alloc;
}
--
2.25.1
next reply other threads:[~2022-09-26 14:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-26 13:32 Yang Yingliang [this message]
2022-09-26 13:37 ` [PATCH -next] backlight: pwm_bl: Switch to use dev_err_probe() helper Daniel Thompson
2022-09-26 13:41 ` Daniel Thompson
2022-09-26 14:00 ` Yang Yingliang
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=20220926133258.1104850-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lee@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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).