simple_mfd: don't attach children twice

Trying to probe+attach the child device at the point it is added comes
before the syscon handle is set up (if relevant). It will therefore be
unavailable to the attach method which is expecting it, and the first
attempt to attach the device will fail.

Just rely on the call to bus_generic_attach() at the end of the function
to perform probe+attach of dev's children.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44268
This commit is contained in:
Mitchell Horne 2024-03-08 10:09:17 -04:00
parent 08635c51d1
commit accda78153

View file

@ -168,7 +168,6 @@ simple_mfd_attach(device_t dev)
{
struct simple_mfd_softc *sc;
phandle_t node, child;
device_t cdev;
int rid;
sc = device_get_softc(dev);
@ -203,9 +202,7 @@ simple_mfd_attach(device_t dev)
/* Attach child devices */
for (child = OF_child(node); child > 0; child = OF_peer(child)) {
cdev = simple_mfd_add_device(dev, child, 0, NULL, -1, NULL);
if (cdev != NULL)
device_probe_and_attach(cdev);
(void)simple_mfd_add_device(dev, child, 0, NULL, -1, NULL);
}
if (ofw_bus_is_compatible(dev, "syscon")) {