Adding a void * to pinctrl_pin_desc

Linus Walleij linus.walleij at linaro.org
Fri Apr 26 04:52:06 EDT 2013


On Fri, Apr 26, 2013 at 2:42 AM, Sherman Yin <syin at broadcom.com> wrote:

>  What do you think about expanding the struct to something like this:
>
> struct pinctrl_pin_desc {
>         unsigned number;
>         const char *name;
>         void * pin_data;
> };
>
> so that drivers can optionally use pin_data to hold other pin-specific information?

No don't do this.

Instead:

struct foo_pin_desc {
      struct pinctrl_pin_desc desc;
      ....
      /* Insert my pindata here */
};

Then use container_of() to dereference a struct foo_pin_desc pointer from the
pointer at &foodesc->desc;

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list