[PATCH v2 1/3] drivers/of: add of_changeset_apply_locked

2014-09-25 Thread Cyril Bur
Due to the requirement of of_changesets that of_changeset_apply be called
holding the of_mutex and that the of_mutex cannot be accessed nicely outside
the of code, added a wrapper which grabs the lock and called
of_changeset_apply.

Signed-off-by: Cyril Bur cyril@au1.ibm.com
---
 drivers/of/dynamic.c | 11 +++
 include/linux/of.h   |  1 +
 2 files changed, 12 insertions(+)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 54fecc4..cbff2a2 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -542,6 +542,17 @@ void of_changeset_destroy(struct of_changeset *ocs)
__of_changeset_entry_destroy(ce);
 }
 
+int of_changeset_apply_locked(struct of_changeset *ocs)
+{
+   int ret;
+
+   mutex_lock(of_mutex);
+   ret = of_changeset_apply(ocs);
+   mutex_unlock(of_mutex);
+
+   return ret;
+}
+
 /**
  * of_changeset_apply - Applies a changeset
  *
diff --git a/include/linux/of.h b/include/linux/of.h
index 6c4363b..f5c48fa 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -827,6 +827,7 @@ struct of_changeset {
 extern void of_changeset_init(struct of_changeset *ocs);
 extern void of_changeset_destroy(struct of_changeset *ocs);
 extern int of_changeset_apply(struct of_changeset *ocs);
+extern int of_changeset_apply_locked(struct of_changeset *ocs);
 extern int of_changeset_revert(struct of_changeset *ocs);
 extern int of_changeset_action(struct of_changeset *ocs,
unsigned long action, struct device_node *np,
-- 
1.9.1

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 1/3] drivers/of: add of_changeset_apply_locked

2014-09-25 Thread Stephen Rothwell
Hi Cyril,

Nit:

On Thu, 25 Sep 2014 16:41:28 +1000 Cyril Bur cyril@au1.ibm.com wrote:

 Due to the requirement of of_changesets that of_changeset_apply be called
 holding the of_mutex and that the of_mutex cannot be accessed nicely outside
 the of code, added a wrapper which grabs the lock and called
^^
calls

 of_changeset_apply.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


signature.asc
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 1/3] drivers/of: add of_changeset_apply_locked

2014-09-25 Thread Tyrel Datwyler
On 09/24/2014 11:41 PM, Cyril Bur wrote:
 Due to the requirement of of_changesets that of_changeset_apply be called
 holding the of_mutex and that the of_mutex cannot be accessed nicely outside
 the of code, added a wrapper which grabs the lock and called
 of_changeset_apply.
 
 Signed-off-by: Cyril Bur cyril@au1.ibm.com
 ---
  drivers/of/dynamic.c | 11 +++
  include/linux/of.h   |  1 +
  2 files changed, 12 insertions(+)

This patch needs to go through Grant Likely and the device tree list.
When unsure scripts/get_maintainer.pl can help point the way.

-Tyrel

 
 diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
 index 54fecc4..cbff2a2 100644
 --- a/drivers/of/dynamic.c
 +++ b/drivers/of/dynamic.c
 @@ -542,6 +542,17 @@ void of_changeset_destroy(struct of_changeset *ocs)
   __of_changeset_entry_destroy(ce);
  }
  
 +int of_changeset_apply_locked(struct of_changeset *ocs)
 +{
 + int ret;
 +
 + mutex_lock(of_mutex);
 + ret = of_changeset_apply(ocs);
 + mutex_unlock(of_mutex);
 +
 + return ret;
 +}
 +
  /**
   * of_changeset_apply - Applies a changeset
   *
 diff --git a/include/linux/of.h b/include/linux/of.h
 index 6c4363b..f5c48fa 100644
 --- a/include/linux/of.h
 +++ b/include/linux/of.h
 @@ -827,6 +827,7 @@ struct of_changeset {
  extern void of_changeset_init(struct of_changeset *ocs);
  extern void of_changeset_destroy(struct of_changeset *ocs);
  extern int of_changeset_apply(struct of_changeset *ocs);
 +extern int of_changeset_apply_locked(struct of_changeset *ocs);
  extern int of_changeset_revert(struct of_changeset *ocs);
  extern int of_changeset_action(struct of_changeset *ocs,
   unsigned long action, struct device_node *np,
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev