[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D4R7CGGQAJ50.U5UY2B7PBGG@bootlin.com>
Date: Wed, 09 Oct 2024 12:27:06 +0200
From: Théo Lebrun <theo.lebrun@...tlin.com>
To: "Krzysztof Kozlowski" <krzk@...nel.org>
Cc: "Linus Walleij" <linus.walleij@...aro.org>, "Andi Shyti"
<andi.shyti@...nel.org>, "Rob Herring" <robh@...nel.org>, "Krzysztof
Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley" <conor+dt@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-i2c@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "Vladimir
Kondratiev" <vladimir.kondratiev@...ileye.com>,
Grégory Clement <gregory.clement@...tlin.com>, "Thomas
Petazzoni" <thomas.petazzoni@...tlin.com>, "Tawfik Bayouk"
<tawfik.bayouk@...ileye.com>
Subject: Re: [PATCH 2/4] i2c: nomadik: support Mobileye EyeQ6H I2C
controller
On Tue Oct 8, 2024 at 6:03 PM CEST, Krzysztof Kozlowski wrote:
> On 08/10/2024 16:43, Théo Lebrun wrote:
> > On Tue Oct 8, 2024 at 3:39 PM CEST, Krzysztof Kozlowski wrote:
> >> On Tue, Oct 08, 2024 at 12:29:41PM +0200, Théo Lebrun wrote:
> >>> + bool is_eyeq6h = of_device_is_compatible(np, "mobileye,eyeq6h-i2c");
> >>> + bool is_eyeq5 = of_device_is_compatible(np, "mobileye,eyeq5-i2c");
> >>
> >> You should use match data, not add compatibles in the middle of code.
> >> That's preferred, scallable pattern. What you added here last time does
> >> not scale and above change is a proof for that.
> >
> > I would have used match data if the driver struct had a .of_match_table
> > field. `struct amba_driver` does not. Are you recommending the approach
> > below?
> >
> > I don't see how it brings much to the driver but I do get the scaling
> > issue as the number of support compatibles increases. This is a fear
> > based on what *could* happen in the future though.
>
> You still have adev->dev.of_node, which you can use for matching in
> probe. See for example of_match_device() (and add a note so people will
> not convert it to device_get_match_data() blindly).
Just sent the new revision [0]. It uses of_match_device() in the same
way as was shown in my previous answer to this thread [1]. Followed
your recommendation and added a comment to avoid conversions to
device_get_match_data().
Thanks!
[0]: https://lore.kernel.org/lkml/20241009-mbly-i2c-v2-0-ac9230a8dac5@bootlin.com/
[1]: https://lore.kernel.org/lkml/D4QI63B6YQU5.3UPKA7G75J445@bootlin.com/
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists