Skip to content

Commit 0666598

Browse files
committed
powerpc: pseries: only store the device node basename in full_name
With dependencies on full_name containing the entire device node path removed, stop storing the full_name in nodes created by dlpar_configure_connector() and pSeries_reconfig_add_node(). Signed-off-by: Rob Herring <robh@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: linuxppc-dev@lists.ozlabs.org
1 parent 2bd6bf0 commit 0666598

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

‎arch/powerpc/platforms/pseries/dlpar.c‎

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,17 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
7575
return prop;
7676
}
7777

78-
static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa,
79-
const char *path)
78+
static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa)
8079
{
8180
struct device_node *dn;
82-
char *name;
83-
84-
/* If parent node path is "/" advance path to NULL terminator to
85-
* prevent double leading slashs in full_name.
86-
*/
87-
if (!path[1])
88-
path++;
81+
const char *name;
8982

9083
dn = kzalloc(sizeof(*dn), GFP_KERNEL);
9184
if (!dn)
9285
return NULL;
9386

94-
name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
95-
dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name);
87+
name = (const char *)ccwa + be32_to_cpu(ccwa->name_offset);
88+
dn->full_name = kstrdup(name, GFP_KERNEL);
9689
if (!dn->full_name) {
9790
kfree(dn);
9891
return NULL;
@@ -148,7 +141,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
148141
struct property *last_property = NULL;
149142
struct cc_workarea *ccwa;
150143
char *data_buf;
151-
const char *parent_path = parent->full_name;
152144
int cc_token;
153145
int rc = -1;
154146

@@ -182,7 +174,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
182174
break;
183175

184176
case NEXT_SIBLING:
185-
dn = dlpar_parse_cc_node(ccwa, parent_path);
177+
dn = dlpar_parse_cc_node(ccwa);
186178
if (!dn)
187179
goto cc_error;
188180

@@ -192,10 +184,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
192184
break;
193185

194186
case NEXT_CHILD:
195-
if (first_dn)
196-
parent_path = last_dn->full_name;
197-
198-
dn = dlpar_parse_cc_node(ccwa, parent_path);
187+
dn = dlpar_parse_cc_node(ccwa);
199188
if (!dn)
200189
goto cc_error;
201190

@@ -226,7 +215,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
226215

227216
case PREV_PARENT:
228217
last_dn = last_dn->parent;
229-
parent_path = last_dn->parent->full_name;
230218
break;
231219

232220
case CALL_AGAIN:

‎arch/powerpc/platforms/pseries/reconfig.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
3333
if (!np)
3434
goto out_err;
3535

36-
np->full_name = kstrdup(path, GFP_KERNEL);
36+
np->full_name = kstrdup(kbasename(path), GFP_KERNEL);
3737
if (!np->full_name)
3838
goto out_err;
3939

0 commit comments

Comments
 (0)