Skip to contentSkip to conversation

PCI: endpoint: test: Synchronously cancel command handler work

PATCH Applied Damien Le Moal 3 participants 3 messages Oct 17, 2024 – Nov 2, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: endpoint: test: Synchronously cancel command handler work

Use cancel_delayed_work_sync() in pci_epf_test_epc_deinit() to ensure that the command handler is really stopped before proceeding with DMA and BAR cleanup.

The same change is also done in pci_epf_test_link_down() to ensure that the link down handling completes with the command handler fully stopped.

---
Changes from v1:
- Corrected typos/grammar in commit message

 drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/endpoint/functions/pci-epf-test.c +2 -2
index a73bc0771d35..c2e7f67e5107 100644
@@ -800,7 +800,7 @@ static void pci_epf_test_epc_deinit(struct pci_epf *epf)
 {
 	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
 
-	cancel_delayed_work(&epf_test->cmd_handler);
+	cancel_delayed_work_sync(&epf_test->cmd_handler);
 	pci_epf_test_clean_dma_chan(epf_test);
 	pci_epf_test_clear_bar(epf);
 }
@@ -931,7 +931,7 @@ static void pci_epf_test_unbind(struct pci_epf *epf)
 	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
 	struct pci_epc *epc = epf->epc;
 
-	cancel_delayed_work(&epf_test->cmd_handler);
+	cancel_delayed_work_sync(&epf_test->cmd_handler);
 	if (epc->init_complete) {
 		pci_epf_test_clean_dma_chan(epf_test);
 		pci_epf_test_clear_bar(epf);
Signature · 1 line
2.47.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Damien Le Moal

Use cancel_delayed_work_sync() in pci_epf_test_epc_deinit() to ensure that the command handler is really stopped before proceeding with DMA and BAR cleanup.

The same change is also done in pci_epf_test_link_down() to ensure that the link down handling completes with the command handler fully stopped.

Quoted 32 lines

---
Changes from v1:
- Corrected typos/grammar in commit message

 drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/endpoint/functions/pci-epf-test.c +2 -3
index a73bc0771d35..c2e7f67e5107 100644
@@ -800,7 +800,7 @@ static void pci_epf_test_epc_deinit(struct pci_epf *epf)
 {
 	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
 
-	cancel_delayed_work(&epf_test->cmd_handler);
+	cancel_delayed_work_sync(&epf_test->cmd_handler);
 	pci_epf_test_clean_dma_chan(epf_test);
 	pci_epf_test_clear_bar(epf);
 }
@@ -931,7 +931,7 @@ static void pci_epf_test_unbind(struct pci_epf *epf)
 	struct pci_epf_test *epf_test = epf_get_drvdata(epf);
 	struct pci_epc *epc = epf->epc;
 
-	cancel_delayed_work(&epf_test->cmd_handler);
+	cancel_delayed_work_sync(&epf_test->cmd_handler);
 	if (epc->init_complete) {
 		pci_epf_test_clean_dma_chan(epf_test);
 		pci_epf_test_clear_bar(epf);
--

2.47.0

#2 lore raw
In reply to Damien Le Moal

Hello,

Quoted 6 lines

Use cancel_delayed_work_sync() in pci_epf_test_epc_deinit() to ensure that the command handler is really stopped before proceeding with DMA and BAR cleanup.

The same change is also done in pci_epf_test_link_down() to ensure that the link down handling completes with the command handler fully stopped.

Applied to endpoint, thank you!

[1/1] PCI: endpoint: test: Synchronously cancel command handler work

      https://git.kernel.org/pci/pci/c/7a48655d2bf2

	Krzysztof