From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <robherring2@gmail.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Matt Porter <matt.porter@linaro.org>,
Koen Kooi <koen@dominion.thruhere.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alison Chaiken <Alison_Chaiken@mentor.com>,
Dinh Nguyen <dinh.linux@gmail.com>, Jan Lubbe <jluebbe@lasnet.de>,
Alexander Sverdlin <alexander.sverdlin@nsn.com>,
Michael Stickel <ms@mycable.de>,
Guenter Roeck <linux@roeck-us.net>,
Dirk Behme <dirk.behme@gmail.com>,
Alan Tull <delicious.quinoa@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Michael Bohan <mbohan@codeaurora.org>,
Ionut Nicu <ioan.nicu.ext@nsn.com>,
Michal Simek <monstr@monstr.eu>,
Matt Ranostay <mranostay@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Pete Popov <pete.popov@konsulko.com>,
Dan Malek <dan.malek@konsulko.com>,
Georgi Vlaev <georgi.vlaev@konsulko.com>,
Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
Pantelis Antoniou <panto@antoniou-consulting.com>
Subject: [PATCH 3/5] of: Only call notifiers when node is attached
Date: Tue, 28 Oct 2014 22:33:51 +0200 [thread overview]
Message-ID: <1414528433-9650-4-git-send-email-pantelis.antoniou@konsulko.com> (raw)
In-Reply-To: <1414528433-9650-1-git-send-email-pantelis.antoniou@konsulko.com>
Make sure we call notifier only when the node is attached.
When a detatched tree is being constructed we do not want the
notifiers to fire at all.
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
---
drivers/of/base.c | 9 ++++++---
drivers/of/dynamic.c | 5 +----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2305dc0..a79d4ee 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1695,7 +1695,8 @@ int of_add_property(struct device_node *np, struct property *prop)
mutex_unlock(&of_mutex);
- if (!rc)
+ /* only call notifiers if the node is attached and no error occurred */
+ if (of_node_is_attached(np) && !rc)
of_property_notify(OF_RECONFIG_ADD_PROPERTY, np, prop, NULL);
return rc;
@@ -1754,7 +1755,8 @@ int of_remove_property(struct device_node *np, struct property *prop)
mutex_unlock(&of_mutex);
- if (!rc)
+ /* only call notifiers if the node is attached and no error occurred */
+ if (of_node_is_attached(np) && !rc)
of_property_notify(OF_RECONFIG_REMOVE_PROPERTY, np, prop, NULL);
return rc;
@@ -1830,7 +1832,8 @@ int of_update_property(struct device_node *np, struct property *newprop)
mutex_unlock(&of_mutex);
- if (!rc)
+ /* only call notifiers if the node is attached and no error occurred */
+ if (of_node_is_attached(np) && !rc)
of_property_notify(OF_RECONFIG_UPDATE_PROPERTY, np, newprop, oldprop);
return rc;
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index f297891..8e8b614 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -90,10 +90,6 @@ int of_property_notify(int action, struct device_node *np,
{
struct of_prop_reconfig pr;
- /* only call notifiers if the node is attached */
- if (!of_node_is_attached(np))
- return 0;
-
pr.dn = np;
pr.prop = prop;
pr.old_prop = oldprop;
@@ -138,6 +134,7 @@ int of_attach_node(struct device_node *np)
__of_attach_node_sysfs(np);
mutex_unlock(&of_mutex);
+ /* node is guaranteed to be attached at this point */
of_reconfig_notify(OF_RECONFIG_ATTACH_NODE, np);
return 0;
--
1.7.12
next prev parent reply other threads:[~2014-10-28 20:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 20:33 [PATCH 0/5] of: Resolver and dynamic updates Pantelis Antoniou
2014-10-28 20:33 ` [PATCH 1/5] of: resolver: Switch to new local fixups format Pantelis Antoniou
2014-10-28 20:33 ` [PATCH 2/5] of: testcases: Update with " Pantelis Antoniou
2014-10-28 20:33 ` Pantelis Antoniou [this message]
2014-11-05 21:39 ` [PATCH 3/5] of: Only call notifiers when node is attached Grant Likely
2014-11-06 12:33 ` Pantelis Antoniou
2014-11-06 12:47 ` Grant Likely
2014-10-28 20:33 ` [PATCH 4/5] of: Add old prop argument on OF_RECONFIG_UPDATE_PROPERTY Pantelis Antoniou
2014-11-05 20:01 ` Grant Likely
2014-11-05 20:08 ` Pantelis Antoniou
2014-11-06 12:46 ` Grant Likely
2014-11-06 13:14 ` Pantelis Antoniou
2014-10-28 20:33 ` [PATCH 5/5] of: of_reconfig_get_state_change() of notifier helper Pantelis Antoniou
2014-11-05 20:07 ` Grant Likely
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=1414528433-9650-4-git-send-email-pantelis.antoniou@konsulko.com \
--to=pantelis.antoniou@konsulko.com \
--cc=Alison_Chaiken@mentor.com \
--cc=alexander.sverdlin@nsn.com \
--cc=dan.malek@konsulko.com \
--cc=delicious.quinoa@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dinh.linux@gmail.com \
--cc=dirk.behme@gmail.com \
--cc=georgi.vlaev@konsulko.com \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=ioan.nicu.ext@nsn.com \
--cc=jluebbe@lasnet.de \
--cc=koen@dominion.thruhere.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=matt.porter@linaro.org \
--cc=mbohan@codeaurora.org \
--cc=monstr@monstr.eu \
--cc=mranostay@gmail.com \
--cc=ms@mycable.de \
--cc=panto@antoniou-consulting.com \
--cc=pete.popov@konsulko.com \
--cc=robherring2@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=swarren@wwwdotorg.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
all inboxes | Powered by JetHome®