mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Soha Jin" <soha@lohu.info>
To: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
	"'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>,
	"'Rob Herring'" <robh+dt@kernel.org>
Cc: "'Rafael J. Wysocki'" <rafael@kernel.org>,
	"'Daniel Scally'" <djrscally@gmail.com>,
	"'Heikki Krogerus'" <heikki.krogerus@linux.intel.com>,
	"'Sakari Ailus'" <sakari.ailus@linux.intel.com>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: RE: [PATCH 1/3] string: add match_string_nocase() for case-insensitive match
Date: Mon, 10 Oct 2022 15:36:17 +0800	[thread overview]
Message-ID: <9963070D38F093DB+25d201d8dc7a$fca3e570$f5ebb050$@lohu.info> (raw)
In-Reply-To: <Y0O6kDQ9Bxi9jMfo@kroah.com>

Hi Greg and Andy,

> From: 'Greg Kroah-Hartman' <gregkh@linuxfoundation.org>
> Sent: Monday, October 10, 2022 2:24 PM
> 
> > I am writing regarding the compatibility. In
> > `of_device_is_compatible`, it uses `of_compat_cmp` which calls
> `strcasecmp` to match compatible property.
> >
> > As the `fwnode_is_compatible` should be the replacement of the OF way,
> > I think we should make the fwnode way and the OF way the same, i.e.
> > either both case-insensitive or case-sensitive, to keep the
> > consistency. I am afraid that make `of_compat_cmp` case-sensitive may
> > break a great many of devices, that is why I am doing this.
> 
> Ok, but if you change this with the series, what will break? 

My changeset will not break something, and make comparison case-sensitive
does. Some old device firmwares that did not care about letter case might
not function correctly in a newer kernel, because the current kernel checks
compatibility case-insensitively and the former developer did not notice
this with the just working kernel.

> What needs this
> new case-insensitive comparison that does not work today?

> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: Monday, October 10, 2022 2:24 PM
> 
> So, why do we have such in the OF code and do we really need it in the
> modern world?

Frankly speaking, I think case-insensitive comparison is not needed TODAY,
and before I compose this change, I can see codes in kernel like this:
    of_device_is_compatible(np, "U4-pcie") ||
    of_device_is_compatible(np, "u4-pcie")
which means kernel codes is de facto case-sensitive, although this function
calls `strcasecmp`.

I do not know kernel maintainers' mind when I am composing this change, I
just chose the way which will not break anything. Anyway, I am also glad to
edit the patch to make it case-sensitive once maintainers have made the
final decision.

Regards,
Soha


  reply	other threads:[~2022-10-10  7:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09 16:21 [PATCH 0/3] Case-insensitive match_string and fwnode_is_compatible() Soha Jin
2022-10-09 16:21 ` [PATCH 1/3] string: add match_string_nocase() for case-insensitive match Soha Jin
2022-10-09 18:24   ` Greg Kroah-Hartman
2022-10-10  3:02     ` Soha Jin
2022-10-10  6:24       ` 'Greg Kroah-Hartman'
2022-10-10  7:36         ` Soha Jin [this message]
2022-10-09 16:21 ` [PATCH 2/3] device property: add {device,fwnode}_property_match_string_nocase() Soha Jin
2022-10-09 18:25   ` Greg Kroah-Hartman
2022-10-09 18:40   ` kernel test robot
2022-10-09 18:40   ` kernel test robot
2022-10-09 16:21 ` [PATCH 3/3] device property: add fwnode_is_compatible() for compatible match Soha Jin
2022-10-09 18:26   ` Greg Kroah-Hartman
2022-10-09 18:24 ` [PATCH 0/3] Case-insensitive match_string and fwnode_is_compatible() Greg Kroah-Hartman
2022-10-10  3:07   ` Soha Jin
2022-10-10  6:26     ` 'Greg Kroah-Hartman'
2022-10-10  7:40       ` Soha Jin
2022-10-10  6:23 ` Andy Shevchenko

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='9963070D38F093DB+25d201d8dc7a$fca3e570$f5ebb050$@lohu.info' \
    --to=soha@lohu.info \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®