mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
cpufreq: Use of_property_present()
Use of_property_present() to test for property presence rather than of_(find|get)_property(). This is part of a larger effort to remove callers of of_find_property() and similar functions. of_find_property() leaks the DT struct property and data pointers which is a problem for dynamically allocated nodes which may be freed. Signed-off-by: Rob Herring (Arm) <robh@kernel.org> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
8400291e28
commit
872cc94c7e
@ -69,7 +69,6 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
|
|||||||
static const char *find_supply_name(struct device *dev)
|
static const char *find_supply_name(struct device *dev)
|
||||||
{
|
{
|
||||||
struct device_node *np __free(device_node) = of_node_get(dev->of_node);
|
struct device_node *np __free(device_node) = of_node_get(dev->of_node);
|
||||||
struct property *pp;
|
|
||||||
int cpu = dev->id;
|
int cpu = dev->id;
|
||||||
|
|
||||||
/* This must be valid for sure */
|
/* This must be valid for sure */
|
||||||
@ -77,14 +76,10 @@ static const char *find_supply_name(struct device *dev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Try "cpu0" for older DTs */
|
/* Try "cpu0" for older DTs */
|
||||||
if (!cpu) {
|
if (!cpu && of_property_present(np, "cpu0-supply"))
|
||||||
pp = of_find_property(np, "cpu0-supply", NULL);
|
return "cpu0";
|
||||||
if (pp)
|
|
||||||
return "cpu0";
|
|
||||||
}
|
|
||||||
|
|
||||||
pp = of_find_property(np, "cpu-supply", NULL);
|
if (of_property_present(np, "cpu-supply"))
|
||||||
if (pp)
|
|
||||||
return "cpu";
|
return "cpu";
|
||||||
|
|
||||||
dev_dbg(dev, "no regulator for cpu%d\n", cpu);
|
dev_dbg(dev, "no regulator for cpu%d\n", cpu);
|
||||||
|
@ -505,7 +505,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
|
|||||||
continue;
|
continue;
|
||||||
if (strcmp(loc, "CPU CLOCK"))
|
if (strcmp(loc, "CPU CLOCK"))
|
||||||
continue;
|
continue;
|
||||||
if (!of_get_property(hwclock, "platform-get-frequency", NULL))
|
if (!of_property_present(hwclock, "platform-get-frequency"))
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ static int __init sti_cpufreq_init(void)
|
|||||||
goto skip_voltage_scaling;
|
goto skip_voltage_scaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!of_get_property(ddata.cpu->of_node, "operating-points-v2", NULL)) {
|
if (!of_property_present(ddata.cpu->of_node, "operating-points-v2")) {
|
||||||
dev_err(ddata.cpu, "OPP-v2 not supported\n");
|
dev_err(ddata.cpu, "OPP-v2 not supported\n");
|
||||||
goto skip_voltage_scaling;
|
goto skip_voltage_scaling;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ static bool dt_has_supported_hw(void)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for_each_child_of_node_scoped(np, opp) {
|
for_each_child_of_node_scoped(np, opp) {
|
||||||
if (of_find_property(opp, "opp-supported-hw", NULL)) {
|
if (of_property_present(opp, "opp-supported-hw")) {
|
||||||
has_opp_supported_hw = true;
|
has_opp_supported_hw = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user