[PATCH 0/5] Some cleanups after making bus_type::remove return void

STALE1868d

Revision v1 of 2 in this series.

3 messages, 2 authors, 2021-07-27 · open the first message on its own page

[PATCH 0/5] Some cleanups after making bus_type::remove return void

From: Uwe Kleine-König <hidden>
Date: 2021-07-27 08:10:37

Hello,

while working on the patch set that made bus_type::remove return void I
noticed a few things that could be improved. This series addresses
these. Apart from a simple conflict between the two zorro patches there
are no interdependencies between these patches. I created them on top of
Greg's bus_remove_return_void-5.15 tag[1]. There might be further
(probably simple) conflicts if they are applied based on an earlier
commit.

So it should be easily possible to let these patches go in through their
usual maintainer trees. So please if you're a maintainer state if you
prefer to take the patches yourself or if you prefer that Greg takes
them together.

Best regards
Uwe

[1] available at

	git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git tags/bus_remove_return_void-5.15

    see https://lore.kernel.org/lkml/YPkwQwf0dUKnGA7L@kroah.com

Uwe Kleine-König (5):
  nubus: Simplify check in remove callback
  nubus: Make struct nubus_driver::remove return void
  sh: superhyway: Simplify check in remove callback
  zorro: Simplify remove callback
  zorro: Drop useless (and hardly used) .driver member in struct
    zorro_dev

 drivers/net/ethernet/8390/mac8390.c     |  3 +--
 drivers/net/ethernet/natsemi/macsonic.c |  4 +---
 drivers/nubus/bus.c                     |  2 +-
 drivers/sh/superhyway/superhyway.c      |  2 +-
 drivers/zorro/zorro-driver.c            | 13 ++++---------
 include/linux/nubus.h                   |  2 +-
 include/linux/zorro.h                   |  1 -
 7 files changed, 9 insertions(+), 18 deletions(-)


base-commit: fc7a6209d5710618eb4f72a77cd81b8d694ecf89
-- 
2.30.2

[PATCH 2/5] nubus: Make struct nubus_driver::remove return void

From: Uwe Kleine-König <hidden>
Date: 2021-07-27 08:09:06

The nubus core ignores the return value of the remove callback (in
nubus_device_remove()) and all implementers return 0 anyway.

So make it impossible for future drivers to return an unused error code
by changing the remove prototype to return void.

Signed-off-by: Uwe Kleine-König <redacted>
---
 drivers/net/ethernet/8390/mac8390.c     | 3 +--
 drivers/net/ethernet/natsemi/macsonic.c | 4 +---
 include/linux/nubus.h                   | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/8390/mac8390.c b/drivers/net/ethernet/8390/mac8390.c
index 9aac7119d382..91b04abfd687 100644
--- a/drivers/net/ethernet/8390/mac8390.c
+++ b/drivers/net/ethernet/8390/mac8390.c
@@ -428,13 +428,12 @@ static int mac8390_device_probe(struct nubus_board *board)
 	return err;
 }
 
-static int mac8390_device_remove(struct nubus_board *board)
+static void mac8390_device_remove(struct nubus_board *board)
 {
 	struct net_device *dev = nubus_get_drvdata(board);
 
 	unregister_netdev(dev);
 	free_netdev(dev);
-	return 0;
 }
 
 static struct nubus_driver mac8390_driver = {
diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c
index 2289e1fe3741..8709d700e15a 100644
--- a/drivers/net/ethernet/natsemi/macsonic.c
+++ b/drivers/net/ethernet/natsemi/macsonic.c
@@ -603,7 +603,7 @@ static int mac_sonic_nubus_probe(struct nubus_board *board)
 	return err;
 }
 
-static int mac_sonic_nubus_remove(struct nubus_board *board)
+static void mac_sonic_nubus_remove(struct nubus_board *board)
 {
 	struct net_device *ndev = nubus_get_drvdata(board);
 	struct sonic_local *lp = netdev_priv(ndev);
@@ -613,8 +613,6 @@ static int mac_sonic_nubus_remove(struct nubus_board *board)
 			  SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
 			  lp->descriptors, lp->descriptors_laddr);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static struct nubus_driver mac_sonic_nubus_driver = {
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index eba50b057f6f..392fc6c53e96 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -86,7 +86,7 @@ extern struct list_head nubus_func_rsrcs;
 struct nubus_driver {
 	struct device_driver driver;
 	int (*probe)(struct nubus_board *board);
-	int (*remove)(struct nubus_board *board);
+	void (*remove)(struct nubus_board *board);
 };
 
 extern struct bus_type nubus_bus_type;
-- 
2.30.2

Re: [PATCH 2/5] nubus: Make struct nubus_driver::remove return void

From: Finn Thain <fthain@linux-m68k.org>
Date: 2021-07-27 09:47:44

On Tue, 27 Jul 2021, Uwe Kleine-König wrote:
The nubus core ignores the return value of the remove callback (in
nubus_device_remove()) and all implementers return 0 anyway.

So make it impossible for future drivers to return an unused error code
by changing the remove prototype to return void.

Signed-off-by: Uwe Kleine-König <redacted>
Acked-by: Finn Thain <fthain@linux-m68k.org>
quoted hunk
---
 drivers/net/ethernet/8390/mac8390.c     | 3 +--
 drivers/net/ethernet/natsemi/macsonic.c | 4 +---
 include/linux/nubus.h                   | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/8390/mac8390.c b/drivers/net/ethernet/8390/mac8390.c
index 9aac7119d382..91b04abfd687 100644
--- a/drivers/net/ethernet/8390/mac8390.c
+++ b/drivers/net/ethernet/8390/mac8390.c
@@ -428,13 +428,12 @@ static int mac8390_device_probe(struct nubus_board *board)
 	return err;
 }
 
-static int mac8390_device_remove(struct nubus_board *board)
+static void mac8390_device_remove(struct nubus_board *board)
 {
 	struct net_device *dev = nubus_get_drvdata(board);
 
 	unregister_netdev(dev);
 	free_netdev(dev);
-	return 0;
 }
 
 static struct nubus_driver mac8390_driver = {
diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c
index 2289e1fe3741..8709d700e15a 100644
--- a/drivers/net/ethernet/natsemi/macsonic.c
+++ b/drivers/net/ethernet/natsemi/macsonic.c
@@ -603,7 +603,7 @@ static int mac_sonic_nubus_probe(struct nubus_board *board)
 	return err;
 }
 
-static int mac_sonic_nubus_remove(struct nubus_board *board)
+static void mac_sonic_nubus_remove(struct nubus_board *board)
 {
 	struct net_device *ndev = nubus_get_drvdata(board);
 	struct sonic_local *lp = netdev_priv(ndev);
@@ -613,8 +613,6 @@ static int mac_sonic_nubus_remove(struct nubus_board *board)
 			  SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
 			  lp->descriptors, lp->descriptors_laddr);
 	free_netdev(ndev);
-
-	return 0;
 }
 
 static struct nubus_driver mac_sonic_nubus_driver = {
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index eba50b057f6f..392fc6c53e96 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -86,7 +86,7 @@ extern struct list_head nubus_func_rsrcs;
 struct nubus_driver {
 	struct device_driver driver;
 	int (*probe)(struct nubus_board *board);
-	int (*remove)(struct nubus_board *board);
+	void (*remove)(struct nubus_board *board);
 };
 
 extern struct bus_type nubus_bus_type;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help