firewire: ohci: obsolete flushing field in at_context structure
Takashi Sakamoto
maintainerPATCH 1/1 firewire: ohci: obsolete flushing field in at_context structure
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.
--- drivers/firewire/ohci.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/firewire/ohci.c +5 -6
@@ -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
Signature · 1 line
2.53.0
Quoted 12 lines · Takashi Sakamoto
The flushing field in the
at_contextstructure is used for the internal branches inhandle_at_packet(). This field is enabled inat_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 theat_contextstructure. Replacing the flushing field with a work structure check is preferable since the branching can be self-contained without relying on an external flag.
Quoted 4 lines
Signed-off-by Takashi Sakamoto <[email protected]>--- drivers/firewire/ohci.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Applied to for-next branch.
Regards
Takashi Sakamoto