* [PATCH 007/182] gpio: 74x164: use gpiochip data pointer
@ 2015-12-09 13:13 Linus Walleij
0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2015-12-09 13:13 UTC (permalink / raw)
To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
Markus Pargmann
Cc: Linus Walleij, Alexander Shiyan
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().
Cc: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-74x164.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index fb555300008f..34c20e802da9 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -26,11 +26,6 @@ struct gen_74x164_chip {
u32 registers;
};
-static struct gen_74x164_chip *gpio_to_74x164_chip(struct gpio_chip *gc)
-{
- return container_of(gc, struct gen_74x164_chip, gpio_chip);
-}
-
static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
{
struct spi_device *spi = to_spi_device(chip->gpio_chip.parent);
@@ -68,7 +63,7 @@ static int __gen_74x164_write_config(struct gen_74x164_chip *chip)
static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset)
{
- struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc);
+ struct gen_74x164_chip *chip = gpiochip_get_data(gc);
u8 bank = offset / 8;
u8 pin = offset % 8;
int ret;
@@ -83,7 +78,7 @@ static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset)
static void gen_74x164_set_value(struct gpio_chip *gc,
unsigned offset, int val)
{
- struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc);
+ struct gen_74x164_chip *chip = gpiochip_get_data(gc);
u8 bank = offset / 8;
u8 pin = offset % 8;
@@ -154,7 +149,7 @@ static int gen_74x164_probe(struct spi_device *spi)
goto exit_destroy;
}
- ret = gpiochip_add(&chip->gpio_chip);
+ ret = gpiochip_add_data(&chip->gpio_chip, chip);
if (!ret)
return 0;
--
2.4.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-09 13:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 13:13 [PATCH 007/182] gpio: 74x164: use gpiochip data pointer Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).