Re: [PATCH 112/182] pinctrl: samsung: use gpiochip data pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 11, 2015 at 7:14 AM, Tomasz Figa <tomasz.figa@xxxxxxxxx> wrote:
> Hi Linus,
>
> 2015-12-09 22:33 GMT+09:00 Linus Walleij <linus.walleij@xxxxxxxxxx>:
>> This makes the driver use the data pointer added to the gpio_chip
>> to store a pointer to the state container instead of relying on
>> container_of().
>
> I always thought container_of() was preferred because of higher type
> safety than void *data pointers. Is there any reason for mandating the
> (IMHO worse) new method of accessing data, even though the one
> currently used seems to be still valid?

This is explained in patch 000/182:
http://marc.info/?l=linux-gpio&m=144966662402660&w=2

In the generic GPIO case it gets really really messy with
container_of(container_of(x)) in every driver, making the code
so hard to read that it becomes a pain to maintain and do the
right thing, trumping any type safety.

Unless someone has a real performance issue I think this is
the way to go.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux