]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
firewire: core: refactor notification type determination after isoc resource manageme...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 1 May 2026 13:58:22 +0000 (22:58 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 3 May 2026 11:44:21 +0000 (20:44 +0900)
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>
drivers/firewire/core-cdev.c

index 0d57b61ade12d4ce8e5de6697694e19b4de35347..4ce8754da93fa382e92829f5010f5c686337755b 100644 (file)
@@ -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;