[POWERPC] Remove find_compatible_devices
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 24 Apr 2007 03:48:41 +0000 (13:48 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 24 Apr 2007 12:08:57 +0000 (22:08 +1000)
This is an old interface and is replaced by of_find_compatible_node.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/prom.c
arch/powerpc/platforms/chrp/time.c
drivers/macintosh/macio-adb.c
include/asm-powerpc/prom.h

index ec6921c54a0720167f8f8c583b560a94a06b44c8..2f7e6ec215f87dc4d0ef8a05dcea483c7a9a1caf 100644 (file)
@@ -1170,30 +1170,6 @@ int machine_is_compatible(const char *compat)
 }
 EXPORT_SYMBOL(machine_is_compatible);
 
-/**
- * Construct and return a list of the device_nodes with a given type
- * and compatible property.
- */
-struct device_node *find_compatible_devices(const char *type,
-                                           const char *compat)
-{
-       struct device_node *head, **prevp, *np;
-
-       prevp = &head;
-       for (np = allnodes; np != 0; np = np->allnext) {
-               if (type != NULL
-                   && !(np->type != 0 && strcasecmp(np->type, type) == 0))
-                       continue;
-               if (of_device_is_compatible(np, compat)) {
-                       *prevp = np;
-                       prevp = &np->next;
-               }
-       }
-       *prevp = NULL;
-       return head;
-}
-EXPORT_SYMBOL(find_compatible_devices);
-
 /**
  * Find the device_node with a given full_name.
  */
index 7d7889026936a2eee1366b4ba7e6cc6b9e35923c..96d1e4b3c493f8628049891f8f54d1813e8cadaa 100644 (file)
@@ -39,12 +39,17 @@ long __init chrp_time_init(void)
        struct resource r;
        int base;
 
-       rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
+       rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
        if (rtcs == NULL)
-               rtcs = find_compatible_devices("rtc", "ds1385-rtc");
-       if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r))
+               rtcs = of_find_compatible_node(NULL, "rtc", "ds1385-rtc");
+       if (rtcs == NULL)
+               return 0;
+       if (of_address_to_resource(rtcs, 0, &r)) {
+               of_node_put(rtcs);
                return 0;
-       
+       }
+       of_node_put(rtcs);
+
        base = r.start;
        nvram_as1 = 0;
        nvram_as0 = base;
index 026b67f4f659f59fb55e9953dd87ba05952207e5..79119f56e82def706ce517bfdb8e9dcebc1eb3d3 100644 (file)
@@ -82,7 +82,14 @@ struct adb_driver macio_adb_driver = {
 
 int macio_probe(void)
 {
-       return find_compatible_devices("adb", "chrp,adb0")? 0: -ENODEV;
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, "adb", "chrp,adb0");
+       if (np) {
+               of_node_put(np);
+               return 0;
+       }
+       return -ENODEV;
 }
 
 int macio_init(void)
@@ -91,12 +98,14 @@ int macio_init(void)
        struct resource r;
        unsigned int irq;
 
-       adbs = find_compatible_devices("adb", "chrp,adb0");
+       adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
        if (adbs == 0)
                return -ENXIO;
 
-       if (of_address_to_resource(adbs, 0, &r))
+       if (of_address_to_resource(adbs, 0, &r)) {
+               of_node_put(adbs);
                return -ENXIO;
+       }
        adb = ioremap(r.start, sizeof(struct adb_regs));
 
        out_8(&adb->ctrl.r, 0);
@@ -107,6 +116,7 @@ int macio_init(void)
        out_8(&adb->autopoll.r, APE);
 
        irq = irq_of_parse_and_map(adbs, 0);
+       of_node_put(adbs);
        if (request_irq(irq, macio_adb_interrupt, 0, "ADB", (void *)0)) {
                printk(KERN_ERR "ADB: can't get irq %d\n", irq);
                return -EAGAIN;
index f31af713e6a4fc4c5b9a9edead65bb39f0faf764..58eabb2fa24eac5c2399b82cb18e674fb0dfc168 100644 (file)
@@ -116,8 +116,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
 extern struct device_node *find_devices(const char *name);
 extern struct device_node *find_type_devices(const char *type);
 extern struct device_node *find_path_device(const char *path);
-extern struct device_node *find_compatible_devices(const char *type,
-                                                  const char *compat);
 extern struct device_node *find_all_nodes(void);
 
 /* New style node lookup */