diff options
-rw-r--r-- | drivers/firewire/core-transaction.c | 13 | ||||
-rw-r--r-- | include/linux/firewire.h | 12 |
2 files changed, 18 insertions, 7 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index d39cfa45817a..28a94c7ec6e5 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( | |||
519 | return NULL; | 519 | return NULL; |
520 | } | 520 | } |
521 | 521 | ||
522 | static DEFINE_SPINLOCK(address_handler_lock); | 522 | static DEFINE_SPINLOCK(address_handler_list_lock); |
523 | static LIST_HEAD(address_handler_list); | 523 | static LIST_HEAD(address_handler_list); |
524 | 524 | ||
525 | const struct fw_address_region fw_high_memory_region = | 525 | const struct fw_address_region fw_high_memory_region = |
@@ -556,6 +556,7 @@ static bool is_in_fcp_region(u64 offset, size_t length) | |||
556 | * the specified callback is invoked. The parameters passed to the callback | 556 | * the specified callback is invoked. The parameters passed to the callback |
557 | * give the details of the particular request. | 557 | * give the details of the particular request. |
558 | * | 558 | * |
559 | * To be called in process context. | ||
559 | * Return value: 0 on success, non-zero otherwise. | 560 | * Return value: 0 on success, non-zero otherwise. |
560 | * | 561 | * |
561 | * The start offset of the handler's address region is determined by | 562 | * 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, | |||
576 | handler->length == 0) | 577 | handler->length == 0) |
577 | return -EINVAL; | 578 | return -EINVAL; |
578 | 579 | ||
579 | spin_lock_bh(&address_handler_lock); | 580 | spin_lock(&address_handler_list_lock); |
580 | 581 | ||
581 | handler->offset = region->start; | 582 | handler->offset = region->start; |
582 | while (handler->offset + handler->length <= region->end) { | 583 | while (handler->offset + handler->length <= region->end) { |
@@ -595,7 +596,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler, | |||
595 | } | 596 | } |
596 | } | 597 | } |
597 | 598 | ||
598 | spin_unlock_bh(&address_handler_lock); | 599 | spin_unlock(&address_handler_list_lock); |
599 | 600 | ||
600 | return ret; | 601 | return ret; |
601 | } | 602 | } |
@@ -604,14 +605,16 @@ EXPORT_SYMBOL(fw_core_add_address_handler); | |||
604 | /** | 605 | /** |
605 | * fw_core_remove_address_handler() - unregister an address handler | 606 | * fw_core_remove_address_handler() - unregister an address handler |
606 | * | 607 | * |
608 | * To be called in process context. | ||
609 | * | ||
607 | * When fw_core_remove_address_handler() returns, @handler->callback() is | 610 | * When fw_core_remove_address_handler() returns, @handler->callback() is |
608 | * guaranteed to not run on any CPU anymore. | 611 | * guaranteed to not run on any CPU anymore. |
609 | */ | 612 | */ |
610 | void fw_core_remove_address_handler(struct fw_address_handler *handler) | 613 | void fw_core_remove_address_handler(struct fw_address_handler *handler) |
611 | { | 614 | { |
612 | spin_lock_bh(&address_handler_lock); | 615 | spin_lock(&address_handler_list_lock); |
613 | list_del_rcu(&handler->link); | 616 | list_del_rcu(&handler->link); |
614 | spin_unlock_bh(&address_handler_lock); | 617 | spin_unlock(&address_handler_list_lock); |
615 | synchronize_rcu(); | 618 | synchronize_rcu(); |
616 | } | 619 | } |
617 | EXPORT_SYMBOL(fw_core_remove_address_handler); | 620 | EXPORT_SYMBOL(fw_core_remove_address_handler); |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index db04ec5121cb..191501afd7fb 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -265,8 +265,16 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
265 | void *data, size_t length, | 265 | void *data, size_t length, |
266 | void *callback_data); | 266 | void *callback_data); |
267 | /* | 267 | /* |
268 | * Important note: Except for the FCP registers, the callback must guarantee | 268 | * This callback handles an inbound request subaction. It is called in |
269 | * that either fw_send_response() or kfree() is called on the @request. | 269 | * RCU read-side context, therefore must not sleep. |
270 | * | ||
271 | * The callback should not initiate outbound request subactions directly. | ||
272 | * Otherwise there is a danger of recursion of inbound and outbound | ||
273 | * transactions from and to the local node. | ||
274 | * | ||
275 | * The callback is responsible that either fw_send_response() or kfree() | ||
276 | * is called on the @request, except for FCP registers for which the core | ||
277 | * takes care of that. | ||
270 | */ | 278 | */ |
271 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 279 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
272 | struct fw_request *request, | 280 | struct fw_request *request, |