diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
commit | 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 (patch) | |
tree | fa581f6dc1c0596391690d1f67eceef3af8246dc /drivers/video/fbdev/via | |
parent | d4e493caf788ef44982e131ff9c786546904d934 (diff) |
Linux-libre 4.5-gnu
Diffstat (limited to 'drivers/video/fbdev/via')
-rw-r--r-- | drivers/video/fbdev/via/via-gpio.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c index 6f433b8ce..1e89c3434 100644 --- a/drivers/video/fbdev/via/via-gpio.c +++ b/drivers/video/fbdev/via/via-gpio.c @@ -6,7 +6,7 @@ */ #include <linux/spinlock.h> -#include <linux/gpio.h> +#include <linux/gpio/driver.h> #include <linux/platform_device.h> #include <linux/via-core.h> #include <linux/via-gpio.h> @@ -83,9 +83,7 @@ struct viafb_gpio_cfg { static void via_gpio_set(struct gpio_chip *chip, unsigned int nr, int value) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); u8 reg; struct viafb_gpio *gpio; unsigned long flags; @@ -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) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); struct viafb_gpio *gpio; unsigned long flags; @@ -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) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); u8 reg; struct viafb_gpio *gpio; unsigned long flags; @@ -142,7 +136,7 @@ static int via_gpio_get(struct gpio_chip *chip, unsigned int nr) gpio = cfg->active_gpios[nr]; reg = via_read_reg(VIASR, gpio->vg_port_index); spin_unlock_irqrestore(&cfg->vdev->reg_lock, flags); - return reg & (0x04 << gpio->vg_mask_shift); + return !!(reg & (0x04 << gpio->vg_mask_shift)); } @@ -255,7 +249,8 @@ static int viafb_gpio_probe(struct platform_device *platdev) * Get registered. */ 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) { printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); viafb_gpio_config.gpio_chip.ngpio = 0; |