* [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work
@ 2024-10-17 1:06 Damien Le Moal
2024-10-17 3:15 ` Frank Li
2024-11-02 11:17 ` Krzysztof Wilczyński
0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2024-10-17 1:06 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci
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.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
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(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index a73bc0771d35..c2e7f67e5107 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work
2024-10-17 1:06 [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work Damien Le Moal
@ 2024-10-17 3:15 ` Frank Li
2024-11-02 11:17 ` Krzysztof Wilczyński
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2024-10-17 3:15 UTC (permalink / raw)
To: Damien Le Moal
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Bjorn Helgaas, linux-pci
On Thu, Oct 17, 2024 at 10:06:48AM +0900, Damien Le Moal wrote:
> 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.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> 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(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index a73bc0771d35..c2e7f67e5107 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -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
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work
2024-10-17 1:06 [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work Damien Le Moal
2024-10-17 3:15 ` Frank Li
@ 2024-11-02 11:17 ` Krzysztof Wilczyński
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2024-11-02 11:17 UTC (permalink / raw)
To: Damien Le Moal
Cc: Manivannan Sadhasivam, Kishon Vijay Abraham I, Bjorn Helgaas,
linux-pci
Hello,
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-02 11:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 1:06 [PATCH v2] PCI: endpoint: test: Synchronously cancel command handler work Damien Le Moal
2024-10-17 3:15 ` Frank Li
2024-11-02 11:17 ` Krzysztof Wilczyński
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox