summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/usbdux.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-07-29 17:44:50 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-31 17:44:54 -0700
commit5c63f094a75820b85f7aecf6ee84439d610017c0 (patch)
treea506198878fa3fda0aa2bee4a033887bc7ccc564 /drivers/staging/comedi/drivers/usbdux.c
parent3b2dc08b72a80009887a0e0b80d63fdaa1f2a8a9 (diff)
downloadlinux-5c63f094a75820b85f7aecf6ee84439d610017c0.tar.bz2
staging: comedi: usbdux: tidy up usbdux_pwm_write()
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>
Diffstat (limited to 'drivers/staging/comedi/drivers/usbdux.c')
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 72094d9abba7..214a49f23ec5 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -1426,27 +1426,23 @@ static int usbdux_pwm_pattern(struct comedi_device *dev,
static int usbdux_pwm_write(struct comedi_device *dev,
struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_insn *insn,
+ unsigned int *data)
{
- struct usbdux_private *this_usbduxsub = dev->private;
-
- if (!this_usbduxsub)
- return -EFAULT;
+ unsigned int chan = CR_CHAN(insn->chanspec);
- if ((insn->n) != 1) {
- /*
- * doesn't make sense to have more than one value here because
- * it would just overwrite the PWM buffer a couple of times
- */
+ /*
+ * It doesn't make sense to support more than one value here
+ * because it would just overwrite the PWM buffer.
+ */
+ if (insn->n != 1)
return -EINVAL;
- }
/*
- * the sign is set via a special INSN only, this gives us 8 bits for
- * normal operation
- * relay sign 0 by default
+ * The sign is set via a special INSN only, this gives us 8 bits
+ * for normal operation, sign is 0 by default.
*/
- return usbdux_pwm_pattern(dev, s, CR_CHAN(insn->chanspec), data[0], 0);
+ return usbdux_pwm_pattern(dev, s, chan, data[0], 0);
}
static int usbdux_pwm_read(struct comedi_device *x1,