2023-07-18 06:20:36

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

From: Randy Dunlap <[email protected]>

When (MFD) RZ_MTU3=m and PWM_RZ_MTU3=y, there are numerous build errors:

ld: vmlinux.o: in function `rz_mtu3_pwm_config':
drivers/pwm/pwm-rz-mtu3.c:374: undefined reference to `rz_mtu3_disable'
ld: drivers/pwm/pwm-rz-mtu3.c:377: undefined reference to `rz_mtu3_8bit_ch_write'
ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to `rz_mtu3_16bit_ch_write'
ld: vmlinux.o: in function `rz_mtu3_pwm_config':
drivers/pwm/pwm-rz-mtu3.c:382: undefined reference to `rz_mtu3_8bit_ch_write'
ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to `rz_mtu3_16bit_ch_write'
ld: drivers/pwm/pwm-rz-mtu3.c:111: undefined reference to `rz_mtu3_16bit_ch_write'
ld: vmlinux.o: in function `rz_mtu3_pwm_config':
drivers/pwm/pwm-rz-mtu3.c:397: undefined reference to `rz_mtu3_enable'
ld: vmlinux.o: in function `rz_mtu3_pwm_disable':
drivers/pwm/pwm-rz-mtu3.c:259: undefined reference to `rz_mtu3_8bit_ch_write'
ld: drivers/pwm/pwm-rz-mtu3.c:264: undefined reference to `rz_mtu3_disable'
ld: vmlinux.o: in function `rz_mtu3_pwm_enable':
drivers/pwm/pwm-rz-mtu3.c:230: undefined reference to `rz_mtu3_8bit_ch_write'
ld: drivers/pwm/pwm-rz-mtu3.c:234: undefined reference to `rz_mtu3_8bit_ch_write'
ld: drivers/pwm/pwm-rz-mtu3.c:238: undefined reference to `rz_mtu3_enable'
ld: vmlinux.o: in function `rz_mtu3_pwm_is_ch_enabled':
drivers/pwm/pwm-rz-mtu3.c:155: undefined reference to `rz_mtu3_is_enabled'
ld: drivers/pwm/pwm-rz-mtu3.c:162: undefined reference to `rz_mtu3_8bit_ch_read'
ld: vmlinux.o: in function `rz_mtu3_pwm_read_tgr_registers':
drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to `rz_mtu3_16bit_ch_read'
ld: drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to `rz_mtu3_16bit_ch_read'
ld: drivers/pwm/pwm-rz-mtu3.c:103: undefined reference to `rz_mtu3_16bit_ch_read'
ld: vmlinux.o: in function `rz_mtu3_pwm_get_state':
drivers/pwm/pwm-rz-mtu3.c:296: undefined reference to `rz_mtu3_8bit_ch_read'

Modify the dependencies of PWM_RZ_MTU3 so that COMPILE_TEST is
still allowed but PWM_RZ_MTU3 depends on RZ_MTU3 if it is being built
but also allow the latter not to be built.

Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
Signed-off-by: Randy Dunlap <[email protected]>
Cc: Biju Das <[email protected]>
Cc: Uwe Kleine-König <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]
---
drivers/pwm/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff -- a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -505,7 +505,8 @@ config PWM_ROCKCHIP

config PWM_RZ_MTU3
tristate "Renesas RZ/G2L MTU3a PWM Timer support"
- depends on RZ_MTU3 || COMPILE_TEST
+ depends on COMPILE_TEST
+ depends on RZ_MTU3 || RZ_MTU3=n
depends on HAS_IOMEM
help
This driver exposes the MTU3a PWM Timer controller found in Renesas


2023-07-18 06:54:48

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH] pwm: fi pwm-rz-mtu3.c build errors



> -----Original Message-----
> From: Randy Dunlap <[email protected]>
> Sent: Tuesday, July 18, 2023 7:38 AM
> To: [email protected]; [email protected]
> Cc: Uwe Kleine-König <[email protected]>; Thierry Reding
> <[email protected]>; Biju Das <[email protected]>
> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>
> On 7/17/23 22:59, Randy Dunlap wrote:
> > From: Randy Dunlap <[email protected]>
> >
> >
> > Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> > Signed-off-by: Randy Dunlap <[email protected]>
>
> Oops, I should resend that with corrected email addresses. Sorry.

