diff options
-rw-r--r-- | arch/powerpc/kernel/prom.c | 24 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/time.c | 13 | ||||
-rw-r--r-- | drivers/macintosh/macio-adb.c | 16 | ||||
-rw-r--r-- | include/asm-powerpc/prom.h | 2 |
4 files changed, 22 insertions, 33 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index ec6921c54a07..2f7e6ec215f8 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -1171,30 +1171,6 @@ int machine_is_compatible(const char *compat) | |||
1171 | EXPORT_SYMBOL(machine_is_compatible); | 1171 | EXPORT_SYMBOL(machine_is_compatible); |
1172 | 1172 | ||
1173 | /** | 1173 | /** |
1174 | * Construct and return a list of the device_nodes with a given type | ||
1175 | * and compatible property. | ||
1176 | */ | ||
1177 | struct device_node *find_compatible_devices(const char *type, | ||
1178 | const char *compat) | ||
1179 | { | ||
1180 | struct device_node *head, **prevp, *np; | ||
1181 | |||
1182 | prevp = &head; | ||
1183 | for (np = allnodes; np != 0; np = np->allnext) { | ||
1184 | if (type != NULL | ||
1185 | && !(np->type != 0 && strcasecmp(np->type, type) == 0)) | ||
1186 | continue; | ||
1187 | if (of_device_is_compatible(np, compat)) { | ||
1188 | *prevp = np; | ||
1189 | prevp = &np->next; | ||
1190 | } | ||
1191 | } | ||
1192 | *prevp = NULL; | ||
1193 | return head; | ||
1194 | } | ||
1195 | EXPORT_SYMBOL(find_compatible_devices); | ||
1196 | |||
1197 | /** | ||
1198 | * Find the device_node with a given full_name. | 1174 | * Find the device_node with a given full_name. |
1199 | */ | 1175 | */ |
1200 | struct device_node *find_path_device(const char *path) | 1176 | struct device_node *find_path_device(const char *path) |
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c index 7d7889026936..96d1e4b3c493 100644 --- a/arch/powerpc/platforms/chrp/time.c +++ b/arch/powerpc/platforms/chrp/time.c | |||
@@ -39,12 +39,17 @@ long __init chrp_time_init(void) | |||
39 | struct resource r; | 39 | struct resource r; |
40 | int base; | 40 | int base; |
41 | 41 | ||
42 | rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); | 42 | rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00"); |
43 | if (rtcs == NULL) | 43 | if (rtcs == NULL) |
44 | rtcs = find_compatible_devices("rtc", "ds1385-rtc"); | 44 | rtcs = of_find_compatible_node(NULL, "rtc", "ds1385-rtc"); |
45 | if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r)) | 45 | if (rtcs == NULL) |
46 | return 0; | ||
47 | if (of_address_to_resource(rtcs, 0, &r)) { | ||
48 | of_node_put(rtcs); | ||
46 | return 0; | 49 | return 0; |
47 | 50 | } | |
51 | of_node_put(rtcs); | ||
52 | |||
48 | base = r.start; | 53 | base = r.start; |
49 | nvram_as1 = 0; | 54 | nvram_as1 = 0; |
50 | nvram_as0 = base; | 55 | nvram_as0 = base; |
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c index 026b67f4f659..79119f56e82d 100644 --- a/drivers/macintosh/macio-adb.c +++ b/drivers/macintosh/macio-adb.c | |||
@@ -82,7 +82,14 @@ struct adb_driver macio_adb_driver = { | |||
82 | 82 | ||
83 | int macio_probe(void) | 83 | int macio_probe(void) |
84 | { | 84 | { |
85 | return find_compatible_devices("adb", "chrp,adb0")? 0: -ENODEV; | 85 | struct device_node *np; |
86 | |||
87 | np = of_find_compatible_node(NULL, "adb", "chrp,adb0"); | ||
88 | if (np) { | ||
89 | of_node_put(np); | ||
90 | return 0; | ||
91 | } | ||
92 | return -ENODEV; | ||
86 | } | 93 | } |
87 | 94 | ||
88 | int macio_init(void) | 95 | int macio_init(void) |
@@ -91,12 +98,14 @@ int macio_init(void) | |||
91 | struct resource r; | 98 | struct resource r; |
92 | unsigned int irq; | 99 | unsigned int irq; |
93 | 100 | ||
94 | adbs = find_compatible_devices("adb", "chrp,adb0"); | 101 | adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0"); |
95 | if (adbs == 0) | 102 | if (adbs == 0) |
96 | return -ENXIO; | 103 | return -ENXIO; |
97 | 104 | ||
98 | if (of_address_to_resource(adbs, 0, &r)) | 105 | if (of_address_to_resource(adbs, 0, &r)) { |
106 | of_node_put(adbs); | ||
99 | return -ENXIO; | 107 | return -ENXIO; |
108 | } | ||
100 | adb = ioremap(r.start, sizeof(struct adb_regs)); | 109 | adb = ioremap(r.start, sizeof(struct adb_regs)); |
101 | 110 | ||
102 | out_8(&adb->ctrl.r, 0); | 111 | out_8(&adb->ctrl.r, 0); |
@@ -107,6 +116,7 @@ int macio_init(void) | |||
107 | out_8(&adb->autopoll.r, APE); | 116 | out_8(&adb->autopoll.r, APE); |
108 | 117 | ||
109 | irq = irq_of_parse_and_map(adbs, 0); | 118 | irq = irq_of_parse_and_map(adbs, 0); |
119 | of_node_put(adbs); | ||
110 | if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) { | 120 | if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) { |
111 | printk(KERN_ERR "ADB: can't get irq %d\n", irq); | 121 | printk(KERN_ERR "ADB: can't get irq %d\n", irq); |
112 | return -EAGAIN; | 122 | return -EAGAIN; |
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index f31af713e6a4..58eabb2fa24e 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -116,8 +116,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e | |||
116 | extern struct device_node *find_devices(const char *name); | 116 | extern struct device_node *find_devices(const char *name); |
117 | extern struct device_node *find_type_devices(const char *type); | 117 | extern struct device_node *find_type_devices(const char *type); |
118 | extern struct device_node *find_path_device(const char *path); | 118 | extern struct device_node *find_path_device(const char *path); |
119 | extern struct device_node *find_compatible_devices(const char *type, | ||
120 | const char *compat); | ||
121 | extern struct device_node *find_all_nodes(void); | 119 | extern struct device_node *find_all_nodes(void); |
122 | 120 | ||
123 | /* New style node lookup */ | 121 | /* New style node lookup */ |