]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: altera: use container_of() to get state container
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 25 Aug 2015 08:54:12 +0000 (10:54 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 2 Oct 2015 11:19:32 +0000 (04:19 -0700)
commit95da1d96c151e621c8cc19d0937abcbd203d80a9
treef01c6b7c3fb8b477475c4ed4d917ad7d9d754088
parent3d0a214c258a44ce50c1717f754c4142c8ee1af9
gpio: altera: use container_of() to get state container

The state container of the Altera GPIO driver is extracted from
the gpio_chip exploiting the fact that offsetof() the
struct gpio_chip inside the struct of_mm_gpio_chip are both 0, so
the container_of() is in practice a noop. However if a member
is added to struct altera_gpio_chip in front of
struct of_mm_gpio_chip, things will break. Using proper
container_of() avoids this problem.

Semantically this is a noop, the compiler will optimize it away,
but syntactically it makes me happier.

Cc: Tien Hock Loh <thloh@altera.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-altera.c