linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh+dt@kernel.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Mylène Josserand" <mylene.josserand@collabora.com>,
	"Linux Input" <linux-input@vger.kernel.org>,
	devicetree@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Collabora Kernel ML" <kernel@collabora.com>
Subject: Re: [PATCHv2 3/4] Input: rotary-encoder - Use dev_err_probe
Date: Wed, 9 Sep 2020 13:48:49 -0600	[thread overview]
Message-ID: <CAL_JsqJ8E4Y-kaksCXBC=_sEf4Nz8bZr-4=_g5_PjWtQJm8jsA@mail.gmail.com> (raw)
In-Reply-To: <20200907204045.95530-4-sebastian.reichel@collabora.com>

On Mon, Sep 7, 2020 at 2:40 PM Sebastian Reichel
<sebastian.reichel@collabora.com> wrote:
>
> Simplify driver a bit by making use of dev_err_probe.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  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 e9a5dbb10513..16ad86fad7cb 100644
> --- a/drivers/input/misc/rotary_encoder.c
> +++ b/drivers/input/misc/rotary_encoder.c
> @@ -241,12 +241,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");

I hadn't seen dev_err_probe...

Just FYI, I'm working on a different fix here which is to print errors
in the subsystems instead. We already do this for IRQs, so why not
everything else? The original reason was no resource is sometimes not
an error, but now we have *_optional calls to handle this case for
most all subsystems. It's a coccinelle script (hacked up from
platform_get_irq.cocci) to convert all the drivers.

Rob

  reply	other threads:[~2020-09-09 19:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 20:40 [PATCHv2 0/4] Rotary Encoder Push Button Support Sebastian Reichel
2020-09-07 20:40 ` [PATCHv2 1/4] dt-bindings: input: Convert rotary-encoder bindings to schema Sebastian Reichel
2020-09-15 16:22   ` Rob Herring
2020-09-07 20:40 ` [PATCHv2 2/4] Input: rotary-encoder - Fix steps property reading Sebastian Reichel
2020-09-07 20:40 ` [PATCHv2 3/4] Input: rotary-encoder - Use dev_err_probe Sebastian Reichel
2020-09-09 19:48   ` Rob Herring [this message]
2020-09-10 20:58     ` Sebastian Reichel
2020-09-07 20:40 ` [PATCHv2 4/4] Input: rotary-encoder - Add gpio as push button Sebastian Reichel
2020-09-15 16:33   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL_JsqJ8E4Y-kaksCXBC=_sEf4Nz8bZr-4=_g5_PjWtQJm8jsA@mail.gmail.com' \
    --to=robh+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mylene.josserand@collabora.com \
    --cc=sebastian.reichel@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).