Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1696607 > unrolled thread
| Started by | Rob Herring <robh@kernel.org> |
|---|---|
| First post | 2017-07-25 23:50 +0200 |
| Last post | 2017-07-26 16:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/4] powerpc: pseries: only store the device node basename in full_name Rob Herring <robh@kernel.org> - 2017-07-25 23:50 +0200
RE: [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name David Laight <David.Laight@ACULAB.COM> - 2017-07-26 12:10 +0200
Re: [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name Rob Herring <robh@kernel.org> - 2017-07-26 16:40 +0200
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2017-07-25 23:50 +0200 |
| Subject | [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name |
| Message-ID | <u7fSh-8jG-13@gated-at.bofh.it> |
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
---
arch/powerpc/platforms/pseries/dlpar.c | 20 ++++----------------
arch/powerpc/platforms/pseries/reconfig.c | 2 +-
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 783f36364690..8ab0be0706fd 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -75,24 +75,17 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
return prop;
}
-static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa,
- const char *path)
+static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa)
{
struct device_node *dn;
char *name;
- /* If parent node path is "/" advance path to NULL terminator to
- * prevent double leading slashs in full_name.
- */
- if (!path[1])
- path++;
-
dn = kzalloc(sizeof(*dn), GFP_KERNEL);
if (!dn)
return NULL;
name = (char *)ccwa + be32_to_cpu(ccwa->name_offset);
- dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name);
+ dn->full_name = kasprintf(GFP_KERNEL, "%s", name);
if (!dn->full_name) {
kfree(dn);
return NULL;
@@ -148,7 +141,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
struct property *last_property = NULL;
struct cc_workarea *ccwa;
char *data_buf;
- const char *parent_path = parent->full_name;
int cc_token;
int rc = -1;
@@ -182,7 +174,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
break;
case NEXT_SIBLING:
- dn = dlpar_parse_cc_node(ccwa, parent_path);
+ dn = dlpar_parse_cc_node(ccwa);
if (!dn)
goto cc_error;
@@ -192,10 +184,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
break;
case NEXT_CHILD:
- if (first_dn)
- parent_path = last_dn->full_name;
-
- dn = dlpar_parse_cc_node(ccwa, parent_path);
+ dn = dlpar_parse_cc_node(ccwa);
if (!dn)
goto cc_error;
@@ -226,7 +215,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
case PREV_PARENT:
last_dn = last_dn->parent;
- parent_path = last_dn->parent->full_name;
break;
case CALL_AGAIN:
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index e5bf1e84047f..73e4063ad997 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -33,7 +33,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
if (!np)
goto out_err;
- np->full_name = kstrdup(path, GFP_KERNEL);
+ np->full_name = kstrdup(kbasename(path), GFP_KERNEL);
if (!np->full_name)
goto out_err;
--
2.11.0
[toc] | [next] | [standalone]
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Date | 2017-07-26 12:10 +0200 |
| Subject | RE: [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name |
| Message-ID | <u7rqq-7pw-3@gated-at.bofh.it> |
| In reply to | #1696607 |
From: Rob Herring > Sent: 25 July 2017 22:44 > 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(). ... > dn = kzalloc(sizeof(*dn), GFP_KERNEL); > if (!dn) > return NULL; > > name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); > - dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name); > + dn->full_name = kasprintf(GFP_KERNEL, "%s", name); Isn't this just strdup()? Perhaps you should rename full_name to name - since it is no longer 'full'? Maybe you could do a single malloc() for both 'dn' and the name? David
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2017-07-26 16:40 +0200 |
| Subject | Re: [PATCH 3/4] powerpc: pseries: only store the device node basename in full_name |
| Message-ID | <u7vDI-1vq-39@gated-at.bofh.it> |
| In reply to | #1696949 |
On Wed, Jul 26, 2017 at 5:07 AM, David Laight <David.Laight@aculab.com> wrote: > From: Rob Herring >> Sent: 25 July 2017 22:44 >> 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(). > ... >> dn = kzalloc(sizeof(*dn), GFP_KERNEL); >> if (!dn) >> return NULL; >> >> name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); >> - dn->full_name = kasprintf(GFP_KERNEL, "%s/%s", path, name); >> + dn->full_name = kasprintf(GFP_KERNEL, "%s", name); > > Isn't this just strdup()? Yes, it can be simplified to that now. > Perhaps you should rename full_name to name - since it is no longer 'full'? Ideally, yes. However, we still have users in other places tree wide (which should still work with the change) and I don't think it is worth the additional churn. Also, we already have "name" as that is the node name without the unit-address. I'd like to get rid of that, but name is special in that it is exposed as a property too. Finally, full_name is still the full path on Sparc. > Maybe you could do a single malloc() for both 'dn' and the name? Sure. Rob
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web