]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pwm: Check for CONFIG_PWM using IS_REACHABLE() in main header
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Mon, 17 Feb 2025 10:25:02 +0000 (11:25 +0100)
committerUwe Kleine-König <ukleinek@kernel.org>
Fri, 28 Feb 2025 22:56:07 +0000 (23:56 +0100)
Preparing CONFIG_PWM becoming tristate the right magic to check for the
availability of the pwm functions is using IS_REACHABLE() and not
IS_ENABLED(). The latter gives the wrong result for built-in code with
CONFIG_PWM=m.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20250217102504.687916-2-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
include/linux/pwm.h

index a2df509056ac7aebe8071de04a2bad1a9ce97201..9ece4e5d3815752248b73c27d851f95df6821740 100644 (file)
@@ -379,7 +379,7 @@ static inline void pwmchip_set_drvdata(struct pwm_chip *chip, void *data)
        dev_set_drvdata(&chip->dev, data);
 }
 
-#if IS_ENABLED(CONFIG_PWM)
+#if IS_REACHABLE(CONFIG_PWM)
 
 /* PWM consumer APIs */
 int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf);
@@ -661,7 +661,7 @@ struct pwm_lookup {
        PWM_LOOKUP_WITH_MODULE(_provider, _index, _dev_id, _con_id, _period, \
                               _polarity, NULL)
 
-#if IS_ENABLED(CONFIG_PWM)
+#if IS_REACHABLE(CONFIG_PWM)
 void pwm_add_table(struct pwm_lookup *table, size_t num);
 void pwm_remove_table(struct pwm_lookup *table, size_t num);
 #else