[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120223044825.GD9141@shlinux2.ap.freescale.net>
Date: Thu, 23 Feb 2012 12:48:26 +0800
From: Dong Aisheng <aisheng.dong@...escale.com>
To: Stephen Warren <swarren@...dia.com>
CC: Linus Walleij <linus.walleij@...aro.org>,
Linus Walleij <linus.walleij@...ricsson.com>,
"B29396@...escale.com" <B29396@...escale.com>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"dongas86@...il.com" <dongas86@...il.com>,
"shawn.guo@...aro.org" <shawn.guo@...aro.org>,
"thomas.abraham@...aro.org" <thomas.abraham@...aro.org>,
"tony@...mide.com" <tony@...mide.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 08/20] pinctrl: Assume map table entries can't have a
NULL name field
On Wed, Feb 22, 2012 at 07:53:44PM -0800, Stephen Warren wrote:
> Dong Aisheng wrote at Wednesday, February 22, 2012 8:57 PM:
> > On Wed, Feb 22, 2012 at 07:39:42PM -0800, Stephen Warren wrote:
> > > Dong Aisheng wrote at Wednesday, February 22, 2012 8:35 PM:
> > > > On Wed, Feb 22, 2012 at 10:05:20AM -0800, Stephen Warren wrote:
> ...
> > > > > regulator_get(dev, id) requires id != NULL.
> > > > >
> > > > > clk_get(dev, con_id) requires con_id != NULL in order to match a clock
> > > > > that has a non-NULL con_id defined (although clocks with a NULL con_id
> > > > > are also legal, in which case, the con_id parameter to clk_get is
> > > > > ignored)
> > > > >
> > > > > So pinctrl_get(dev, state) requiring state != NULL seems consistent
> > > > > with existing practice.
> > > >
> > > > Yes, it's true if given all map entries have a name.
> > > >
> > > > Now i'm intend to the way you mentioned at:
> > > > https://lkml.org/lkml/2012/2/21/213
> > > >
> > > > And i agree with the way you said:
> > > > If we continue to allow NULL names, I think we should change that to:
> > > > if name:
> > > > match = map->name && !strcmp(name, map->name)
> > > > else:
> > > > match = !map->name
> > > >
> > > > And i think allowing map name to be NULL will make life easy for those
> > > > devices who do not support multi states.
> > >
> > > It does make it a little convenient for board files, but isn't really
> > > practical to implement for device-tree unless we modify the binding to
> > > have something that means "no name". I'd rather not allow more options
> > > in the binding though.
> > >
> > > What's wrong with writing e.g. PINCTRL_DEFAULT instead of NULL when calling
> > > pinctrl_get() or pinctrl_lookup_state() though? Given pinctrl.h having:
> > >
> > > #define PINCTRL_DEFAULT "default"
> >
> > First, map writer needs know this logic.
>
> Sure, but that's always true; you need to know the state name in all cases.
> And this requirement seems extremely trivial for a map writer to implement.
>
> > Second, all as you said:
> >
> > > > > every mapping table entry has a name and drivers (or device tree bindings)
> > > > > define what that name must be, so why shouldn't drivers be required to
> > > > > request that specific name, and experience an error if the mapping table
> > > > > author didn't create that name?
> >
> > if want to keep align with regulator and clock,
> > i just feel a little that it does not make too much sense to
> > internally convert NULL to "default", right?
>
> I'm hoping that we don't do this internal conversion. The rules I'd like are:
>
I'm also agree that we either allow map name to be NULL or not but not do internal
conversion.
> * Every mapping table entry must include a non-NULL name field.
>
> * Every call to pinctrl_get()/pinctrl_lookup_state() must pass a non-NULL name
This is a way.
Before using this, i'm still wondering what big problems do you think for us to support
a NULL map name?
Because the name for devices do not have different state really does not make too much
sense but extra overhead.
Regards
Dong Aisheng
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists