linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org"
	<kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v3] Input: rotary_encoder - support binary encoding of states
Date: Fri, 8 Apr 2016 08:40:58 +0200	[thread overview]
Message-ID: <20160408064058.GC10108@pengutronix.de> (raw)
In-Reply-To: <CAL_JsqLfQQu69LcsFuJkKmjppp047vW5Ga+y5XiDAAG-Weh6ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hello Rob,

On Thu, Apr 07, 2016 at 05:45:00PM -0500, Rob Herring wrote:
> On Thu, Apr 7, 2016 at 1:58 PM, Uwe Kleine-König
> <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > It's not advisable to use this encoding, but to support existing devices
> > add support for this to the driver.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > ---
> 
> Ack for the binding, but...

Thanks. Actually I already had your ack for v2 and only dropped it to
make you look over the patch again :-)
 
> > @@ -213,6 +222,17 @@ static int rotary_encoder_probe(struct platform_device *pdev)
> >         encoder->rollover =
> >                 device_property_read_bool(dev, "rotary-encoder,rollover");
> >
> > +       err = device_property_read_string(dev, "rotary-encoder,encoding",
> > +                                         &encoding);
> > +       if (!err && !strcmp(encoding, "binary")) {
> > +               encoder->encoding = ROTENC_BINARY;
> > +       } else if (err || !strcmp(encoding, "gray")) {
> > +               encoder->encoding = ROTENC_GRAY;
> > +       } else {
> > +               dev_err(dev, "unknown encoding setting");
> > +               return -EINVAL;
> 
> device_property_match_string() here instead.

With the added downside that the property is parsed at least twice from
dt, right? This is not a hot path, but still I wonder if it simplyfies
the driver code enough to be worth the effort?

Also this seems to have a different semantic and allows the property to
be an array.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-04-08  6:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 18:58 [PATCH v3] Input: rotary_encoder - support binary encoding of states Uwe Kleine-König
2016-04-07 22:45 ` Rob Herring
     [not found]   ` <CAL_JsqLfQQu69LcsFuJkKmjppp047vW5Ga+y5XiDAAG-Weh6ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-08  6:40     ` Uwe Kleine-König [this message]
     [not found]       ` <20160408064058.GC10108-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-04-11 15:32         ` 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=20160408064058.GC10108@pengutronix.de \
    --to=u.kleine-koenig-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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).