Commit 56b42767 authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Walleij

gpio: use container_of to resolve cs5535_gpio_chip from gpio_chip

Use container_of instead of casting first structure member.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 1e960dbb
...@@ -201,7 +201,8 @@ EXPORT_SYMBOL_GPL(cs5535_gpio_setup_event); ...@@ -201,7 +201,8 @@ EXPORT_SYMBOL_GPL(cs5535_gpio_setup_event);
static int chip_gpio_request(struct gpio_chip *c, unsigned offset) static int chip_gpio_request(struct gpio_chip *c, unsigned offset)
{ {
struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; struct cs5535_gpio_chip *chip =
container_of(c, struct cs5535_gpio_chip, chip);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&chip->lock, flags); spin_lock_irqsave(&chip->lock, flags);
...@@ -241,7 +242,8 @@ static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val) ...@@ -241,7 +242,8 @@ static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
static int chip_direction_input(struct gpio_chip *c, unsigned offset) static int chip_direction_input(struct gpio_chip *c, unsigned offset)
{ {
struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; struct cs5535_gpio_chip *chip =
container_of(c, struct cs5535_gpio_chip, chip);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&chip->lock, flags); spin_lock_irqsave(&chip->lock, flags);
...@@ -254,7 +256,8 @@ static int chip_direction_input(struct gpio_chip *c, unsigned offset) ...@@ -254,7 +256,8 @@ static int chip_direction_input(struct gpio_chip *c, unsigned offset)
static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val)
{ {
struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; struct cs5535_gpio_chip *chip =
container_of(c, struct cs5535_gpio_chip, chip);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&chip->lock, flags); spin_lock_irqsave(&chip->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment