Commit 3a335229 authored by Takashi Sakamoto's avatar Takashi Sakamoto

firewire: core: use guard macro to maintain the list of address handler for transaction

The core function maintains address handlers by list. It is protected by
spinlock to insert and remove entry to the list.

This commit uses guard macro to maintain the spinlock.

Link: https://lore.kernel.org/r/20240805085408.251763-8-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
parent 2a6a58f0
......@@ -596,7 +596,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
handler->length == 0)
return -EINVAL;
spin_lock(&address_handler_list_lock);
guard(spinlock)(&address_handler_list_lock);
handler->offset = region->start;
while (handler->offset + handler->length <= region->end) {
......@@ -615,8 +615,6 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
}
}
spin_unlock(&address_handler_list_lock);
return ret;
}
EXPORT_SYMBOL(fw_core_add_address_handler);
......@@ -632,9 +630,9 @@ EXPORT_SYMBOL(fw_core_add_address_handler);
*/
void fw_core_remove_address_handler(struct fw_address_handler *handler)
{
spin_lock(&address_handler_list_lock);
scoped_guard(spinlock, &address_handler_list_lock)
list_del_rcu(&handler->link);
spin_unlock(&address_handler_list_lock);
synchronize_rcu();
}
EXPORT_SYMBOL(fw_core_remove_address_handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment