diff mbox series

[01/16] spi: armada-3700: Drop of_match_ptr for ID table

Message ID 20230310222857.315629-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State New
Headers show
Series [01/16] spi: armada-3700: Drop of_match_ptr for ID table | expand

Commit Message

Krzysztof Kozlowski March 10, 2023, 10:28 p.m. UTC
The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it is not relevant here).

  drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/spi/spi-armada-3700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown March 13, 2023, 1:55 p.m. UTC | #1
On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:
> The driver can match only via the DT table so the table should be always
> used and the of_match_ptr does not have any sense (this also allows ACPI
> matching via PRP0001, even though it is not relevant here).
> 
>   drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]

It would be much better to fix of_match_ptr() and/or the module stuff
that also references the match table here.
Mark Brown March 13, 2023, 6:20 p.m. UTC | #2
On Fri, 10 Mar 2023 23:28:42 +0100, Krzysztof Kozlowski wrote:
> The driver can match only via the DT table so the table should be always
> used and the of_match_ptr does not have any sense (this also allows ACPI
> matching via PRP0001, even though it is not relevant here).
> 
>   drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[12/16] spi: pxa2xx: Mark OF related data as maybe unused
        commit: d94df25e8b9c8deefc5d7fcd344eb5d4bd41cf7b
[13/16] spi: bcm-qspi: Mark OF related data as maybe unused
        commit: 6340fdf2e13c5f1ff3a9622f0cb3b8e9c3955a31
[14/16] spi: sh-msiof: Mark OF related data as maybe unused
        commit: d946b6b0ed01949b1a3856e03469361fc9168318
[15/16] spi: sc18is602: Mark OF related data as maybe unused
        commit: 833f43308234600e934e9c6fa70fd8b7eebc632b
[16/16] spi: rspi: Mark OF related data as maybe unused
        commit: edfa970370a759c2c6a38b2884887937b1aea552

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Krzysztof Kozlowski March 13, 2023, 6:39 p.m. UTC | #3
On 13/03/2023 14:55, Mark Brown wrote:
> On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:
>> The driver can match only via the DT table so the table should be always
>> used and the of_match_ptr does not have any sense (this also allows ACPI
>> matching via PRP0001, even though it is not relevant here).
>>
>>   drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> 
> It would be much better to fix of_match_ptr() and/or the module stuff
> that also references the match table here.

Why? The recommendation is in general not to use of_match_ptr, because
there are little benefits but it disables matching via PRP0001. Jonathan
in parallel thread explicitly said of_match_ptr should disappear and he
is not accepting any new code with it. And in general he is right.

https://lore.kernel.org/all/20230311183534.1d0dfd64@jic23-huawei/

and earlier:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=444f5f854b35

Best regards,
Krzysztof
Mark Brown March 13, 2023, 7:22 p.m. UTC | #4
On Mon, Mar 13, 2023 at 07:39:45PM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 14:55, Mark Brown wrote:
> > On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:

> >>   drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]

> > It would be much better to fix of_match_ptr() and/or the module stuff
> > that also references the match table here.

> Why? The recommendation is in general not to use of_match_ptr, because
> there are little benefits but it disables matching via PRP0001. Jonathan
> in parallel thread explicitly said of_match_ptr should disappear and he
> is not accepting any new code with it. And in general he is right.

If that's the case then why are you adding maybe unused annotations for
half the drivers rather than removing their of_match_ptr() usages?
There doesn't seem to be any logic here, it's just randomly making
changes as far as I can tell.

The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
do the right thing for CONFIG_ACPI.  It doesn't buy us huge amounts but
it also costs us very little and may be useful in future.  When there's
missing annotations it's not causing issues for practical configurations
as far as I can tell, and if the macro were updated for CONFIG_ACPI it'd
be even less of an issue.
Krzysztof Kozlowski March 14, 2023, 6:44 a.m. UTC | #5
On 13/03/2023 20:22, Mark Brown wrote:
> On Mon, Mar 13, 2023 at 07:39:45PM +0100, Krzysztof Kozlowski wrote:
>> On 13/03/2023 14:55, Mark Brown wrote:
>>> On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:
> 
>>>>   drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> 
>>> It would be much better to fix of_match_ptr() and/or the module stuff
>>> that also references the match table here.
> 
>> Why? The recommendation is in general not to use of_match_ptr, because
>> there are little benefits but it disables matching via PRP0001. Jonathan
>> in parallel thread explicitly said of_match_ptr should disappear and he
>> is not accepting any new code with it. And in general he is right.
> 
> If that's the case then why are you adding maybe unused annotations for
> half the drivers rather than removing their of_match_ptr() usages?
> There doesn't seem to be any logic here, it's just randomly making
> changes as far as I can tell.

These are not random but depend on whether OF is the only matching
method or one of few. Although for IIO all of my patches would be
dropping the of_match_ptr... For some cases in other patchsets I added
__maybe_unused also because of_match_node(), when the table is not used
in driver of_match_table.

> 
> The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
> do the right thing for CONFIG_ACPI.

That's actually interesting idea, kind of obvious so I wonder why it
wasn't done like this in the first place in 886ca88be6b3 ("ACPI / bus:
Respect PRP0001 when retrieving device match data"). Maybe not to
populate OF device ID tables for the ACPI systems which do not care
about PRP0001?


>  It doesn't buy us huge amounts but
> it also costs us very little and may be useful in future.  When there's
> missing annotations it's not causing issues for practical configurations
> as far as I can tell, and if the macro were updated for CONFIG_ACPI it'd
> be even less of an issue.

Best regards,
Krzysztof
Mark Brown March 14, 2023, 1:26 p.m. UTC | #6
On Tue, Mar 14, 2023 at 07:44:04AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 20:22, Mark Brown wrote:

> > If that's the case then why are you adding maybe unused annotations for
> > half the drivers rather than removing their of_match_ptr() usages?
> > There doesn't seem to be any logic here, it's just randomly making
> > changes as far as I can tell.

> These are not random but depend on whether OF is the only matching
> method or one of few. Although for IIO all of my patches would be
> dropping the of_match_ptr... For some cases in other patchsets I added
> __maybe_unused also because of_match_node(), when the table is not used
> in driver of_match_table.

This logic is both not apparent when looking at the patches and doesn't
move us in any particular direction - I'd expect this stuff to be
written the same way for all drivers, there's no reason for it to vary.
That just adds complication, it's more random obscure rules people have
to learn.

> > The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
> > do the right thing for CONFIG_ACPI.

> That's actually interesting idea, kind of obvious so I wonder why it
> wasn't done like this in the first place in 886ca88be6b3 ("ACPI / bus:
> Respect PRP0001 when retrieving device match data"). Maybe not to
> populate OF device ID tables for the ACPI systems which do not care
> about PRP0001?

Or just it didn't occur to anyone at the time.
diff mbox series

Patch

diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
index 6a7e605f73bf..feb7371940bc 100644
--- a/drivers/spi/spi-armada-3700.c
+++ b/drivers/spi/spi-armada-3700.c
@@ -919,7 +919,7 @@  static void a3700_spi_remove(struct platform_device *pdev)
 static struct platform_driver a3700_spi_driver = {
 	.driver = {
 		.name	= DRIVER_NAME,
-		.of_match_table = of_match_ptr(a3700_spi_dt_ids),
+		.of_match_table = a3700_spi_dt_ids,
 	},
 	.probe		= a3700_spi_probe,
 	.remove_new	= a3700_spi_remove,