Re: [PATCH v2 2/4] can: fixed-transceiver: Add documentation for CAN fixed transceiver bindings

From: Franklin S Cooper Jr
Date: Tue Jul 25 2017 - 14:16:41 EST




On 07/25/2017 11:32 AM, Oliver Hartkopp wrote:
>
>> + max-data-speed: a positive non 0 value that determines the max
>> data rate
>> + that can be used in CAN-FD mode. A value of -1 implies
>> + CAN-FD is not supported by the transceiver.
>> +
>> +Examples:
>
> (..)
>
>> + fixed-transceiver {
>> + max-data-speed = <(-1)>;
>
> Looks ugly IMHO.
>
> Why didn't you stay on '0' for 'not supported'??

Unless a driver specifically calls of_can_transceiver_fixed
priv->max_trans_data_speed will be by default 0. Therefore, all drivers
that support CAN-FD will claim that the transceiver indicates that it
isn't supported. So one option was to update every single driver to set
this property by default which I started to do but it end up becoming a
massive patch and it was risky in case I missed a driver which would of
resulted in major regressions. Its also problematic for new drivers that
miss this property or the many out of tree CAN drivers. The other option
was to create another variable to track to see if
of_can_transceiver_fixed was called but I didn't think that was the
better solution. So using signed values in DT is a bit ugly due to
syntax but was valid and I made sure I documented it so its clear.
>
> Regards,
> Oliver
>