[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdqgEvcs_LAHBV=O57vVMVrjUnfVr3anzJmtFMKYyeMkw@mail.gmail.com>
Date: Thu, 27 Aug 2020 12:08:15 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
Linus Walleij <linus.walleij@...aro.org>,
Bastien Nocera <hadess@...ess.net>,
Sangwon Jee <jeesw@...fas.com>,
Eugen Hristev <eugen.hristev@...rochip.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-input <linux-input@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Platform Driver <platform-driver-x86@...r.kernel.org>
Subject: Re: [PATCH 07/24] Input: rotary_encoder - Simplify with dev_err_probe()
On Wed, Aug 26, 2020 at 9:23 PM Krzysztof Kozlowski <krzk@...nel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe(). Less code and also it prints the error value.
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
> drivers/input/misc/rotary_encoder.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
> index 6d613f2a017c..ea56c9f4975a 100644
> --- a/drivers/input/misc/rotary_encoder.c
> +++ b/drivers/input/misc/rotary_encoder.c
> @@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
> device_property_read_bool(dev, "rotary-encoder,relative-axis");
>
> encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
> - if (IS_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 (IS_ERR(encoder->gpios))
> + return dev_err_probe(dev, PTR_ERR(encoder->gpios), "unable to get gpios\n");
> if (encoder->gpios->ndescs < 2) {
> dev_err(dev, "not enough gpios found\n");
> return -EINVAL;
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists