[PATCH 1/1] device property: Add fwnode_name_eq()

Andy Shevchenko andriy.shevchenko at linux.intel.com
Tue Oct 31 09:32:17 PDT 2023


On Tue, Oct 31, 2023 at 03:53:06PM +0200, Sakari Ailus wrote:
> Add fwnode_name_eq() to implement the functionality of of_node_name_eq()
> on fwnode property API. The same convention of ending the comparison at
> '@' (besides '\0') is applied on also both ACPI and swnode. The function
> is intended for comparing unit address-less node names on DT and firmware
> or swnodes compliant with DT bindings.

Some comments below.

...

> Would you be able to use this to replace of_node_name_eq()?

Can you point out to the use case? Maybe it can be rewritten using existing
APIs?

...

> +	len = strchrnul(node_name, '@') - node_name;

> +	return strlen(name) == len && !strncmp(node_name, name, len);

Seems like this is reimplementation of str_has_prefix().

	len = strchrnul(node_name, '@') - node_name;
	return str_has_prefix(node_name, name) == len;

-- 
With Best Regards,
Andy Shevchenko





More information about the Linux-mediatek mailing list