Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+1 -26
-10
drivers/pinctrl/sh-pfc/core.c
··· 598 598 return 0; 599 599 } 600 600 601 - static 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 - 610 601 static const struct platform_device_id sh_pfc_id_table[] = { 611 602 #ifdef CONFIG_PINCTRL_PFC_SH7203 612 603 { "pfc-sh7203", (kernel_ulong_t)&sh7203_pinmux_info }, ··· 641 650 642 651 static struct platform_driver sh_pfc_driver = { 643 652 .probe = sh_pfc_probe, 644 - .remove = sh_pfc_remove, 645 653 .id_table = sh_pfc_id_table, 646 654 .driver = { 647 655 .name = DRV_NAME,
-1
drivers/pinctrl/sh-pfc/core.h
··· 20 20 }; 21 21 22 22 int sh_pfc_register_gpiochip(struct sh_pfc *pfc); 23 - int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc); 24 23 25 24 int sh_pfc_register_pinctrl(struct sh_pfc *pfc); 26 25
+1 -12
drivers/pinctrl/sh-pfc/gpio.c
··· 318 318 if (ret < 0) 319 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 322 if (unlikely(ret < 0)) 323 323 return ERR_PTR(ret); 324 324 ··· 399 399 chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL); 400 400 if (IS_ERR(chip)) 401 401 return PTR_ERR(chip); 402 - 403 - pfc->func = chip; 404 402 #endif /* CONFIG_SUPERH */ 405 403 406 - return 0; 407 - } 408 - 409 - int 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 404 return 0; 416 405 }
-3
drivers/pinctrl/sh-pfc/sh_pfc.h
··· 207 207 unsigned int nr_gpio_pins; 208 208 209 209 struct sh_pfc_chip *gpio; 210 - #ifdef CONFIG_SUPERH 211 - struct sh_pfc_chip *func; 212 - #endif 213 210 }; 214 211 215 212 struct sh_pfc_soc_operations {