summaryrefslogtreecommitdiffstats
path: root/include/linux/pwm.h
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-14 10:30:48 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-15 12:37:29 +0100
commit4e59267c7a20eb1c1ad9106e682cb6a0d8eb3111 (patch)
tree46ff9d6257227c59bd4416d733a11f2eddf41f16 /include/linux/pwm.h
parenteb58bf4afd708eb3c64c7b9b2c5fbfacdcdee3e5 (diff)
downloadlinux-4e59267c7a20eb1c1ad9106e682cb6a0d8eb3111.tar.gz
linux-4e59267c7a20eb1c1ad9106e682cb6a0d8eb3111.tar.bz2
linux-4e59267c7a20eb1c1ad9106e682cb6a0d8eb3111.zip
pwm: Provide an inline function to get the parent device of a given chip
Currently a pwm_chip stores in its struct device *dev member a pointer to the parent device. Preparing a change that embeds a full struct device in struct pwm_chip, this accessor function should be used in all drivers directly accessing chip->dev now. This way struct pwm_chip and this new function can be changed without having to touch all drivers in the same change set. Make use of this function in the framework's core sources. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/cc30090d2f9762bed9854a55612144bccc910781.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r--include/linux/pwm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 8ffe9ae7a23a..07af6910bdce 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -289,6 +289,11 @@ struct pwm_chip {
struct pwm_device *pwms;
};
+static inline struct device *pwmchip_parent(const struct pwm_chip *chip)
+{
+ return chip->dev;
+}
+
#if IS_ENABLED(CONFIG_PWM)
/* PWM user APIs */
int pwm_apply_might_sleep(struct pwm_device *pwm, const struct pwm_state *state);