power: reset: gpio-restart: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 14 Apr 2023 17:12:35 +0000 (19:12 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 8 May 2023 12:41:00 +0000 (14:41 +0200)
Returning an error code from a remove callback makes the driver core
emit a generic (and so little helpful) error message and after that the
error code is ignored and the device unbound.

As gpio_restart_remove() already emits an error message, suppressing the
generic error is no loss.

Then convert to .remove_new() which is equivalent to returning 0
unconditionally in .remove(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for its rational.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/reset/gpio-restart.c

index 35d981d..a479d35 100644 (file)
@@ -105,7 +105,7 @@ static int gpio_restart_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int gpio_restart_remove(struct platform_device *pdev)
+static void gpio_restart_remove(struct platform_device *pdev)
 {
        struct gpio_restart *gpio_restart = platform_get_drvdata(pdev);
        int ret;
@@ -115,10 +115,7 @@ static int gpio_restart_remove(struct platform_device *pdev)
                dev_err(&pdev->dev,
                                "%s: cannot unregister restart handler, %d\n",
                                __func__, ret);
-               return -ENODEV;
        }
-
-       return 0;
 }
 
 static const struct of_device_id of_gpio_restart_match[] = {
@@ -128,7 +125,7 @@ static const struct of_device_id of_gpio_restart_match[] = {
 
 static struct platform_driver gpio_restart_driver = {
        .probe = gpio_restart_probe,
-       .remove = gpio_restart_remove,
+       .remove_new = gpio_restart_remove,
        .driver = {
                .name = "restart-gpio",
                .of_match_table = of_gpio_restart_match,