From: Pingfan Liu <kernelfans@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Andrew Donnellan <ajd@linux.ibm.com>,
kexec@lists.infradead.org, Pingfan Liu <kernelfans@gmail.com>,
Paul Mackerras <paulus@samba.org>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
Oliver O'Halloran <oohall@gmail.com>,
Dan Williams <dan.j.williams@intel.com>,
Hari Bathini <hbathini@linux.ibm.com>
Subject: [PATCHv2 1/2] powerpc/of: split out new_property() for reusing
Date: Fri, 28 Feb 2020 17:41:34 +0800 [thread overview]
Message-ID: <1582882895-3142-1-git-send-email-kernelfans@gmail.com> (raw)
Splitting out new_property() for coming reusing and moving it to
of_helpers.c.
Also do some coding style cleanup.
Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Oliver O'Halloran <oohall@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Andrew Donnellan <ajd@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: kexec@lists.infradead.org
---
arch/powerpc/platforms/pseries/of_helpers.c | 28 ++++++++++++++++++++++++++++
arch/powerpc/platforms/pseries/of_helpers.h | 3 +++
arch/powerpc/platforms/pseries/reconfig.c | 26 --------------------------
3 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/of_helpers.c b/arch/powerpc/platforms/pseries/of_helpers.c
index 66dfd82..1022e0f 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.c
+++ b/arch/powerpc/platforms/pseries/of_helpers.c
@@ -7,6 +7,34 @@
#include "of_helpers.h"
+struct property *new_property(const char *name, const int length,
+ const unsigned char *value, struct property *last)
+{
+ struct property *new = kzalloc(sizeof(*new), GFP_KERNEL);
+
+ if (!new)
+ return NULL;
+
+ new->name = kstrdup(name, GFP_KERNEL);
+ if (!new->name)
+ goto cleanup;
+ new->value = kmalloc(length + 1, GFP_KERNEL);
+ if (!new->value)
+ goto cleanup;
+
+ memcpy(new->value, value, length);
+ *(((char *)new->value) + length) = 0;
+ new->length = length;
+ new->next = last;
+ return new;
+
+cleanup:
+ kfree(new->name);
+ kfree(new->value);
+ kfree(new);
+ return NULL;
+}
+
/**
* pseries_of_derive_parent - basically like dirname(1)
* @path: the full_name of a node to be added to the tree
diff --git a/arch/powerpc/platforms/pseries/of_helpers.h b/arch/powerpc/platforms/pseries/of_helpers.h
index decad65..34add82 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.h
+++ b/arch/powerpc/platforms/pseries/of_helpers.h
@@ -4,6 +4,9 @@
#include <linux/of.h>
+struct property *new_property(const char *name, const int length,
+ const unsigned char *value, struct property *last);
+
struct device_node *pseries_of_derive_parent(const char *path);
#endif /* _PSERIES_OF_HELPERS_H */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 7f7369f..8e5a2ba 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -165,32 +165,6 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
return tmp;
}
-static struct property *new_property(const char *name, const int length,
- const unsigned char *value, struct property *last)
-{
- struct property *new = kzalloc(sizeof(*new), GFP_KERNEL);
-
- if (!new)
- return NULL;
-
- if (!(new->name = kstrdup(name, GFP_KERNEL)))
- goto cleanup;
- if (!(new->value = kmalloc(length + 1, GFP_KERNEL)))
- goto cleanup;
-
- memcpy(new->value, value, length);
- *(((char *)new->value) + length) = 0;
- new->length = length;
- new->next = last;
- return new;
-
-cleanup:
- kfree(new->name);
- kfree(new->value);
- kfree(new);
- return NULL;
-}
-
static int do_add_node(char *buf, size_t bufsize)
{
char *path, *end, *name;
--
2.7.5
next reply other threads:[~2020-02-28 9:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 9:41 Pingfan Liu [this message]
2020-02-28 9:41 ` [PATCHv2 2/2] pSeries/papr_scm: buffer pmem's bound addr in dt for kexec kernel Pingfan Liu
2020-03-04 8:47 ` [PATCHv3 0/2] pseries/scm: " Pingfan Liu
2020-03-04 8:47 ` [PATCHv3 1/2] powerpc/of: split out new_property() for reusing Pingfan Liu
2020-03-05 3:58 ` Andrew Donnellan
2020-03-06 19:59 ` Nathan Lynch
2020-03-09 1:50 ` Pingfan Liu
2020-03-04 8:47 ` [PATCHv3 2/2] pseries/scm: buffer pmem's bound addr in dt for kexec kernel Pingfan Liu
2020-03-13 3:17 ` Oliver O'Halloran
2020-03-16 2:49 ` Pingfan Liu
2020-03-16 2:53 ` Aneesh Kumar K.V
2020-03-16 8:37 ` Pingfan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1582882895-3142-1-git-send-email-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=ajd@linux.ibm.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=hbathini@linux.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=oohall@gmail.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).