Skip to content

Commit c45b9a0

Browse files
committed
Revert "firewire: core: use mutex to coordinate concurrent calls to flush completions"
This reverts commit d9605d6, since this commit is on the following reverted changes. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent f877f1d commit c45b9a0

File tree

3 files changed

+25
-24
lines changed

3 files changed

+25
-24
lines changed

drivers/firewire/core-iso.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
157157
ctx->callback.sc = callback;
158158
ctx->callback_data = callback_data;
159159
INIT_WORK(&ctx->work, flush_completions_work);
160-
mutex_init(&ctx->flushing_completions_mutex);
161160

162161
trace_isoc_outbound_allocate(ctx, channel, speed);
163162
trace_isoc_inbound_single_allocate(ctx, channel, header_size);
@@ -174,8 +173,6 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx)
174173
trace_isoc_inbound_multiple_destroy(ctx);
175174

176175
ctx->card->driver->free_iso_context(ctx);
177-
178-
mutex_destroy(&ctx->flushing_completions_mutex);
179176
}
180177
EXPORT_SYMBOL(fw_iso_context_destroy);
181178

@@ -229,19 +226,15 @@ EXPORT_SYMBOL(fw_iso_context_queue_flush);
229226
* to process the context asynchronously, fw_iso_context_schedule_flush_completions() is available
230227
* instead.
231228
*
232-
* Context: Process context due to mutex_trylock().
229+
* Context: Process context.
233230
*/
234231
int fw_iso_context_flush_completions(struct fw_iso_context *ctx)
235232
{
236233
trace_isoc_outbound_flush_completions(ctx);
237234
trace_isoc_inbound_single_flush_completions(ctx);
238235
trace_isoc_inbound_multiple_flush_completions(ctx);
239236

240-
scoped_cond_guard(mutex_try, /* nothing to do */, &ctx->flushing_completions_mutex) {
241-
return ctx->card->driver->flush_iso_completions(ctx);
242-
}
243-
244-
return 0;
237+
return ctx->card->driver->flush_iso_completions(ctx);
245238
}
246239
EXPORT_SYMBOL(fw_iso_context_flush_completions);
247240

drivers/firewire/ohci.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct iso_context {
166166
struct context context;
167167
void *header;
168168
size_t header_length;
169+
unsigned long flushing_completions;
169170
u32 mc_buffer_bus;
170171
u16 mc_completed;
171172
u16 last_timestamp;
@@ -3578,23 +3579,31 @@ static void ohci_flush_queue_iso(struct fw_iso_context *base)
35783579
static int ohci_flush_iso_completions(struct fw_iso_context *base)
35793580
{
35803581
struct iso_context *ctx = container_of(base, struct iso_context, base);
3582+
int ret = 0;
35813583

3582-
// Note that tasklet softIRQ is not used to process isochronous context anymore.
3583-
context_tasklet((unsigned long)&ctx->context);
3584+
if (!test_and_set_bit_lock(0, &ctx->flushing_completions)) {
3585+
// Note that tasklet softIRQ is not used to process isochronous context anymore.
3586+
context_tasklet((unsigned long)&ctx->context);
35843587

3585-
switch (base->type) {
3586-
case FW_ISO_CONTEXT_TRANSMIT:
3587-
case FW_ISO_CONTEXT_RECEIVE:
3588-
if (ctx->header_length != 0)
3589-
flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH);
3590-
return 0;
3591-
case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
3592-
if (ctx->mc_completed != 0)
3593-
flush_ir_buffer_fill(ctx);
3594-
return 0;
3595-
default:
3596-
return -ENOSYS;
3588+
switch (base->type) {
3589+
case FW_ISO_CONTEXT_TRANSMIT:
3590+
case FW_ISO_CONTEXT_RECEIVE:
3591+
if (ctx->header_length != 0)
3592+
flush_iso_completions(ctx, FW_ISO_CONTEXT_COMPLETIONS_CAUSE_FLUSH);
3593+
break;
3594+
case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
3595+
if (ctx->mc_completed != 0)
3596+
flush_ir_buffer_fill(ctx);
3597+
break;
3598+
default:
3599+
ret = -ENOSYS;
3600+
}
3601+
3602+
clear_bit_unlock(0, &ctx->flushing_completions);
3603+
smp_mb__after_atomic();
35973604
}
3605+
3606+
return ret;
35983607
}
35993608

36003609
static const struct fw_card_driver ohci_driver = {

include/linux/firewire.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ union fw_iso_callback {
512512
struct fw_iso_context {
513513
struct fw_card *card;
514514
struct work_struct work;
515-
struct mutex flushing_completions_mutex;
516515
int type;
517516
int channel;
518517
int speed;

0 commit comments

Comments
 (0)