From dd1c6b1518346b582a675a6e630a20ccbd90e508 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Wed, 7 Oct 2026 18:32:34 +0900 Subject: [PATCH] firewire: core: schedule callback when cancelling pending transactions The current implementation invokes the transaction callback in the context where transaction cancellation is requested. This is inconvenient because the context can affect the transaction callback. Invoke the transaction callback from a workqueue instead. Use the workqueue for error handling. Link: https://lore.kernel.org/r/20261007093235.175742-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index bf39f82d9fc4..617df7ecb12e 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -110,8 +110,6 @@ void fw_cancel_pending_transactions(struct fw_card *card) int fw_cancel_transaction(struct fw_card *card, struct fw_transaction *transaction) { - u32 tstamp; - // Cancel the packet transmission if it's still queued. That will schedule the packet // transmission callback which cancels the transaction. if (card->driver->cancel_packet(card, &transaction->packet) == 0) @@ -131,9 +129,10 @@ int fw_cancel_transaction(struct fw_card *card, // Timestamping on behalf of hardware. (void)fw_card_read_cycle_time(card, &curr_cycle_time); - tstamp = cycle_time_to_ohci_tstamp(curr_cycle_time); + transaction->response_timestamp = cycle_time_to_ohci_tstamp(curr_cycle_time); + transaction->rcode = RCODE_CANCELLED; - invoke_callback(transaction, RCODE_CANCELLED, tstamp, NULL, 0); + enable_and_queue_work(card->async_wq, &transaction->error_work); return 0; }