From 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 25 Mar 2016 03:53:42 -0300 Subject: Linux-libre 4.5-gnu --- drivers/gpio/gpio-lpc18xx.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'drivers/gpio/gpio-lpc18xx.c') diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c index e39dcb0af..98832c9f6 100644 --- a/drivers/gpio/gpio-lpc18xx.c +++ b/drivers/gpio/gpio-lpc18xx.c @@ -31,27 +31,22 @@ struct lpc18xx_gpio_chip { spinlock_t lock; }; -static inline struct lpc18xx_gpio_chip *to_lpc18xx_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct lpc18xx_gpio_chip, gpio); -} - static void lpc18xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip); + struct lpc18xx_gpio_chip *gc = gpiochip_get_data(chip); writeb(value ? 1 : 0, gc->base + offset); } static int lpc18xx_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip); + struct lpc18xx_gpio_chip *gc = gpiochip_get_data(chip); return !!readb(gc->base + offset); } static int lpc18xx_gpio_direction(struct gpio_chip *chip, unsigned offset, bool out) { - struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip); + struct lpc18xx_gpio_chip *gc = gpiochip_get_data(chip); unsigned long flags; u32 port, pin, dir; @@ -127,9 +122,9 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev) spin_lock_init(&gc->lock); - gc->gpio.dev = &pdev->dev; + gc->gpio.parent = &pdev->dev; - ret = gpiochip_add(&gc->gpio); + ret = gpiochip_add_data(&gc->gpio, gc); if (ret) { dev_err(&pdev->dev, "failed to add gpio chip\n"); clk_disable_unprepare(gc->clk); -- cgit v1.2.3-54-g00ecf