diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-19 21:56:35 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-24 20:33:55 -0700 |
commit | 2481d76615d5e15340ccfb0243fe8779766dfc6e (patch) | |
tree | 2d047756426224d741388b4c557151f9a7cb8335 /arch/sparc64 | |
parent | 072bd413b88c17509c7aa7dbc398ab8bade633b3 (diff) |
sparc: Add mutex for set property calls.
On some platforms, the I2C controller is shared between the OS and
OBP. OBP uses this I2C controller to access the EEPROM, and thus is
programmed when the kernel calls prom_setprop().
Wrap such calls with the new of_set_property_mutex.
Relevant I2C bus drivers can grab this mutex around top-level I2C
operations to provide the proper protection.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/prom.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c index 3c048ac4e63..922dd612612 100644 --- a/arch/sparc64/kernel/prom.c +++ b/arch/sparc64/kernel/prom.c @@ -59,6 +59,9 @@ int of_getintprop_default(struct device_node *np, const char *name, int def) } EXPORT_SYMBOL(of_getintprop_default); +DEFINE_MUTEX(of_set_property_mutex); +EXPORT_SYMBOL(of_set_property_mutex); + int of_set_property(struct device_node *dp, const char *name, void *val, int len) { struct property **prevp; @@ -82,7 +85,10 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len void *old_val = prop->value; int ret; + mutex_lock(&of_set_property_mutex); ret = prom_setprop(dp->node, name, val, len); + mutex_unlock(&of_set_property_mutex); + err = -EINVAL; if (ret >= 0) { prop->value = new_val; |