From: "Clément Léger" <clement.leger@bootlin.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Nathan Lynch <nathanl@linux.ibm.com>,
Laurent Dufour <ldufour@linux.ibm.com>,
Daniel Henrique Barboza <danielhb413@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Ohhoon Kwon <ohoono.kwon@samsung.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
YueHaibing <yuehaibing@huawei.com>
Cc: "Clément Léger" <clement.leger@bootlin.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org,
"Allan Nielsen" <allan.nielsen@microchip.com>,
"Horatiu Vultur" <horatiu.vultur@microchip.com>,
"Steen Hegelund" <steen.hegelund@microchip.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Lizhi Hou" <lizhi.hou@xilinx.com>
Subject: [PATCH v3 2/5] of: remove __of_node_dup() allocflags parameter
Date: Mon, 20 Jun 2022 12:41:20 +0200 [thread overview]
Message-ID: <20220620104123.341054-3-clement.leger@bootlin.com> (raw)
In-Reply-To: <20220620104123.341054-1-clement.leger@bootlin.com>
The alloclags are always set to GFP_KERNEL so remove this specific flag.
Moreover, this function is going to be based on one that does not
provides passing gfp flags, so be prepared for this.
Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
drivers/of/dynamic.c | 9 ++++-----
drivers/of/of_private.h | 2 +-
drivers/of/overlay.c | 2 +-
drivers/of/unittest.c | 16 ++++++++--------
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index cd3821a6444f..5560e501aedf 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -369,7 +369,6 @@ void of_node_release(struct kobject *kobj)
/**
* __of_prop_dup - Copy a property dynamically.
* @prop: Property to copy
- * @allocflags: Allocation flags (typically pass GFP_KERNEL)
*
* Copy a property by dynamically allocating the memory of both the
* property structure and the property name & contents. The property's
@@ -378,11 +377,11 @@ void of_node_release(struct kobject *kobj)
*
* Return: The newly allocated property or NULL on out of memory error.
*/
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
+struct property *__of_prop_dup(const struct property *prop)
{
struct property *new;
- new = kzalloc(sizeof(*new), allocflags);
+ new = kzalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return NULL;
@@ -392,8 +391,8 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
* of zero bytes. We do this to work around the use
* of of_get_property() calls on boolean values.
*/
- new->name = kstrdup(prop->name, allocflags);
- new->value = kmemdup(prop->value, prop->length, allocflags);
+ new->name = kstrdup(prop->name, GFP_KERNEL);
+ new->value = kmemdup(prop->value, prop->length, GFP_KERNEL);
new->length = prop->length;
if (!new->name || !new->value)
goto err_free;
diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
index 9324483397f6..e319d8c2bf8b 100644
--- a/drivers/of/of_private.h
+++ b/drivers/of/of_private.h
@@ -115,7 +115,7 @@ extern void *__unflatten_device_tree(const void *blob,
* without taking node references, so you either have to
* own the devtree lock or work on detached trees only.
*/
-struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags);
+struct property *__of_prop_dup(const struct property *prop);
struct device_node *__of_node_dup(const struct device_node *np,
const char *full_name);
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 4044ddcb02c6..9c026bcbf6ab 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -339,7 +339,7 @@ static int add_changeset_property(struct overlay_changeset *ovcs,
return -EINVAL;
new_prop = dup_and_fixup_symbol_prop(ovcs, overlay_prop);
} else {
- new_prop = __of_prop_dup(overlay_prop, GFP_KERNEL);
+ new_prop = __of_prop_dup(overlay_prop);
}
if (!new_prop)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 7f6bba18c515..23ccb74ef408 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -772,13 +772,13 @@ static void __init of_unittest_property_copy(void)
struct property p2 = { .name = "p2", .length = 5, .value = "abcd" };
struct property *new;
- new = __of_prop_dup(&p1, GFP_KERNEL);
+ new = __of_prop_dup(&p1);
unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n");
kfree(new->value);
kfree(new->name);
kfree(new);
- new = __of_prop_dup(&p2, GFP_KERNEL);
+ new = __of_prop_dup(&p2);
unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n");
kfree(new->value);
kfree(new->name);
@@ -811,19 +811,19 @@ static void __init of_unittest_changeset(void)
nremove = of_get_child_by_name(nchangeset, "node-remove");
unittest(nremove, "testcase setup failure\n");
- ppadd = __of_prop_dup(&padd, GFP_KERNEL);
+ ppadd = __of_prop_dup(&padd);
unittest(ppadd, "testcase setup failure\n");
- ppname_n1 = __of_prop_dup(&pname_n1, GFP_KERNEL);
+ ppname_n1 = __of_prop_dup(&pname_n1);
unittest(ppname_n1, "testcase setup failure\n");
- ppname_n2 = __of_prop_dup(&pname_n2, GFP_KERNEL);
+ ppname_n2 = __of_prop_dup(&pname_n2);
unittest(ppname_n2, "testcase setup failure\n");
- ppname_n21 = __of_prop_dup(&pname_n21, GFP_KERNEL);
+ ppname_n21 = __of_prop_dup(&pname_n21);
unittest(ppname_n21, "testcase setup failure\n");
- ppupdate = __of_prop_dup(&pupdate, GFP_KERNEL);
+ ppupdate = __of_prop_dup(&pupdate);
unittest(ppupdate, "testcase setup failure\n");
parent = nchangeset;
@@ -3333,7 +3333,7 @@ static __init void of_unittest_overlay_high_level(void)
struct property *new_prop;
for_each_property_of_node(overlay_base_symbols, prop) {
- new_prop = __of_prop_dup(prop, GFP_KERNEL);
+ new_prop = __of_prop_dup(prop);
if (!new_prop) {
unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__",
prop->name);
--
2.36.1
next prev parent reply other threads:[~2022-06-20 10:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 10:41 [PATCH v3 0/5] of: add of_property_alloc/free() and of_node_alloc() Clément Léger
2022-06-20 10:41 ` [PATCH v3 1/5] of: constify of_property_check_flags() prop argument Clément Léger
2022-06-27 17:19 ` Rob Herring
2022-06-20 10:41 ` Clément Léger [this message]
2022-06-21 17:15 ` [PATCH v3 2/5] of: remove __of_node_dup() allocflags parameter Bjorn Helgaas
2022-06-20 10:41 ` [PATCH v3 3/5] of: dynamic: add of_property_alloc() and of_property_free() Clément Léger
2022-06-20 10:41 ` [PATCH v3 4/5] of: dynamic: add of_node_alloc() Clément Léger
2022-06-20 10:41 ` [PATCH v3 5/5] powerpc/pseries: use of_property_alloc/free() and of_node_alloc() Clément Léger
[not found] ` <a6068e53-80ea-600b-0b54-0a1d0c784c54@csgroup.eu>
2022-06-29 7:30 ` Clément Léger
2022-06-24 4:02 ` [PATCH v3 0/5] of: add " Frank Rowand
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=20220620104123.341054-3-clement.leger@bootlin.com \
--to=clement.leger@bootlin.com \
--cc=akpm@linux-foundation.org \
--cc=allan.nielsen@microchip.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=helgaas@kernel.org \
--cc=horatiu.vultur@microchip.com \
--cc=ldufour@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lizhi.hou@xilinx.com \
--cc=mpe@ellerman.id.au \
--cc=nathanl@linux.ibm.com \
--cc=ohoono.kwon@samsung.com \
--cc=paulus@samba.org \
--cc=robh+dt@kernel.org \
--cc=steen.hegelund@microchip.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=yuehaibing@huawei.com \
/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
all inboxes | Powered by JetHome®