summaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2012-09-27 21:46:09 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-09-28 11:47:42 +0200
commit4d50c44381c981c9caa74e82ab894d4938dac9ca (patch)
tree58ff020b13eccd0db85c6796300dd576544b9349 /drivers/firewire
parent35202f7d8420fff586b372422a2419affeaba8ef (diff)
firewire: addendum to address handler RCU conversion
Follow up on commit c285f6ff6787 "firewire: remove global lock around address handlers, convert to RCU": - address_handler_lock no longer serializes the address handler, only its function to serialize updates to the list of handlers remains. Rename the lock to address_handler_list_lock. - Callers of fw_core_remove_address_handler() must be able to sleep. Comment on this in the API documentation. - The counterpart fw_core_add_address_handler() is by nature something which is used in process context. Replace spin_lock_bh() by spin_lock() in fw_core_add_address_handler() and in fw_core_remove_address_handler(), and document that process context is now required for fw_core_add_address_handler(). - Extend the documentation of fw_address_callback_t. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-transaction.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index d39cfa45817..28a94c7ec6e 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -519,7 +519,7 @@ static struct fw_address_handler *lookup_enclosing_address_handler(
return NULL;
}
-static DEFINE_SPINLOCK(address_handler_lock);
+static DEFINE_SPINLOCK(address_handler_list_lock);
static LIST_HEAD(address_handler_list);
const struct fw_address_region fw_high_memory_region =
@@ -556,6 +556,7 @@ static bool is_in_fcp_region(u64 offset, size_t length)
* the specified callback is invoked. The parameters passed to the callback
* give the details of the particular request.
*
+ * To be called in process context.
* Return value: 0 on success, non-zero otherwise.
*
* The start offset of the handler's address region is determined by
@@ -576,7 +577,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
handler->length == 0)
return -EINVAL;
- spin_lock_bh(&address_handler_lock);
+ spin_lock(&address_handler_list_lock);
handler->offset = region->start;
while (handler->offset + handler->length <= region->end) {
@@ -595,7 +596,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
}
}
- spin_unlock_bh(&address_handler_lock);
+ spin_unlock(&address_handler_list_lock);
return ret;
}
@@ -604,14 +605,16 @@ EXPORT_SYMBOL(fw_core_add_address_handler);
/**
* fw_core_remove_address_handler() - unregister an address handler
*
+ * To be called in process context.
+ *
* When fw_core_remove_address_handler() returns, @handler->callback() is
* guaranteed to not run on any CPU anymore.
*/
void fw_core_remove_address_handler(struct fw_address_handler *handler)
{
- spin_lock_bh(&address_handler_lock);
+ spin_lock(&address_handler_list_lock);
list_del_rcu(&handler->link);
- spin_unlock_bh(&address_handler_lock);
+ spin_unlock(&address_handler_list_lock);
synchronize_rcu();
}
EXPORT_SYMBOL(fw_core_remove_address_handler);