diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-03 12:20:29 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:01 -0500 |
commit | b2afc6f3522c8f49a420cb77f5a9c51fe1d50e33 (patch) | |
tree | fcd456c705daac41c689ae2e668a944d9cdd761d /drivers/gpio/gpio-74x164.c | |
parent | d602ae90a35e66c418189e917395408dd2e85e20 (diff) |
gpio: 74x164: 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: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-74x164.c')
-rw-r--r-- | drivers/gpio/gpio-74x164.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 54a4147fba52..c81224ff2dca 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
@@ -33,11 +33,6 @@ struct gen_74x164_chip { | |||
33 | u8 buffer[0]; | 33 | u8 buffer[0]; |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static struct gen_74x164_chip *gpio_to_74x164_chip(struct gpio_chip *gc) | ||
37 | { | ||
38 | return container_of(gc, struct gen_74x164_chip, gpio_chip); | ||
39 | } | ||
40 | |||
41 | static int __gen_74x164_write_config(struct gen_74x164_chip *chip) | 36 | static int __gen_74x164_write_config(struct gen_74x164_chip *chip) |
42 | { | 37 | { |
43 | struct spi_transfer xfer = { | 38 | struct spi_transfer xfer = { |
@@ -51,7 +46,7 @@ static int __gen_74x164_write_config(struct gen_74x164_chip *chip) | |||
51 | 46 | ||
52 | static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) | 47 | static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) |
53 | { | 48 | { |
54 | struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); | 49 | struct gen_74x164_chip *chip = gpiochip_get_data(gc); |
55 | u8 bank = chip->registers - 1 - offset / 8; | 50 | u8 bank = chip->registers - 1 - offset / 8; |
56 | u8 pin = offset % 8; | 51 | u8 pin = offset % 8; |
57 | int ret; | 52 | int ret; |
@@ -66,7 +61,7 @@ static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) | |||
66 | static void gen_74x164_set_value(struct gpio_chip *gc, | 61 | static void gen_74x164_set_value(struct gpio_chip *gc, |
67 | unsigned offset, int val) | 62 | unsigned offset, int val) |
68 | { | 63 | { |
69 | struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); | 64 | struct gen_74x164_chip *chip = gpiochip_get_data(gc); |
70 | u8 bank = chip->registers - 1 - offset / 8; | 65 | u8 bank = chip->registers - 1 - offset / 8; |
71 | u8 pin = offset % 8; | 66 | u8 pin = offset % 8; |
72 | 67 | ||
@@ -136,7 +131,7 @@ static int gen_74x164_probe(struct spi_device *spi) | |||
136 | goto exit_destroy; | 131 | goto exit_destroy; |
137 | } | 132 | } |
138 | 133 | ||
139 | ret = gpiochip_add(&chip->gpio_chip); | 134 | ret = gpiochip_add_data(&chip->gpio_chip, chip); |
140 | if (!ret) | 135 | if (!ret) |
141 | return 0; | 136 | return 0; |
142 | 137 | ||