git: 34f5de82e8fc - main - bus_delayed_attach_children: Switch return type to void

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 06 Dec 2024 22:29:21 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=34f5de82e8fcf0ab335a708a9141a5f4240a4c64

commit 34f5de82e8fcf0ab335a708a9141a5f4240a4c64
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-12-06 22:27:14 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-12-06 22:27:14 +0000

    bus_delayed_attach_children: Switch return type to void
    
    This function never fails similar to bus_attach_children.
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D47677
---
 sys/arm/broadcom/bcm2835/bcm2835_bsc.c       |  3 ++-
 sys/arm/freescale/imx/imx_i2c.c              |  3 ++-
 sys/arm/freescale/imx/imx_spi.c              |  3 ++-
 sys/arm/mv/a37x0_spi.c                       |  3 ++-
 sys/arm/mv/mv_spi.c                          |  3 ++-
 sys/arm/ti/ti_i2c.c                          |  2 +-
 sys/dev/glxiic/glxiic.c                      |  2 +-
 sys/dev/hid/hidbus.c                         | 11 ++++-------
 sys/dev/ichsmb/ichsmb.c                      |  3 ++-
 sys/dev/iicbus/controller/cadence/cdnc_i2c.c |  3 ++-
 sys/dev/intel/spi.c                          |  3 ++-
 sys/dev/ow/owc_gpiobus.c                     |  3 ++-
 sys/kern/subr_bus.c                          |  4 +---
 sys/sys/bus.h                                |  2 +-
 14 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
index 6a9853a7b4f9..c7de4df0e8fb 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
@@ -349,7 +349,8 @@ bcm_bsc_attach(device_t dev)
 	}
 
 	/* Probe and attach the iicbus when interrupts are available. */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/arm/freescale/imx/imx_i2c.c b/sys/arm/freescale/imx/imx_i2c.c
index d8d7514c8c4b..c1d5c8c974a8 100644
--- a/sys/arm/freescale/imx/imx_i2c.c
+++ b/sys/arm/freescale/imx/imx_i2c.c
@@ -469,7 +469,8 @@ no_recovery:
 	/* We don't do a hardware reset here because iicbus_attach() does it. */
 
 	/* Probe and attach the iicbus when interrupts are available. */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/arm/freescale/imx/imx_spi.c b/sys/arm/freescale/imx/imx_spi.c
index 388b25b7ec28..53d9f739b97c 100644
--- a/sys/arm/freescale/imx/imx_spi.c
+++ b/sys/arm/freescale/imx/imx_spi.c
@@ -564,7 +564,8 @@ spi_attach(device_t dev)
 	 * their attach. We can't do IO until timers and interrupts are working.
 	 */
 	sc->spibus = device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/arm/mv/a37x0_spi.c b/sys/arm/mv/a37x0_spi.c
index 4bcbbc503218..bc47da2f3e6e 100644
--- a/sys/arm/mv/a37x0_spi.c
+++ b/sys/arm/mv/a37x0_spi.c
@@ -217,7 +217,8 @@ a37x0_spi_attach(device_t dev)
 	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	/* Probe and attach the spibus when interrupts are available. */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/arm/mv/mv_spi.c b/sys/arm/mv/mv_spi.c
index 621594624b7b..1f9c8ebf2380 100644
--- a/sys/arm/mv/mv_spi.c
+++ b/sys/arm/mv/mv_spi.c
@@ -171,7 +171,8 @@ mv_spi_attach(device_t dev)
 	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
 	/* Probe and attach the spibus when interrupts are available. */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/arm/ti/ti_i2c.c b/sys/arm/ti/ti_i2c.c
index 527c8cbd8ee3..a6c397a87e8b 100644
--- a/sys/arm/ti/ti_i2c.c
+++ b/sys/arm/ti/ti_i2c.c
@@ -889,7 +889,7 @@ ti_i2c_attach(device_t dev)
 	}
 
 	/* Probe and attach the iicbus when interrupts are available. */
