From: H Hartley Sweeten Date: Wed, 24 Jul 2013 21:13:15 +0000 (-0700) Subject: staging: comedi: usbdux: tidy up usbduxsub_submit_outurbs() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6754698b6a19ad1eb9075b2a49dba85850840a3f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: comedi: usbdux: tidy up usbduxsub_submit_outurbs() Pass the comedi_device pointer (the urb context) to this function instead of the private data pointer. Use a local variable for the urb pointers that are setup and submitted. Remove the sanity check of the private data. This function can only get called if the allocation was successful during the attach. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 4d4ce3f184b7..7304ef0e2ded 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -723,22 +723,25 @@ static int usbduxsub_submit_inurbs(struct comedi_device *dev) return 0; } -static int usbduxsub_submit_outurbs(struct usbdux_private *usbduxsub) +static int usbduxsub_submit_outurbs(struct comedi_device *dev) { - int i, err_flag; + struct usbdux_private *devpriv = dev->private; + struct urb *urb; + int ret; + int i; - if (!usbduxsub) - return -EFAULT; + for (i = 0; i < devpriv->num_out_buffers; i++) { + urb = devpriv->urb_out[i]; - for (i = 0; i < usbduxsub->num_out_buffers; i++) { /* in case of a resubmission after an unlink... */ - usbduxsub->urb_out[i]->context = usbduxsub->comedidev; - usbduxsub->urb_out[i]->dev = usbduxsub->usbdev; - usbduxsub->urb_out[i]->status = 0; - usbduxsub->urb_out[i]->transfer_flags = URB_ISO_ASAP; - err_flag = usb_submit_urb(usbduxsub->urb_out[i], GFP_ATOMIC); - if (err_flag) - return err_flag; + urb->context = dev; + urb->dev = devpriv->usbdev; + urb->status = 0; + urb->transfer_flags = URB_ISO_ASAP; + + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret) + return ret; } return 0; } @@ -1131,7 +1134,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, } if (!(this_usbduxsub->ao_cmd_running)) { this_usbduxsub->ao_cmd_running = 1; - ret = usbduxsub_submit_outurbs(this_usbduxsub); + ret = usbduxsub_submit_outurbs(dev); if (ret < 0) { this_usbduxsub->ao_cmd_running = 0; up(&this_usbduxsub->sem); @@ -1289,7 +1292,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->start_src == TRIG_NOW) { /* enable this acquisition operation */ this_usbduxsub->ao_cmd_running = 1; - ret = usbduxsub_submit_outurbs(this_usbduxsub); + ret = usbduxsub_submit_outurbs(dev); if (ret < 0) { this_usbduxsub->ao_cmd_running = 0; /* fixme: unlink here?? */