Commit 11680af7 authored by Linus Walleij's avatar Linus Walleij

video: fbdev: via: use gpiochip data pointer

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: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Acked-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 166814d8
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/gpio.h> #include <linux/gpio/driver.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/via-core.h> #include <linux/via-core.h>
#include <linux/via-gpio.h> #include <linux/via-gpio.h>
...@@ -83,9 +83,7 @@ struct viafb_gpio_cfg { ...@@ -83,9 +83,7 @@ struct viafb_gpio_cfg {
static void via_gpio_set(struct gpio_chip *chip, unsigned int nr, static void via_gpio_set(struct gpio_chip *chip, unsigned int nr,
int value) int value)
{ {
struct viafb_gpio_cfg *cfg = container_of(chip, struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip);
struct viafb_gpio_cfg,
gpio_chip);
u8 reg; u8 reg;
struct viafb_gpio *gpio; struct viafb_gpio *gpio;
unsigned long flags; unsigned long flags;
...@@ -115,9 +113,7 @@ static int via_gpio_dir_out(struct gpio_chip *chip, unsigned int nr, ...@@ -115,9 +113,7 @@ static int via_gpio_dir_out(struct gpio_chip *chip, unsigned int nr,
*/ */
static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr) static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr)
{ {
struct viafb_gpio_cfg *cfg = container_of(chip, struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip);
struct viafb_gpio_cfg,
gpio_chip);
struct viafb_gpio *gpio; struct viafb_gpio *gpio;
unsigned long flags; unsigned long flags;
...@@ -131,9 +127,7 @@ static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr) ...@@ -131,9 +127,7 @@ static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr)
static int via_gpio_get(struct gpio_chip *chip, unsigned int nr) static int via_gpio_get(struct gpio_chip *chip, unsigned int nr)
{ {
struct viafb_gpio_cfg *cfg = container_of(chip, struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip);
struct viafb_gpio_cfg,
gpio_chip);
u8 reg; u8 reg;
struct viafb_gpio *gpio; struct viafb_gpio *gpio;
unsigned long flags; unsigned long flags;
...@@ -255,7 +249,8 @@ static int viafb_gpio_probe(struct platform_device *platdev) ...@@ -255,7 +249,8 @@ static int viafb_gpio_probe(struct platform_device *platdev)
* Get registered. * Get registered.
*/ */
viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */
ret = gpiochip_add(&viafb_gpio_config.gpio_chip); ret = gpiochip_add_data(&viafb_gpio_config.gpio_chip,
&viafb_gpio_config);
if (ret) { if (ret) {
printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret);
viafb_gpio_config.gpio_chip.ngpio = 0; viafb_gpio_config.gpio_chip.ngpio = 0;
......
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