-	err = bus_delayed_attach_children(dev);
+	bus_delayed_attach_children(dev);
 
 out:
 	if (err) {
diff --git a/sys/dev/glxiic/glxiic.c b/sys/dev/glxiic/glxiic.c
index 16ed337c543b..5dfea9acbe4a 100644
--- a/sys/dev/glxiic/glxiic.c
+++ b/sys/dev/glxiic/glxiic.c
@@ -408,7 +408,7 @@ glxiic_attach(device_t dev)
 	glxiic_smb_enable(sc, IIC_FASTEST, 0);
 
 	/* Probe and attach the iicbus when interrupts are available. */
-	error = bus_delayed_attach_children(dev);
+	bus_delayed_attach_children(dev);
 
 out:
 	if (error != 0) {
diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
index 8e55d65f308b..9b8b7fed8887 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -272,15 +272,12 @@ hidbus_attach_children(device_t dev)
 	if (sc->nest != 0)
 		return (0);
 
-	if (hid_is_keyboard(sc->rdesc.data, sc->rdesc.len) != 0) {
+	if (hid_is_keyboard(sc->rdesc.data, sc->rdesc.len) != 0)
 		bus_attach_children(dev);
-		error = 0;
-	} else
-		error = bus_delayed_attach_children(dev);
-	if (error != 0)
-		device_printf(dev, "failed to attach child: error %d\n", error);
+	else
+		bus_delayed_attach_children(dev);
 
-	return (error);
+	return (0);
 }
 
 static int
diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c
index 94fc03d2bc67..063fbf66a75a 100644
--- a/sys/dev/ichsmb/ichsmb.c
+++ b/sys/dev/ichsmb/ichsmb.c
@@ -130,7 +130,8 @@ ichsmb_attach(device_t dev)
 	}
 
 	/* Attach children when interrupts are available */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 fail:
 	mtx_destroy(&sc->mutex);
 	return (error);
diff --git a/sys/dev/iicbus/controller/cadence/cdnc_i2c.c b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c
index 61f4975c10de..3bed24c36070 100644
--- a/sys/dev/iicbus/controller/cadence/cdnc_i2c.c
+++ b/sys/dev/iicbus/controller/cadence/cdnc_i2c.c
@@ -617,7 +617,8 @@ cdnc_i2c_attach(device_t dev)
 	cdnc_i2c_add_sysctls(dev);
 
 	/* Probe and attach iicbus when interrupts work. */
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
index 1a52300ea785..4c45ef7863a7 100644
--- a/sys/dev/intel/spi.c
+++ b/sys/dev/intel/spi.c
@@ -529,7 +529,8 @@ intelspi_attach(device_t dev)
 
 	device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
 
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 
 error:
 	INTELSPI_LOCK_DESTROY(sc);
diff --git a/sys/dev/ow/owc_gpiobus.c b/sys/dev/ow/owc_gpiobus.c
index 2d37b71aee2d..231902e02536 100644
--- a/sys/dev/ow/owc_gpiobus.c
+++ b/sys/dev/ow/owc_gpiobus.c
@@ -134,7 +134,8 @@ owc_gpiobus_attach(device_t dev)
 	 * the system timecounter (which initializes after device attachments).
 	 */
 	device_add_child(sc->sc_dev, "ow", DEVICE_UNIT_ANY);
-	return (bus_delayed_attach_children(dev));
+	bus_delayed_attach_children(dev);
+	return (0);
 }
 
 static int
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 945d91d951d6..1d04ea496f08 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3485,13 +3485,11 @@ bus_attach_children(device_t dev)
  * attach until after interrupts and/or timers are running.  This function
  * delays their attach until interrupts and timers are enabled.
  */
-int
+void
 bus_delayed_attach_children(device_t dev)
 {
 	/* Probe and attach the bus children when interrupts are available */
 	config_intrhook_oneshot((ich_func_t)bus_attach_children, dev);
-
-	return (0);
 }
 
 /**
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 38834bcf5a8e..01031ae3ef28 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -595,9 +595,9 @@ int	bus_child_pnpinfo(device_t child, struct sbuf *sb);
 int	bus_child_location(device_t child, struct sbuf *sb);
 
 void	bus_attach_children(device_t dev);
+void	bus_delayed_attach_children(device_t bus);
 int	bus_detach_children(device_t dev);
 void	bus_enumerate_hinted_children(device_t bus);
-int	bus_delayed_attach_children(device_t bus);
 void	bus_identify_children(device_t dev);
 
 static __inline struct resource *