Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()

2020-08-26 Thread Krzysztof Kozlowski
On Wed, Aug 26, 2020 at 10:39:12PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 10:23 PM Krzysztof Kozlowski  wrote:
> > On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> > > On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > > > Common pattern of handling deferred probe can be simplified with
> > > > dev_err_probe().  Less code and also it prints the error value.
> > >
> > > > --- a/drivers/input/keyboard/gpio_keys.c
> > > > +++ b/drivers/input/keyboard/gpio_keys.c
> > > > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct 
> > > > platform_device *pdev,
> > > >  */
> > > > bdata->gpiod = NULL;
> > >
> > > gpiod_get_optional()?
> > > Do not see much context though (but please double check your series for 
> > > these
> > > kind of things).
> >
> > It would fit except it is devm_fwnode_gpiod_get() which does not have
> > optional yet.
> >
> > I can add it although the scope of the patch grows from simple
> > defer-path-simplification.
> 
> No need. My comment only about existing API per individual cases. SO,
> here it's fine then.

I checked the others and I didn't see such pattern anymore.

Best regards,
Krzysztof



Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()

2020-08-26 Thread Andy Shevchenko
On Wed, Aug 26, 2020 at 10:23 PM Krzysztof Kozlowski  wrote:
> On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> > On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > > Common pattern of handling deferred probe can be simplified with
> > > dev_err_probe().  Less code and also it prints the error value.
> >
> > > --- a/drivers/input/keyboard/gpio_keys.c
> > > +++ b/drivers/input/keyboard/gpio_keys.c
> > > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct 
> > > platform_device *pdev,
> > >  */
> > > bdata->gpiod = NULL;
> >
> > gpiod_get_optional()?
> > Do not see much context though (but please double check your series for 
> > these
> > kind of things).
>
> It would fit except it is devm_fwnode_gpiod_get() which does not have
> optional yet.
>
> I can add it although the scope of the patch grows from simple
> defer-path-simplification.

No need. My comment only about existing API per individual cases. SO,
here it's fine then.

> Thanks for the feedback.

You're welcome!

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()

2020-08-26 Thread Krzysztof Kozlowski
On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device 
> > *pdev,
> >  */
> > bdata->gpiod = NULL;
> 
> gpiod_get_optional()?
> Do not see much context though (but please double check your series for these
> kind of things).

It would fit except it is devm_fwnode_gpiod_get() which does not have
optional yet.

I can add it although the scope of the patch grows from simple
defer-path-simplification.

Thanks for the feedback.

Best regards,
Krzysztof


Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()

2020-08-26 Thread Andy Shevchenko
On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device 
> *pdev,
>*/
>   bdata->gpiod = NULL;

gpiod_get_optional()?
Do not see much context though (but please double check your series for these
kind of things).

>   } else {
> - if (error != -EPROBE_DEFER)
> - dev_err(dev, "failed to get gpio: %d\n",
> - error);
> - return error;
> + return dev_err_probe(dev, error, "failed to get 
> gpio\n");
>   }
>   }
>   } else if (gpio_is_valid(button->gpio)) {

-- 
With Best Regards,
Andy Shevchenko