From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Mark Brown" <broonie@kernel.org>,
"Arnd Bergmann" <arnd@kernel.org>,
linux-kernel@vger.kernel.org,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Andi Shyti" <andi.shyti@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Li Zetao" <lizetao1@huawei.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Rob Herring" <robh@kernel.org>,
"Yang Yingliang" <yangyingliang@huawei.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Luis de Arquer" <luis.dearquer@inertim.com>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Sam Protsenko" <semen.protsenko@linaro.org>,
"Peter Griffin" <peter.griffin@linaro.org>,
"Jaewon Kim" <jaewon02.kim@samsung.com>,
linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org,
linux-rockchip@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 31/34] spi: remove incorrect of_match_ptr annotations
Date: Thu, 04 Apr 2024 00:19:41 +0200 [thread overview]
Message-ID: <e5ebcbac-f445-4a48-a40f-7aa606c7d460@app.fastmail.com> (raw)
In-Reply-To: <Zg3GdUtBUKzB6NNZ@surfacebook.localdomain>
On Wed, Apr 3, 2024, at 23:13, Andy Shevchenko wrote:
> Wed, Apr 03, 2024 at 11:05:51PM +0200, Uwe Kleine-König kirjoitti:
>> On Wed, Apr 03, 2024 at 10:56:58AM +0100, Mark Brown wrote:
>> > On Wed, Apr 03, 2024 at 10:06:49AM +0200, Arnd Bergmann wrote:
>> >
>> > > These appear to all be copied from the same original driver, so fix them at the
>> > > same time by removing the unnecessary of_match_ptr() annotation. As far as I
>> > > can tell, all these drivers are only actually used on configurations that
>> > > have CONFIG_OF enabled.
>> >
>> > Why are we not fixing of_match_ptr() here, or at least adding the ifdefs
>> > in case someone does end up wanting to run without OF?
>>
>> Fixing of_match_ptr =
>>
>> diff --git a/include/linux/of.h b/include/linux/of.h
>> index a0bedd038a05..d980bccffda0 100644
>> --- a/include/linux/of.h
>> +++ b/include/linux/of.h
>> @@ -890,7 +890,7 @@ static inline const void *of_device_get_match_data(const struct device *dev)
>> return NULL;
>> }
>>
>> -#define of_match_ptr(_ptr) NULL
>> +#define of_match_ptr(_ptr) (0 ? (_ptr) : NULL)
This would require removing several hundred "#ifdef CONFIG_OF"
checks around the of_device_id tables at the same time
unfortunately. Most of those are completely unnecessary, so
if we wanted to remove those, we should remove the of_match_ptr()
instances at the same time.
>> #define of_match_node(_matches, _node) NULL
>> #endif /* CONFIG_OF */
>>
>> ?
>>
>> Assuming this helps, I agree this would be the better fix.
>
> Why? I mean why do we need to even have this API? It's always
> good to know which devices are supported by the module even
> if you have no need in such support or it's not compiled in.
> One of the reasons why is to be able to google for compatible hardware,
> for example.
As far as I can tell, the of_match_ptr() helper was a historic
mistake, it makes pretty much no sense in its current form.
The version that Uwe proposes would have made sense but we
can't change it now.
Arnd
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2024-04-03 22:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
2024-04-03 8:06 ` [PATCH 31/34] spi: remove incorrect of_match_ptr annotations Arnd Bergmann
2024-04-03 9:04 ` Andy Shevchenko
2024-04-03 9:05 ` Krzysztof Kozlowski
2024-04-03 9:56 ` Mark Brown
2024-04-03 21:05 ` Uwe Kleine-König
2024-04-03 21:13 ` Andy Shevchenko
2024-04-03 22:19 ` Arnd Bergmann [this message]
2024-04-06 5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
2024-04-10 8:02 ` (subset) " Sebastian Reichel
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=e5ebcbac-f445-4a48-a40f-7aa606c7d460@app.fastmail.com \
--to=arnd@arndb.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=alim.akhtar@samsung.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=arnd@kernel.org \
--cc=broonie@kernel.org \
--cc=heiko@sntech.de \
--cc=jaewon02.kim@samsung.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lizetao1@huawei.com \
--cc=luis.dearquer@inertim.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=neil.armstrong@linaro.org \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=tudor.ambarus@linaro.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yangyingliang@huawei.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
all inboxes | Powered by JetHome®