[PATCH] firewire: ohci: obsolete flushing field in at_context structure
From: Takashi Sakamoto
Date: Fri Sep 11 2026 - 23:23:52 EST
The flushing field in the at_context structure is used for the internal
branches in handle_at_packet(). This field is enabled in
at_context_flush() when either handling the selfIDComplete event in
the threadedIRQ handler or calling the .remove callback of the PCI
device.
In these two flushing cases, the pointer to the work structure retrieved
by current_work() should be different from the one in the at_context
structure. Replacing the flushing field with a work structure check is
preferable since the branching can be self-contained without relying on an
external flag.
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/ohci.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index b7df280bec51..7d797755bbd6 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -162,7 +162,6 @@ struct context {
struct at_context {
struct context context;
struct work_struct work;
- bool flushing;
};
struct iso_context {
@@ -1338,9 +1337,7 @@ static void at_context_flush(struct at_context *ctx)
disable_work_sync(&ctx->work);
- WRITE_ONCE(ctx->flushing, true);
ohci_at_context_work(&ctx->work);
- WRITE_ONCE(ctx->flushing, false);
enable_work(&ctx->work);
}
@@ -1362,8 +1359,10 @@ static int handle_at_packet(struct context *context,
struct driver_data *driver_data;
struct fw_packet *packet;
int evt;
+ // Check whether this is called from at_context_flush().
+ bool in_flushing = current_work() != &ctx->work;
- if (last->transfer_status == 0 && !READ_ONCE(ctx->flushing))
+ if (last->transfer_status == 0 && !in_flushing)
/* This descriptor isn't done yet, stop iteration. */
return 0;
@@ -1395,7 +1394,7 @@ static int handle_at_packet(struct context *context,
break;
case OHCI1394_evt_missing_ack:
- if (READ_ONCE(ctx->flushing))
+ if (in_flushing)
packet->ack = RCODE_GENERATION;
else {
/*
@@ -1417,7 +1416,7 @@ static int handle_at_packet(struct context *context,
break;
case OHCI1394_evt_no_status:
- if (READ_ONCE(ctx->flushing)) {
+ if (in_flushing) {
packet->ack = RCODE_GENERATION;
break;
}
base-commit: 5cd70119ea77f631e0ceb4aa97f608f2983cbeba
--
2.53.0