diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-09-14 09:56:55 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-09-23 11:51:39 -0400 |
commit | 56b427678cc3c1c4e305a96c9cfa8ba985c70a48 (patch) | |
tree | fdedc26c8f75d9bf4e1c9295cda6ef66f3e86a54 /drivers/gpio | |
parent | 1e960dbb7b12886d2095df05adf8754eef1c26d0 (diff) |
gpio: use container_of to resolve cs5535_gpio_chip from gpio_chip
Use container_of instead of casting first structure member.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-cs5535.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 92ec58fa9236..668127fe90ef 100644 --- a/drivers/gpio/gpio-cs5535.c +++ b/drivers/gpio/gpio-cs5535.c | |||
@@ -201,7 +201,8 @@ EXPORT_SYMBOL_GPL(cs5535_gpio_setup_event); | |||
201 | 201 | ||
202 | static int chip_gpio_request(struct gpio_chip *c, unsigned offset) | 202 | static int chip_gpio_request(struct gpio_chip *c, unsigned offset) |
203 | { | 203 | { |
204 | struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; | 204 | struct cs5535_gpio_chip *chip = |
205 | container_of(c, struct cs5535_gpio_chip, chip); | ||
205 | unsigned long flags; | 206 | unsigned long flags; |
206 | 207 | ||
207 | spin_lock_irqsave(&chip->lock, flags); | 208 | spin_lock_irqsave(&chip->lock, flags); |
@@ -241,7 +242,8 @@ static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | |||
241 | 242 | ||
242 | static int chip_direction_input(struct gpio_chip *c, unsigned offset) | 243 | static int chip_direction_input(struct gpio_chip *c, unsigned offset) |
243 | { | 244 | { |
244 | struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; | 245 | struct cs5535_gpio_chip *chip = |
246 | container_of(c, struct cs5535_gpio_chip, chip); | ||
245 | unsigned long flags; | 247 | unsigned long flags; |
246 | 248 | ||
247 | spin_lock_irqsave(&chip->lock, flags); | 249 | spin_lock_irqsave(&chip->lock, flags); |
@@ -254,7 +256,8 @@ static int chip_direction_input(struct gpio_chip *c, unsigned offset) | |||
254 | 256 | ||
255 | static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) | 257 | static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) |
256 | { | 258 | { |
257 | struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; | 259 | struct cs5535_gpio_chip *chip = |
260 | container_of(c, struct cs5535_gpio_chip, chip); | ||
258 | unsigned long flags; | 261 | unsigned long flags; |
259 | 262 | ||
260 | spin_lock_irqsave(&chip->lock, flags); | 263 | spin_lock_irqsave(&chip->lock, flags); |