From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Krzysztof Kozlowski" <krzk@kernel.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
"Andi Shyti" <andi.shyti@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>
Subject: Re: [PATCH 2/4] i2c: nomadik: support Mobileye EyeQ6H I2C controller
Date: Wed, 09 Oct 2024 12:27:06 +0200 [thread overview]
Message-ID: <D4R7CGGQAJ50.U5UY2B7PBGG@bootlin.com> (raw)
In-Reply-To: <fc17ef3d-7895-4ee8-bfa0-d31dd45f2f2c@kernel.org>
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
next prev parent reply other threads:[~2024-10-09 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 10:29 [PATCH 0/4] i2c: nomadik: support >=1MHz & Mobileye EyeQ6H platform Théo Lebrun
2024-10-08 10:29 ` [PATCH 1/4] dt-bindings: i2c: nomadik: add mobileye,eyeq6h-i2c bindings Théo Lebrun
2024-10-08 13:38 ` Krzysztof Kozlowski
2024-10-08 10:29 ` [PATCH 2/4] i2c: nomadik: support Mobileye EyeQ6H I2C controller Théo Lebrun
2024-10-08 13:39 ` Krzysztof Kozlowski
2024-10-08 14:43 ` Théo Lebrun
2024-10-08 16:03 ` Krzysztof Kozlowski
2024-10-09 10:27 ` Théo Lebrun [this message]
2024-10-08 10:29 ` [PATCH 3/4] i2c: nomadik: fix BRCR computation Théo Lebrun
2024-10-08 10:29 ` [PATCH 4/4] i2c: nomadik: support >=1MHz speed modes Théo Lebrun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D4R7CGGQAJ50.U5UY2B7PBGG@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=andi.shyti@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tawfik.bayouk@mobileye.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.kondratiev@mobileye.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).