staging: comedi: usbdux: tidy up usbdux_ao_insn_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 25 Jul 2013 23:05:00 +0000 (16:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2013 22:09:55 +0000 (15:09 -0700)
commit37c1d1ec37144e9fe14bcc0c3ab0bba92c332312
treea699424b672f5127f352d15e2400492c428be078
parent818782c8a7744f5183e5e1a411622ce0ae25a558
staging: comedi: usbdux: tidy up usbdux_ao_insn_write()

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>
drivers/staging/comedi/drivers/usbdux.c