diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 08:38:36 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:14 -0500 |
commit | d27ad7a833443fe0c4247129ab97105f1d845cda (patch) | |
tree | 7e1fac04617264ef386ff8b0718926785b169869 /drivers/gpio/gpio-syscon.c | |
parent | 5b90b8c217e92ce9f027af5aa2cb12bdbbd2127a (diff) |
gpio: syscon: 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-syscon.c')
-rw-r--r-- | drivers/gpio/gpio-syscon.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index 333d5af4abd1..e5c5b6205886 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c | |||
@@ -59,14 +59,9 @@ struct syscon_gpio_priv { | |||
59 | u32 dir_reg_offset; | 59 | u32 dir_reg_offset; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static inline struct syscon_gpio_priv *to_syscon_gpio(struct gpio_chip *chip) | ||
63 | { | ||
64 | return container_of(chip, struct syscon_gpio_priv, chip); | ||
65 | } | ||
66 | |||
67 | static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) | 62 | static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) |
68 | { | 63 | { |
69 | struct syscon_gpio_priv *priv = to_syscon_gpio(chip); | 64 | struct syscon_gpio_priv *priv = gpiochip_get_data(chip); |
70 | unsigned int val, offs; | 65 | unsigned int val, offs; |
71 | int ret; | 66 | int ret; |
72 | 67 | ||
@@ -82,7 +77,7 @@ static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
82 | 77 | ||
83 | static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | 78 | static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val) |
84 | { | 79 | { |
85 | struct syscon_gpio_priv *priv = to_syscon_gpio(chip); | 80 | struct syscon_gpio_priv *priv = gpiochip_get_data(chip); |
86 | unsigned int offs; | 81 | unsigned int offs; |
87 | 82 | ||
88 | offs = priv->dreg_offset + priv->data->dat_bit_offset + offset; | 83 | offs = priv->dreg_offset + priv->data->dat_bit_offset + offset; |
@@ -95,7 +90,7 @@ static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | |||
95 | 90 | ||
96 | static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) | 91 | static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) |
97 | { | 92 | { |
98 | struct syscon_gpio_priv *priv = to_syscon_gpio(chip); | 93 | struct syscon_gpio_priv *priv = gpiochip_get_data(chip); |
99 | 94 | ||
100 | if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { | 95 | if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { |
101 | unsigned int offs; | 96 | unsigned int offs; |
@@ -113,7 +108,7 @@ static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) | |||
113 | 108 | ||
114 | static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) | 109 | static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) |
115 | { | 110 | { |
116 | struct syscon_gpio_priv *priv = to_syscon_gpio(chip); | 111 | struct syscon_gpio_priv *priv = gpiochip_get_data(chip); |
117 | 112 | ||
118 | if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { | 113 | if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { |
119 | unsigned int offs; | 114 | unsigned int offs; |
@@ -144,7 +139,7 @@ static const struct syscon_gpio_data clps711x_mctrl_gpio = { | |||
144 | 139 | ||
145 | static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | 140 | static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val) |
146 | { | 141 | { |
147 | struct syscon_gpio_priv *priv = to_syscon_gpio(chip); | 142 | struct syscon_gpio_priv *priv = gpiochip_get_data(chip); |
148 | unsigned int offs; | 143 | unsigned int offs; |
149 | int ret; | 144 | int ret; |
150 | 145 | ||
@@ -243,7 +238,7 @@ static int syscon_gpio_probe(struct platform_device *pdev) | |||
243 | 238 | ||
244 | platform_set_drvdata(pdev, priv); | 239 | platform_set_drvdata(pdev, priv); |
245 | 240 | ||
246 | return gpiochip_add(&priv->chip); | 241 | return gpiochip_add_data(&priv->chip, priv); |
247 | } | 242 | } |
248 | 243 | ||
249 | static int syscon_gpio_remove(struct platform_device *pdev) | 244 | static int syscon_gpio_remove(struct platform_device *pdev) |