diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-07-10 07:55:39 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-07-22 19:23:26 -0400 |
commit | 17e52464292320d0de260b146605d93326a9014c (patch) | |
tree | 13a567d6894759525771eb2f9d483cfb53e6199c /drivers/pinctrl/pinctrl-baytrail.c | |
parent | 9c5b65579597609844ae248a6e76f614f02e3c42 (diff) |
pinctrl-baytrail: introduce to_byt_gpio() macro
The introduced macro helps to convert struct gpio_chip to struct byt_gpio.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-baytrail.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-baytrail.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 71fa88754718..3bf7c948b7fc 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -130,10 +130,12 @@ struct byt_gpio { | |||
130 | struct pinctrl_gpio_range *range; | 130 | struct pinctrl_gpio_range *range; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | #define to_byt_gpio(c) container_of(c, struct byt_gpio, chip) | ||
134 | |||
133 | static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset, | 135 | static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset, |
134 | int reg) | 136 | int reg) |
135 | { | 137 | { |
136 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 138 | struct byt_gpio *vg = to_byt_gpio(chip); |
137 | u32 reg_offset; | 139 | u32 reg_offset; |
138 | 140 | ||
139 | if (reg == BYT_INT_STAT_REG) | 141 | if (reg == BYT_INT_STAT_REG) |
@@ -146,7 +148,7 @@ static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset, | |||
146 | 148 | ||
147 | static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) | 149 | static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) |
148 | { | 150 | { |
149 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 151 | struct byt_gpio *vg = to_byt_gpio(chip); |
150 | 152 | ||
151 | pm_runtime_get(&vg->pdev->dev); | 153 | pm_runtime_get(&vg->pdev->dev); |
152 | 154 | ||
@@ -155,7 +157,7 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
155 | 157 | ||
156 | static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) | 158 | static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) |
157 | { | 159 | { |
158 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 160 | struct byt_gpio *vg = to_byt_gpio(chip); |
159 | void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG); | 161 | void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG); |
160 | u32 value; | 162 | u32 value; |
161 | 163 | ||
@@ -216,7 +218,7 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
216 | 218 | ||
217 | static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 219 | static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
218 | { | 220 | { |
219 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 221 | struct byt_gpio *vg = to_byt_gpio(chip); |
220 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); | 222 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); |
221 | unsigned long flags; | 223 | unsigned long flags; |
222 | u32 old_val; | 224 | u32 old_val; |
@@ -235,7 +237,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
235 | 237 | ||
236 | static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 238 | static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
237 | { | 239 | { |
238 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 240 | struct byt_gpio *vg = to_byt_gpio(chip); |
239 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); | 241 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); |
240 | unsigned long flags; | 242 | unsigned long flags; |
241 | u32 value; | 243 | u32 value; |
@@ -254,7 +256,7 @@ static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
254 | static int byt_gpio_direction_output(struct gpio_chip *chip, | 256 | static int byt_gpio_direction_output(struct gpio_chip *chip, |
255 | unsigned gpio, int value) | 257 | unsigned gpio, int value) |
256 | { | 258 | { |
257 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 259 | struct byt_gpio *vg = to_byt_gpio(chip); |
258 | void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG); | 260 | void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG); |
259 | unsigned long flags; | 261 | unsigned long flags; |
260 | u32 reg_val; | 262 | u32 reg_val; |
@@ -272,7 +274,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, | |||
272 | 274 | ||
273 | static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | 275 | static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
274 | { | 276 | { |
275 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 277 | struct byt_gpio *vg = to_byt_gpio(chip); |
276 | int i; | 278 | int i; |
277 | unsigned long flags; | 279 | unsigned long flags; |
278 | u32 conf0, val, offs; | 280 | u32 conf0, val, offs; |
@@ -301,7 +303,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
301 | 303 | ||
302 | static int byt_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 304 | static int byt_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
303 | { | 305 | { |
304 | struct byt_gpio *vg = container_of(chip, struct byt_gpio, chip); | 306 | struct byt_gpio *vg = to_byt_gpio(chip); |
305 | return irq_create_mapping(vg->domain, offset); | 307 | return irq_create_mapping(vg->domain, offset); |
306 | } | 308 | } |
307 | 309 | ||