Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2023 11:06:18 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Emmanuel Vadot <manu@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 69f8cc60aa1e - main - ofw_firmware: Only match if there is no compatible
Message-ID:  <885195f6-2dbd-4890-affc-5571404e9982@FreeBSD.org>
In-Reply-To: <202308130919.37D9JtjW003148@gitrepo.freebsd.org>
References:  <202308130919.37D9JtjW003148@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?885195f6-2dbd-4890-affc-5571404e9982>