Only manage ofw gpio providers on ofw systems

On arm64 we may boot via ACPI. In this case we will still try to manage the
gpio providers as if we are using FDT. Fix this by checking if the FDT node
is valid before registering a cross reference.

Sponsored by:	Innovate UK
This commit is contained in:
Andrew Turner 2020-09-10 09:42:37 +00:00
parent 365ed84f28
commit f5e4e9153c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=365558

View File

@ -197,7 +197,8 @@ ofw_gpiobus_register_provider(device_t provider)
phandle_t node;
node = ofw_bus_get_node(provider);
OF_device_register_xref(OF_xref_from_node(node), provider);
if (node != -1)
OF_device_register_xref(OF_xref_from_node(node), provider);
}
void
@ -206,7 +207,8 @@ ofw_gpiobus_unregister_provider(device_t provider)
phandle_t node;
node = ofw_bus_get_node(provider);
OF_device_register_xref(OF_xref_from_node(node), NULL);
if (node != -1)
OF_device_register_xref(OF_xref_from_node(node), NULL);
}
static struct ofw_gpiobus_devinfo *