firewire: core: misc fixes
Takashi Sakamoto
maintainercover firewire: core: misc fixes
Hi,
This series fixes a few bugs introduced by recent changes.
Takashi Sakamoto (2):
firewire: core: adjust context_unsafe() usage for lockdep checks
firewire: core: replace drain_workqueue() with flush_workqueue()
drivers/firewire/core-card.c | 4 ++-- drivers/firewire/core-transaction.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
base-commit: 9a513d9f68461294a6a615986becf619b9549f37
Signature · 1 line
2.53.0
Takashi Sakamoto
maintainerPATCH 1/2 firewire: core: adjust context_unsafe() usage for lockdep checks
schedule_error_callback() requires a lock to be held by the caller. However, __fw_send_request() calls the function without holding any lock when retrieving the transaction label fails, as no lock is needed in this case. context_safe() is used to suppress the precondition check in compiler-based context analysis, but it does not affect lockdep checks. As a result, lockdep reports a violation of the precondition.
Acquire the lock before calling the function instead of using context_unsafe().
--- drivers/firewire/core-transaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/firewire/core-transaction.c +2 -1
@@ -438,7 +438,8 @@ __must_not_hold(&card->transactions.lock) tstamp =cycle_time_to_ohci_tstamp (curr_cycle_time); t->packet.timestamp = tstamp; -context_unsafe (schedule_error_callback (card, t,RCODE_SEND_ERROR , tstamp)); + scoped_guard(spinlock_irqsave, &card->transactions.lock) +schedule_error_callback (card, t,RCODE_SEND_ERROR , tstamp);return ; }
Signature · 1 line
2.53.0
Takashi Sakamoto
maintainerPATCH 2/2 firewire: core: replace drain_workqueue() with flush_workqueue()
In reply to Takashi Sakamotodrain_workqueue() allows only chained work to be queued while draining. This is inconvenient because work can be queued from contexts other than work items already executing on the workqueue.
Use flush_workqueue() instead to allow work to be queued from any context.
--- drivers/firewire/core-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firewire/core-card.c +2 -2
@@ -841,8 +841,8 @@ void fw_core_remove_card(struct fw_card *card)// Ensure the entire contents of the driver are visible to other CPUs. smp_store_release (&card->driver, &closer.driver); -drain_workqueue (card->isoc_wq); -drain_workqueue (card->async_wq); +flush_workqueue (card->isoc_wq); +flush_workqueue (card->async_wq); card->driver->disable (card);scoped_guard (spinlock_irqsave, &card->transactions.lock)
Signature · 1 line
2.53.0
Quoted 11 lines · Takashi Sakamoto
Hi,
This series fixes a few bugs introduced by recent changes.
Takashi Sakamoto (2):
firewire: core: adjustcontext_unsafe()usage for lockdep checks
firewire: core: replacedrain_workqueue()withflush_workqueue()drivers/firewire/core-card.c | 4 ++-- drivers/firewire/core-transaction.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
Applied to for-next branch.
Regards
Takashi Sakamoto