aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2016-06-10 05:22:44 -0400
committerGeert Uytterhoeven <geert+renesas@glider.be>2016-06-21 03:24:58 -0400
commitc29e2f2cb6ceb574ac9bc2f324a13f0e6b08115a (patch)
tree9b701e0a9555b46ad3107e434d08678ead2fce95 /drivers/pinctrl
parent07d36d29088356e0fc7ec2c0bad51bb4789e0c26 (diff)
pinctrl: sh-pfc: Convert to devm_gpiochip_add_data()
This allows to remove the .remove() callback, and all functions and data it needed for its own bookkeeping. Suggested-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/sh-pfc/core.c10
-rw-r--r--drivers/pinctrl/sh-pfc/core.h1
-rw-r--r--drivers/pinctrl/sh-pfc/gpio.c13
-rw-r--r--drivers/pinctrl/sh-pfc/sh_pfc.h3
4 files changed, 1 insertions, 26 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 9b9cee06ec59..a3b82041b6a2 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -598,15 +598,6 @@ static int sh_pfc_probe(struct platform_device *pdev)
598 return 0; 598 return 0;
599} 599}
600 600
601static int sh_pfc_remove(struct platform_device *pdev)
602{
603#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
604 sh_pfc_unregister_gpiochip(platform_get_drvdata(pdev));
605#endif
606
607 return 0;
608}
609
610static const struct platform_device_id sh_pfc_id_table[] = { 601static const struct platform_device_id sh_pfc_id_table[] = {
611#ifdef CONFIG_PINCTRL_PFC_SH7203 602#ifdef CONFIG_PINCTRL_PFC_SH7203
612 { "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info }, 603 { "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info },
@@ -650,7 +641,6 @@ static const struct platform_device_id sh_pfc_id_table[] = {
650 641
651static struct platform_driver sh_pfc_driver = { 642static struct platform_driver sh_pfc_driver = {
652 .probe = sh_pfc_probe, 643 .probe = sh_pfc_probe,
653 .remove = sh_pfc_remove,
654 .id_table = sh_pfc_id_table, 644 .id_table = sh_pfc_id_table,
655 .driver = { 645 .driver = {
656 .name = DRV_NAME, 646 .name = DRV_NAME,
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index 9dde6ea5e28f..0bbdea5849f4 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -20,7 +20,6 @@ struct sh_pfc_pin_range {
20}; 20};
21 21
22int sh_pfc_register_gpiochip(struct sh_pfc *pfc); 22int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
23int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
24 23
25int sh_pfc_register_pinctrl(struct sh_pfc *pfc); 24int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
26 25
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index 97dff6a09ff0..6b5422766f13 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -318,7 +318,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *),
318 if (ret < 0) 318 if (ret < 0)
319 return ERR_PTR(ret); 319 return ERR_PTR(ret);
320 320
321 ret = gpiochip_add_data(&chip->gpio_chip, chip); 321 ret = devm_gpiochip_add_data(pfc->dev, &chip->gpio_chip, chip);
322 if (unlikely(ret < 0)) 322 if (unlikely(ret < 0))
323 return ERR_PTR(ret); 323 return ERR_PTR(ret);
324 324
@@ -399,18 +399,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
399 chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL); 399 chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL);
400 if (IS_ERR(chip)) 400 if (IS_ERR(chip))
401 return PTR_ERR(chip); 401 return PTR_ERR(chip);
402
403 pfc->func = chip;
404#endif /* CONFIG_SUPERH */ 402#endif /* CONFIG_SUPERH */
405 403
406 return 0; 404 return 0;
407} 405}
408
409int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
410{
411 gpiochip_remove(&pfc->gpio->gpio_chip);
412#ifdef CONFIG_SUPERH
413 gpiochip_remove(&pfc->func->gpio_chip);
414#endif
415 return 0;
416}
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 5732752667e2..5e966c09434d 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -207,9 +207,6 @@ struct sh_pfc {
207 unsigned int nr_gpio_pins; 207 unsigned int nr_gpio_pins;
208 208
209 struct sh_pfc_chip *gpio; 209 struct sh_pfc_chip *gpio;
210#ifdef CONFIG_SUPERH
211 struct sh_pfc_chip *func;
212#endif
213}; 210};
214 211
215struct sh_pfc_soc_operations { 212struct sh_pfc_soc_operations {