aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-10-11 11:34:16 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-10-16 16:13:43 -0400
commit203f0daafdf228a7e4e90a714a2a085884d91ea4 (patch)
treeae310bd9117993b495d0360a22c745fb150ced74
parentc771c2f484857f3b1fc81d180485e96b7cb67c17 (diff)
gpio: replace trivial implementations of request/free with generic one
Replace all trivial request/free callbacks that do nothing but call into pinctrl code with the generic versions. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: James Hogan <james.hogan@imgtec.com> Acked-by: Stefan Agner <stefan@agner.ch> Acked-by: Joachim Eastwood <manabian@gmail.com> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-lpc18xx.c14
-rw-r--r--drivers/gpio/gpio-moxart.c14
-rw-r--r--drivers/gpio/gpio-mvebu.c14
-rw-r--r--drivers/gpio/gpio-tb10x.c14
-rw-r--r--drivers/gpio/gpio-tz1090-pdc.c14
-rw-r--r--drivers/gpio/gpio-vf610.c14
6 files changed, 12 insertions, 72 deletions
diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index eb68603136b0..e39dcb0af8ae 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -36,16 +36,6 @@ static inline struct lpc18xx_gpio_chip *to_lpc18xx_gpio(struct gpio_chip *chip)
36 return container_of(chip, struct lpc18xx_gpio_chip, gpio); 36 return container_of(chip, struct lpc18xx_gpio_chip, gpio);
37} 37}
38 38
39static int lpc18xx_gpio_request(struct gpio_chip *chip, unsigned offset)
40{
41 return pinctrl_request_gpio(offset);
42}
43
44static void lpc18xx_gpio_free(struct gpio_chip *chip, unsigned offset)
45{
46 pinctrl_free_gpio(offset);
47}
48
49static void lpc18xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 39static void lpc18xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
50{ 40{
51 struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip); 41 struct lpc18xx_gpio_chip *gc = to_lpc18xx_gpio(chip);
@@ -95,8 +85,8 @@ static int lpc18xx_gpio_direction_output(struct gpio_chip *chip,
95 85
96static struct gpio_chip lpc18xx_chip = { 86static struct gpio_chip lpc18xx_chip = {
97 .label = "lpc18xx/43xx-gpio", 87 .label = "lpc18xx/43xx-gpio",
98 .request = lpc18xx_gpio_request, 88 .request = gpiochip_generic_request,
99 .free = lpc18xx_gpio_free, 89 .free = gpiochip_generic_free,
100 .direction_input = lpc18xx_gpio_direction_input, 90 .direction_input = lpc18xx_gpio_direction_input,
101 .direction_output = lpc18xx_gpio_direction_output, 91 .direction_output = lpc18xx_gpio_direction_output,
102 .set = lpc18xx_gpio_set, 92 .set = lpc18xx_gpio_set,
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
index abd8676ce2b6..d3355a6dc9b1 100644
--- a/drivers/gpio/gpio-moxart.c
+++ b/drivers/gpio/gpio-moxart.c
@@ -29,16 +29,6 @@
29#define GPIO_DATA_IN 0x04 29#define GPIO_DATA_IN 0x04
30#define GPIO_PIN_DIRECTION 0x08 30#define GPIO_PIN_DIRECTION 0x08
31 31
32static int moxart_gpio_request(struct gpio_chip *chip, unsigned offset)
33{
34 return pinctrl_request_gpio(offset);
35}
36
37static void moxart_gpio_free(struct gpio_chip *chip, unsigned offset)
38{
39 pinctrl_free_gpio(offset);
40}
41
42static int moxart_gpio_probe(struct platform_device *pdev) 32static int moxart_gpio_probe(struct platform_device *pdev)
43{ 33{
44 struct device *dev = &pdev->dev; 34 struct device *dev = &pdev->dev;
@@ -66,8 +56,8 @@ static int moxart_gpio_probe(struct platform_device *pdev)
66 } 56 }
67 57
68 bgc->gc.label = "moxart-gpio"; 58 bgc->gc.label = "moxart-gpio";
69 bgc->gc.request = moxart_gpio_request; 59 bgc->gc.request = gpiochip_generic_request;
70 bgc->gc.free = moxart_gpio_free; 60 bgc->gc.free = gpiochip_generic_free;
71 bgc->data = bgc->read_reg(bgc->reg_set); 61 bgc->data = bgc->read_reg(bgc->reg_set);
72 bgc->gc.base = 0; 62 bgc->gc.base = 0;
73 bgc->gc.ngpio = 32; 63 bgc->gc.ngpio = 32;
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index df418b81456d..d428b97876c5 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -185,16 +185,6 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip)
185 * Functions implementing the gpio_chip methods 185 * Functions implementing the gpio_chip methods
186 */ 186 */
187 187
188static int mvebu_gpio_request(struct gpio_chip *chip, unsigned pin)
189{
190 return pinctrl_request_gpio(chip->base + pin);
191}
192
193static void mvebu_gpio_free(struct gpio_chip *chip, unsigned pin)
194{
195 pinctrl_free_gpio(chip->base + pin);
196}
197
198static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value) 188static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
199{ 189{
200 struct mvebu_gpio_chip *mvchip = 190 struct mvebu_gpio_chip *mvchip =
@@ -709,8 +699,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
709 mvchip->soc_variant = soc_variant; 699 mvchip->soc_variant = soc_variant;
710 mvchip->chip.label = dev_name(&pdev->dev); 700 mvchip->chip.label = dev_name(&pdev->dev);
711 mvchip->chip.dev = &pdev->dev; 701 mvchip->chip.dev = &pdev->dev;
712 mvchip->chip.request = mvebu_gpio_request; 702 mvchip->chip.request = gpiochip_generic_request;
713 mvchip->chip.free = mvebu_gpio_free; 703 mvchip->chip.free = gpiochip_generic_free;
714 mvchip->chip.direction_input = mvebu_gpio_direction_input; 704 mvchip->chip.direction_input = mvebu_gpio_direction_input;
715 mvchip->chip.get = mvebu_gpio_get; 705 mvchip->chip.get = mvebu_gpio_get;
716 mvchip->chip.direction_output = mvebu_gpio_direction_output; 706 mvchip->chip.direction_output = mvebu_gpio_direction_output;
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index 12c99d969b98..4356e6c20fc5 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -138,16 +138,6 @@ static int tb10x_gpio_direction_out(struct gpio_chip *chip,
138 return 0; 138 return 0;
139} 139}
140 140
141static int tb10x_gpio_request(struct gpio_chip *chip, unsigned offset)
142{
143 return pinctrl_request_gpio(chip->base + offset);
144}
145
146static void tb10x_gpio_free(struct gpio_chip *chip, unsigned offset)
147{
148 pinctrl_free_gpio(chip->base + offset);
149}
150
151static int tb10x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 141static int tb10x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
152{ 142{
153 struct tb10x_gpio *tb10x_gpio = to_tb10x_gpio(chip); 143 struct tb10x_gpio *tb10x_gpio = to_tb10x_gpio(chip);
@@ -213,8 +203,8 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
213 tb10x_gpio->gc.get = tb10x_gpio_get; 203 tb10x_gpio->gc.get = tb10x_gpio_get;
214 tb10x_gpio->gc.direction_output = tb10x_gpio_direction_out; 204 tb10x_gpio->gc.direction_output = tb10x_gpio_direction_out;
215 tb10x_gpio->gc.set = tb10x_gpio_set; 205 tb10x_gpio->gc.set = tb10x_gpio_set;
216 tb10x_gpio->gc.request = tb10x_gpio_request; 206 tb10x_gpio->gc.request = gpiochip_generic_request;
217 tb10x_gpio->gc.free = tb10x_gpio_free; 207 tb10x_gpio->gc.free = gpiochip_generic_free;
218 tb10x_gpio->gc.base = -1; 208 tb10x_gpio->gc.base = -1;
219 tb10x_gpio->gc.ngpio = ngpio; 209 tb10x_gpio->gc.ngpio = ngpio;
220 tb10x_gpio->gc.can_sleep = false; 210 tb10x_gpio->gc.can_sleep = false;
diff --git a/drivers/gpio/gpio-tz1090-pdc.c b/drivers/gpio/gpio-tz1090-pdc.c
index ede7e403ffde..3623d009d808 100644
--- a/drivers/gpio/gpio-tz1090-pdc.c
+++ b/drivers/gpio/gpio-tz1090-pdc.c
@@ -137,16 +137,6 @@ static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset,
137 __global_unlock2(lstat); 137 __global_unlock2(lstat);
138} 138}
139 139
140static int tz1090_pdc_gpio_request(struct gpio_chip *chip, unsigned int offset)
141{
142 return pinctrl_request_gpio(chip->base + offset);
143}
144
145static void tz1090_pdc_gpio_free(struct gpio_chip *chip, unsigned int offset)
146{
147 pinctrl_free_gpio(chip->base + offset);
148}
149
150static int tz1090_pdc_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) 140static int tz1090_pdc_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
151{ 141{
152 struct tz1090_pdc_gpio *priv = to_pdc(chip); 142 struct tz1090_pdc_gpio *priv = to_pdc(chip);
@@ -203,8 +193,8 @@ static int tz1090_pdc_gpio_probe(struct platform_device *pdev)
203 priv->chip.direction_output = tz1090_pdc_gpio_direction_output; 193 priv->chip.direction_output = tz1090_pdc_gpio_direction_output;
204 priv->chip.get = tz1090_pdc_gpio_get; 194 priv->chip.get = tz1090_pdc_gpio_get;
205 priv->chip.set = tz1090_pdc_gpio_set; 195 priv->chip.set = tz1090_pdc_gpio_set;
206 priv->chip.free = tz1090_pdc_gpio_free; 196 priv->chip.free = gpiochip_generic_free;
207 priv->chip.request = tz1090_pdc_gpio_request; 197 priv->chip.request = gpiochip_generic_request;
208 priv->chip.to_irq = tz1090_pdc_gpio_to_irq; 198 priv->chip.to_irq = tz1090_pdc_gpio_to_irq;
209 priv->chip.of_node = np; 199 priv->chip.of_node = np;
210 200
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index e1a397121729..87b950cec6ec 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -82,16 +82,6 @@ static inline u32 vf610_gpio_readl(void __iomem *reg)
82 return readl_relaxed(reg); 82 return readl_relaxed(reg);
83} 83}
84 84
85static int vf610_gpio_request(struct gpio_chip *chip, unsigned offset)
86{
87 return pinctrl_request_gpio(chip->base + offset);
88}
89
90static void vf610_gpio_free(struct gpio_chip *chip, unsigned offset)
91{
92 pinctrl_free_gpio(chip->base + offset);
93}
94
95static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio) 85static int vf610_gpio_get(struct gpio_chip *gc, unsigned int gpio)
96{ 86{
97 struct vf610_gpio_port *port = to_vf610_gp(gc); 87 struct vf610_gpio_port *port = to_vf610_gp(gc);
@@ -264,8 +254,8 @@ static int vf610_gpio_probe(struct platform_device *pdev)
264 gc->ngpio = VF610_GPIO_PER_PORT; 254 gc->ngpio = VF610_GPIO_PER_PORT;
265 gc->base = of_alias_get_id(np, "gpio") * VF610_GPIO_PER_PORT; 255 gc->base = of_alias_get_id(np, "gpio") * VF610_GPIO_PER_PORT;
266 256
267 gc->request = vf610_gpio_request; 257 gc->request = gpiochip_generic_request;
268 gc->free = vf610_gpio_free; 258 gc->free = gpiochip_generic_free;
269 gc->direction_input = vf610_gpio_direction_input; 259 gc->direction_input = vf610_gpio_direction_input;
270 gc->get = vf610_gpio_get; 260 gc->get = vf610_gpio_get;
271 gc->direction_output = vf610_gpio_direction_output; 261 gc->direction_output = vf610_gpio_direction_output;