diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 11:34:53 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 11:21:11 +0100 |
commit | 510f48713711abed9a79aa405147687dd256d072 (patch) | |
tree | 144dfde97c5468858e0b4a8d82d08e3b4cf0e516 | |
parent | 597358e41070e03479a7724b16eb3c6c7ea50027 (diff) | |
download | talos-op-linux-510f48713711abed9a79aa405147687dd256d072.tar.gz talos-op-linux-510f48713711abed9a79aa405147687dd256d072.zip |
gpio: pch: 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: Thierry Reding <treding@nvidia.com>
Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-pch.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 8c45b74dcf21..0475782a7e88 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -109,7 +109,7 @@ struct pch_gpio { static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { u32 reg_val; - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); @@ -125,7 +125,7 @@ static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); return !!(ioread32(&chip->reg->pi) & (1 << nr)); } @@ -133,7 +133,7 @@ static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr) static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); u32 pm; u32 reg_val; unsigned long flags; @@ -158,7 +158,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int pch_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); u32 pm; unsigned long flags; @@ -211,7 +211,7 @@ static void pch_gpio_restore_reg_conf(struct pch_gpio *chip) static int pch_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); return chip->irq_base + offset; } @@ -397,7 +397,7 @@ static int pch_gpio_probe(struct pci_dev *pdev, #ifdef CONFIG_OF_GPIO chip->gpio.of_node = pdev->dev.of_node; #endif - ret = gpiochip_add(&chip->gpio); + ret = gpiochip_add_data(&chip->gpio, chip); if (ret) { dev_err(&pdev->dev, "PCH gpio: Failed to register GPIO\n"); goto err_gpiochip_add; |