[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y0MSPaZlhW6iOYEV@kroah.com>
Date: Sun, 9 Oct 2022 20:26:05 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Soha Jin <soha@...u.info>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] device property: add fwnode_is_compatible() for
compatible match
On Mon, Oct 10, 2022 at 12:21:55AM +0800, Soha Jin wrote:
> fwnode_is_compatible is a shortcut to check if a device is compatible with
> a compat string in fwnode property "compatible". This function is similar
> to of_device_is_compatible.
>
> Signed-off-by: Soha Jin <soha@...u.info>
> ---
> include/linux/property.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/property.h b/include/linux/property.h
> index dbe747f3e3be..776e4a8bc379 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -252,6 +252,13 @@ fwnode_property_string_array_count(const struct fwnode_handle *fwnode,
> return fwnode_property_read_string_array(fwnode, propname, NULL, 0);
> }
>
> +static inline bool fwnode_is_compatible(const struct fwnode_handle *fwnode,
> + const char *compat)
> +{
> + return fwnode_property_match_string_nocase(fwnode, "compatible",
> + compat) >= 0;
Who would mistype "compatible" in a case insensitive way?
Why can't you fix the firmware to be correct instead of forcing the
operating system to fix it for them?
thanks,
greg k-h
Powered by blists - more mailing lists