lkml.org 
[lkml]   [2012]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRE: [PATCH 08/20] pinctrl: Assume map table entries can't have a NULL name field
Dong Aisheng wrote at Wednesday, February 22, 2012 9:48 PM:
> On Wed, Feb 22, 2012 at 07:53:44PM -0800, Stephen Warren wrote:
...
> > I'm hoping that we don't do this internal conversion. The rules I'd like are:
...
> > * 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.

If we disallow NULL names, it simplifies the code in the pinctrl core;
when registering mappings or right at the start of pinctrl_get() or
pinctrl_lookup_state(), we check if the name is NULL and if so error out.
Everywhere else can then assume name!=NULL, and hence not have special-
cases for name==NULL, e.g.:

In debug code:
name ? name : "(unnamed)"
vs.:
name

When matching mapping table entries:
match = !name ? !map->name : !strcmp(name, map->name)
vs.:
match = !strcmp(name, map->name)

Similar for the body of pinctrl_lookup_state().

Equally, it's not possible to generate a mapping table entry with a NULL
name from device tree given the bindings we discussed, so disallowing them
everywhere keeps things consistent.

--
nvpublic



\
 
 \ /
  Last update: 2012-02-23 17:43    [W:0.079 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site