The driver core ignores the return value of the remove callback, so
don't give siox drivers the chance to provide a value.
All siox drivers only allocate devm-managed resources in
.probe, so there is no .remove callback to fix.
Signed-off-by: Uwe Kleine-König <[email protected]>
---
drivers/siox/siox-core.c | 5 ++---
include/linux/siox.h | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
index b56cdcb52967..1794ff0106bc 100644
--- a/drivers/siox/siox-core.c
+++ b/drivers/siox/siox-core.c
@@ -525,12 +525,11 @@ static int siox_remove(struct device *dev)
struct siox_driver *sdriver =
container_of(dev->driver, struct siox_driver, driver);
struct siox_device *sdevice = to_siox_device(dev);
- int ret = 0;
if (sdriver->remove)
- ret = sdriver->remove(sdevice);
+ sdriver->remove(sdevice);
- return ret;
+ return 0;
}
static void siox_shutdown(struct device *dev)
diff --git a/include/linux/siox.h b/include/linux/siox.h
index da7225bf1877..6bfbda3f634c 100644
--- a/include/linux/siox.h
+++ b/include/linux/siox.h
@@ -36,7 +36,7 @@ bool siox_device_connected(struct siox_device *sdevice);
struct siox_driver {
int (*probe)(struct siox_device *sdevice);
- int (*remove)(struct siox_device *sdevice);
+ void (*remove)(struct siox_device *sdevice);
void (*shutdown)(struct siox_device *sdevice);
/*
--
2.29.2
Hello,
On Tue, Nov 24, 2020 at 03:18:34PM +0100, Uwe Kleine-König wrote:
> The driver core ignores the return value of the remove callback, so
> don't give siox drivers the chance to provide a value.
>
> All siox drivers only allocate devm-managed resources in
> .probe, so there is no .remove callback to fix.
>
> Signed-off-by: Uwe Kleine-König <[email protected]>
> ---
> drivers/siox/siox-core.c | 5 ++---
> include/linux/siox.h | 2 +-
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
> index b56cdcb52967..1794ff0106bc 100644
> --- a/drivers/siox/siox-core.c
> +++ b/drivers/siox/siox-core.c
> @@ -525,12 +525,11 @@ static int siox_remove(struct device *dev)
Shouldn't this return void?
> struct siox_driver *sdriver =
> container_of(dev->driver, struct siox_driver, driver);
> struct siox_device *sdevice = to_siox_device(dev);
> - int ret = 0;
>
> if (sdriver->remove)
> - ret = sdriver->remove(sdevice);
> + sdriver->remove(sdevice);
>
> - return ret;
> + return 0;
> }
>
[...]
> --
> 2.29.2
>
Kind regards
Thorsten
--
Thorsten Scherer | Eckelmann AG | http://www.eckelmann.de |
On Tue, Nov 24, 2020 at 09:58:45PM +0100, Thorsten Scherer wrote:
> Hello,
>
> On Tue, Nov 24, 2020 at 03:18:34PM +0100, Uwe Kleine-K?nig wrote:
> > The driver core ignores the return value of the remove callback, so
> > don't give siox drivers the chance to provide a value.
> >
> > All siox drivers only allocate devm-managed resources in
> > .probe, so there is no .remove callback to fix.
> >
> > Signed-off-by: Uwe Kleine-K?nig <[email protected]>
> > ---
> > drivers/siox/siox-core.c | 5 ++---
> > include/linux/siox.h | 2 +-
> > 2 files changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
> > index b56cdcb52967..1794ff0106bc 100644
> > --- a/drivers/siox/siox-core.c
> > +++ b/drivers/siox/siox-core.c
> > @@ -525,12 +525,11 @@ static int siox_remove(struct device *dev)
>
> Shouldn't this return void?
This is the callback used for struct device_driver::remove (and after
patch 2 struct bus_type::remove) which still has to return int. But in
the long run I want to change these to void, too.
Best regards and thanks for your feedback
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |