Re: [PATCH 2/6] gpio: twl4030: Use devm_gpiochip_add_data() to simplify remove path
From: Andy Shevchenko
Date: Tue Mar 07 2023 - 12:50:52 EST
On Tue, Mar 07, 2023 at 10:54:28AM -0600, Andrew Davis wrote:
> Use devm version of gpiochip add function to handle removal for us.
I do not see this change in the below code.
Can you shed a light?
> Signed-off-by: Andrew Davis <afd@xxxxxx>
> ---
> drivers/gpio/gpio-twl4030.c | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
> index c1bb2c3ca6f2..23f58bf3a415 100644
> --- a/drivers/gpio/gpio-twl4030.c
> +++ b/drivers/gpio/gpio-twl4030.c
> @@ -492,18 +492,6 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev,
> return omap_twl_info;
> }
>
> -/* Cannot use as gpio_twl4030_probe() calls us */
> -static int gpio_twl4030_remove(struct platform_device *pdev)
> -{
> - struct gpio_twl4030_priv *priv = platform_get_drvdata(pdev);
> -
> - gpiochip_remove(&priv->gpio_chip);
> -
> - /* REVISIT no support yet for deregistering all the IRQs */
> - WARN_ON(!is_module());
> - return 0;
> -}
> -
> static int gpio_twl4030_probe(struct platform_device *pdev)
> {
> struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
> @@ -581,12 +569,9 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
> if (ret < 0) {
> dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
> priv->gpio_chip.ngpio = 0;
> - gpio_twl4030_remove(pdev);
> goto out;
> }
>
> - platform_set_drvdata(pdev, priv);
> -
> if (pdata->setup) {
> int status;
>
> @@ -615,7 +600,6 @@ static struct platform_driver gpio_twl4030_driver = {
> .of_match_table = twl_gpio_match,
> },
> .probe = gpio_twl4030_probe,
> - .remove = gpio_twl4030_remove,
> };
>
> static int __init gpio_twl4030_init(void)
--
With Best Regards,
Andy Shevchenko