mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[POWERPC] Use for_each macros in arch/powerpc/sysdev
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
283029d16a
commit
26cb7d8bbd
@ -1128,12 +1128,11 @@ arch_initcall(fs_enet_of_init);
|
|||||||
|
|
||||||
static int __init fsl_pcmcia_of_init(void)
|
static int __init fsl_pcmcia_of_init(void)
|
||||||
{
|
{
|
||||||
struct device_node *np = NULL;
|
struct device_node *np;
|
||||||
/*
|
/*
|
||||||
* Register all the devices which type is "pcmcia"
|
* Register all the devices which type is "pcmcia"
|
||||||
*/
|
*/
|
||||||
while ((np = of_find_compatible_node(np,
|
for_each_compatible_node(np, "pcmcia", "fsl,pq-pcmcia")
|
||||||
"pcmcia", "fsl,pq-pcmcia")) != NULL)
|
|
||||||
of_platform_device_create(np, "m8xx-pcmcia", NULL);
|
of_platform_device_create(np, "m8xx-pcmcia", NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id)
|
|||||||
|
|
||||||
/* only register the shared platform device the first time through */
|
/* only register the shared platform device the first time through */
|
||||||
if (id == 0 && (err = eth_register_shared_pdev(np)))
|
if (id == 0 && (err = eth_register_shared_pdev(np)))
|
||||||
return err;;
|
return err;
|
||||||
|
|
||||||
memset(r, 0, sizeof(r));
|
memset(r, 0, sizeof(r));
|
||||||
of_irq_to_resource(np, 0, &r[0]);
|
of_irq_to_resource(np, 0, &r[0]);
|
||||||
@ -451,22 +451,19 @@ static int __init mv64x60_device_setup(void)
|
|||||||
int id;
|
int id;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
for (id = 0;
|
id = 0;
|
||||||
(np = of_find_compatible_node(np, "serial", "marvell,mpsc")); id++)
|
for_each_compatible_node(np, "serial", "marvell,mpsc")
|
||||||
if ((err = mv64x60_mpsc_device_setup(np, id)))
|
if ((err = mv64x60_mpsc_device_setup(np, id++)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (id = 0;
|
id = 0;
|
||||||
(np = of_find_compatible_node(np, "network",
|
for_each_compatible_node(np, "network", "marvell,mv64x60-eth")
|
||||||
"marvell,mv64x60-eth"));
|
if ((err = mv64x60_eth_device_setup(np, id++)))
|
||||||
id++)
|
|
||||||
if ((err = mv64x60_eth_device_setup(np, id)))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (id = 0;
|
id = 0;
|
||||||
(np = of_find_compatible_node(np, "i2c", "marvell,mv64x60-i2c"));
|
for_each_compatible_node(np, "i2c", "marvell,mv64x60-i2c")
|
||||||
id++)
|
if ((err = mv64x60_i2c_device_setup(np, id++)))
|
||||||
if ((err = mv64x60_i2c_device_setup(np, id)))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* support up to one watchdog timer */
|
/* support up to one watchdog timer */
|
||||||
@ -477,7 +474,6 @@ static int __init mv64x60_device_setup(void)
|
|||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -164,8 +164,8 @@ static int __init mv64x60_add_bridge(struct device_node *dev)
|
|||||||
|
|
||||||
void __init mv64x60_pci_init(void)
|
void __init mv64x60_pci_init(void)
|
||||||
{
|
{
|
||||||
struct device_node *np = NULL;
|
struct device_node *np;
|
||||||
|
|
||||||
while ((np = of_find_compatible_node(np, "pci", "marvell,mv64x60-pci")))
|
for_each_compatible_node(np, "pci", "marvell,mv64x60-pci")
|
||||||
mv64x60_add_bridge(np);
|
mv64x60_add_bridge(np);
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,10 @@ static void mv64x60_udbg_init(void)
|
|||||||
if (!stdout)
|
if (!stdout)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (np = NULL;
|
for_each_compatible_node(np, "serial", "marvell,mpsc") {
|
||||||
(np = of_find_compatible_node(np, "serial", "marvell,mpsc")); )
|
|
||||||
if (np == stdout)
|
if (np == stdout)
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
of_node_put(stdout);
|
of_node_put(stdout);
|
||||||
if (!np)
|
if (!np)
|
||||||
|
@ -66,14 +66,12 @@ EXPORT_SYMBOL(get_vir_csrbase);
|
|||||||
static int __init tsi108_eth_of_init(void)
|
static int __init tsi108_eth_of_init(void)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
unsigned int i;
|
unsigned int i = 0;
|
||||||
struct platform_device *tsi_eth_dev;
|
struct platform_device *tsi_eth_dev;
|
||||||
struct resource res;
|
struct resource res;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (np = NULL, i = 0;
|
for_each_compatible_node(np, "network", "tsi108-ethernet") {
|
||||||
(np = of_find_compatible_node(np, "network", "tsi108-ethernet")) != NULL;
|
|
||||||
i++) {
|
|
||||||
struct resource r[2];
|
struct resource r[2];
|
||||||
struct device_node *phy, *mdio;
|
struct device_node *phy, *mdio;
|
||||||
hw_info tsi_eth_data;
|
hw_info tsi_eth_data;
|
||||||
@ -98,7 +96,7 @@ static int __init tsi108_eth_of_init(void)
|
|||||||
__FUNCTION__,r[1].name, r[1].start, r[1].end);
|
__FUNCTION__,r[1].name, r[1].start, r[1].end);
|
||||||
|
|
||||||
tsi_eth_dev =
|
tsi_eth_dev =
|
||||||
platform_device_register_simple("tsi-ethernet", i, &r[0],
|
platform_device_register_simple("tsi-ethernet", i++, &r[0],
|
||||||
1);
|
1);
|
||||||
|
|
||||||
if (IS_ERR(tsi_eth_dev)) {
|
if (IS_ERR(tsi_eth_dev)) {
|
||||||
@ -154,6 +152,7 @@ static int __init tsi108_eth_of_init(void)
|
|||||||
unreg:
|
unreg:
|
||||||
platform_device_unregister(tsi_eth_dev);
|
platform_device_unregister(tsi_eth_dev);
|
||||||
err:
|
err:
|
||||||
|
of_node_put(np);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,28 +309,23 @@ void __init uic_init_tree(void)
|
|||||||
const u32 *interrupts;
|
const u32 *interrupts;
|
||||||
|
|
||||||
/* First locate and initialize the top-level UIC */
|
/* First locate and initialize the top-level UIC */
|
||||||
|
for_each_compatible_node(np, NULL, "ibm,uic") {
|
||||||
np = of_find_compatible_node(NULL, NULL, "ibm,uic");
|
|
||||||
while (np) {
|
|
||||||
interrupts = of_get_property(np, "interrupts", NULL);
|
interrupts = of_get_property(np, "interrupts", NULL);
|
||||||
if (! interrupts)
|
if (!interrupts)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
np = of_find_compatible_node(np, NULL, "ibm,uic");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BUG_ON(!np); /* uic_init_tree() assumes there's a UIC as the
|
BUG_ON(!np); /* uic_init_tree() assumes there's a UIC as the
|
||||||
* top-level interrupt controller */
|
* top-level interrupt controller */
|
||||||
primary_uic = uic_init_one(np);
|
primary_uic = uic_init_one(np);
|
||||||
if (! primary_uic)
|
if (!primary_uic)
|
||||||
panic("Unable to initialize primary UIC %s\n", np->full_name);
|
panic("Unable to initialize primary UIC %s\n", np->full_name);
|
||||||
|
|
||||||
irq_set_default_host(primary_uic->irqhost);
|
irq_set_default_host(primary_uic->irqhost);
|
||||||
of_node_put(np);
|
of_node_put(np);
|
||||||
|
|
||||||
/* The scan again for cascaded UICs */
|
/* The scan again for cascaded UICs */
|
||||||
np = of_find_compatible_node(NULL, NULL, "ibm,uic");
|
for_each_compatible_node(np, NULL, "ibm,uic") {
|
||||||
while (np) {
|
|
||||||
interrupts = of_get_property(np, "interrupts", NULL);
|
interrupts = of_get_property(np, "interrupts", NULL);
|
||||||
if (interrupts) {
|
if (interrupts) {
|
||||||
/* Secondary UIC */
|
/* Secondary UIC */
|
||||||
@ -348,8 +343,6 @@ void __init uic_init_tree(void)
|
|||||||
|
|
||||||
/* FIXME: setup critical cascade?? */
|
/* FIXME: setup critical cascade?? */
|
||||||
}
|
}
|
||||||
|
|
||||||
np = of_find_compatible_node(np, NULL, "ibm,uic");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user