Also typo in patch header "pwm: fi pwm-rz-mtu3.c build errors" ??

Not sure fixes tag should be
b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a")
or
254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")

Cheers,
Biju

2023-07-18 06:58:59

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

Hi Randy Dunlap,

Thanks for the feedback.

> Subject: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>
> From: Randy Dunlap <[email protected]>
>
> When (MFD) RZ_MTU3=m and PWM_RZ_MTU3=y, there are numerous build errors:

Recently added module support for RZ_MTU3[1]. ie, after adding PWM support.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20230718&id=b8b28b718ddd56e546d44107cf7c57f3a07d7efd

>
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:374: undefined reference to `rz_mtu3_disable'
> ld: drivers/pwm/pwm-rz-mtu3.c:377: undefined reference to
> `rz_mtu3_8bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:382: undefined reference to
> `rz_mtu3_8bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:111: undefined reference to
> `rz_mtu3_16bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:397: undefined reference to `rz_mtu3_enable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_disable':
> drivers/pwm/pwm-rz-mtu3.c:259: undefined reference to
> `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:264: undefined reference to
> `rz_mtu3_disable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_enable':
> drivers/pwm/pwm-rz-mtu3.c:230: undefined reference to
> `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:234: undefined reference to
> `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:238: undefined reference to
> `rz_mtu3_enable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_is_ch_enabled':
> drivers/pwm/pwm-rz-mtu3.c:155: undefined reference to
> `rz_mtu3_is_enabled'
> ld: drivers/pwm/pwm-rz-mtu3.c:162: undefined reference to
> `rz_mtu3_8bit_ch_read'
> ld: vmlinux.o: in function `rz_mtu3_pwm_read_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> ld: drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> ld: drivers/pwm/pwm-rz-mtu3.c:103: undefined reference to
> `rz_mtu3_16bit_ch_read'
> ld: vmlinux.o: in function `rz_mtu3_pwm_get_state':
> drivers/pwm/pwm-rz-mtu3.c:296: undefined reference to
> `rz_mtu3_8bit_ch_read'
>
> Modify the dependencies of PWM_RZ_MTU3 so that COMPILE_TEST is still
> allowed but PWM_RZ_MTU3 depends on RZ_MTU3 if it is being built but also
> allow the latter not to be built.
>
> Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> Signed-off-by: Randy Dunlap <[email protected]>
> Cc: Biju Das <[email protected]>
> Cc: Uwe Kleine-König <[email protected]>
> Cc: Thierry Reding <[email protected]>
> Cc: [email protected]

Reviewed-by: Biju Das <[email protected]>

Cheers,
Biju

> ---
> drivers/pwm/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff -- a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -505,7 +505,8 @@ config PWM_ROCKCHIP
>
> config PWM_RZ_MTU3
> tristate "Renesas RZ/G2L MTU3a PWM Timer support"
> - depends on RZ_MTU3 || COMPILE_TEST
> + depends on COMPILE_TEST
> + depends on RZ_MTU3 || RZ_MTU3=n
> depends on HAS_IOMEM
> help
> This driver exposes the MTU3a PWM Timer controller found in
> Renesas

2023-07-18 07:03:23

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

Hi Randy Dunlap,

> -----Original Message-----
> From: Randy Dunlap <[email protected]>
> Sent: Tuesday, July 18, 2023 7:45 AM
> To: Biju Das <[email protected]>; [email protected];
> [email protected]
> Cc: Uwe Kleine-König <[email protected]>; Thierry Reding
> <[email protected]>
> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>
> On 7/17/23 23:42, Biju Das wrote:
> >
> >
> >> -----Original Message-----
> >> From: Randy Dunlap <[email protected]>
> >> Sent: Tuesday, July 18, 2023 7:38 AM
> >> To: [email protected]; [email protected]
> >> Cc: Uwe Kleine-König <[email protected]>; Thierry Reding
> >> <[email protected]>; Biju Das <[email protected]>
> >> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
> >>
> >> On 7/17/23 22:59, Randy Dunlap wrote:
> >>> From: Randy Dunlap <[email protected]>
> >>>
> >>>
> >>> Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> >>> Signed-off-by: Randy Dunlap <[email protected]>
> >>
> >> Oops, I should resend that with corrected email addresses. Sorry.
> >
> > Also typo in patch header "pwm: fi pwm-rz-mtu3.c build errors" ??
>
> Yes, I saw & fixed that one.
>
> > Not sure fixes tag should be
> > b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a") or
> > 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
>
> It's the PWM Kconfig entry that is incorrect AFAICT.

