aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-03-07 06:55:49 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-03-27 09:51:13 -0400
commit05fd8e73e1357feaea9c48938d937eae76b4aef4 (patch)
tree77aa0cfcfbd892423dcba295610116ca053029e2
parent0412d6c9271811b84568fcea3237e2193e21866a (diff)
clkdev: add possibility to get a clock based on the device name
This adds clk_get_sys to get a clock without the associated struct device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/common/clkdev.c11
-rw-r--r--include/linux/clk.h17
2 files changed, 26 insertions, 2 deletions
diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
index 1037bba18329..5589444ff437 100644
--- a/arch/arm/common/clkdev.c
+++ b/arch/arm/common/clkdev.c
@@ -62,9 +62,8 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
62 return clk; 62 return clk;
63} 63}
64 64
65struct clk *clk_get(struct device *dev, const char *con_id) 65struct clk *clk_get_sys(const char *dev_id, const char *con_id)
66{ 66{
67 const char *dev_id = dev ? dev_name(dev) : NULL;
68 struct clk *clk; 67 struct clk *clk;
69 68
70 mutex_lock(&clocks_mutex); 69 mutex_lock(&clocks_mutex);
@@ -75,6 +74,14 @@ struct clk *clk_get(struct device *dev, const char *con_id)
75 74
76 return clk ? clk : ERR_PTR(-ENOENT); 75 return clk ? clk : ERR_PTR(-ENOENT);
77} 76}
77EXPORT_SYMBOL(clk_get_sys);
78
79struct clk *clk_get(struct device *dev, const char *con_id)
80{
81 const char *dev_id = dev ? dev_name(dev) : NULL;
82
83 return clk_get_sys(dev_id, con_id);
84}
78EXPORT_SYMBOL(clk_get); 85EXPORT_SYMBOL(clk_get);
79 86
80void clk_put(struct clk *clk) 87void clk_put(struct clk *clk)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 778777316ea4..1db9bbf444a3 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -125,4 +125,21 @@ int clk_set_parent(struct clk *clk, struct clk *parent);
125 */ 125 */
126struct clk *clk_get_parent(struct clk *clk); 126struct clk *clk_get_parent(struct clk *clk);
127 127
128/**
129 * clk_get_sys - get a clock based upon the device name
130 * @dev_id: device name
131 * @con_id: connection ID
132 *
133 * Returns a struct clk corresponding to the clock producer, or
134 * valid IS_ERR() condition containing errno. The implementation
135 * uses @dev_id and @con_id to determine the clock consumer, and
136 * thereby the clock producer. In contrast to clk_get() this function
137 * takes the device name instead of the device itself for identification.
138 *
139 * Drivers must assume that the clock source is not enabled.
140 *
141 * clk_get_sys should not be called from within interrupt context.
142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144
128#endif 145#endif