[PATCH v2] rapidio/tsi721: Replace flush_scheduled_work() with flush_work().

Tetsuo Handa posted 1 patch 3 years, 10 months ago
There is a newer version of this series
drivers/rapidio/devices/tsi721.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v2] rapidio/tsi721: Replace flush_scheduled_work() with flush_work().
Posted by Tetsuo Handa 3 years, 10 months ago
Since "struct tsi721_device" is per a device struct, I assume that
tsi721_remove() needs to wait for only two works associated with that
device. Therefore, wait for only these works using flush_work().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
Changes in v2:
  Use flush_work() instead of introducing a dedicated WQ.

Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue()
using a macro") for background.

 drivers/rapidio/devices/tsi721.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index b3134744fb55..0a42d6a2af24 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -2941,7 +2941,8 @@ static void tsi721_remove(struct pci_dev *pdev)
 
 	tsi721_disable_ints(priv);
 	tsi721_free_irq(priv);
-	flush_scheduled_work();
+	flush_work(&priv->idb_work);
+	flush_work(&priv->pw_work);
 	rio_unregister_mport(&priv->mport);
 
 	tsi721_unregister_dma(priv);
-- 
2.18.4
Re: [PATCH v2] rapidio/tsi721: Replace flush_scheduled_work() with flush_work().
Posted by Tetsuo Handa 3 years, 10 months ago
Is this change correct?

On 2022/06/12 22:31, Tetsuo Handa wrote:
> Since "struct tsi721_device" is per a device struct, I assume that
> tsi721_remove() needs to wait for only two works associated with that
> device. Therefore, wait for only these works using flush_work().
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> Changes in v2:
>   Use flush_work() instead of introducing a dedicated WQ.
> 
> Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue()
> using a macro") for background.
> 
>  drivers/rapidio/devices/tsi721.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
> index b3134744fb55..0a42d6a2af24 100644
> --- a/drivers/rapidio/devices/tsi721.c
> +++ b/drivers/rapidio/devices/tsi721.c
> @@ -2941,7 +2941,8 @@ static void tsi721_remove(struct pci_dev *pdev)
>  
>  	tsi721_disable_ints(priv);
>  	tsi721_free_irq(priv);
> -	flush_scheduled_work();
> +	flush_work(&priv->idb_work);
> +	flush_work(&priv->pw_work);
>  	rio_unregister_mport(&priv->mport);
>  
>  	tsi721_unregister_dma(priv);
Re: [PATCH v2] rapidio/tsi721: Replace flush_scheduled_work() with flush_work().
Posted by Tetsuo Handa 3 years, 9 months ago
Can we start testing this change?

On 2022/06/26 22:56, Tetsuo Handa wrote:
> Is this change correct?
> 
> On 2022/06/12 22:31, Tetsuo Handa wrote:
>> Since "struct tsi721_device" is per a device struct, I assume that
>> tsi721_remove() needs to wait for only two works associated with that
>> device. Therefore, wait for only these works using flush_work().
>>
>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> ---
>> Changes in v2:
>>   Use flush_work() instead of introducing a dedicated WQ.
>>
>> Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue()
>> using a macro") for background.
>>
>>  drivers/rapidio/devices/tsi721.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
>> index b3134744fb55..0a42d6a2af24 100644
>> --- a/drivers/rapidio/devices/tsi721.c
>> +++ b/drivers/rapidio/devices/tsi721.c
>> @@ -2941,7 +2941,8 @@ static void tsi721_remove(struct pci_dev *pdev)
>>  
>>  	tsi721_disable_ints(priv);
>>  	tsi721_free_irq(priv);
>> -	flush_scheduled_work();
>> +	flush_work(&priv->idb_work);
>> +	flush_work(&priv->pw_work);
>>  	rio_unregister_mport(&priv->mport);
>>  
>>  	tsi721_unregister_dma(priv);