diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-04-23 23:53:04 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 08:09:02 -0400 |
commit | 30686ba6d56858657829d3eb524ed73e5dc98d2b (patch) | |
tree | 42bf3cea4dc7028fec30377560b367cd8274825e /drivers | |
parent | 1658ab66781d918f604c6069c5cf9a94b6f52f84 (diff) |
[POWERPC] Remove old interface find_devices
Replace uses with of_find_node_by_name and for_each_node_by_name.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/macintosh/ans-lcd.c | 9 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu.c | 4 | ||||
-rw-r--r-- | drivers/media/video/planb.c | 5 | ||||
-rw-r--r-- | drivers/serial/pmac_zilog.c | 4 | ||||
-rw-r--r-- | drivers/video/controlfb.c | 16 |
5 files changed, 25 insertions, 13 deletions
diff --git a/drivers/macintosh/ans-lcd.c b/drivers/macintosh/ans-lcd.c index cdd5a0f72e3c..e54c4d9f6365 100644 --- a/drivers/macintosh/ans-lcd.c +++ b/drivers/macintosh/ans-lcd.c | |||
@@ -145,11 +145,12 @@ anslcd_init(void) | |||
145 | int retval; | 145 | int retval; |
146 | struct device_node* node; | 146 | struct device_node* node; |
147 | 147 | ||
148 | node = find_devices("lcd"); | 148 | node = of_find_node_by_name(NULL, "lcd"); |
149 | if (!node || !node->parent) | 149 | if (!node || !node->parent || strcmp(node->parent->name, "gc")) { |
150 | return -ENODEV; | 150 | of_node_put(node); |
151 | if (strcmp(node->parent->name, "gc")) | ||
152 | return -ENODEV; | 151 | return -ENODEV; |
152 | } | ||
153 | of_node_put(node); | ||
153 | 154 | ||
154 | anslcd_ptr = ioremap(ANSLCD_ADDR, 0x20); | 155 | anslcd_ptr = ioremap(ANSLCD_ADDR, 0x20); |
155 | 156 | ||
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 7b7db5db50dc..e31cb1e7a47b 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -487,7 +487,8 @@ static int __init via_pmu_dev_init(void) | |||
487 | pmu_batteries[0].flags |= PMU_BATT_TYPE_SMART; | 487 | pmu_batteries[0].flags |= PMU_BATT_TYPE_SMART; |
488 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; | 488 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; |
489 | } else { | 489 | } else { |
490 | struct device_node* prim = find_devices("power-mgt"); | 490 | struct device_node* prim = |
491 | of_find_node_by_name(NULL, "power-mgt"); | ||
491 | const u32 *prim_info = NULL; | 492 | const u32 *prim_info = NULL; |
492 | if (prim) | 493 | if (prim) |
493 | prim_info = of_get_property(prim, "prim-info", NULL); | 494 | prim_info = of_get_property(prim, "prim-info", NULL); |
@@ -498,6 +499,7 @@ static int __init via_pmu_dev_init(void) | |||
498 | if (pmu_battery_count > 1) | 499 | if (pmu_battery_count > 1) |
499 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; | 500 | pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; |
500 | } | 501 | } |
502 | of_node_put(prim); | ||
501 | } | 503 | } |
502 | #endif /* CONFIG_PPC32 */ | 504 | #endif /* CONFIG_PPC32 */ |
503 | 505 | ||
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 86d2884e16c6..e6e61df0d071 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c | |||
@@ -2160,7 +2160,7 @@ static int find_planb(void) | |||
2160 | if (!machine_is(powermac)) | 2160 | if (!machine_is(powermac)) |
2161 | return 0; | 2161 | return 0; |
2162 | 2162 | ||
2163 | planb_devices = find_devices("planb"); | 2163 | planb_devices = of_find_node_by_name(NULL, "planb"); |
2164 | if (planb_devices == 0) { | 2164 | if (planb_devices == 0) { |
2165 | planb_num=0; | 2165 | planb_num=0; |
2166 | printk(KERN_WARNING "PlanB: no device found!\n"); | 2166 | printk(KERN_WARNING "PlanB: no device found!\n"); |
@@ -2175,12 +2175,14 @@ static int find_planb(void) | |||
2175 | if (planb_devices->n_addrs != 1) { | 2175 | if (planb_devices->n_addrs != 1) { |
2176 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " | 2176 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " |
2177 | "(got %d)", planb_devices->n_addrs); | 2177 | "(got %d)", planb_devices->n_addrs); |
2178 | of_node_put(planb_devices); | ||
2178 | return 0; | 2179 | return 0; |
2179 | } | 2180 | } |
2180 | 2181 | ||
2181 | if (planb_devices->n_intrs == 0) { | 2182 | if (planb_devices->n_intrs == 0) { |
2182 | printk(KERN_WARNING "PlanB: no intrs for device %s\n", | 2183 | printk(KERN_WARNING "PlanB: no intrs for device %s\n", |
2183 | planb_devices->full_name); | 2184 | planb_devices->full_name); |
2185 | of_node_put(planb_devices); | ||
2184 | return 0; | 2186 | return 0; |
2185 | } else { | 2187 | } else { |
2186 | irq = planb_devices->intrs[0].line; | 2188 | irq = planb_devices->intrs[0].line; |
@@ -2202,6 +2204,7 @@ static int find_planb(void) | |||
2202 | confreg = planb_devices->addrs[0].space & 0xff; | 2204 | confreg = planb_devices->addrs[0].space & 0xff; |
2203 | old_base = planb_devices->addrs[0].address; | 2205 | old_base = planb_devices->addrs[0].address; |
2204 | new_base = 0xf1000000; | 2206 | new_base = 0xf1000000; |
2207 | of_node_put(planb_devices); | ||
2205 | 2208 | ||
2206 | DEBUG("PlanB: Found on bus %d, dev %d, func %d, " | 2209 | DEBUG("PlanB: Found on bus %d, dev %d, func %d, " |
2207 | "membase 0x%x (base reg. 0x%x)\n", | 2210 | "membase 0x%x (base reg. 0x%x)\n", |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 2b163c532e0d..cd92a3966b0c 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -1467,7 +1467,8 @@ no_dma: | |||
1467 | if (ZS_IS_IRDA(uap)) | 1467 | if (ZS_IS_IRDA(uap)) |
1468 | uap->port_type = PMAC_SCC_IRDA; | 1468 | uap->port_type = PMAC_SCC_IRDA; |
1469 | if (ZS_IS_INTMODEM(uap)) { | 1469 | if (ZS_IS_INTMODEM(uap)) { |
1470 | struct device_node* i2c_modem = find_devices("i2c-modem"); | 1470 | struct device_node* i2c_modem = |
1471 | of_find_node_by_name(NULL, "i2c-modem"); | ||
1471 | if (i2c_modem) { | 1472 | if (i2c_modem) { |
1472 | const char* mid = | 1473 | const char* mid = |
1473 | of_get_property(i2c_modem, "modem-id", NULL); | 1474 | of_get_property(i2c_modem, "modem-id", NULL); |
@@ -1482,6 +1483,7 @@ no_dma: | |||
1482 | } | 1483 | } |
1483 | printk(KERN_INFO "pmac_zilog: i2c-modem detected, id: %d\n", | 1484 | printk(KERN_INFO "pmac_zilog: i2c-modem detected, id: %d\n", |
1484 | mid ? (*mid) : 0); | 1485 | mid ? (*mid) : 0); |
1486 | of_node_put(i2c_modem); | ||
1485 | } else { | 1487 | } else { |
1486 | printk(KERN_INFO "pmac_zilog: serial modem detected\n"); | 1488 | printk(KERN_INFO "pmac_zilog: serial modem detected\n"); |
1487 | } | 1489 | } |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index fd60dba294da..8b762739b1e0 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -179,12 +179,14 @@ MODULE_LICENSE("GPL"); | |||
179 | int init_module(void) | 179 | int init_module(void) |
180 | { | 180 | { |
181 | struct device_node *dp; | 181 | struct device_node *dp; |
182 | int ret = -ENXIO; | ||
182 | 183 | ||
183 | dp = find_devices("control"); | 184 | dp = of_find_node_by_name(NULL, "control"); |
184 | if (dp != 0 && !control_of_init(dp)) | 185 | if (dp != 0 && !control_of_init(dp)) |
185 | return 0; | 186 | ret = 0; |
187 | of_node_put(dp); | ||
186 | 188 | ||
187 | return -ENXIO; | 189 | return ret; |
188 | } | 190 | } |
189 | 191 | ||
190 | void cleanup_module(void) | 192 | void cleanup_module(void) |
@@ -589,16 +591,18 @@ static int __init control_init(void) | |||
589 | { | 591 | { |
590 | struct device_node *dp; | 592 | struct device_node *dp; |
591 | char *option = NULL; | 593 | char *option = NULL; |
594 | int ret = -ENXIO; | ||
592 | 595 | ||
593 | if (fb_get_options("controlfb", &option)) | 596 | if (fb_get_options("controlfb", &option)) |
594 | return -ENODEV; | 597 | return -ENODEV; |
595 | control_setup(option); | 598 | control_setup(option); |
596 | 599 | ||
597 | dp = find_devices("control"); | 600 | dp = of_find_node_by_name(NULL, "control"); |
598 | if (dp != 0 && !control_of_init(dp)) | 601 | if (dp != 0 && !control_of_init(dp)) |
599 | return 0; | 602 | ret = 0; |
603 | of_node_put(dp); | ||
600 | 604 | ||
601 | return -ENXIO; | 605 | return ret; |
602 | } | 606 | } |
603 | 607 | ||
604 | module_init(control_init); | 608 | module_init(control_init); |