diff mbox series

Input: rotary-encoder: Don't log EPROBE_DEFER to kernel log

Message ID 20181007203726.2158-1-uwe@kleine-koenig.org (mailing list archive)
State Accepted
Headers show
Series Input: rotary-encoder: Don't log EPROBE_DEFER to kernel log | expand

Commit Message

Uwe Kleine-König Oct. 7, 2018, 8:37 p.m. UTC
When a driver fails to bind because a resource it still missing it's not
helpful to report this as (usually) probing is repeated later.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 drivers/input/misc/rotary_encoder.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Uwe Kleine-König Dec. 4, 2018, 8:10 p.m. UTC | #1
Hello Dmitry,

On Sun, Oct 07, 2018 at 10:37:26PM +0200, Uwe Kleine-König wrote:
> When a driver fails to bind because a resource it still missing it's not
> helpful to report this as (usually) probing is repeated later.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>

did this patch fell throug the cracks? I didn't get any feedback for it.

Best regards
Uwe

> ---
>  drivers/input/misc/rotary_encoder.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
> index 30ec77ad32c6..a76e3f972432 100644
> --- a/drivers/input/misc/rotary_encoder.c
> +++ b/drivers/input/misc/rotary_encoder.c
> @@ -240,8 +240,10 @@ static int rotary_encoder_probe(struct platform_device *pdev)
>  
>  	encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
>  	if (IS_ERR(encoder->gpios)) {
> -		dev_err(dev, "unable to get gpios\n");
> -		return PTR_ERR(encoder->gpios);
> +		err = PTR_ERR(encoder->gpios);
> +		if (err != -EPROBE_DEFER)
> +			dev_err(dev, "unable to get gpios (%d)\n", err);
> +		return err;
>  	}
>  	if (encoder->gpios->ndescs < 2) {
>  		dev_err(dev, "not enough gpios found\n");
> -- 
> 2.19.0
> 
> 
>
Dmitry Torokhov Dec. 5, 2018, 12:38 a.m. UTC | #2
Hi Uwe,

On Tue, Dec 04, 2018 at 09:10:32PM +0100, Uwe Kleine-König wrote:
> Hello Dmitry,
> 
> On Sun, Oct 07, 2018 at 10:37:26PM +0200, Uwe Kleine-König wrote:
> > When a driver fails to bind because a resource it still missing it's not
> > helpful to report this as (usually) probing is repeated later.
> > 
> > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> did this patch fell throug the cracks? I didn't get any feedback for it.

Sorry, must have missed it. Do not have that strong preference either
way. I guess we can't really do anything to avoid deferral, so there is
no point in telling the reason for deferring.

I'll apply this.

Thanks.
Uwe Kleine-König Dec. 5, 2018, 8:23 a.m. UTC | #3
On Tue, Dec 04, 2018 at 04:38:12PM -0800, Dmitry Torokhov wrote:
> Hi Uwe,
> 
> On Tue, Dec 04, 2018 at 09:10:32PM +0100, Uwe Kleine-König wrote:
> > Hello Dmitry,
> > 
> > On Sun, Oct 07, 2018 at 10:37:26PM +0200, Uwe Kleine-König wrote:
> > > When a driver fails to bind because a resource it still missing it's not
> > > helpful to report this as (usually) probing is repeated later.
> > > 
> > > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> > 
> > did this patch fell throug the cracks? I didn't get any feedback for it.
> 
> Sorry, must have missed it. Do not have that strong preference either
> way. I guess we can't really do anything to avoid deferral, so there is
> no point in telling the reason for deferring.

I think there is a strong reason to not emit a warning on deferral:
There is no success-message when the device is probed (which is a good
choice IMHO) and with the warning emitted the only sign that the device
is there is this warning telling that it was unable to get its hands on
the gpios. This is irritating for users and testers because when the
message is noticed the content is (usually) already wrong.

> I'll apply this.

Thanks
Uwe
diff mbox series

Patch

diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index 30ec77ad32c6..a76e3f972432 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -240,8 +240,10 @@  static int rotary_encoder_probe(struct platform_device *pdev)
 
 	encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
 	if (IS_ERR(encoder->gpios)) {
-		dev_err(dev, "unable to get gpios\n");
-		return PTR_ERR(encoder->gpios);
+		err = PTR_ERR(encoder->gpios);
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "unable to get gpios (%d)\n", err);
+		return err;
 	}
 	if (encoder->gpios->ndescs < 2) {
 		dev_err(dev, "not enough gpios found\n");