summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/usbdux.c
AgeCommit message (Collapse)AuthorFilesLines
2014-04-23staging: comedi: usbdux: bug fix for accessing 'ao_chanlist' in private dataH Hartley Sweeten1-6/+3
In usbdux_ao_cmd(), the channels for the command are transfered from the cmd->chanlist and stored in the private data 'ao_chanlist'. The channel numbers are bit-shifted when stored so that they become the "command" that is transfered to the device. The channel to command conversion results in the 'ao_chanlist' having these values for the channels: channel 0 -> ao_chanlist = 0x00 channel 1 -> ao_chanlist = 0x40 channel 2 -> ao_chanlist = 0x80 channel 3 -> ao_chanlist = 0xc0 The problem is, the usbduxsub_ao_isoc_irq() function uses the 'chan' value from 'ao_chanlist' to access the 'ao_readback' array in the private data. So instead of accessing the array as 0, 1, 2, 3, it accesses it as 0x00, 0x40, 0x80, 0xc0. Fix this by storing the raw channel number in 'ao_chanlist' and doing the bit-shift when creating the command. Fixes: a998a3db530bff80 "staging: comedi: usbdux: cleanup the private data 'outBuffer'" Cc: stable <stable@vger.kernel.org> # 3.12 Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Acked-by: Bernd Porr <mail@berndporr.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17staging: delete non-required instances of include <linux/init.h>Paul Gortmaker1-1/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-16staging: comedi: usbdux: sample types are unsignedIan Abbott1-17/+18
Sample values in comedi are generally represented as unsigned values. Use unsigned types consistently for handling comedi sample data and also for the USB data buffers. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17staging: comedi: usbdux drivers: use comedi_dio_update_state()H Hartley Sweeten1-4/+2
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state. These drivers always need to update the hardware in order to update the i/o configuration regardless of if the state has changed. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-21staging: comedi: usbdux: allocating too much dataDan Carpenter1-2/+2
We only need to allocate enough space for a pointer. We allocate the space for the urbs themselves with the call to usb_alloc_urb() a few lines later. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-12staging: comedi: drivers: use comedi_dio_insn_config() for simple casesH Hartley Sweeten1-15/+4
Convert the drivers with simple, per channel programmable i/o, to use the comedi_dio_insn_config() helper function. All of these pass a 'mask' of '0' to comedi_dio_insn_config() this causes the per channel mask to be used to configure the i/o direction. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_free_usb_buffers()H Hartley Sweeten1-5/+3
For aesthetics, pass the comedi_device pointer to this function instead of the private data pointer. The usb_kill_urb() calls are not needed. All the urbs were unlinked before this function was called. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_detach()H Hartley Sweeten1-10/+11
Make sure the usb intfdata is always cleared when the device is detached. Refactor the code to remove an indent level. Always unlink the urbs when the device is detached. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_alloc_usb_buffers()H Hartley Sweeten1-26/+6
Tidy up the error path by doing all the basic allocations then checking for failures. We have the comedi device now so fill in the urb->context. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: return void from usbdux_pwm_pattern()H Hartley Sweeten1-9/+10
This function never fails and currently returns '1' so that the usbdux_pwm_write() function returns to proper value (insn->n). It's also called by usbdux_pwm_config() which also returns the '1' value. The proper return code for this function should be '0' to indicate success. Change the return type of the function to void and just have the callers return the proper values. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_pwm_config()H Hartley Sweeten1-19/+13
Rename the local variable used for the private data pointer to 'devpriv'. Tidy up the function a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: remove usbdux_pwm_read()H Hartley Sweeten1-9/+0
The pwm subdevice is not readable so this callback function is not needed. Remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_pwm_write()H Hartley Sweeten1-15/+11
Remove the sanity check of the private data. This function can only be called if the private data was successfully allocated in the attach. Tidy up the function a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_pwm_pattern()H Hartley Sweeten1-34/+19
Rename the local variable used for the private data pointer to 'devpriv'. Remove the sanity check of the private data. This function can only be called if the private data was successfully allocated in the attach. Tidy up the function to make it more concise. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: tidy up usbdux_pwm_period()H Hartley Sweeten1-5/+6
Rename the local variable used for the private data pointer to 'devpriv'. Fix the fx2delay calculation so it does not use floating point values. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31staging: comedi: usbdux: generalize the usb_submit_urb functionsH Hartley Sweeten1-32/+15
Generalize a helper function to replace usbduxsub_submit_{in,out}urbs(). Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: consolidate usbduxsub_unlink_{in, out}urbs()H Hartley Sweeten1-21/+7
These functions are identical other than the which and how many urbs are unlinked. Consolidate the functions into one usbdux_unlink_urbs() function. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: move and rename the bulk transfer commandsH Hartley Sweeten1-23/+22
For aesthetic reasons, move the defines used for the bulk transfer commands out of the middle of the code and rename them so they are a bit more readable. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: remove unused defineH Hartley Sweeten1-3/+0
This define is not used, and it's actually incorrect. The usbdux device only has 4 analog output channels. Remove it. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: 'dac_commands' does not need to be kzalloc()'dH Hartley Sweeten1-10/+3
The 'dac_commands' buffer is used to pass the ao channel list from usbdux_ao_cmd() to the urb callback, usbduxsub_ao_isoc_irq(). This buffer does not need to be allocated. Change it into a simple array of the correct size. Rename the variable to 'ao_chanlist' to clarify what it actually is. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: remove unnecessary check in usbdux_ao_cmd()H Hartley Sweeten1-3/+0
This check is not necessary. The cmd->chanlist_len will always be less than or equal to the subdevice len_chanlist that was setup during the attach of the device. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: remove unnecessary check in usbdux_ai_cmd()H Hartley Sweeten1-6/+0
This check is not necessary. The cmd->chanlist_len will always be less than or equal to the subdevice len_chanlist that was setup during the attach of the device. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: simplify initializing the ao urb transfer_bufferH Hartley Sweeten1-9/+10
Remove the ugly casting of datap to the ao urb->transfer_buffer. The format of the data in the buffer is simply. [0] = # of channels to update (s->async->cmd.chanlist.len) [1] = lsb of value for 1st channel to update [2] = msb of value for 1st channel to update [3] = 1st channel to update (depvriv->dac_commands[0]) If more than 1 channel is to be updated they are simply added to the buffer: [4] = lsb of value for 2st channel to update [5] = msb of value for 2st channel to update [6] = 1st channel to update (depvriv->dac_commands[1]) etc. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: cleanup the private data 'outBuffer'H Hartley Sweeten1-27/+22
This buffer is used to cache the values that are written to the analog output channels. Currently it only caches the single writes to the channels using the (*insn_write) callback. The async command writes are not cached. The buffer is also being kzalloc'ed during the attach of the driver to a size much larger that required. Rename the CamelCase buffer and change it to an array in the private data of the correct size to cache the analog output channel values. Modify the analog output urb callback so it updates the cached values with those used for the asynchronous command to allow readback after the command completes. The sanity check of the index to dac_commands[] (i.e. the 'chan' being written) is not needed. The chanlist_len will always be less than the number of channels. Also, fix the dev_err() message so it uses the proper device pointer. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: rename private data variablesH Hartley Sweeten1-68/+68
The usbdux and usbduxsigma drivers are _very_ similar. For aesthetic reasons, rename the private data variables in this driver to match the names in the usbduxsigma driver so we can start sharing the common code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: clarify bipolar ai data in usbduxsub_ai_isoc_irq()H Hartley Sweeten1-7/+8
Use the comedi_range_is_bipolar() helper instead of checking the 'range' index against a magic number. Also, use the s->maxdata to calculate the value needed to munge the value for bipolar data instead of the magic number. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: move usbdux_firmware_upload()H Hartley Sweeten1-88/+82
For aesthetics, move this function closer to the (*auto_attach). Also, rename some of the defined constants that are used by the firmware upload. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: remove some unused definesH Hartley Sweeten1-10/+0
These defines are not used by the driver. Remove them. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: remove the usb endpoint definesH Hartley Sweeten1-20/+5
The endpoint defines are each only used in one place and don't help clarify the code. Remove the defines and just open code the values. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: use the stop helpers in the detachH Hartley Sweeten1-6/+4
Use the stop helpers instead of duplicating the code in the detach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up unlink and stop helpersH Hartley Sweeten1-66/+29
For aesthetic reasons, pass the comedi_device pointer to the unlink helpers instead of the private data pointer. All the unlink helpers simply call usb_kill_urb() to cancel any pending transfer requests. The usb passed to usb_kill_urb() can be NULL so the extra sanity check is not required. The unlink helpers will always return success so just make them void functions. Since the stop helpers will also always return success, make them void functions as well. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: fix usbdux_pwm_start()H Hartley Sweeten1-17/+17
Add the missing down/up of the semaphore to prevent other commands from being issued to the usb device while the pwn is being stopped. Rename the local variable used for the private data pointer to the comedi "norm". Use memset() to initialize the urb transfer buffer. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: fix usbdux_pwm_cancel()H Hartley Sweeten1-5/+13
Add the missing down/up of the semaphore to prevent other commands from being issued to the usb device while the pwn is being stopped. Rename the local variable used for the private data pointer to the comedi "norm". Make sure to check that usbdux_pwm_stop() was successful before sending command to the usb device to stop the pwm. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_pwm_stop()H Hartley Sweeten1-13/+8
For aesthetic reasons, pass the comedi_device pointer to this function instead of the private data pointer. Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: fix usbdux_counter_write()H Hartley Sweeten1-14/+17
Comedi (*insn_write) operations are supposed to write insn->n values. Fix this function to work like the core expects. Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: fix usbdux_counter_read()H Hartley Sweeten1-20/+19
Comedi (*insn_read) operations are supposed to read and return insn->n values. Fix this function to work like the core expects. Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_dio_insn_bits()H Hartley Sweeten1-27/+27
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_dio_insn_config()H Hartley Sweeten1-13/+11
Tidy up this function a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ao_cmd()H Hartley Sweeten1-29/+33
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Make sure an ao command is not already running and return -EBUSY. Tidy up the exit path using goto to ensure that the semaphore is released. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ao_inttrig()H Hartley Sweeten1-17/+18
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Return -EBUSY instead if an ao command is already running. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ao_insn_write()H Hartley Sweeten1-25/+28
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Return -EBUSY instead of 0 if the (*insn_write) cannot be done because a command is running. Tidy up the for() loop that writes the data. The dux_commands[1] and [4] can be set outside the loop since they are constant. Use a local pointer for dux_commands[2] to load the value to write. Only the last value needs to be cached in the private data for read back. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ao_insn_read()H Hartley Sweeten1-13/+8
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: clarify bipolar ai dataH Hartley Sweeten1-2/+4
Use the comedi_range_is_bipolar() helper instead of checking the 'range' index against a magic number. Also, use the s->maxdata to calculate the value needed to munge the value for bipolar data instead of the magic number. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ai_insn_read()H Hartley Sweeten1-32/+27
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Return -EBUSY instead of 0 if the (*insn_read) cannot be done because a command is running. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ai_cmd()H Hartley Sweeten1-48/+45
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26staging: comedi: usbdux: tidy up usbdux_ai_inttrig()H Hartley Sweeten1-17/+18
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Tidy up the exit path using goto to ensure that the semaphore is released. Return -EBUSY if an ai command is already running. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25staging: comedi: usbdux: tidy up usbdux_ao_cancel()H Hartley Sweeten1-10/+7
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25staging: comedi: usbdux: tidy up usbdux_ao_stop()H Hartley Sweeten1-14/+9
For aesthetic reasons, pass the comedi_device pointer to this function instead of the private data pointer. Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25staging: comedi: usbdux: tidy up usbdux_ai_cancel()H Hartley Sweeten1-15/+7
Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25staging: comedi: usbdux: tidy up usbdux_ai_stop()H Hartley Sweeten1-20/+11
For aesthetic reasons, pass the comedi_device pointer to this function instead of the private data pointer. Rename the local variable used for the private data pointer to the comedi "norm". Remove the unnecessary sanity check of the private data pointer. This function can only be called is the private data was allocated during the attach. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>