* [PATCH] firewire: ohci: obsolete flushing field in at_context structure
@ 2026-09-12 3:22 Takashi Sakamoto
2026-09-13 7:52 ` Takashi Sakamoto
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Sakamoto @ 2026-09-12 3:22 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
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@sakamocchi.jp>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] firewire: ohci: obsolete flushing field in at_context structure
2026-09-12 3:22 [PATCH] firewire: ohci: obsolete flushing field in at_context structure Takashi Sakamoto
@ 2026-09-13 7:52 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2026-09-13 7:52 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
On Sat, Sep 12, 2026 at 12:22:19PM +0900, Takashi Sakamoto wrote:
> 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@sakamocchi.jp>
> ---
> drivers/firewire/ohci.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
Applied to for-next branch.
Regards
Takashi Sakamoto
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-13 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 3:22 [PATCH] firewire: ohci: obsolete flushing field in at_context structure Takashi Sakamoto
2026-09-13 7:52 ` Takashi Sakamoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®