Re: [PATCH net-next v1 1/2] dt-bindings: net: dsa: Add KSZ8567 switch support
From: Conor Dooley
Date: Thu Jan 25 2024 - 07:54:45 EST
On Wed, Jan 24, 2024 at 07:08:29PM +0100, Andrew Lunn wrote:
> > That sounds counter productive to be honest. Why does the driver not
> > trust that the dt is correct? I saw this recently in some IIO drivers,
> > but it was shot down for this sort of reason.
>
> DT is software, therefore it contains bugs.
>
> Say we ignore that the compatible does not match the hardware on the
> board and just accept the DT has a bug in it and keep going.
>
> That then makes the compatible pointless, and unusable for anything,
> since there are boards out in the wild with incorrect compatibles. If
> we later actually use the compatible for something, it might cause
> regressions for those buggy DT blobs.
>
> By erroring out then the compatible does not match the hardware avoids
> such bugs.
It also makes fallback compatibles useless, which is what I see as being
counter productive, since you'll have to add support to the driver even
if (other than the id) the change is imperceptible to software.
If you have your reasons why you do not trust the compatibles for these
devices, then it is your prerogative as a driver author to cross check it
and fail if they don't match.
That said, it does not prevent the fallback being accurately described
in the binding itself, which at the end of the day is what I am more
interested it.
> The marvell mv88e6xxx driver takes a different approach. All the
> compatible does is tell the driver where to find the ID
> register. Marvell keeps moving it around, so there are three different
> compatibles for the three different locations. If you use the wrong
> compatible, its not going to find a device is knows about and errors
> out. So this also avoids bugs in the compatible.
>
> Andrew
Attachment:
signature.asc
Description: PGP signature