[PATCH 3/5] firewire: ohci: refactor branches in at_context_transmit()
From: Takashi Sakamoto
Date: Sat Sep 19 2026 - 07:50:51 EST
Refactor the branches to consolidate the handling of local requests and
responses, as well as hardware queueing errors.
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/ohci.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index dddb08dbb45f..710640b759e4 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -1667,22 +1667,16 @@ static void queue_work_for_at_local_packet(struct at_context *ctx, struct fw_pac
static void at_context_transmit(struct at_context *ctx, struct fw_packet *packet)
{
struct fw_ohci *ohci = ctx->context.ohci;
- unsigned long flags;
- int ret;
-
- spin_lock_irqsave(&ohci->lock, flags);
+ bool use_work = true;
- if (destination_is_local(packet, ohci)) {
- spin_unlock_irqrestore(&ohci->lock, flags);
-
- queue_work_for_at_local_packet(ctx, packet, ohci);
- return;
+ scoped_guard(spinlock_irqsave, &ohci->lock) {
+ if (!destination_is_local(packet, ohci)) {
+ if (!at_context_queue_packet(ctx, packet))
+ use_work = false;
+ }
}
- ret = at_context_queue_packet(ctx, packet);
- spin_unlock_irqrestore(&ohci->lock, flags);
-
- if (ret < 0)
+ if (use_work)
queue_work_for_at_local_packet(ctx, packet, ohci);
}
--
2.53.0