File powerpc-utils-papr.no_sysfs_hp_path.patch of Package powerpc-utils

---
 cmds/drmgr/common_pci.c       |   40 ----------------------------------------
 cmds/drmgr/drpci.h            |    1 -
 cmds/drmgr/drslot_chrp_slot.c |   16 +++++++---------
 3 files changed, 7 insertions(+), 50 deletions(-)

--- a/cmds/drmgr/common_pci.c
+++ b/cmds/drmgr/common_pci.c
@@ -61,7 +61,6 @@ alloc_node(struct dr_connector *drc, int
 	node->drc_power = drc->powerdomain;
 	node->dev_type = dev_type;
 	node->sysfs_dev_path = NULL;
-	node->sysfs_hp_path = get_sysfs_hp_path(node->drc_name);
 
 	return node;
 
@@ -478,43 +477,6 @@ done:
 	return rc;
 }
 
-#define PHP_SYSFS_PATH "/sys/bus/pci/slots"
-
-/**
- * get_sysfs_hp_path
- *
- * @param drc_name
- * @returns
- */
-char *
-get_sysfs_hp_path(char *drc_name)
-{
-	struct dirent **de_list, *de;
-	char path[DR_PATH_MAX], location[DR_BUF_SZ], *result = NULL;
-	int count, i, rc;
-
-	count = scandir(PHP_SYSFS_PATH, &de_list, 0, alphasort);
-	for (i = 0; i < count; i++) {
-		de = de_list[i];
-		if ((de->d_type != DT_DIR) || is_dot_dir(de->d_name))
-			continue;
-
-		sprintf(path, "%s/%s", PHP_SYSFS_PATH, de->d_name);
-
-		rc = get_str_attribute(path, "phy_location", &location,
-				       DR_BUF_SZ);
-		if ((rc == 0) && (!strcmp(location, drc_name))) {
-			result = strdup(path);
-			if (result == NULL)
-				err_msg("Could not allocate sysfs hp path "
-					"for %s\n", path);
-			break;
-		}
-	}
-
-	return result;
-}
-
 static inline int is_hp_type(char *type)
 {
 	return (strtoul(type, NULL, 10) > 0);
@@ -558,8 +520,6 @@ free_node(struct node *node_list)
 			free(node->ofdt_dname);
 		if (node->sysfs_dev_path)
 			free(node->sysfs_dev_path);
-		if (node->sysfs_hp_path)
-			free(node->sysfs_hp_path);
 		if (node->node_pci_info)
 			free(node->node_pci_info);
 
--- a/cmds/drmgr/drpci.h
+++ b/cmds/drmgr/drpci.h
@@ -97,7 +97,6 @@ struct node {				/* One per PCI hot plug
 	char		*ofdt_path;
 	char		*ofdt_dname;
 	char		*sysfs_dev_path;
-	char		*sysfs_hp_path;
 
 	int		skip;
 	uint32_t	dev_type;
--- a/cmds/drmgr/drslot_chrp_slot.c
+++ b/cmds/drmgr/drslot_chrp_slot.c
@@ -51,16 +51,14 @@ remove_slot(struct node *node)
 	int rc;
 	char cmd[256], *remove_path;
 
-	if (node->sysfs_hp_path) {
-		rc = disable_hp_children(node->drc_name);
-		if (rc)
-			err_msg("failed to disable hotplug children\n");
+	rc = disable_hp_children(node->drc_name);
+	if (rc)
+		err_msg("failed to disable hotplug children\n");
 
-		rc = release_hp_children(node->drc_name);
-		if (rc && rc != -EINVAL) {
-			err_msg("failed to release hotplug children\n");
-			return rc;
-		}
+	rc = release_hp_children(node->drc_name);
+	if (rc && rc != -EINVAL) {
+		err_msg("failed to release hotplug children\n");
+		return rc;
 	}
 
 	dbg("The sensor-state of drc_index 0x%x is %d\n",
openSUSE Build Service is sponsored by