2023-03-12 13:51:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 1/2] pwm: rcar: drop of_match_ptr for ID table

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 might not be relevant here). This
also fixes !CONFIG_OF error:

drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>

---

Changes since v1:
1. Extend commit msg.
---
drivers/pwm/pwm-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 55f46d09602b..8f31f3cc93d5 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -260,7 +260,7 @@ static struct platform_driver rcar_pwm_driver = {
.remove = rcar_pwm_remove,
.driver = {
.name = "pwm-rcar",
- .of_match_table = of_match_ptr(rcar_pwm_of_table),
+ .of_match_table = rcar_pwm_of_table,
}
};
module_platform_driver(rcar_pwm_driver);
--
2.34.1



2023-03-12 13:51:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH v2 2/2] pwm: stm32-lp: drop of_match_ptr for ID table

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 might not be relevant here). This
also fixes !CONFIG_OF error:

drivers/pwm/pwm-stm32-lp.c:245:34: error: ‘stm32_pwm_lp_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>

---

Changes since v1:
1. Extend commit msg.
---
drivers/pwm/pwm-stm32-lp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c
index f315fa106be8..bb3a045a7334 100644
--- a/drivers/pwm/pwm-stm32-lp.c
+++ b/drivers/pwm/pwm-stm32-lp.c
@@ -252,7 +252,7 @@ static struct platform_driver stm32_pwm_lp_driver = {
.probe = stm32_pwm_lp_probe,
.driver = {
.name = "stm32-pwm-lp",
- .of_match_table = of_match_ptr(stm32_pwm_lp_of_match),
+ .of_match_table = stm32_pwm_lp_of_match,
.pm = &stm32_pwm_lp_pm_ops,
},
};
--
2.34.1


2023-03-12 15:42:26

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] pwm: rcar: drop of_match_ptr for ID table

Hello,

On Sun, Mar 12, 2023 at 02:51:19PM +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 might not be relevant here). This
> also fixes !CONFIG_OF error:
>
> drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Hmm, I wonder what else is required here to trigger that warning. On
amd64 I also disabled CONFIG_MODULES as otherwise rcar_pwm_of_table is
used by

MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);

With that I have:

uwe@taurus:~/work/kbuild/amd64$ make drivers/pwm/pwm-rcar.o
GEN Makefile
CALL /home/uwe/gsrc/linux/scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC drivers/pwm/pwm-rcar.o
uwe@taurus:~/work/kbuild/amd64$ make drivers/pwm/pwm-rcar.i
GEN Makefile
CALL /home/uwe/gsrc/linux/scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CPP drivers/pwm/pwm-rcar.i
uwe@taurus:~/work/kbuild/amd64$ grep rcar_pwm_of_table drivers/pwm/pwm-rcar.i
static const struct of_device_id rcar_pwm_of_table[] = {

... some time later ...

ah, you also need W=1 to get that warning because of

# These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.extrawarn)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)

in the toplevel Makefile.

I guess that explains why there is no previous report by one of the
build bots about this issue.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (1.92 kB)
signature.asc (488.00 B)
Download all attachments

2023-03-22 18:17:04

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] pwm: rcar: drop of_match_ptr for ID table

On 12/03/2023 16:42, Uwe Kleine-König wrote:
> Hello,
>
> On Sun, Mar 12, 2023 at 02:51:19PM +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 might not be relevant here). This
>> also fixes !CONFIG_OF error:
>>
>> drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>
> Hmm, I wonder what else is required here to trigger that warning. On
> amd64 I also disabled CONFIG_MODULES as otherwise rcar_pwm_of_table is
> used by
>
> MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);

1. x86_64 allyesconfig, remove CONFIG_OF
2. Build with W=1 (this was GCC)

Best regards,
Krzysztof

2023-03-22 21:08:49

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] pwm: rcar: drop of_match_ptr for ID table

Hello Krzysztof,

On Wed, Mar 22, 2023 at 07:12:08PM +0100, Krzysztof Kozlowski wrote:
> On 12/03/2023 16:42, Uwe Kleine-König wrote:
> > Hello,
> >
> > On Sun, Mar 12, 2023 at 02:51:19PM +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 might not be relevant here). This
> >> also fixes !CONFIG_OF error:
> >>
> >> drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]
> >>
> >> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> >
> > Hmm, I wonder what else is required here to trigger that warning. On
> > amd64 I also disabled CONFIG_MODULES as otherwise rcar_pwm_of_table is
> > used by
> >
> > MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
>
> 1. x86_64 allyesconfig, remove CONFIG_OF
> 2. Build with W=1 (this was GCC)

Ah right, it's not that CONFIG_MODULES must be unset, but the driver
must not be configured as module. So I suggest

This also fixes the compiler warning

drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]

for builds with CONFIG_OF=n, CONFIG_PWM_RCAR=y and W=1.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (1.51 kB)
signature.asc (499.00 B)
Download all attachments

2023-04-06 13:54:27

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] pwm: rcar: drop of_match_ptr for ID table

On Sun, Mar 12, 2023 at 02:51:19PM +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 might not be relevant here). This
> also fixes !CONFIG_OF error:
>
> drivers/pwm/pwm-rcar.c:252:34: error: ‘rcar_pwm_of_table’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>
> ---
>
> Changes since v1:
> 1. Extend commit msg.
> ---
> drivers/pwm/pwm-rcar.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I've applied both patches with an updated commit message clarifying the
exact configuration as pointed out by Uwe.

Thanks,
Thierry


Attachments:
(No filename) (820.00 B)
signature.asc (849.00 B)
Download all attachments