Should of_device_is_compatible() use strcmp() rather than strncasecmp()?

Scott Wood scottwood at freescale.com
Wed Jul 4 08:33:37 EST 2007


Olof Johansson wrote:
> On Tue, Jul 03, 2007 at 05:15:11PM -0500, Scott Wood wrote:
> 
> 
>>How about a CONFIG_NOT_BROKEN_DEVICE_TREE that disables this and other 
>>legacy stuff?  If unset, warnings will be printed whenever broken things 
>>are detected.  Boards which need proper device tree parsing can select 
>>the config option.
>>
>>I'd prefer the other way around (CONFIG_BROKEN_DEVICE_TREE), but it'd 
>>need to default y at first, and kconfig has no unselect command that I 
>>can see...
> 
> 
> What's the value add in doing this? The code to handle both cases still
> has to be in there (just under ifdef now). Is there actually any harm
> in doing case-insensitive matching today, where things break because
> there are conflicting properties with different cases?

Not for case insensitivity (that I know of), but the whole reason I 
posted this was because of time spent trying to figure out why my serial 
port recently stopped working -- apparently, it's checking nodes in a 
different order now (or something along those lines), causing the 
substring match to match against the wrong thing.

I'd really rather not have to go out of my way to avoid picking 
compatible names that break Linux.

> Device trees will never be perfect, and it's idiotic of the kernel to
> expect them to be.

It's even more idiotic to break valid device trees just because the 
kernel has always done so.  Putting it under ifdef, especially once the 
default is conformant behavior, will make it more likely that future 
device trees are compliant in that regrad, as long as Linux is involved 
in the testing process.

> Even with the dts files, there are several of them
> that have errors in them. There will be more in the future as well.

And the earlier we implement stricter checking, the fewer of them there 
will be.

-Scott



More information about the Linuxppc-dev mailing list