linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: locomo: make locomo bus's remove callback return void
@ 2020-11-26 11:01 Uwe Kleine-König
  2020-11-26 13:56 ` Lee Jones
  2020-11-26 21:31 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2020-11-26 11:01 UTC (permalink / raw)
  To: Russell King, Dmitry Torokhov, Lee Jones, Daniel Thompson,
	Jingoo Han, Bartlomiej Zolnierkiewicz
  Cc: linux-arm-kernel, linux-input, dri-devel, linux-fbdev, kernel

The driver core ignores the return value of struct bus_type::remove
because there is only little that can be done. To simplify the quest to
make this function return void, let struct locomo_driver::remove return
void, too. All users already unconditionally return 0, this commit makes
it obvious that returning an error code is a bad idea and ensures future
users behave accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

if desired the change to arch/arm/mach-sa1100/collie.c can be split out
of this patch. The change of prototype then doesn't affect this driver
any more. There is one locomo-driver that is already now unaffected:
drivers/leds/leds-locomo.c. This driver doesn't have a remove callback.

Best regards
Uwe

 arch/arm/common/locomo.c               | 5 ++---
 arch/arm/include/asm/hardware/locomo.h | 2 +-
 arch/arm/mach-sa1100/collie.c          | 6 ------
 drivers/input/keyboard/locomokbd.c     | 4 +---
 drivers/video/backlight/locomolcd.c    | 3 +--
 5 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 62f241b09fe3..e45f4e4e06b6 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -838,11 +838,10 @@ static int locomo_bus_remove(struct device *dev)
 {
 	struct locomo_dev *ldev = LOCOMO_DEV(dev);
 	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
 
 	if (drv->remove)
-		ret = drv->remove(ldev);
-	return ret;
+		drv->remove(ldev);
+	return 0;
 }
 
 struct bus_type locomo_bus_type = {
diff --git a/arch/arm/include/asm/hardware/locomo.h b/arch/arm/include/asm/hardware/locomo.h
index f8712e3c29cf..246a3de25931 100644
--- a/arch/arm/include/asm/hardware/locomo.h
+++ b/arch/arm/include/asm/hardware/locomo.h
@@ -188,7 +188,7 @@ struct locomo_driver {
 	struct device_driver	drv;
 	unsigned int		devid;
 	int (*probe)(struct locomo_dev *);
-	int (*remove)(struct locomo_dev *);
+	void (*remove)(struct locomo_dev *);
 };
 
 #define LOCOMO_DRV(_d)	container_of((_d), struct locomo_driver, drv)
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index bd3a52fd09ce..f43beb7b25c7 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -204,18 +204,12 @@ static int collie_uart_probe(struct locomo_dev *dev)
 	return 0;
 }
 
-static int collie_uart_remove(struct locomo_dev *dev)
-{
-	return 0;
-}
-
 static struct locomo_driver collie_uart_driver = {
 	.drv = {
 		.name = "collie_uart",
 	},
 	.devid	= LOCOMO_DEVID_UART,
 	.probe	= collie_uart_probe,
-	.remove	= collie_uart_remove,
 };
 
 static int __init collie_uart_init(void)
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index daf6a753ca61..dae053596572 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -304,7 +304,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
 	return err;
 }
 
-static int locomokbd_remove(struct locomo_dev *dev)
+static void locomokbd_remove(struct locomo_dev *dev)
 {
 	struct locomokbd *locomokbd = locomo_get_drvdata(dev);
 
@@ -318,8 +318,6 @@ static int locomokbd_remove(struct locomo_dev *dev)
 	release_mem_region((unsigned long) dev->mapbase, dev->length);
 
 	kfree(locomokbd);
-
-	return 0;
 }
 
 static struct locomo_driver keyboard_driver = {
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index 297ee2e1ab0b..0468ea82159f 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -208,7 +208,7 @@ static int locomolcd_probe(struct locomo_dev *ldev)
 	return 0;
 }
 
-static int locomolcd_remove(struct locomo_dev *dev)
+static void locomolcd_remove(struct locomo_dev *dev)
 {
 	unsigned long flags;
 
@@ -220,7 +220,6 @@ static int locomolcd_remove(struct locomo_dev *dev)
 	local_irq_save(flags);
 	locomolcd_dev = NULL;
 	local_irq_restore(flags);
-	return 0;
 }
 
 static struct locomo_driver poodle_lcd_driver = {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: locomo: make locomo bus's remove callback return void
  2020-11-26 11:01 [PATCH] ARM: locomo: make locomo bus's remove callback return void Uwe Kleine-König
@ 2020-11-26 13:56 ` Lee Jones
  2020-11-26 21:31 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2020-11-26 13:56 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Russell King, Dmitry Torokhov, Daniel Thompson, Jingoo Han,
	Bartlomiej Zolnierkiewicz, linux-arm-kernel, linux-input,
	dri-devel, linux-fbdev, kernel

