RE: [PATCH v6] pinctrl: add a pin config interface

From: Stephen Warren
Date: Wed Dec 14 2011 - 10:44:40 EST


Linus Walleij wrote at Wednesday, December 14, 2011 2:06 AM:
> On Wed, Dec 14, 2011 at 8:04 AM, Chanho Park <chanho61.park@xxxxxxxxxxx> wrote:
>
> >> ChangeLog v5->v6:
> >> - Change to using a pin name as parameter for the
> >>   [get|set]_config() functions, as suggested by Stephen Warren.
> >>   This is more natural as names will be what a developer has
> >>   access to in written documentation etc.
> >
> > I don't agree with it.
> > Someone doesn't like to assign a pin name individually because a
> > pin number is sufficient to represent each pin.
...
> What turned me around to see things Stephen's way was the fact
> that if someone reads this code and finds:
>
> pin_config_set(dev, 42, MY_FUNNY_PULLUP_MACRO);
>
> It is harder to understand than:
>
> pin_config_set(dev, "I2C0 SCL", MY_FUNNY_PULLUP_MACRO);

You could mitigate the opaqueness of the numbers by having the pinctrl
driver export a header of #defines for the pin numbers, so this could be:

pin_config_set(dev, FOO_PMX_PIN_I2C0_SCL, MY_FUNNY_PULLUP_MACRO);

Still, using strings avoids the need to do this.

Equally, I don't see the disadvantage of using strings here. In earlier
discussions, I thought we already discussed making pin names mandatory,
which seems to avoid most of Chanho's objections?

--
nvpublic

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/