firewire: core: use kref structure to maintain lifetime of data for fw_request structure
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 20 Jan 2023 09:03:42 +0000 (18:03 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 23 Jan 2023 08:17:43 +0000 (09:17 +0100)
commit13a55d6bb15fa6bf0dcaf997e0676f532f258f52
treee95f3aeb31e343e1c38d597bd5552c5986408c2e
parent87978e6ad45a16835cc58234451111091be3c59a
firewire: core: use kref structure to maintain lifetime of data for fw_request structure

Developers have acknowledged that maintenance of lifetime for
fw_transaction structure is effective when handling asynchronous
transaction to IEC 61883-1 FCP region, since the core function allows
multiples listeners to the region. Some of them needs to access to the
payload of request in process context after the callback to listener,
while the core function releases the object for the structure just after
completing the callbacks to listeners.

One of the listeners is character device. Current implementation of the
character device duplicates the object for the payload of transaction,
while it's a cost in kernel memory consumption. The lifetime management
can reduce it.

The typical way to maintain the lifetime is reference count. This commit
uses kref structure as a first step for the purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230120090344.296451-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
drivers/firewire/core-cdev.c
drivers/firewire/core-transaction.c
drivers/firewire/core.h