[PATCH 4/5] firewire: core: schedule callback when cancelling pending transactions
From: Takashi Sakamoto
Date: Mon Oct 05 2026 - 07:32:37 EST
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.
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
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 8c30a476f9fd..90419760d8b4 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -106,8 +106,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)
@@ -127,9 +125,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;
}
--
2.53.0