From: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Uwe Kleine-König"
<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@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: Mon, 11 Apr 2016 10:32:48 -0500 [thread overview]
Message-ID: <20160411153248.GA20044@rob-hp-laptop> (raw)
In-Reply-To: <20160408064058.GC10108-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
On Fri, Apr 08, 2016 at 08:40:58AM +0200, Uwe Kleine-König wrote:
> 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?
IMO, yes.
> Also this seems to have a different semantic and allows the property to
> be an array.
It is not really the kernel's job to validate crap in bindings. If you
put '"binary", "gray"' in your DT, then the kernel may or may not handle
that.
Rob
--
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
prev parent reply other threads:[~2016-04-11 15:32 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
[not found] ` <20160408064058.GC10108-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-04-11 15:32 ` Rob Herring [this message]
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=20160411153248.GA20044@rob-hp-laptop \
--to=robh-dgejt+ai2ygdnm+yrofe0a@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=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@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