[PATCH 1/2] staging: comedi: das16: deschedule timer routine on detach

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

 



The "das16" driver optionally uses a kernel timer and a DMA channel to
support asynchronous data acquisition, but currently never calls
`del_timer_sync()`.  There is some possibility the timer routine could
still be scheduled to run when the comedi "detach" handler is run to
clean up the device and cause a certain amount of havoc.  Avoid that by
calling `del_time_sync()` in the comedi "detach" handler
`das16_detach()` if the timer was initialized by the "attach" handler
`das16_attach()`.  Use the timer's `data` member to tell whether it was
initialized or not.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/das16.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
index 5d47d0a..51c4a58 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -1226,6 +1226,8 @@ static void das16_detach(struct comedi_device *dev)
 	int i;
 
 	if (devpriv) {
+		if (devpriv->timer.data)
+			del_timer_sync(&devpriv->timer);
 		if (dev->iobase)
 			das16_reset(dev);
 
-- 
2.1.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux