Skip to contentSkip to conversation

pwm: add devm_pwm_get() and devm_pwm_put()

PATCH Applied Alexandre Courbot 2 participants 2 messages Aug 1, 2012 – Aug 9, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 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
index 950856b..43cff70 100644
@@ -284,3 +284,7 @@ CLOCK
 PINCTRL
   devm_pinctrl_get()
   devm_pinctrl_put()
+
+PWM
+  devm_pwm_get()
+  devm_pwm_put()
Documentation/pwm.txt +2 -1
index 554290e..47cd24d 100644
@@ -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
index 21d076c..8ddc824 100644
@@ -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
#1 lore raw
Quoted 5 lines · Alexandre Courbot

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.

Applied, with minor editorial fixups. Thanks.

Thierry