Skip to content

Commit

Permalink
gpio: max730x: use gpiochip data pointer
Browse files Browse the repository at this point in the history
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: Roland Stigge <stigge@antcom.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
linusw committed Jan 5, 2016
1 parent f291e00 commit 5e45e01
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/gpio/gpio-max730x.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

static int max7301_direction_input(struct gpio_chip *chip, unsigned offset)
{
struct max7301 *ts = container_of(chip, struct max7301, chip);
struct max7301 *ts = gpiochip_get_data(chip);
u8 *config;
u8 offset_bits, pin_config;
int ret;
Expand Down Expand Up @@ -92,7 +92,7 @@ static int __max7301_set(struct max7301 *ts, unsigned offset, int value)
static int max7301_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
struct max7301 *ts = container_of(chip, struct max7301, chip);
struct max7301 *ts = gpiochip_get_data(chip);
u8 *config;
u8 offset_bits;
int ret;
Expand Down Expand Up @@ -120,7 +120,7 @@ static int max7301_direction_output(struct gpio_chip *chip, unsigned offset,

static int max7301_get(struct gpio_chip *chip, unsigned offset)
{
struct max7301 *ts = container_of(chip, struct max7301, chip);
struct max7301 *ts = gpiochip_get_data(chip);
int config, level = -EINVAL;

/* First 4 pins are unused in the controller */
Expand Down Expand Up @@ -148,7 +148,7 @@ static int max7301_get(struct gpio_chip *chip, unsigned offset)

static void max7301_set(struct gpio_chip *chip, unsigned offset, int value)
{
struct max7301 *ts = container_of(chip, struct max7301, chip);
struct max7301 *ts = gpiochip_get_data(chip);

/* First 4 pins are unused in the controller */
offset += 4;
Expand Down Expand Up @@ -213,7 +213,7 @@ int __max730x_probe(struct max7301 *ts)
}
}

ret = gpiochip_add(&ts->chip);
ret = gpiochip_add_data(&ts->chip, ts);
if (ret)
goto exit_destroy;

Expand Down

0 comments on commit 5e45e01

Please sign in to comment.