Commit 5c63f094 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b2dc08b
...@@ -1426,27 +1426,23 @@ static int usbdux_pwm_pattern(struct comedi_device *dev, ...@@ -1426,27 +1426,23 @@ static int usbdux_pwm_pattern(struct comedi_device *dev,
static int usbdux_pwm_write(struct comedi_device *dev, static int usbdux_pwm_write(struct comedi_device *dev,
struct comedi_subdevice *s, 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; unsigned int chan = CR_CHAN(insn->chanspec);
if (!this_usbduxsub)
return -EFAULT;
if ((insn->n) != 1) {
/* /*
* doesn't make sense to have more than one value here because * It doesn't make sense to support more than one value here
* it would just overwrite the PWM buffer a couple of times * because it would just overwrite the PWM buffer.
*/ */
if (insn->n != 1)
return -EINVAL; return -EINVAL;
}
/* /*
* the sign is set via a special INSN only, this gives us 8 bits for * The sign is set via a special INSN only, this gives us 8 bits
* normal operation * for normal operation, sign is 0 by default.
* relay sign 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, static int usbdux_pwm_read(struct comedi_device *x1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment