diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-04 09:29:41 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:02 -0500 |
commit | fb7228879a5a6552c9cd91561ca7c9b565a102aa (patch) | |
tree | 98b0c864b2ccdf2bcfb84187dfb623b91e0b47aa /drivers/gpio/gpio-amdpt.c | |
parent | 57683ec203a642e8fc8befac94c8341d237f5d54 (diff) |
gpio: amdpt: 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: YD Tseng <ltyu101@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-amdpt.c')
-rw-r--r-- | drivers/gpio/gpio-amdpt.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-amdpt.c b/drivers/gpio/gpio-amdpt.c index f842ccc45e64..c2484046e8e9 100644 --- a/drivers/gpio/gpio-amdpt.c +++ b/drivers/gpio/gpio-amdpt.c | |||
@@ -31,11 +31,9 @@ struct pt_gpio_chip { | |||
31 | spinlock_t lock; | 31 | spinlock_t lock; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #define to_pt_gpio(c) container_of(c, struct pt_gpio_chip, gc) | ||
35 | |||
36 | static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) | 34 | static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) |
37 | { | 35 | { |
38 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 36 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
39 | unsigned long flags; | 37 | unsigned long flags; |
40 | u32 using_pins; | 38 | u32 using_pins; |
41 | 39 | ||
@@ -60,7 +58,7 @@ static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) | |||
60 | 58 | ||
61 | static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) | 59 | static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) |
62 | { | 60 | { |
63 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 61 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
64 | unsigned long flags; | 62 | unsigned long flags; |
65 | u32 using_pins; | 63 | u32 using_pins; |
66 | 64 | ||
@@ -77,7 +75,7 @@ static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) | |||
77 | 75 | ||
78 | static void pt_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value) | 76 | static void pt_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value) |
79 | { | 77 | { |
80 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 78 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
81 | unsigned long flags; | 79 | unsigned long flags; |
82 | u32 data; | 80 | u32 data; |
83 | 81 | ||
@@ -97,7 +95,7 @@ static void pt_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value) | |||
97 | 95 | ||
98 | static int pt_gpio_get_value(struct gpio_chip *gc, unsigned offset) | 96 | static int pt_gpio_get_value(struct gpio_chip *gc, unsigned offset) |
99 | { | 97 | { |
100 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 98 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
101 | unsigned long flags; | 99 | unsigned long flags; |
102 | u32 data; | 100 | u32 data; |
103 | 101 | ||
@@ -124,7 +122,7 @@ static int pt_gpio_get_value(struct gpio_chip *gc, unsigned offset) | |||
124 | 122 | ||
125 | static int pt_gpio_direction_input(struct gpio_chip *gc, unsigned offset) | 123 | static int pt_gpio_direction_input(struct gpio_chip *gc, unsigned offset) |
126 | { | 124 | { |
127 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 125 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
128 | unsigned long flags; | 126 | unsigned long flags; |
129 | u32 data; | 127 | u32 data; |
130 | 128 | ||
@@ -144,7 +142,7 @@ static int pt_gpio_direction_input(struct gpio_chip *gc, unsigned offset) | |||
144 | static int pt_gpio_direction_output(struct gpio_chip *gc, | 142 | static int pt_gpio_direction_output(struct gpio_chip *gc, |
145 | unsigned offset, int value) | 143 | unsigned offset, int value) |
146 | { | 144 | { |
147 | struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); | 145 | struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); |
148 | unsigned long flags; | 146 | unsigned long flags; |
149 | u32 data; | 147 | u32 data; |
150 | 148 | ||
@@ -214,7 +212,7 @@ static int pt_gpio_probe(struct platform_device *pdev) | |||
214 | #if defined(CONFIG_OF_GPIO) | 212 | #if defined(CONFIG_OF_GPIO) |
215 | pt_gpio->gc.of_node = pdev->dev.of_node; | 213 | pt_gpio->gc.of_node = pdev->dev.of_node; |
216 | #endif | 214 | #endif |
217 | ret = gpiochip_add(&pt_gpio->gc); | 215 | ret = gpiochip_add_data(&pt_gpio->gc, pt_gpio); |
218 | if (ret) { | 216 | if (ret) { |
219 | dev_err(&pdev->dev, "Failed to register GPIO lib\n"); | 217 | dev_err(&pdev->dev, "Failed to register GPIO lib\n"); |
220 | return ret; | 218 | return ret; |