On Thu, 26 Nov 2020, Uwe Kleine-König wrote:

> The driver core ignores the return value of struct bus_type::remove
> because there is only little that can be done. To simplify the quest to
> make this function return void, let struct locomo_driver::remove return
> void, too. All users already unconditionally return 0, this commit makes
> it obvious that returning an error code is a bad idea and ensures future
> users behave accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> if desired the change to arch/arm/mach-sa1100/collie.c can be split out
> of this patch. The change of prototype then doesn't affect this driver
> any more. There is one locomo-driver that is already now unaffected:
> drivers/leds/leds-locomo.c. This driver doesn't have a remove callback.
> 
> Best regards
> Uwe
> 
>  arch/arm/common/locomo.c               | 5 ++---
>  arch/arm/include/asm/hardware/locomo.h | 2 +-
>  arch/arm/mach-sa1100/collie.c          | 6 ------
>  drivers/input/keyboard/locomokbd.c     | 4 +---
>  drivers/video/backlight/locomolcd.c    | 3 +--

Acked-by: Lee Jones <lee.jones@linaro.org>

>  5 files changed, 5 insertions(+), 15 deletions(-)

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARM: locomo: make locomo bus's remove callback return void
  2020-11-26 11:01 [PATCH] ARM: locomo: make locomo bus's remove callback return void Uwe Kleine-König
  2020-11-26 13:56 ` Lee Jones
@ 2020-11-26 21:31 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-11-26 21:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Russell King, Lee Jones, Daniel Thompson, Jingoo Han,
	Bartlomiej Zolnierkiewicz, linux-arm-kernel, linux-input,
	dri-devel, linux-fbdev, kernel

On Thu, Nov 26, 2020 at 12:01:40PM +0100, Uwe Kleine-König wrote:
> The driver core ignores the return value of struct bus_type::remove
> because there is only little that can be done. To simplify the quest to
> make this function return void, let struct locomo_driver::remove return
> void, too. All users already unconditionally return 0, this commit makes
> it obvious that returning an error code is a bad idea and ensures future
> users behave accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> if desired the change to arch/arm/mach-sa1100/collie.c can be split out
> of this patch. The change of prototype then doesn't affect this driver
> any more. There is one locomo-driver that is already now unaffected:
> drivers/leds/leds-locomo.c. This driver doesn't have a remove callback.
> 
> Best regards
> Uwe
> 
>  arch/arm/common/locomo.c               | 5 ++---
>  arch/arm/include/asm/hardware/locomo.h | 2 +-
>  arch/arm/mach-sa1100/collie.c          | 6 ------
>  drivers/input/keyboard/locomokbd.c     | 4 +---

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

>  drivers/video/backlight/locomolcd.c    | 3 +--
>  5 files changed, 5 insertions(+), 15 deletions(-)

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-26 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 11:01 [PATCH] ARM: locomo: make locomo bus's remove callback return void Uwe Kleine-König
2020-11-26 13:56 ` Lee Jones
2020-11-26 21:31 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).