From: Pantelis Antoniou <panto@antoniou-consulting.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>,
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,
Pantelis Antoniou <panto@antoniou-consulting.com>
Subject: [PATCH v4 4/5] OF: Export all DT proc update functions
Date: Fri, 8 Nov 2013 17:03:59 +0200 [thread overview]
Message-ID: <1383923040-24803-5-git-send-email-panto@antoniou-consulting.com> (raw)
In-Reply-To: <1383923040-24803-1-git-send-email-panto@antoniou-consulting.com>
There are other users for the proc DT functions.
Export them.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/of/base.c | 70 ++++++++++++++++++++++++++++++------------------------
include/linux/of.h | 29 ++++++++++++++++++++++
2 files changed, 68 insertions(+), 31 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6603795..9c4afb5 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1436,6 +1436,40 @@ int of_property_notify(int action, struct device_node *np,
EXPORT_SYMBOL(of_property_notify);
#endif
+#ifdef CONFIG_PROC_DEVICETREE
+
+void of_add_proc_dt_entry(struct device_node *dn)
+{
+ struct proc_dir_entry *ent;
+
+ ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
+ if (ent)
+ proc_device_tree_add_node(dn, ent);
+}
+
+void of_add_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop)
+{
+ if (np && prop && np->pde)
+ proc_device_tree_add_prop(np->pde, prop);
+}
+
+void of_remove_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop)
+{
+ if (np && prop && np->pde)
+ proc_device_tree_remove_prop(np->pde, prop);
+}
+
+void of_update_proc_dt_prop_entry(struct device_node *np,
+ struct property *newprop, struct property *oldprop)
+{
+ if (np && newprop && oldprop && np->pde)
+ proc_device_tree_update_prop(np->pde, newprop, oldprop);
+}
+
+#endif /* CONFIG_PROC_DEVICETREE */
+
/**
* of_add_property - Add a property to a node
*/
@@ -1463,11 +1497,8 @@ int of_add_property(struct device_node *np, struct property *prop)
*next = prop;
raw_spin_unlock_irqrestore(&devtree_lock, flags);
-#ifdef CONFIG_PROC_DEVICETREE
/* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_add_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
+ of_add_proc_dt_prop_entry(np, prop);
return 0;
}
@@ -1509,11 +1540,7 @@ int of_remove_property(struct device_node *np, struct property *prop)
if (!found)
return -ENODEV;
-#ifdef CONFIG_PROC_DEVICETREE
- /* try to remove the proc node as well */
- if (np->pde)
- proc_device_tree_remove_prop(np->pde, prop);
-#endif /* CONFIG_PROC_DEVICETREE */
+ of_remove_proc_dt_prop_entry(np, prop);
return 0;
}
@@ -1563,11 +1590,8 @@ int of_update_property(struct device_node *np, struct property *newprop)
if (!found)
return -ENODEV;
-#ifdef CONFIG_PROC_DEVICETREE
/* try to add to proc as well if it was initialized */
- if (np->pde)
- proc_device_tree_update_prop(np->pde, newprop, oldprop);
-#endif /* CONFIG_PROC_DEVICETREE */
+ of_update_proc_dt_prop_entry(np, newprop, oldprop);
return 0;
}
@@ -1603,22 +1627,6 @@ int of_reconfig_notify(unsigned long action, void *p)
return notifier_to_errno(rc);
}
-#ifdef CONFIG_PROC_DEVICETREE
-static void of_add_proc_dt_entry(struct device_node *dn)
-{
- struct proc_dir_entry *ent;
-
- ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
- if (ent)
- proc_device_tree_add_node(dn, ent);
-}
-#else
-static void of_add_proc_dt_entry(struct device_node *dn)
-{
- return;
-}
-#endif
-
/**
* of_attach_node - Plug a device node into the tree and global list.
*/
@@ -1644,12 +1652,12 @@ int of_attach_node(struct device_node *np)
}
#ifdef CONFIG_PROC_DEVICETREE
-static void of_remove_proc_dt_entry(struct device_node *dn)
+void of_remove_proc_dt_entry(struct device_node *dn)
{
proc_remove(dn->pde);
}
#else
-static void of_remove_proc_dt_entry(struct device_node *dn)
+void of_remove_proc_dt_entry(struct device_node *dn)
{
return;
}
diff --git a/include/linux/of.h b/include/linux/of.h
index 6fec255..a56c450 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -318,6 +318,35 @@ static inline int of_property_notify(int action, struct device_node *np,
}
#endif
+#ifdef CONFIG_PROC_DEVICETREE
+
+extern void of_add_proc_dt_entry(struct device_node *dn);
+extern void of_remove_proc_dt_entry(struct device_node *dn);
+
+extern void of_add_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop);
+
+extern void of_remove_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop);
+
+extern void of_update_proc_dt_prop_entry(struct device_node *np,
+ struct property *newprop, struct property *oldprop);
+#else
+
+static inline void of_add_proc_dt_entry(struct device_node *dn) { }
+static inline void of_remove_proc_dt_entry(struct device_node *dn) { }
+
+static inline void of_add_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop) { }
+
+static inline void of_remove_proc_dt_prop_entry(struct device_node *np,
+ struct property *prop) { }
+
+static inline void of_update_proc_dt_prop_entry(struct device_node *np,
+ struct property *newprop, struct property *oldprop) { }
+
+#endif
+
extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
extern int of_alias_get_id(struct device_node *np, const char *stem);
--
1.7.12
next prev parent reply other threads:[~2013-11-08 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-08 15:03 [PATCH v4 0/5] OF: Fixes in preperation of DT overlays Pantelis Antoniou
2013-11-08 15:03 ` [PATCH v4 1/5] OF: Introduce device tree node flag helpers Pantelis Antoniou
2013-11-08 15:03 ` [PATCH v4 2/5] OF: Clear detach flag on attach Pantelis Antoniou
2013-11-08 15:03 ` [PATCH v4 3/5] OF: export of_property_notify Pantelis Antoniou
2013-11-08 15:03 ` Pantelis Antoniou [this message]
2013-11-08 15:04 ` [PATCH v4 5/5] OF: Introduce utility helper functions Pantelis Antoniou
2013-11-08 19:10 ` Guenter Roeck
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=1383923040-24803-5-git-send-email-panto@antoniou-consulting.com \
--to=panto@antoniou-consulting.com \
--cc=Alison_Chaiken@mentor.com \
--cc=alexander.sverdlin@nsn.com \
--cc=delicious.quinoa@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dinh.linux@gmail.com \
--cc=dirk.behme@gmail.com \
--cc=grant.likely@secretlab.ca \
--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=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®