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")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@intel.com/
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
I've included this patch in this series because it should save us from being
notified by 0-day about the build failure this patch fixes. From contributor's
perspective, it's easier to have this patch together with the rest of ad4030
series. Though, no objection if kernel maintainers decide to pick it [1] through
the PWM tree.
[1]: https://lore.kernel.org/linux-pwm/1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com/
Thanks,
Marcelo
include/linux/pwm.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 8cafc483db53..e79545c0cb89 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -501,6 +501,25 @@ struct pwm_device *devm_fwnode_pwm_get(struct device *dev,
struct fwnode_handle *fwnode,
const char *con_id);
#else
+static inline int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)
+{
+ might_sleep();
+ return -EOPNOTSUPP;
+}
+
+static inline int pwm_get_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)
+{
+ might_sleep();
+ return -EOPNOTSUPP;
+}
+
+static inline int pwm_set_waveform_might_sleep(struct pwm_device *pwm,
+ const struct pwm_waveform *wf, bool exact)
+{
+ might_sleep();
+ return -EOPNOTSUPP;
+}
+
static inline bool pwm_might_sleep(struct pwm_device *pwm)
{
return true;
--
2.39.2
Hello,
On Wed, Oct 08, 2025 at 10:49:44AM -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")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@intel.com/
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> ---
> I've included this patch in this series because it should save us from being
> notified by 0-day about the build failure this patch fixes. From contributor's
> perspective, it's easier to have this patch together with the rest of ad4030
> series. Though, no objection if kernel maintainers decide to pick it [1] through
> the PWM tree.
>
> [1]: https://lore.kernel.org/linux-pwm/1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com/
TL;DR: nack
I replied to the original submission about why this patch is wrong. See
there for the details.
Best regards
Uwe
On 10/9/25 11:58 AM, Uwe Kleine-König wrote:
> Hello,
>
> On Wed, Oct 08, 2025 at 10:49:44AM -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")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@intel.com/
>> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
>> ---
>> I've included this patch in this series because it should save us from being
>> notified by 0-day about the build failure this patch fixes. From contributor's
>> perspective, it's easier to have this patch together with the rest of ad4030
>> series. Though, no objection if kernel maintainers decide to pick it [1] through
>> the PWM tree.
>>
>> [1]: https://lore.kernel.org/linux-pwm/1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com/
>
> TL;DR: nack
>
> I replied to the original submission about why this patch is wrong. See
> there for the details.
>
> Best regards
> Uwe
If we want to avoid this patch, then it sounds like we should use:
#if IS_REACHABLE(CONFIG_PWM)
in the ADC driver around any PWM waveform code.
On Fri, Oct 10, 2025 at 11:34:49AM -0500, David Lechner wrote:
> On 10/9/25 11:58 AM, Uwe Kleine-König wrote:
> > Hello,
> >
> > On Wed, Oct 08, 2025 at 10:49:44AM -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")
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@intel.com/
> >> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> >> ---
> >> I've included this patch in this series because it should save us from being
> >> notified by 0-day about the build failure this patch fixes. From contributor's
> >> perspective, it's easier to have this patch together with the rest of ad4030
> >> series. Though, no objection if kernel maintainers decide to pick it [1] through
> >> the PWM tree.
> >>
> >> [1]: https://lore.kernel.org/linux-pwm/1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com/
> >
> > TL;DR: nack
> >
> > I replied to the original submission about why this patch is wrong. See
> > there for the details.
>
> If we want to avoid this patch, then it sounds like we should use:
>
> #if IS_REACHABLE(CONFIG_PWM)
>
> in the ADC driver around any PWM waveform code.
Or use IS_REACHABLE(CONFIG_SPI_OFFLOAD_TRIGGER_PWM) which might be
nearer to the actual dependency. (Hmm, but looking in the driver, it
handles the pwm device and setting directly, I would have expected that
code specific to SPI_OFFLOAD_TRIGGER_PWM does that and the driver
doesn't even see the pwm.)
Or make the driver depend on CONFIG_PWM, which is cheap.
Or if the PWM support is really optional, convince me to add the stubs.
Best regards
Uwe
© 2016 - 2026 Red Hat, Inc.