pwm: add devm_pwm_get() and devm_pwm_put()
Subsystems (2)
PATCH v2 1/1 pwm: add devm_pwm_get() and devm_pwm_put()
Add resource managed variants of pwm_get() and pwm_put() for convenience. Code is largely inspired by the equivalent devm functions of the regulator framework.
Signed-off-by Alexandre Courbot <[email protected]>
--- Documentation/driver-model/devres.txt | 4 +++ Documentation/pwm.txt | 3 +- drivers/pwm/core.c | 68 +++++++++++++++++++++++++++++++++++ include/linux/pwm.h | 3 ++ 4 files changed, 77 insertions(+), 1 deletion(-)
Documentation/driver-model/devres.txt +4 -0
@@ -284,3 +284,7 @@ CLOCK PINCTRL devm_pinctrl_get() devm_pinctrl_put() + +PWM + devm_pwm_get() + devm_pwm_put()
Documentation/pwm.txt +2 -1
@@ -36,7 +36,8 @@ Legacy users can request a PWM device using pwm_request() and free it after usage with pwm_free(). New users should use the pwm_get() function and pass to it the consumer -device or a consumer name. pwm_put() is used to free the PWM device. +device or a consumer name. pwm_put() is used to free the PWM device. Devm +variants of these functions also exist. After being requested a PWM has to be configured using:
drivers/pwm/core.c +68 -0
74 lines not on this page · raw message
include/linux/pwm.h +3 -0
@@ -125,6 +125,9 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,struct pwm_device *pwm_get (struct device *dev,const char *consumer);void pwm_put (struct pwm_device *pwm); +struct pwm_device *devm_pwm_get (struct device *dev,const char *consumer); +void devm_pwm_put (struct device *dev,struct pwm_device *pwm); +struct pwm_lookup {struct list_head list;const char *provider;
Signature · 1 line
1.7.11.3
Thierry Reding
AppliedQuoted 5 lines · Alexandre Courbot
Add resource managed variants of
pwm_get()andpwm_put()for convenience. Code is largely inspired by the equivalent devm functions of the regulator framework.Signed-off-by Alexandre Courbot <[email protected]>
Applied, with minor editorial fixups. Thanks.
Thierry