All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Zijun Hu <zijun_hu@icloud.com>
Cc: Saravana Kannan <saravanak@google.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zijun Hu <quic_zijuhu@quicinc.com>
Subject: Re: [PATCH 3/5] of: Correct property name comparison in __of_add_property()
Date: Tue, 25 Feb 2025 08:38:44 -0600	[thread overview]
Message-ID: <20250225143844.GA2279028-robh@kernel.org> (raw)
In-Reply-To: <20250224-of_bugfix-v1-3-03640ae8c3a6@quicinc.com>

On Mon, Feb 24, 2025 at 10:27:59PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@quicinc.com>
> 
> __of_add_property() compares property name by strcmp(), and that is
> improper for SPARC which wants strcasecmp().

Except that 'name' is the nodename (usually, with a few rare 
exceptions). Sparc node names are case sensitive, so strcmp was correct. 

My hope is to get rid of case insensitive comparisions, so if nothing 
cares that we're doing a case sensitive comparision, I want to keep 
that. 

I also want to get rid of storing both 'name' as a property and 
device_node.name. The name property is an ABI issue though if no one is 
looking, then it's not an ABI issue. Also, we should be able to generate 
device_node.name from device_node.full_name. There's still a bunch of 
direct users of device_node.name which have to be fixed. Mostly in clock 
drivers from what I remember.

> Fix by using dedicated property name comparison macro of_prop_cmp().
> 
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
>  drivers/of/base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 001ff6ce4abf85c07f13649d5a9f691f549a8ccc..c810014957e81171675b63f25eaabe391cc903e4 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1651,7 +1651,7 @@ int __of_add_property(struct device_node *np, struct property *prop)
>  	prop->next = NULL;
>  	next = &np->properties;
>  	while (*next) {
> -		if (strcmp(prop->name, (*next)->name) == 0) {
> +		if (of_prop_cmp(prop->name, (*next)->name) == 0) {
>  			/* duplicate ! don't insert it */
>  			rc = -EEXIST;
>  			goto out_unlock;
> 
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-02-25 14:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 14:27 [PATCH 0/5] of: Trivial cleanup Zijun Hu
2025-02-24 14:27 ` [PATCH 1/5] of: Compare property names by of_prop_cmp() in of_alias_scan() Zijun Hu
2025-02-25 14:42   ` Rob Herring (Arm)
2025-02-24 14:27 ` [PATCH 2/5] of: Introduce and apply private is_pseudo_property() Zijun Hu
2025-02-25 14:44   ` Rob Herring (Arm)
2025-02-24 14:27 ` [PATCH 3/5] of: Correct property name comparison in __of_add_property() Zijun Hu
2025-02-25 14:38   ` Rob Herring [this message]
2025-02-25 15:04     ` Zijun Hu
2025-02-25 19:57       ` Rob Herring
2025-02-24 14:28 ` [PATCH 4/5] of: Do not change property state under __of_add_property() failure Zijun Hu
2025-02-25 14:41   ` Rob Herring
2025-02-25 15:24     ` Zijun Hu
2025-02-25 15:25     ` Zijun Hu
2025-02-24 14:28 ` [PATCH 5/5] of/platform: Do not use of_get_property() to test property presence Zijun Hu
2025-02-25 14:44   ` Rob Herring (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250225143844.GA2279028-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_zijuhu@quicinc.com \
    --cc=saravanak@google.com \
    --cc=zijun_hu@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.