OK got it.

Cheers,
Biju

2023-07-18 07:20:40

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

On 7/17/23 23:42, Biju Das wrote:
>
>
>> -----Original Message-----
>> From: Randy Dunlap <[email protected]>
>> Sent: Tuesday, July 18, 2023 7:38 AM
>> To: [email protected]; [email protected]
>> Cc: Uwe Kleine-König <[email protected]>; Thierry Reding
>> <[email protected]>; Biju Das <[email protected]>
>> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>>
>> On 7/17/23 22:59, Randy Dunlap wrote:
>>> From: Randy Dunlap <[email protected]>
>>>
>>>
>>> Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
>>> Signed-off-by: Randy Dunlap <[email protected]>
>>
>> Oops, I should resend that with corrected email addresses. Sorry.
>
> Also typo in patch header "pwm: fi pwm-rz-mtu3.c build errors" ??

Yes, I saw & fixed that one.

> Not sure fixes tag should be
> b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a")
> or
> 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")

It's the PWM Kconfig entry that is incorrect AFAICT.

thanks.
--
~Randy


2023-07-18 07:23:33

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

On 7/17/23 22:59, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
>
> Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> Signed-off-by: Randy Dunlap <[email protected]>

Oops, I should resend that with corrected email addresses. Sorry.

--
~Randy


2023-07-18 09:10:10

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

Hello,

On Mon, Jul 17, 2023 at 10:59:02PM -0700, Randy Dunlap wrote:
> From: Randy Dunlap <[email protected]>
>
> When (MFD) RZ_MTU3=m and PWM_RZ_MTU3=y, there are numerous build errors:
>
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:374: undefined reference to `rz_mtu3_disable'
> ld: drivers/pwm/pwm-rz-mtu3.c:377: undefined reference to `rz_mtu3_8bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to `rz_mtu3_16bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:382: undefined reference to `rz_mtu3_8bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to `rz_mtu3_16bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:111: undefined reference to `rz_mtu3_16bit_ch_write'
> ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> drivers/pwm/pwm-rz-mtu3.c:397: undefined reference to `rz_mtu3_enable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_disable':
> drivers/pwm/pwm-rz-mtu3.c:259: undefined reference to `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:264: undefined reference to `rz_mtu3_disable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_enable':
> drivers/pwm/pwm-rz-mtu3.c:230: undefined reference to `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:234: undefined reference to `rz_mtu3_8bit_ch_write'
> ld: drivers/pwm/pwm-rz-mtu3.c:238: undefined reference to `rz_mtu3_enable'
> ld: vmlinux.o: in function `rz_mtu3_pwm_is_ch_enabled':
> drivers/pwm/pwm-rz-mtu3.c:155: undefined reference to `rz_mtu3_is_enabled'
> ld: drivers/pwm/pwm-rz-mtu3.c:162: undefined reference to `rz_mtu3_8bit_ch_read'
> ld: vmlinux.o: in function `rz_mtu3_pwm_read_tgr_registers':
> drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to `rz_mtu3_16bit_ch_read'
> ld: drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to `rz_mtu3_16bit_ch_read'
> ld: drivers/pwm/pwm-rz-mtu3.c:103: undefined reference to `rz_mtu3_16bit_ch_read'
> ld: vmlinux.o: in function `rz_mtu3_pwm_get_state':
> drivers/pwm/pwm-rz-mtu3.c:296: undefined reference to `rz_mtu3_8bit_ch_read'
>
> Modify the dependencies of PWM_RZ_MTU3 so that COMPILE_TEST is
> still allowed but PWM_RZ_MTU3 depends on RZ_MTU3 if it is being built
> but also allow the latter not to be built.
>
> Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> Signed-off-by: Randy Dunlap <[email protected]>
> Cc: Biju Das <[email protected]>
> Cc: Uwe Kleine-König <[email protected]>
> Cc: Thierry Reding <[email protected]>
> Cc: [email protected]

While testing here I hit another (unrelated) problem:

drivers/pinctrl/renesas/pinctrl-rzg2l.c: In function ‘rzg2l_gpio_free’:
drivers/pinctrl/renesas/pinctrl-rzg2l.c:917:37: error: ‘struct gpio_chip’ has no member named ‘irq’
917 | virq = irq_find_mapping(chip->irq.domain, offset);
| ^~

Did someone address that one already? I guess PINCTRL_RZG2L should
select GPIOLIB_IRQCHIP. Also RZ_MTU3 should select MFD_CORE as I hit:

aarch64-linux-gnu-ld: rz-mtu3.c:(.text+0x544): undefined reference to `mfd_remove_devices'

