diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 08:16:19 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:12 -0500 |
commit | 78132252cc4c6cecec25491a7bcfb6567bf29147 (patch) | |
tree | d223db471b16918a25e2d966ea381f67f3f87f68 /drivers/gpio/gpio-rdc321x.c | |
parent | c7b6f457cb53bceece484f4c528d1c149995e6c7 (diff) |
gpio: rdc321x: 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().
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-rdc321x.c')
-rw-r--r-- | drivers/gpio/gpio-rdc321x.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c index d729bc8a554d..96ddee3f464a 100644 --- a/drivers/gpio/gpio-rdc321x.c +++ b/drivers/gpio/gpio-rdc321x.c | |||
@@ -47,7 +47,7 @@ static int rdc_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | |||
47 | u32 value = 0; | 47 | u32 value = 0; |
48 | int reg; | 48 | int reg; |
49 | 49 | ||
50 | gpch = container_of(chip, struct rdc321x_gpio, chip); | 50 | gpch = gpiochip_get_data(chip); |
51 | reg = gpio < 32 ? gpch->reg1_data_base : gpch->reg2_data_base; | 51 | reg = gpio < 32 ? gpch->reg1_data_base : gpch->reg2_data_base; |
52 | 52 | ||
53 | spin_lock(&gpch->lock); | 53 | spin_lock(&gpch->lock); |
@@ -65,7 +65,7 @@ static void rdc_gpio_set_value_impl(struct gpio_chip *chip, | |||
65 | struct rdc321x_gpio *gpch; | 65 | struct rdc321x_gpio *gpch; |
66 | int reg = (gpio < 32) ? 0 : 1; | 66 | int reg = (gpio < 32) ? 0 : 1; |
67 | 67 | ||
68 | gpch = container_of(chip, struct rdc321x_gpio, chip); | 68 | gpch = gpiochip_get_data(chip); |
69 | 69 | ||
70 | if (value) | 70 | if (value) |
71 | gpch->data_reg[reg] |= 1 << (gpio & 0x1f); | 71 | gpch->data_reg[reg] |= 1 << (gpio & 0x1f); |
@@ -83,7 +83,7 @@ static void rdc_gpio_set_value(struct gpio_chip *chip, | |||
83 | { | 83 | { |
84 | struct rdc321x_gpio *gpch; | 84 | struct rdc321x_gpio *gpch; |
85 | 85 | ||
86 | gpch = container_of(chip, struct rdc321x_gpio, chip); | 86 | gpch = gpiochip_get_data(chip); |
87 | spin_lock(&gpch->lock); | 87 | spin_lock(&gpch->lock); |
88 | rdc_gpio_set_value_impl(chip, gpio, value); | 88 | rdc_gpio_set_value_impl(chip, gpio, value); |
89 | spin_unlock(&gpch->lock); | 89 | spin_unlock(&gpch->lock); |
@@ -96,7 +96,7 @@ static int rdc_gpio_config(struct gpio_chip *chip, | |||
96 | int err; | 96 | int err; |
97 | u32 reg; | 97 | u32 reg; |
98 | 98 | ||
99 | gpch = container_of(chip, struct rdc321x_gpio, chip); | 99 | gpch = gpiochip_get_data(chip); |
100 | 100 | ||
101 | spin_lock(&gpch->lock); | 101 | spin_lock(&gpch->lock); |
102 | err = pci_read_config_dword(gpch->sb_pdev, gpio < 32 ? | 102 | err = pci_read_config_dword(gpch->sb_pdev, gpio < 32 ? |
@@ -194,7 +194,7 @@ static int rdc321x_gpio_probe(struct platform_device *pdev) | |||
194 | 194 | ||
195 | dev_info(&pdev->dev, "registering %d GPIOs\n", | 195 | dev_info(&pdev->dev, "registering %d GPIOs\n", |
196 | rdc321x_gpio_dev->chip.ngpio); | 196 | rdc321x_gpio_dev->chip.ngpio); |
197 | return gpiochip_add(&rdc321x_gpio_dev->chip); | 197 | return gpiochip_add_data(&rdc321x_gpio_dev->chip, rdc321x_gpio_dev); |
198 | } | 198 | } |
199 | 199 | ||
200 | static int rdc321x_gpio_remove(struct platform_device *pdev) | 200 | static int rdc321x_gpio_remove(struct platform_device *pdev) |