Many of the comedi drivers implement a "timeout" loop of some sort in the analog input (*insn_read) or analog output (*insn_write) functions. Some of these are just crazy "loop this many times" for some status to change. There are a couple that could actually deadlock the system if the status does not occur. Some of the drivers also ignore if a timeout occurs and proceded normally instead of terminating the instruction. Introduce a comedi core helper function, comedi_timeout(), that handles the boilerplate for the timeout. This function will wait up to 1 second for a driver provided callback to indicate that the wait is complete. This also changes the errno for all timeouts to -ETIMEDOUT. Some of the comed drivers are returning -ETIME which isn't appropriate. Patch 01 introduces the helper function. Patches 02-45 cleanup the individual drivers. Patch 46 moves the debug message for a timeout to the core. Patch 47 cleans up the unnecessary clearing of the returned data when a timeout occurs. v2: address issues pointed out by Ian Abbott 1) modify the comedi_tiemout() helper 2) remove the use of comedi_timeout() in the interrupt routines 3) drop the patch to das1800 4) add subdevice number to dev_dbg() timeout messages H Hartley Sweeten (47): staging: comedi: introduce comedi_timeout() staging: comedi: skel: use comedi_timeout() staging: comedi: adl_pci6208x: use comedi_timeout() staging: comedi: das16: use comedi_timeout() staging: comedi: das800: use comedi_timeout() staging: comedi: ii_pci20kc: use comedi_timeout() staging: comedi: mf6x4: use comedi_timeout() staging: comedi: ni_labpc: use comedi_timeout() staging: comedi: pcl711: use comedi_timeout() staging: comedi: pcmad: use comedi_timeout() staging: comedi: pcmmio: use comedi_timeout() staging: comedi: dt2815: use comedi_timeout() staging: comedi: rti800: use comedi_timeout() staging: comedi: aio_aio12_8: use comedi_timeout() staging: comedi: cb_das16_cs: use comedi_timeout() staging: comedi: cb_pcidas: use comedi_timeout() staging: comedi: cb_pcidas64: use comedi_timeout() staging: comedi: cb_pcimdas: use comedi_timeout() staging: comedi: das08: use comedi_timeout() staging: comedi: das16m1: use comedi_timeout() staging: comedi: dt2811: use comedi_timeout() staging: comedi: me_daq: use comedi_timeout() staging: comedi: mpc624: use comedi_timeout() staging: comedi: s526: use comedi_timeout() staging: comedi: addi_apci_3xx: use comedi_timeout() staging: comedi: ni_at_a2150: use comedi_timeout() staging: comedi: ni_atmio16d: use comedi_timeout() staging: comedi: adl_pci9111: use comedi_timeout() staging: comedi: adl_pci9118: use comedi_timeout() staging: comedi: adv_pci1710: use comedi_timeout() staging: comedi: adq12b: use comedi_timeout() staging: comedi: amplc_pci230: use comedi_timeout() staging: comedi: dyna_pci10xx: use comedi_timeout() staging: comedi: icp_multi: use comedi_timeout() staging: comedi: multiq3: use comedi_timeout() staging: comedi: ni_daq_700: use comedi_timeout() staging: comedi: rtd520: use comedi_timeout() staging: comedi: s626: use comedi_timeout() staging: comedi: dt282x: use comedi_timeout() staging: comedi: daqboard2000: use comedi_timeout() staging: comedi: pcl812: use comedi_timeout() staging: comedi: pcl816: use comedi_timeout() staging: comedi: pcl818: use comedi_timeout() staging: comedi: dt2814: use comedi_timeout() staging: comedi: dmm32at: use comedi_timeout() staging: comedi: move (*insn_{read,write}) timeout debug messages to core staging: comedi: don't clear 'data' on (*insn_read) timeout drivers/staging/comedi/comedi_fops.c | 13 ++- drivers/staging/comedi/comedidev.h | 8 ++ drivers/staging/comedi/drivers.c | 30 +++++++ drivers/staging/comedi/drivers/addi_apci_3xxx.c | 44 ++++++++-- drivers/staging/comedi/drivers/adl_pci6208.c | 22 +++-- drivers/staging/comedi/drivers/adl_pci9111.c | 34 ++++---- drivers/staging/comedi/drivers/adl_pci9118.c | 32 ++++--- drivers/staging/comedi/drivers/adq12b.c | 31 +++---- drivers/staging/comedi/drivers/adv_pci1710.c | 36 ++++---- drivers/staging/comedi/drivers/aio_aio12_8.c | 28 ++++--- drivers/staging/comedi/drivers/amplc_pci230.c | 34 ++++---- drivers/staging/comedi/drivers/cb_das16_cs.c | 28 ++++--- drivers/staging/comedi/drivers/cb_pcidas.c | 27 ++++-- drivers/staging/comedi/drivers/cb_pcidas64.c | 46 +++++----- drivers/staging/comedi/drivers/cb_pcimdas.c | 35 ++++---- drivers/staging/comedi/drivers/daqboard2000.c | 82 +++++++++++------- drivers/staging/comedi/drivers/das08.c | 28 ++++--- drivers/staging/comedi/drivers/das16.c | 19 ++--- drivers/staging/comedi/drivers/das16m1.c | 29 ++++--- drivers/staging/comedi/drivers/das800.c | 18 ++-- drivers/staging/comedi/drivers/dmm32at.c | 83 +++++++++++-------- drivers/staging/comedi/drivers/dt2811.c | 23 +++-- drivers/staging/comedi/drivers/dt2814.c | 29 ++++--- drivers/staging/comedi/drivers/dt2815.c | 39 ++++----- drivers/staging/comedi/drivers/dt282x.c | 62 ++++++++------ drivers/staging/comedi/drivers/dyna_pci10xx.c | 38 +++++---- drivers/staging/comedi/drivers/icp_multi.c | 106 ++++++++++++------------ drivers/staging/comedi/drivers/ii_pci20kc.c | 20 ++--- drivers/staging/comedi/drivers/me_daq.c | 33 +++++--- drivers/staging/comedi/drivers/mf6x4.c | 23 +++-- drivers/staging/comedi/drivers/mpc624.c | 28 ++++--- drivers/staging/comedi/drivers/multiq3.c | 38 +++++---- drivers/staging/comedi/drivers/ni_at_a2150.c | 46 +++++----- drivers/staging/comedi/drivers/ni_atmio16d.c | 52 +++++++----- drivers/staging/comedi/drivers/ni_daq_700.c | 51 ++++++------ drivers/staging/comedi/drivers/ni_labpc.c | 21 ++--- drivers/staging/comedi/drivers/pcl711.c | 21 +++-- drivers/staging/comedi/drivers/pcl812.c | 68 ++++++++------- drivers/staging/comedi/drivers/pcl816.c | 47 +++++------ drivers/staging/comedi/drivers/pcl818.c | 34 ++++---- drivers/staging/comedi/drivers/pcmad.c | 21 +++-- drivers/staging/comedi/drivers/pcmmio.c | 42 ++++++---- drivers/staging/comedi/drivers/rtd520.c | 84 +++++++++---------- drivers/staging/comedi/drivers/rti800.c | 29 +++---- drivers/staging/comedi/drivers/s526.c | 32 ++++--- drivers/staging/comedi/drivers/s626.c | 20 ++++- drivers/staging/comedi/drivers/skel.c | 41 ++++++--- 47 files changed, 1016 insertions(+), 739 deletions(-) -- 1.8.5.2 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel