* [PATCH] iio: adc: hx711: remove errors during deferred probe
@ 2022-11-04 17:22 Nate Drude
2022-11-04 19:10 ` Christophe JAILLET
0 siblings, 1 reply; 2+ messages in thread
From: Nate Drude @ 2022-11-04 17:22 UTC (permalink / raw)
To: Andreas Klinger, Jonathan Cameron, Lars-Peter Clausen, linux-iio,
linux-kernel
Cc: eran.m, Nate Drude
This patch removes noisy kernel messages like "failed to sck-gpiod" or
"failed to get dout-gpiod" when the probe is deferred.
Signed-off-by: Nate Drude <nate.d@variscite.com>
---
drivers/iio/adc/hx711.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index f7ee856a6b8b..8ba4a5b113aa 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -482,8 +482,9 @@ static int hx711_probe(struct platform_device *pdev)
*/
hx711_data->gpiod_pd_sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
if (IS_ERR(hx711_data->gpiod_pd_sck)) {
- dev_err(dev, "failed to get sck-gpiod: err=%ld\n",
- PTR_ERR(hx711_data->gpiod_pd_sck));
+ if (PTR_ERR(hx711_data->gpiod_pd_sck) != -EPROBE_DEFER)
+ dev_err(dev, "failed to get sck-gpiod: err=%ld\n",
+ PTR_ERR(hx711_data->gpiod_pd_sck));
return PTR_ERR(hx711_data->gpiod_pd_sck);
}
@@ -493,8 +494,9 @@ static int hx711_probe(struct platform_device *pdev)
*/
hx711_data->gpiod_dout = devm_gpiod_get(dev, "dout", GPIOD_IN);
if (IS_ERR(hx711_data->gpiod_dout)) {
- dev_err(dev, "failed to get dout-gpiod: err=%ld\n",
- PTR_ERR(hx711_data->gpiod_dout));
+ if (PTR_ERR(hx711_data->gpiod_dout) != -EPROBE_DEFER)
+ dev_err(dev, "failed to get dout-gpiod: err=%ld\n",
+ PTR_ERR(hx711_data->gpiod_dout));
return PTR_ERR(hx711_data->gpiod_dout);
}
--
2.38.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: adc: hx711: remove errors during deferred probe
2022-11-04 17:22 [PATCH] iio: adc: hx711: remove errors during deferred probe Nate Drude
@ 2022-11-04 19:10 ` Christophe JAILLET
0 siblings, 0 replies; 2+ messages in thread
From: Christophe JAILLET @ 2022-11-04 19:10 UTC (permalink / raw)
To: nate.d; +Cc: ak, eran.m, jic23, lars, linux-iio, linux-kernel
Le 04/11/2022 à 18:22, Nate Drude a écrit :
> This patch removes noisy kernel messages like "failed to sck-gpiod" or
> "failed to get dout-gpiod" when the probe is deferred.
>
> Signed-off-by: Nate Drude <nate.d-/HTLZasLZWtl57MIdRCFDg@public.gmane.org>
> ---
> drivers/iio/adc/hx711.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index f7ee856a6b8b..8ba4a5b113aa 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
> @@ -482,8 +482,9 @@ static int hx711_probe(struct platform_device *pdev)
> */
> hx711_data->gpiod_pd_sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
> if (IS_ERR(hx711_data->gpiod_pd_sck)) {
> - dev_err(dev, "failed to get sck-gpiod: err=%ld\n",
> - PTR_ERR(hx711_data->gpiod_pd_sck));
> + if (PTR_ERR(hx711_data->gpiod_pd_sck) != -EPROBE_DEFER)
> + dev_err(dev, "failed to get sck-gpiod: err=%ld\n",
> + PTR_ERR(hx711_data->gpiod_pd_sck));
> return PTR_ERR(hx711_data->gpiod_pd_sck);
> }
>
> @@ -493,8 +494,9 @@ static int hx711_probe(struct platform_device *pdev)
> */
> hx711_data->gpiod_dout = devm_gpiod_get(dev, "dout", GPIOD_IN);
> if (IS_ERR(hx711_data->gpiod_dout)) {
> - dev_err(dev, "failed to get dout-gpiod: err=%ld\n",
> - PTR_ERR(hx711_data->gpiod_dout));
> + if (PTR_ERR(hx711_data->gpiod_dout) != -EPROBE_DEFER)
> + dev_err(dev, "failed to get dout-gpiod: err=%ld\n",
> + PTR_ERR(hx711_data->gpiod_dout));
> return PTR_ERR(hx711_data->gpiod_dout);
> }
>
Hi,
using dev_err_probe() looks like a better candidate for that.
It can be can folded with the return (saving some LoC and the {} around
the error handling path), and display the error code in a human readable
manner.
CJ
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-04 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 17:22 [PATCH] iio: adc: hx711: remove errors during deferred probe Nate Drude
2022-11-04 19:10 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®