21850880 pciaccess device tree walk: di_init() on nexus nodes unnecessary s12_85
authorhenryzh <henry.zhao@oracle.com>
Wed, 23 Sep 2015 12:15:33 -0700
changeset 1574 b4cf47ee40af
parent 1573 596209d216bd
child 1575 c7e9d0d38fad
21850880 pciaccess device tree walk: di_init() on nexus nodes unnecessary
open-src/lib/libpciaccess/21850880.patch
open-src/lib/libpciaccess/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/lib/libpciaccess/21850880.patch	Wed Sep 23 12:15:33 2015 -0700
@@ -0,0 +1,61 @@
+--- src/solx_devfs.c	Wed Aug 26 15:55:42 2015
++++ src/solx_devfs.c	Wed Aug 26 15:57:15 2015
+@@ -62,7 +62,7 @@
+     int first_bus;
+     int last_bus;
+     int domain;
+-    char *path;			/* for errors/debugging; fd is all we need */
++    char *path;			/* for open */
+     char *dev_path;
+     struct nexus *next;
+ } nexus_t;
+@@ -294,7 +294,6 @@
+     int pci_node = 0;
+     int first_bus = 0, last_bus = PCI_REG_BUS_G(PCI_REG_BUS_M);
+     int domain = 0;
+-    di_node_t rnode =  DI_NODE_NIL;
+ #ifdef __sparc
+     int bus_range_found = 0;
+     int device_type_found = 0;
+@@ -420,21 +419,12 @@
+ 	nexus->dev_path = strdup(nexus_dev_path);
+ 	di_devfs_path_free(nexus_dev_path);
+ 
+-	if ((rnode = di_init(nexus->dev_path, DINFOCPYALL)) == DI_NODE_NIL) {
+-	    (void) fprintf(stderr, "di_init failed: %s\n", strerror(errno));
+-	    close(fd);
+-	    free(nexus->path);
+-	    free(nexus->dev_path);
+-	    free(nexus);
+-	    return (DI_WALK_TERMINATE);
+-	}
+-
+ 	/* Walk through devices under the rnode */
+ 	args.pinfo = pinfo;
+ 	args.nexus = nexus;
+ 	args.ret = 0;
+ 
+-	(void) di_walk_node(rnode, DI_WALK_CLDFIRST, (void *)&args, probe_device_node);
++	(void) di_walk_node(di_node, DI_WALK_CLDFIRST, (void *)&args, probe_device_node);
+ 
+ 	close(fd);
+ 
+@@ -442,7 +432,6 @@
+ 	    free(nexus->path);
+ 	    free(nexus->dev_path);
+ 	    free(nexus);
+-	    di_fini(rnode);
+ 	    return (DI_WALK_TERMINATE);
+ 	}
+ 
+@@ -454,10 +443,6 @@
+ 	free(nexus);
+     }
+ 
+-    if (rnode != DI_NODE_NIL) {
+-	di_fini(rnode);
+-    }
+-
+     return DI_WALK_CONTINUE;
+ }
+ 
--- a/open-src/lib/libpciaccess/Makefile	Wed Sep 23 11:19:48 2015 -0700
+++ b/open-src/lib/libpciaccess/Makefile	Wed Sep 23 12:15:33 2015 -0700
@@ -37,7 +37,8 @@
 
 # Patches to apply to source after unpacking, in order
 SOURCE_PATCHES = scanpci.man.patch \
-		21510615.patch
+		21510615.patch \
+		21850880.patch
 
 # Library name
 LIBNAME=libpciaccess