All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe()
@ 2021-09-16 15:31 Cai Huoqing
  2021-09-16 22:30 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Cai Huoqing @ 2021-09-16 15:31 UTC (permalink / raw)
  To: caihuoqing; +Cc: Linus Walleij, Dmitry Torokhov, linux-input, linux-kernel

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/input/touchscreen/cyttsp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 1dbd849c9613..01646910c9db 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -673,7 +673,7 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
 	ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(ts->reset_gpio)) {
 		error = PTR_ERR(ts->reset_gpio);
-		dev_err(dev, "Failed to request reset gpio, error %d\n", error);
+		dev_err_probe(dev, error, "Failed to request reset gpio\n");
 		return ERR_PTR(error);
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe()
  2021-09-16 15:31 [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe() Cai Huoqing
@ 2021-09-16 22:30 ` Linus Walleij
  2021-09-17  1:35   ` Cai Huoqing
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2021-09-16 22:30 UTC (permalink / raw)
  To: Cai Huoqing; +Cc: Dmitry Torokhov, Linux Input, linux-kernel

Hi Cai,

On Thu, Sep 16, 2021 at 5:32 PM Cai Huoqing <caihuoqing@baidu.com> wrote:

>         if (IS_ERR(ts->reset_gpio)) {
>                 error = PTR_ERR(ts->reset_gpio);
> -               dev_err(dev, "Failed to request reset gpio, error %d\n", error);
> +               dev_err_probe(dev, error, "Failed to request reset gpio\n");
>                 return ERR_PTR(error);

In this case you're supposed to do

return dev_err_probe(dev, error, "Failed to request reset gpio\n");

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe()
  2021-09-16 22:30 ` Linus Walleij
@ 2021-09-17  1:35   ` Cai Huoqing
  2021-09-19 19:28     ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Cai Huoqing @ 2021-09-17  1:35 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Dmitry Torokhov, Linux Input, linux-kernel

Hi
thanks for your feedback.

On 17 9月 21 00:30:32, Linus Walleij wrote:
> Hi Cai,
> 
> On Thu, Sep 16, 2021 at 5:32 PM Cai Huoqing <caihuoqing@baidu.com> wrote:
> 
> >         if (IS_ERR(ts->reset_gpio)) {
> >                 error = PTR_ERR(ts->reset_gpio);
> > -               dev_err(dev, "Failed to request reset gpio, error %d\n", error);
> > +               dev_err_probe(dev, error, "Failed to request reset gpio\n");
> >                 return ERR_PTR(error);
> 
> In this case you're supposed to do
> 
> return dev_err_probe(dev, error, "Failed to request reset gpio\n");
the probe function is defined:
"struct cyttsp *cyttsp_probe("

so it is required to return a PTR:cyttsp *.
Thanks
Cai

> 
> Yours,
> Linus Walleij



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe()
  2021-09-17  1:35   ` Cai Huoqing
@ 2021-09-19 19:28     ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2021-09-19 19:28 UTC (permalink / raw)
  To: Cai Huoqing; +Cc: Dmitry Torokhov, Linux Input, linux-kernel

On Fri, Sep 17, 2021 at 3:35 AM Cai Huoqing <caihuoqing@baidu.com> wrote:
> On 17 9月 21 00:30:32, Linus Walleij wrote:
> > On Thu, Sep 16, 2021 at 5:32 PM Cai Huoqing <caihuoqing@baidu.com> wrote:
> >
> > >         if (IS_ERR(ts->reset_gpio)) {
> > >                 error = PTR_ERR(ts->reset_gpio);
> > > -               dev_err(dev, "Failed to request reset gpio, error %d\n", error);
> > > +               dev_err_probe(dev, error, "Failed to request reset gpio\n");
> > >                 return ERR_PTR(error);
> >
> > In this case you're supposed to do
> >
> > return dev_err_probe(dev, error, "Failed to request reset gpio\n");
> the probe function is defined:
> "struct cyttsp *cyttsp_probe("
>
> so it is required to return a PTR:cyttsp *.

What about

return ERR_PTR(dev_err_probe(dev, error, "Failed to request reset gpio\n"));

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-19 19:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 15:31 [PATCH] Input: cyttsp - Make use of the helper function dev_err_probe() Cai Huoqing
2021-09-16 22:30 ` Linus Walleij
2021-09-17  1:35   ` Cai Huoqing
2021-09-19 19:28     ` Linus Walleij

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.