Commit afb177e0 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: rename function em28xx_uninit_isoc to em28xx_uninit_usb_xfer

This function will be used to uninitialize USB bulk transfers, too.
Also rename the local variable isoc_bufs to usb_bufs.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 836e93bf
...@@ -3394,7 +3394,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) ...@@ -3394,7 +3394,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
video_device_node_name(dev->vdev)); video_device_node_name(dev->vdev));
dev->state |= DEV_MISCONFIGURED; dev->state |= DEV_MISCONFIGURED;
em28xx_uninit_isoc(dev, dev->mode); em28xx_uninit_usb_xfer(dev, dev->mode);
dev->state |= DEV_DISCONNECTED; dev->state |= DEV_DISCONNECTED;
} else { } else {
dev->state |= DEV_DISCONNECTED; dev->state |= DEV_DISCONNECTED;
...@@ -3402,7 +3402,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) ...@@ -3402,7 +3402,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
} }
/* free DVB isoc buffers */ /* free DVB isoc buffers */
em28xx_uninit_isoc(dev, EM28XX_DIGITAL_MODE); em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
......
...@@ -962,49 +962,50 @@ static void em28xx_irq_callback(struct urb *urb) ...@@ -962,49 +962,50 @@ static void em28xx_irq_callback(struct urb *urb)
/* /*
* Stop and Deallocate URBs * Stop and Deallocate URBs
*/ */
void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode) void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode)
{ {
struct urb *urb; struct urb *urb;
struct em28xx_usb_bufs *isoc_bufs; struct em28xx_usb_bufs *usb_bufs;
int i; int i;
em28xx_isocdbg("em28xx: called em28xx_uninit_isoc in mode %d\n", mode); em28xx_isocdbg("em28xx: called em28xx_uninit_usb_xfer in mode %d\n",
mode);
if (mode == EM28XX_DIGITAL_MODE) if (mode == EM28XX_DIGITAL_MODE)
isoc_bufs = &dev->usb_ctl.digital_bufs; usb_bufs = &dev->usb_ctl.digital_bufs;
else else
isoc_bufs = &dev->usb_ctl.analog_bufs; usb_bufs = &dev->usb_ctl.analog_bufs;
for (i = 0; i < isoc_bufs->num_bufs; i++) { for (i = 0; i < usb_bufs->num_bufs; i++) {
urb = isoc_bufs->urb[i]; urb = usb_bufs->urb[i];
if (urb) { if (urb) {
if (!irqs_disabled()) if (!irqs_disabled())
usb_kill_urb(urb); usb_kill_urb(urb);
else else
usb_unlink_urb(urb); usb_unlink_urb(urb);
if (isoc_bufs->transfer_buffer[i]) { if (usb_bufs->transfer_buffer[i]) {
usb_free_coherent(dev->udev, usb_free_coherent(dev->udev,
urb->transfer_buffer_length, urb->transfer_buffer_length,
isoc_bufs->transfer_buffer[i], usb_bufs->transfer_buffer[i],
urb->transfer_dma); urb->transfer_dma);
} }
usb_free_urb(urb); usb_free_urb(urb);
isoc_bufs->urb[i] = NULL; usb_bufs->urb[i] = NULL;
} }
isoc_bufs->transfer_buffer[i] = NULL; usb_bufs->transfer_buffer[i] = NULL;
} }
kfree(isoc_bufs->urb); kfree(usb_bufs->urb);
kfree(isoc_bufs->transfer_buffer); kfree(usb_bufs->transfer_buffer);
isoc_bufs->urb = NULL; usb_bufs->urb = NULL;
isoc_bufs->transfer_buffer = NULL; usb_bufs->transfer_buffer = NULL;
isoc_bufs->num_bufs = 0; usb_bufs->num_bufs = 0;
em28xx_capture_start(dev, 0); em28xx_capture_start(dev, 0);
} }
EXPORT_SYMBOL_GPL(em28xx_uninit_isoc); EXPORT_SYMBOL_GPL(em28xx_uninit_usb_xfer);
/* /*
* Stop URBs * Stop URBs
...@@ -1051,7 +1052,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode, ...@@ -1051,7 +1052,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
isoc_bufs = &dev->usb_ctl.analog_bufs; isoc_bufs = &dev->usb_ctl.analog_bufs;
/* De-allocates all pending stuff */ /* De-allocates all pending stuff */
em28xx_uninit_isoc(dev, mode); em28xx_uninit_usb_xfer(dev, mode);
isoc_bufs->num_bufs = num_bufs; isoc_bufs->num_bufs = num_bufs;
...@@ -1081,7 +1082,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode, ...@@ -1081,7 +1082,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL); urb = usb_alloc_urb(isoc_bufs->num_packets, GFP_KERNEL);
if (!urb) { if (!urb) {
em28xx_err("cannot alloc usb_ctl.urb %i\n", i); em28xx_err("cannot alloc usb_ctl.urb %i\n", i);
em28xx_uninit_isoc(dev, mode); em28xx_uninit_usb_xfer(dev, mode);
return -ENOMEM; return -ENOMEM;
} }
isoc_bufs->urb[i] = urb; isoc_bufs->urb[i] = urb;
...@@ -1093,7 +1094,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode, ...@@ -1093,7 +1094,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
" buffer %i%s\n", " buffer %i%s\n",
sb_size, i, sb_size, i,
in_interrupt() ? " while in int" : ""); in_interrupt() ? " while in int" : "");
em28xx_uninit_isoc(dev, mode); em28xx_uninit_usb_xfer(dev, mode);
return -ENOMEM; return -ENOMEM;
} }
memset(isoc_bufs->transfer_buffer[i], 0, sb_size); memset(isoc_bufs->transfer_buffer[i], 0, sb_size);
...@@ -1171,7 +1172,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode, ...@@ -1171,7 +1172,7 @@ int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
if (rc) { if (rc) {
em28xx_err("submit of urb %i failed (error=%i)\n", i, em28xx_err("submit of urb %i failed (error=%i)\n", i,
rc); rc);
em28xx_uninit_isoc(dev, mode); em28xx_uninit_usb_xfer(dev, mode);
return rc; return rc;
} }
} }
......
...@@ -2272,7 +2272,7 @@ static int em28xx_v4l2_close(struct file *filp) ...@@ -2272,7 +2272,7 @@ static int em28xx_v4l2_close(struct file *filp)
v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0); v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
/* do this before setting alternate! */ /* do this before setting alternate! */
em28xx_uninit_isoc(dev, EM28XX_ANALOG_MODE); em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
em28xx_set_mode(dev, EM28XX_SUSPEND); em28xx_set_mode(dev, EM28XX_SUSPEND);
/* set alternate 0 */ /* set alternate 0 */
......
...@@ -667,7 +667,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode, ...@@ -667,7 +667,7 @@ int em28xx_alloc_isoc(struct em28xx *dev, enum em28xx_mode mode,
int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode, int em28xx_init_isoc(struct em28xx *dev, enum em28xx_mode mode,
int num_packets, int num_bufs, int max_pkt_size, int num_packets, int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct em28xx *dev, struct urb *urb)); int (*isoc_copy) (struct em28xx *dev, struct urb *urb));
void em28xx_uninit_isoc(struct em28xx *dev, enum em28xx_mode mode); void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode);
void em28xx_stop_urbs(struct em28xx *dev); void em28xx_stop_urbs(struct em28xx *dev);
int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev); int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev);
int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode); int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode);
......
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