From: Yang Yingliang <yangyingliang@huawei.com> To: <linux-fbdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org> Cc: lee@kernel.org, daniel.thompson@linaro.org, yangyingliang@huawei.com Subject: [PATCH -next] backlight: ktd253: Switch to use dev_err_probe() helper Date: Mon, 26 Sep 2022 21:35:25 +0800 [thread overview] Message-ID: <20220926133525.1107096-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/ktd253-backlight.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index 37aa5a669530..d7d43454f64a 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -173,12 +173,9 @@ static int ktd253_backlight_probe(struct platform_device *pdev) } ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(ktd253->gpiod)) { - ret = PTR_ERR(ktd253->gpiod); - if (ret != -EPROBE_DEFER) - dev_err(dev, "gpio line missing or invalid.\n"); - return ret; - } + if (IS_ERR(ktd253->gpiod)) + return dev_err_probe(dev, PTR_ERR(ktd253->gpiod), + "gpio line missing or invalid.\n"); gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); /* Bring backlight to a known off state */ msleep(KTD253_T_OFF_MS); -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Yang Yingliang <yangyingliang@huawei.com> To: <linux-fbdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org> Cc: <linus.walleij@linaro.org>, <lee@kernel.org>, <daniel.thompson@linaro.org>, <yangyingliang@huawei.com> Subject: [PATCH -next] backlight: ktd253: Switch to use dev_err_probe() helper Date: Mon, 26 Sep 2022 21:35:25 +0800 [thread overview] Message-ID: <20220926133525.1107096-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/ktd253-backlight.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index 37aa5a669530..d7d43454f64a 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -173,12 +173,9 @@ static int ktd253_backlight_probe(struct platform_device *pdev) } ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(ktd253->gpiod)) { - ret = PTR_ERR(ktd253->gpiod); - if (ret != -EPROBE_DEFER) - dev_err(dev, "gpio line missing or invalid.\n"); - return ret; - } + if (IS_ERR(ktd253->gpiod)) + return dev_err_probe(dev, PTR_ERR(ktd253->gpiod), + "gpio line missing or invalid.\n"); gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); /* Bring backlight to a known off state */ msleep(KTD253_T_OFF_MS); -- 2.25.1
next reply other threads:[~2022-09-26 13:28 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-26 13:35 Yang Yingliang [this message] 2022-09-26 13:35 ` [PATCH -next] backlight: ktd253: Switch to use dev_err_probe() helper Yang Yingliang 2022-09-26 13:43 ` Daniel Thompson 2022-09-26 13:43 ` Daniel Thompson
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=20220926133525.1107096-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 \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.