diff options
| author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2026-05-01 16:58:22 +0300 |
|---|---|---|
| committer | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2026-05-03 14:44:21 +0300 |
| commit | afa66eeb1899087b205f49cdfb8465880d61cdd2 (patch) | |
| tree | 1e4fc211bf428551f09dc1a6863afff1e91d746a | |
| parent | 92750bccf01f2e65976429acee06984a95803354 (diff) | |
| download | linux-afa66eeb1899087b205f49cdfb8465880d61cdd2.tar.xz | |
firewire: core: refactor notification type determination after isoc resource management in cdev
After managing the actual isochronous resources, there is
post-processing logic to determine what type of event should be
notified. However, there is room for improvement.
This commit refactors the logic.
Link: https://lore.kernel.org/r/20260501135823.241940-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
| -rw-r--r-- | drivers/firewire/core-cdev.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 0d57b61ade12..4ce8754da93f 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -1390,20 +1390,27 @@ static void iso_resource_auto_work(struct work_struct *work) } } - if (todo == ISO_RES_AUTO_ALLOC && channel >= 0) - r->params.channels = 1ULL << channel; - - if (todo == ISO_RES_AUTO_REALLOC && success) - goto out; - - if (todo == ISO_RES_AUTO_ALLOC) { - e = r->e_alloc; - r->e_alloc = NULL; - } else { + if (todo == ISO_RES_AUTO_DEALLOC) { free = true; e = r->e_dealloc; r->e_dealloc = NULL; + } else { + if (todo == ISO_RES_AUTO_REALLOC) { + if (success) + goto out; + + // Notify the userspace client of the failure through a deallocation event. + e = r->e_dealloc; + r->e_dealloc = NULL; + } else { + if (channel >= 0) + r->params.channels = 1ULL << channel; + + e = r->e_alloc; + r->e_alloc = NULL; + } } + e->iso_resource.handle = r->resource.handle; e->iso_resource.channel = channel; e->iso_resource.bandwidth = bandwidth; |
