[PATCH 2/3] 82xx: Parse SMC serial device node in DTS

Segher Boessenkool segher at kernel.crashing.org
Wed Jul 18 01:08:18 EST 2007


>>>> +               if (strstr(model, "SMC")) {
>>>> +                       cpm_uart_dev =  
>>>> platform_device_register_simple("fsl-cpm-smc:uart",
>>>> +                                                       i, &r 
>>>> [0], 3);
>>>> +               } else if (strstr(model, "SCC")) {

>>> You should probably use of_device_is_compatible() to check
>>> if a given device can be used by a particular driver.
>>
>> I think, the function of_find_compatible_node(), which is called  
>> in the
>> for loop, has already done that. So definitely, no need to call
>> of_device_is_compatible() any more.
>
> It's a little more complicated than that. The "compatible" property  
> should
> indicate the exact interface of that device, so the "model" does  
> not really
> matter here.

"model" is meant to be an exact manufacturer model number.
This can be used for workaround code or such if the "compatible"
entry isn't specific enough.  You should try to make sure your
"compatible" entries are, though.

Oh, and strstr() is asking for trouble.  Just do a full
compare.

> I don't know the difference between smc and scc, but if you
> need to register them as different pplatform devices, they should
> normally also have different names in "compatible", possibly in  
> addition
> to the existing one.

Either that, or if they are identical device, just used in
different ways / connected differently, show that via some
other properties or such.

> If the compatible property contains "fsl,cpm-smc\0cpm_uart", you  
> can scan for
> either of them. The loop will iterate over all cpm_uart compatible  
> devices,
> while the later test will look for an fsl,cpm-smc compatible device.

Well, "fsl,cpm-uart" (note the two differences), but yes.


Segher




More information about the Linuxppc-dev mailing list