Re: [PATCH v1] drivers: make struct device_driver::remove return void

From: Uwe Kleine-König
Date: Wed Nov 25 2020 - 15:53:35 EST


Hello Julia,

On Tue, Nov 10, 2020 at 04:07:23PM +0100, Uwe Kleine-König wrote:
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index ecc304149067..ed79a5c657e5 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -295,7 +295,7 @@ static int amba_probe(struct device *dev)
> return ret;
> }
>
> -static int amba_remove(struct device *dev)
> +static void amba_remove(struct device *dev)
> {
> struct amba_device *pcdev = to_amba_device(dev);
> struct amba_driver *drv = to_amba_driver(dev->driver);
> @@ -303,6 +303,9 @@ static int amba_remove(struct device *dev)
>
> pm_runtime_get_sync(dev);
> ret = drv->remove(pcdev);
> + if (ret)
> + dev_info(dev, "Failed to remove (%pe), ignoring\n",
> + ERR_PTR(ret));
> pm_runtime_put_noidle(dev);
>
> /* Undo the runtime PM settings in amba_probe() */
> @@ -312,8 +315,6 @@ static int amba_remove(struct device *dev)
>
> amba_put_disable_pclk(pcdev);
> dev_pm_domain_detach(dev, true);
> -
> - return ret;
> }
>
> static void amba_shutdown(struct device *dev)
> [...]
> diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
> index ee7ba5b5417e..6a3058d4476a 100644
> --- a/include/linux/device/driver.h
> +++ b/include/linux/device/driver.h
> @@ -107,7 +107,7 @@ struct device_driver {
>
> int (*probe) (struct device *dev);
> void (*sync_state)(struct device *dev);
> - int (*remove) (struct device *dev);
> + void (*remove) (struct device *dev);
> void (*shutdown) (struct device *dev);
> int (*suspend) (struct device *dev, pm_message_t state);
> int (*resume) (struct device *dev);

I tried to let coccinelle help me finding functions I need to adapt for
this change, but I failed. (That is, functions that currently return an
int and are used to set (or initialize) the remove callback for a struct
device_driver.) Can you help me here?

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature