Re: [PATCH v2] iio:light:tsl2563: Replace flush_scheduled_work() with cancel_delayed_work_sync().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 12 Jun 2022 23:52:59 +0900
Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:

> Commit 9e61d901155bcd4e ("iio: light: tsl2563: Remove
> flush_scheduled_work") replaced cancel_delayed_work() +
> flush_scheduled_work() with cancel_delayed_work_sync() for only
> tsl2563_probe() side.
> 
> Do the same thing for tsl2563_remove() side, which was added by
> commit 388be4883952872b ("staging:iio: tsl2563 abi fixes and interrupt
> handling").
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> ---
> Changes in v2:
>   Use cancel_delayed_work_sync() instead of introducing a dedicated WQ.
Nice.  This does the job without the complexity or overhead of a dedicated
work queue.  

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to see if we missed anything.

Thanks,

Jonathqan

> 
> Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue()
> using a macro") for background.
> 
>  drivers/iio/light/tsl2563.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index 0a278eea36ca..4d89ac3a5bbc 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -803,12 +803,11 @@ static int tsl2563_remove(struct i2c_client *client)
>  
>  	iio_device_unregister(indio_dev);
>  	if (!chip->int_enabled)
> -		cancel_delayed_work(&chip->poweroff_work);
> +		cancel_delayed_work_sync(&chip->poweroff_work);
>  	/* Ensure that interrupts are disabled - then flush any bottom halves */
>  	chip->intr &= ~0x30;
>  	i2c_smbus_write_byte_data(chip->client, TSL2563_CMD | TSL2563_REG_INT,
>  				  chip->intr);
> -	flush_scheduled_work();
>  	tsl2563_set_power(chip, 0);
>  
>  	return 0;




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux