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

(cherry picked from commit accda781531788a814bc438e1e96ef544c12aeaf)
This commit is contained in:
Mitchell Horne 2024-03-08 10:09:17 -04:00
parent 29701960b3
commit 9319a8a11a

View file

@ -169,7 +169,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);
@ -204,9 +203,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")) {