Re: [PATCH] pwm: Declare waveform stubs for when PWM is not reachable

From: Uwe Kleine-König
Date: Thu Oct 09 2025 - 12:54:04 EST


Hello Marcelo,

On Tue, Oct 07, 2025 at 07:19:38PM -0300, Marcelo Schmitt wrote:
> Previously, the PWM waveform consumer API would not be declared if
> CONFIG_PWM was not reachable. That caused kernel builds to fail if a
> consumer driver was enabled but PWM disabled. Add stubs for PWM waveform
> functions so client drivers that use, but don't depend on PWM, can build if
> PWM is disabled.
>
> Fixes: 6c5126c6406d ("pwm: Provide new consumer API functions for waveforms")

At the time 6c5126c6406d was applied, there was no user of the API that
doesn't depend on CONFIG_PWM, so I object adding this Fixes line.

> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@xxxxxxxxx/
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> ---
> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>
> Hi Uwe,
>
> This is a fix based on a report from 0-day bot [1].
> We need this for a sophisticated IIO device that makes direct use of a PWM
> waveform (in addition to indirect use of PWM through SPI_OFFLOAD_TRIGGER_PWM).

Does the driver work in some configuration with the pwm stubs? If not,
the right thing to do is to let it depend on PWM. (Note the inverse
isn't necessarily a good idea.)

And I wonder how you could even compile your driver without PWM support
given that it selects SPI_OFFLOAD_TRIGGER_PWM which depends on PWM.

... some time later ...

OK, I tried to reproduce the problem that the kernel build bot run into.
There is a warning:

WARNING: unmet direct dependencies detected for SPI_OFFLOAD_TRIGGER_PWM
Depends on [n]: SPI [=y] && SPI_OFFLOAD [=y] && PWM [=n]
Selected by [y]:
- AD4030 [=y] && IIO [=y] && SPI [=y] && GPIOLIB [=y]

This is the thing that needs fixing, i.e. don't select a symbol with
dependencies that the selecting symbol doesn't assert to be fulfilled.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature