mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pwm: export of_pwm_request
@ 2012-10-31 15:57 Pantelis Antoniou
  2012-11-05  6:48 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Pantelis Antoniou @ 2012-10-31 15:57 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Pantelis Antoniou, linux-kernel, Koen Kooi, Matt Porter,
	Russ Dill, linux-omap

No need to hide of_pwm_request, it's useful to other in-kernel users.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 drivers/pwm/core.c  | 6 +++++-
 include/linux/pwm.h | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index f5acdaa..f8c7e6b 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -457,7 +457,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np)
  * becomes mandatory for devices that look up the PWM device via the con_id
  * parameter.
  */
-static struct pwm_device *of_pwm_request(struct device_node *np,
+struct pwm_device *of_pwm_request(struct device_node *np,
 					 const char *con_id)
 {
 	struct pwm_device *pwm = NULL;
@@ -466,6 +466,9 @@ static struct pwm_device *of_pwm_request(struct device_node *np,
 	int index = 0;
 	int err;
 
+	if (!np)
+		return ERR_PTR(-ENODEV);
+
 	if (con_id) {
 		index = of_property_match_string(np, "pwm-names", con_id);
 		if (index < 0)
@@ -516,6 +519,7 @@ put:
 
 	return pwm;
 }
+EXPORT_SYMBOL(of_pwm_request);
 
 /**
  * pwm_add_table() - register PWM device consumers
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 112b314..fafbb1c 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -171,6 +171,7 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
 					 unsigned int index,
 					 const char *label);
 
+struct pwm_device *of_pwm_request(struct device_node *np, const char *consumer);
 struct pwm_device *pwm_get(struct device *dev, const char *consumer);
 void pwm_put(struct pwm_device *pwm);
 
@@ -204,6 +205,12 @@ static inline struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
 	return ERR_PTR(-ENODEV);
 }
 
+static inline struct pwm_device *of_pwm_request(struct device_node *np,
+					 const char *consumer)
+{
+	return ERR_PTR(-ENODEV);
+}
+
 static inline struct pwm_device *pwm_get(struct device *dev,
 					 const char *consumer)
 {
-- 
1.7.12


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-05  6:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31 15:57 [PATCH] pwm: export of_pwm_request Pantelis Antoniou
2012-11-05  6:48 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®