Thread (36 messages) flat view 36 messages, 5 authors, 2011-10-04

[PATCH 8/9] regulator: helper to extract regulator node based on supply name

From: Rajendra Nayak <hidden>
Date: 2011-09-28 10:56:46
Also in: linux-devicetree, linux-omap

On Wednesday 28 September 2011 12:29 AM, Mark Brown wrote:
On Tue, Sep 27, 2011 at 08:19:37PM +0530, Rajendra Nayak wrote:
quoted
On Tuesday 27 September 2011 05:51 PM, Mark Brown wrote:
quoted
On Tue, Sep 27, 2011 at 03:42:51PM +0530, Rajendra Nayak wrote:
quoted
quoted
quoted
+	if (!dev)
+		return NULL;
quoted
quoted
So how do we handle CPUs?  cpufreq is one of the most active users of
regulators...
quoted
Hmm, never thought of it :(
Maybe I should associate a supply name with all
regulators and then lookup from the global registered
list.
I'm not sure how this should work in a device tree world, I'd *hope*
we'd get a device tree node for the CPU and could then just make this a
regular consumer thing but then the cpufreq drivers would need to be
updated to make use of it.  The only reason we allow null devices right
now is the fact that cpufreq doesn't have a struct device it can use.
quoted
quoted
quoted
+	snprintf(prop_name, 32, "%s-supply", supply);
+
+	prop = of_get_property(dev->of_node, prop_name,&sz);
+	if (!prop || sz<   4)
+		return NULL;
quoted
quoted
sz<   4?  Magic!  :)
quoted
Its the valid phandle size.
I guess I need a sz != 4
I think we need an of_get_phandle(), it'd be clearer what the check is,
more type safe and would avoid needing to replicate the check.
Yes, there already seems to be one, of_parse_phandle() which I should
have used. thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help