[PATCH 2/2] firewire: core: reuse helper function for scheduling error callbacks

From: Takashi Sakamoto

Date: Sat Oct 17 2026 - 11:34:10 EST


The transaction layer has some code that can be replaced with the
existing helper function for scheduling error callbacks.

Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/core-transaction.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 029bd9cdc570..45114da64422 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -106,6 +106,14 @@ __must_not_hold(&card->transactions.lock)
__t; \
})

+static void schedule_error_callback(struct fw_transaction *t, int rcode, u32 response_timestamp)
+{
+ t->rcode = rcode;
+ t->response_timestamp = response_timestamp;
+
+ queue_work(t->card->async_wq, &t->error_work);
+}
+
/**
* fw_cancel_transaction: cancel transaction.
* @card: interface where the transaction has been requested
@@ -143,10 +151,9 @@ __must_not_hold(&card->transactions.lock)

// Timestamping on behalf of hardware.
(void)fw_card_read_cycle_time(card, &curr_cycle_time);
- transaction->response_timestamp = cycle_time_to_ohci_tstamp(curr_cycle_time);
- transaction->rcode = RCODE_CANCELLED;

- queue_work(card->async_wq, &transaction->error_work);
+ schedule_error_callback(transaction, RCODE_CANCELLED,
+ cycle_time_to_ohci_tstamp(curr_cycle_time));

return 0;
}
@@ -165,14 +172,6 @@ static void error_callback_work(struct work_struct *work)
invoke_callback(t, t->rcode, t->response_timestamp, NULL, 0);
}

-static void schedule_error_callback(struct fw_transaction *t, int rcode, u32 response_timestamp)
-{
- t->rcode = rcode;
- t->response_timestamp = response_timestamp;
-
- queue_work(t->card->async_wq, &t->error_work);
-}
-
// card->transactions.lock must be released in advance.
static void split_transaction_timeout_callback(struct timer_list *timer)
{
--
2.53.0