devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Alexandre Courbot <acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: "linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] i2c: pca954x: Fix reset GPIO property name
Date: Tue, 03 Jun 2014 12:51:01 +0200	[thread overview]
Message-ID: <6244450.7XtcE2yoMk@avalon> (raw)
In-Reply-To: <538D272D.5050406-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Hi Alexandre,

On Tuesday 03 June 2014 10:38:53 Alexandre Courbot wrote:
> On 06/03/2014 09:22 AM, Laurent Pinchart wrote:
> > The DT bindings for the pca954x document that the reset GPIO is
> > specified through the "reset-gpios" property. However, the driver
> > erroneously uses a property name of "reset-gpio".
> > 
> > The GPIO DT bindings documentation mentions that
> > 
> > "GPIO properties should be named "[<name>-]gpios". The exact meaning of
> > each gpios property must be documented in the device tree binding for
> > each device."
> > 
> > The correct reset GPIO property name is thus "reset-gpios". Fix the
> > driver accordingly.
> 
> The plural form should be preferred indeed.
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > ---
> > 
> >   drivers/i2c/muxes/i2c-mux-pca954x.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > While commit dd34c37aa3e81715a1ed8da61fa438072428e188
> > 
> > Author: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > Date:   Wed Apr 23 17:28:09 2014 +0200
> > 
> >      gpio: of: Allow -gpio suffix for property names
> >      
> >      Many bindings use the -gpio suffix in property names. Support this in
> >      addition to the -gpios suffix when requesting GPIOs using the new
> >      descriptor-based API.
> > 
> > adds support for the singular form of the property, the GPIO DT bindings
> > document the plural form only. I've thus decided to fix the driver instead
> > of the bindings, even though it could be argued that the singular form
> > makes more sense in this case. I've CC'ed the people involved with the
> > above commit for comments on that, and have no issue fixing the bindings
> > instead of the driver if the singular form is preferred.
> > 
> > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c
> > b/drivers/i2c/muxes/i2c-mux-pca954x.c index 550bd36..73491ca 100644
> > --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> > +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> > @@ -205,7 +205,7 @@ static int pca954x_probe(struct i2c_client *client,
> > 
> >   		int gpio;
> >   		
> >   		/* Get the mux out of reset if a reset GPIO is specified. */
> > 
> > -		gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
> > +		gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags);
> 
> Won't this break DT compatibility for potential users of this driver? (I
> cannot find any in mainline though)

Only if those users don't conform to the DT bindings documentation that 
mandates the plural form, and are thus broken already ;-)

> Considering that this GPIO is only acquired and set once and for all
> during probe (a very simple use-case), how about switching this to the
> gpiod interface instead? That way, you can take advantage of Thierry's
> patch and the plural form will work while also maintaining the singular
> form for backward compatibility.

Regardless of the singular vs. plural debate I think that's a good idea. I'll 
thus rework this patch.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2014-06-03 10:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1401754973-13274-1-git-send-email-laurent.pinchart@ideasonboard.com>
     [not found] ` <1401754973-13274-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-06-03  1:38   ` [PATCH] i2c: pca954x: Fix reset GPIO property name Alexandre Courbot
     [not found]     ` <538D272D.5050406-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-06-03 10:51       ` Laurent Pinchart [this message]
2014-06-03 11:15   ` [PATCH v2] i2c: pca954x: Use the descriptor-based GPIO API Laurent Pinchart
     [not found]     ` <1401794126-22244-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-06-03 11:19       ` Linus Walleij
2014-06-03 12:21       ` Wolfram Sang
2014-06-03 12:32       ` Alexandre Courbot

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=6244450.7XtcE2yoMk@avalon \
    --to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
    --cc=acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@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).