RE: [PATCH 1/3] string: add match_string_nocase() for case-insensitive match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg and Andy,

> From: 'Greg Kroah-Hartman' <gregkh@xxxxxxxxxxxxxxxxxxx>
> 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@xxxxxxxxxxxxxxx>
> 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux