Re: [PATCH] usb/mos7720: process deferred urbs in a workqueue

From: Davidlohr Bueso
Date: Mon Nov 09 2020 - 14:36:51 EST


On Mon, 09 Nov 2020, Oliver Neukum wrote:

Am Donnerstag, den 05.11.2020, 22:17 -0800 schrieb Davidlohr Bueso:
@@ -1888,16 +1732,8 @@ static void mos7720_release(struct usb_serial *serial)
usb_set_serial_data(serial, NULL);
mos_parport->serial = NULL;

- /* if tasklet currently scheduled, wait for it to complete */
- tasklet_kill(&mos_parport->urb_tasklet);
-
- /* unlink any urbs sent by the tasklet */
- spin_lock_irqsave(&mos_parport->listlock, flags);
- list_for_each_entry(urbtrack,
- &mos_parport->active_urbs,
- urblist_entry)
- usb_unlink_urb(urbtrack->urb);
- spin_unlock_irqrestore(&mos_parport->listlock, flags);
+ /* if work is currently scheduled, wait for it to complete */
+ cancel_work_sync(&mos_parport->work);
parport_del_port(mos_parport->pp);

kref_put(&mos_parport->ref_count, destroy_mos_parport);

Hi,

do you really want to cancel as opposed to wait for work in release()?

Well I tried to maintain the current semantics here. tasklet_kill() is
equivalent to cancel_work_sync() in that they both wait for the delayed
execution to finish running and guarantee that it is no longer queued.

Thanks,
Davidlohr