clk: at91: make use of of_clk_parent_fill helper function
Use of_clk_parent_fill to fill in the parent clock names' array. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:

committed by
Stephen Boyd

parent
75ce0cdb62
commit
f0557fbe13
@@ -614,17 +614,12 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
|
|||||||
int num_parents;
|
int num_parents;
|
||||||
unsigned int irq;
|
unsigned int irq;
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
int i;
|
|
||||||
|
|
||||||
num_parents = of_clk_get_parent_count(np);
|
num_parents = of_clk_get_parent_count(np);
|
||||||
if (num_parents <= 0 || num_parents > 2)
|
if (num_parents <= 0 || num_parents > 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; ++i) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
|
@@ -222,7 +222,6 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
|
|||||||
{
|
{
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int num_parents;
|
int num_parents;
|
||||||
int i;
|
|
||||||
unsigned int irq;
|
unsigned int irq;
|
||||||
const char *parent_names[MASTER_SOURCE_MAX];
|
const char *parent_names[MASTER_SOURCE_MAX];
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
@@ -232,11 +231,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
|
|||||||
if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
|
if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; ++i) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
|
@@ -231,7 +231,6 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
|
|||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
u32 id;
|
u32 id;
|
||||||
int i;
|
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int num_parents;
|
int num_parents;
|
||||||
const char *parent_names[PROG_SOURCE_MAX];
|
const char *parent_names[PROG_SOURCE_MAX];
|
||||||
@@ -242,11 +241,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
|
|||||||
if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
|
if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; ++i) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
num = of_get_child_count(np);
|
num = of_get_child_count(np);
|
||||||
if (!num || num > (PROG_ID_MAX + 1))
|
if (!num || num > (PROG_ID_MAX + 1))
|
||||||
|
@@ -371,17 +371,12 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
|
|||||||
const char *parent_names[2];
|
const char *parent_names[2];
|
||||||
int num_parents;
|
int num_parents;
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
int i;
|
|
||||||
|
|
||||||
num_parents = of_clk_get_parent_count(np);
|
num_parents = of_clk_get_parent_count(np);
|
||||||
if (num_parents <= 0 || num_parents > 2)
|
if (num_parents <= 0 || num_parents > 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; ++i) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
@@ -449,17 +444,12 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
|
|||||||
const char *parent_names[2];
|
const char *parent_names[2];
|
||||||
int num_parents;
|
int num_parents;
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
int i;
|
|
||||||
|
|
||||||
num_parents = of_clk_get_parent_count(np);
|
num_parents = of_clk_get_parent_count(np);
|
||||||
if (num_parents != 2)
|
if (num_parents != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; ++i) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
|
@@ -145,7 +145,6 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
|
|||||||
struct at91_pmc *pmc)
|
struct at91_pmc *pmc)
|
||||||
{
|
{
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int i;
|
|
||||||
int num_parents;
|
int num_parents;
|
||||||
const char *parent_names[SMD_SOURCE_MAX];
|
const char *parent_names[SMD_SOURCE_MAX];
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
@@ -154,11 +153,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
|
|||||||
if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
|
if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; i++) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
|
@@ -373,7 +373,6 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
|
|||||||
struct at91_pmc *pmc)
|
struct at91_pmc *pmc)
|
||||||
{
|
{
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int i;
|
|
||||||
int num_parents;
|
int num_parents;
|
||||||
const char *parent_names[USB_SOURCE_MAX];
|
const char *parent_names[USB_SOURCE_MAX];
|
||||||
const char *name = np->name;
|
const char *name = np->name;
|
||||||
@@ -382,11 +381,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
|
|||||||
if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
|
if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < num_parents; i++) {
|
of_clk_parent_fill(np, parent_names, num_parents);
|
||||||
parent_names[i] = of_clk_get_parent_name(np, i);
|
|
||||||
if (!parent_names[i])
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
of_property_read_string(np, "clock-output-names", &name);
|
of_property_read_string(np, "clock-output-names", &name);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user