Re: git: 69f8cc60aa1e - main - ofw_firmware: Only match if there is no compatible
- In reply to: Emmanuel Vadot : "git: 69f8cc60aa1e - main - ofw_firmware: Only match if there is no compatible"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 14 Aug 2023 18:06:18 UTC
On 8/13/23 2:19 AM, Emmanuel Vadot wrote:
> The branch main has been updated by manu:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=69f8cc60aa1e3140f41a75c859333a3d56c947fb
>
> commit 69f8cc60aa1e3140f41a75c859333a3d56c947fb
> Author: Emmanuel Vadot <manu@FreeBSD.org>
> AuthorDate: 2023-08-13 06:28:13 +0000
> Commit: Emmanuel Vadot <manu@FreeBSD.org>
> CommitDate: 2023-08-13 09:19:44 +0000
>
> ofw_firmware: Only match if there is no compatible
>
> If there is a compatible string it likely means that the firmware needs
> a dedicated driver (like on RPI*).
>
> PR: 273087
> Tested-by: Mark Millard <marklmi26-fbsd@yahoo.com>
> Sponsored by: Beckhoff Automation GmbH & Co. KG
> Fixes: fdfd3a90b6ce ("ofw: Add a ofw_firmware driver")
> ---
> sys/dev/ofw/ofw_firmware.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sys/dev/ofw/ofw_firmware.c b/sys/dev/ofw/ofw_firmware.c
> index faba123c3e09..7d62fc317c1d 100644
> --- a/sys/dev/ofw/ofw_firmware.c
> +++ b/sys/dev/ofw/ofw_firmware.c
> @@ -100,11 +100,14 @@ ofw_firmware_add_device(device_t dev, phandle_t node, u_int order,
> static int
> ofw_firmware_probe(device_t dev)
> {
> - const char *name;
> + const char *name, *compat;
>
> name = ofw_bus_get_name(dev);
> if (name == NULL || strcmp(name, "firmware") != 0)
> return (ENXIO);
> + compat = ofw_bus_get_compat(dev);
> + if (compat != NULL)
> + return (ENXIO);>
> device_set_desc(dev, "OFW Firmware Group");
> return (0);
Returning 0 from probe should be discouraged in new drivers FWIW. I'm curious
here why you don't instead just return BUS_PROBE_GENERIC here, and let the
RPi-specific driver return BUS_PROBE_DEFAULT?
--
John Baldwin