[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1ac0fc529e02744aacfcb9140ed597ff60886f39.1759873890.git.marcelo.schmitt@analog.com>
Date: Tue, 7 Oct 2025 19:19:38 -0300
From: Marcelo Schmitt <marcelo.schmitt@...log.com>
To: <linux-pwm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <ukleinek@...nel.org>, <jic23@...nel.org>, <marcelo.schmitt1@...il.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH] pwm: Declare waveform stubs for when PWM is not reachable
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@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202509272028.0zLNiR5w-lkp@intel.com/
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
---
Cc: Jonathan Cameron <jic23@...nel.org>
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).
I'm not very familiar with the details of how it works for series of
patches that update multiple subsystems. Documentation says such sets may go
through the -mm tree. Though, this is a small change and the consumer driver set
depends on it. Would it be okay if this gets picked up through Jonathan's IIO tree?
[1]: https://lore.kernel.org/linux-iio/202509272028.0zLNiR5w-lkp@intel.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 549ac4aaad59..a20ddc40a32a 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -504,6 +504,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;
base-commit: 8f2689f194b8d1bff41150ae316abdfccf191309
--
2.39.2
Powered by blists - more mailing lists