Commit 654c293e1687b31819f9bf1ac71b5a85a8053210 added RZ_MTU3 as bool,
and it's still bool in 254d3a72742. I think the problem started only
with b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a").

The patch looks fine, but the commit log needs some adaption.

The following patch would fix the build failure, too:

diff --git a/include/linux/mfd/rz-mtu3.h b/include/linux/mfd/rz-mtu3.h
index c5173bc06270..4f15c0dead60 100644
--- a/include/linux/mfd/rz-mtu3.h
+++ b/include/linux/mfd/rz-mtu3.h
@@ -151,7 +151,7 @@ struct rz_mtu3 {
void *priv_data;
};

-#if IS_ENABLED(CONFIG_RZ_MTU3)
+#if IS_REACHABLE(CONFIG_RZ_MTU3)
static inline bool rz_mtu3_request_channel(struct rz_mtu3_channel *ch)
{
mutex_lock(&ch->lock);


maybe doing that additionally is a good idea? (Well, not entirely sure
as the above setting then would result in a non-functioning PWM driver.
Maybe that's worse than a build failure?)

Best regards
Uwe

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


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

2023-07-18 09:43:46

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

HI Uwe and Randy,

> -----Original Message-----
> From: Uwe Kleine-König <[email protected]>
> Sent: Tuesday, July 18, 2023 10:00 AM
> To: Randy Dunlap <[email protected]>
> Cc: [email protected]; [email protected]; Thierry
> Reding <[email protected]>; Biju Das <[email protected]>;
> Lee Jones <[email protected]>
> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>
> Hello,
>
> On Mon, Jul 17, 2023 at 10:59:02PM -0700, Randy Dunlap wrote:
> > From: Randy Dunlap <[email protected]>
> >
> > When (MFD) RZ_MTU3=m and PWM_RZ_MTU3=y, there are numerous build errors:
> >
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:374: undefined reference to `rz_mtu3_disable'
> > ld: drivers/pwm/pwm-rz-mtu3.c:377: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:382: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:111: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:397: undefined reference to `rz_mtu3_enable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_disable':
> > drivers/pwm/pwm-rz-mtu3.c:259: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:264: undefined reference to
> `rz_mtu3_disable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_enable':
> > drivers/pwm/pwm-rz-mtu3.c:230: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:234: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:238: undefined reference to
> `rz_mtu3_enable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_is_ch_enabled':
> > drivers/pwm/pwm-rz-mtu3.c:155: undefined reference to
> `rz_mtu3_is_enabled'
> > ld: drivers/pwm/pwm-rz-mtu3.c:162: undefined reference to
> `rz_mtu3_8bit_ch_read'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_read_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: drivers/pwm/pwm-rz-mtu3.c:103: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_get_state':
> > drivers/pwm/pwm-rz-mtu3.c:296: undefined reference to
> `rz_mtu3_8bit_ch_read'
> >
> > Modify the dependencies of PWM_RZ_MTU3 so that COMPILE_TEST is still
> > allowed but PWM_RZ_MTU3 depends on RZ_MTU3 if it is being built but
> > also allow the latter not to be built.
> >
> > Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> > Signed-off-by: Randy Dunlap <[email protected]>
> > Cc: Biju Das <[email protected]>
> > Cc: Uwe Kleine-König <[email protected]>
> > Cc: Thierry Reding <[email protected]>
> > Cc: [email protected]
>
> While testing here I hit another (unrelated) problem:
>
> drivers/pinctrl/renesas/pinctrl-rzg2l.c: In function ‘rzg2l_gpio_free’:
> drivers/pinctrl/renesas/pinctrl-rzg2l.c:917:37: error: ‘struct gpio_chip’
> has no member named ‘irq’
> 917 | virq = irq_find_mapping(chip->irq.domain, offset);
> | ^~
>
> Did someone address that one already? I guess PINCTRL_RZG2L should select
> GPIOLIB_IRQCHIP. Also RZ_MTU3 should select MFD_CORE as I hit:
>
> aarch64-linux-gnu-ld: rz-mtu3.c:(.text+0x544): undefined reference
> to `mfd_remove_devices'
>
> Commit 654c293e1687b31819f9bf1ac71b5a85a8053210 added RZ_MTU3 as bool, and
> it's still bool in 254d3a72742. I think the problem started only with
> b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a").

So far PWM is build tested with

RZ_MTU3=y , PWM_RZ_MTU3=y and m, RZ_MTU3_CNT = y, m

RZ_MTU3=m , PWM_RZ_MTU3=m, RZ_MTU3_CNT = y

But I have n't build tested this configuration
RZ_MTU3=m , PWM_RZ_MTU3=y, RZ_MTU3_CNT =y

This is invalid configuration, as MTU is core driver and PWM/Counter drivers depend upon that

Maybe any one of PWM_RZ_MTU3 or RZ_MTU3_CNT =y, RZ_MTU3 should be selected as y.

Cheers,
Biju

>
> The patch looks fine, but the commit log needs some adaption.
>
> The following patch would fix the build failure, too:
>
> diff --git a/include/linux/mfd/rz-mtu3.h b/include/linux/mfd/rz-mtu3.h
> index c5173bc06270..4f15c0dead60 100644
> --- a/include/linux/mfd/rz-mtu3.h
> +++ b/include/linux/mfd/rz-mtu3.h
> @@ -151,7 +151,7 @@ struct rz_mtu3 {
> void *priv_data;
> };
>
> -#if IS_ENABLED(CONFIG_RZ_MTU3)
> +#if IS_REACHABLE(CONFIG_RZ_MTU3)
> static inline bool rz_mtu3_request_channel(struct rz_mtu3_channel *ch) {
> mutex_lock(&ch->lock);
>
>
> maybe doing that additionally is a good idea? (Well, not entirely sure as
> the above setting then would result in a non-functioning PWM driver.
> Maybe that's worse than a build failure?)
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |

2023-07-18 11:43:28

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH] pwm: fi pwm-rz-mtu3.c build errors

Hi Uwe,

Thanks for the feedback.

> -----Original Message-----
> From: Uwe Kleine-König <[email protected]>
> Sent: Tuesday, July 18, 2023 10:00 AM
> To: Randy Dunlap <[email protected]>
> Cc: [email protected]; [email protected]; Thierry
> Reding <[email protected]>; Biju Das <[email protected]>;
> Lee Jones <[email protected]>
> Subject: Re: [PATCH] pwm: fi pwm-rz-mtu3.c build errors
>
> Hello,
>
> On Mon, Jul 17, 2023 at 10:59:02PM -0700, Randy Dunlap wrote:
> > From: Randy Dunlap <[email protected]>
> >
> > When (MFD) RZ_MTU3=m and PWM_RZ_MTU3=y, there are numerous build errors:
> >
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:374: undefined reference to `rz_mtu3_disable'
> > ld: drivers/pwm/pwm-rz-mtu3.c:377: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:382: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_write_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:110: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:111: undefined reference to
> `rz_mtu3_16bit_ch_write'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_config':
> > drivers/pwm/pwm-rz-mtu3.c:397: undefined reference to `rz_mtu3_enable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_disable':
> > drivers/pwm/pwm-rz-mtu3.c:259: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:264: undefined reference to
> `rz_mtu3_disable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_enable':
> > drivers/pwm/pwm-rz-mtu3.c:230: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:234: undefined reference to
> `rz_mtu3_8bit_ch_write'
> > ld: drivers/pwm/pwm-rz-mtu3.c:238: undefined reference to
> `rz_mtu3_enable'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_is_ch_enabled':
> > drivers/pwm/pwm-rz-mtu3.c:155: undefined reference to
> `rz_mtu3_is_enabled'
> > ld: drivers/pwm/pwm-rz-mtu3.c:162: undefined reference to
> `rz_mtu3_8bit_ch_read'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_read_tgr_registers':
> > drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: drivers/pwm/pwm-rz-mtu3.c:102: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: drivers/pwm/pwm-rz-mtu3.c:103: undefined reference to
> `rz_mtu3_16bit_ch_read'
> > ld: vmlinux.o: in function `rz_mtu3_pwm_get_state':
> > drivers/pwm/pwm-rz-mtu3.c:296: undefined reference to
> `rz_mtu3_8bit_ch_read'
> >
> > Modify the dependencies of PWM_RZ_MTU3 so that COMPILE_TEST is still
> > allowed but PWM_RZ_MTU3 depends on RZ_MTU3 if it is being built but
> > also allow the latter not to be built.
> >
> > Fixes: 254d3a727421 ("pwm: Add Renesas RZ/G2L MTU3a PWM driver")
> > Signed-off-by: Randy Dunlap <[email protected]>
> > Cc: Biju Das <[email protected]>
> > Cc: Uwe Kleine-König <[email protected]>
> > Cc: Thierry Reding <[email protected]>
> > Cc: [email protected]
>
> While testing here I hit another (unrelated) problem:
>
> drivers/pinctrl/renesas/pinctrl-rzg2l.c: In function ‘rzg2l_gpio_free’:
> drivers/pinctrl/renesas/pinctrl-rzg2l.c:917:37: error: ‘struct gpio_chip’
> has no member named ‘irq’
> 917 | virq = irq_find_mapping(chip->irq.domain, offset);
> | ^~
>
> Did someone address that one already? I guess PINCTRL_RZG2L should select
> GPIOLIB_IRQCHIP. Also RZ_MTU3 should select MFD_CORE as I hit:
>
> aarch64-linux-gnu-ld: rz-mtu3.c:(.text+0x544): undefined reference
> to `mfd_remove_devices'


OK, will add "select MFD_CORE" as pointed out.

>
> Commit 654c293e1687b31819f9bf1ac71b5a85a8053210 added RZ_MTU3 as bool, and
> it's still bool in 254d3a72742. I think the problem started only with
> b8b28b718ddd ("mfd: Add module build support for RZ/G2L MTU3a").
>
> The patch looks fine, but the commit log needs some adaption.
>
> The following patch would fix the build failure, too:
>
> diff --git a/include/linux/mfd/rz-mtu3.h b/include/linux/mfd/rz-mtu3.h
> index c5173bc06270..4f15c0dead60 100644
> --- a/include/linux/mfd/rz-mtu3.h
> +++ b/include/linux/mfd/rz-mtu3.h
> @@ -151,7 +151,7 @@ struct rz_mtu3 {
> void *priv_data;
> };
>
> -#if IS_ENABLED(CONFIG_RZ_MTU3)
> +#if IS_REACHABLE(CONFIG_RZ_MTU3)
> static inline bool rz_mtu3_request_channel(struct rz_mtu3_channel *ch) {
> mutex_lock(&ch->lock);
>
>
> maybe doing that additionally is a good idea? (Well, not entirely sure as
> the above setting then would result in a non-functioning PWM driver.
> Maybe that's worse than a build failure?)

It makes sense to use IS_REACHABLE over IS_ENABLED in this context.


Also what is your preference for the KConfig solution?

+ depends on RZ_MTU3 || (COMPILE_TEST && RZ_MTU3)

Or

+ depends on COMPILE_TEST
+ depends on RZ_MTU3 || RZ_MTU3=n


Cheers,
Biju