Re: [PATCH 6/9] staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels

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

 



On 14/08/15 22:29, H Hartley Sweeten wrote:
Move this check from the (*do_cmd) to the (*do_cmdtest).

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
  drivers/staging/comedi/drivers/usbduxfast.c | 12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 45060b9..407f091 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -389,6 +389,11 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
  	if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT)
  		err |= -EINVAL;

+	/* external start trigger is only valid for 1 or 16 channels */
+	if (cmd->start_src == TRIG_EXT &&
+	    cmd->chanlist_len != 1 && cmd->chanlist_len != 16)
+		err |= -EINVAL;
+
  	if (err)
  		return 2;



I'd prefer this test to be done at step 3 of the command test since steps 1 and 2 just check the trigger sources on their own. It shouldn't make much difference in practice though, as the chanlist_len is generally expected to be set to the correct length (as it can affect the timing bounds) except when merely probing for the supported trigger sources.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
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