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

[media] em28xx: rename function em28xx_dvb_isoc_copy and extend for USB bulk transfers

The URB data processing for DVB bulk transfers is very similar to
what is done with isoc transfers, so create a common function that
works with both transfer types based on the existing isoc function.
Tested with device Hauppauge HVR-930c.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4601cc39
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
(c) 2008 Aidan Thornton <makosoft@googlemail.com> (c) 2008 Aidan Thornton <makosoft@googlemail.com>
(c) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by: Based on cx88-dvb, saa7134-dvb and videobuf-dvb originally written by:
(c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au> (c) 2004, 2005 Chris Pascoe <c.pascoe@itee.uq.edu.au>
(c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
...@@ -124,9 +126,9 @@ static inline void print_err_status(struct em28xx *dev, ...@@ -124,9 +126,9 @@ static inline void print_err_status(struct em28xx *dev,
} }
} }
static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb) static inline int em28xx_dvb_urb_data_copy(struct em28xx *dev, struct urb *urb)
{ {
int i; int xfer_bulk, num_packets, i;
if (!dev) if (!dev)
return 0; return 0;
...@@ -137,18 +139,34 @@ static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb) ...@@ -137,18 +139,34 @@ static inline int em28xx_dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
if (urb->status < 0) if (urb->status < 0)
print_err_status(dev, -1, urb->status); print_err_status(dev, -1, urb->status);
for (i = 0; i < urb->number_of_packets; i++) { xfer_bulk = usb_pipebulk(urb->pipe);
int status = urb->iso_frame_desc[i].status;
if (status < 0) { if (xfer_bulk) /* bulk */
print_err_status(dev, i, status); num_packets = 1;
if (urb->iso_frame_desc[i].status != -EPROTO) else /* isoc */
continue; num_packets = urb->number_of_packets;
}
dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer + for (i = 0; i < num_packets; i++) {
urb->iso_frame_desc[i].offset, if (xfer_bulk) {
urb->iso_frame_desc[i].actual_length); if (urb->status < 0) {
print_err_status(dev, i, urb->status);
if (urb->status != -EPROTO)
continue;
}
dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
urb->actual_length);
} else {
if (urb->iso_frame_desc[i].status < 0) {
print_err_status(dev, i,
urb->iso_frame_desc[i].status);
if (urb->iso_frame_desc[i].status != -EPROTO)
continue;
}
dvb_dmx_swfilter(&dev->dvb->demux,
urb->transfer_buffer +
urb->iso_frame_desc[i].offset,
urb->iso_frame_desc[i].actual_length);
}
} }
return 0; return 0;
...@@ -177,7 +195,7 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb) ...@@ -177,7 +195,7 @@ static int em28xx_start_streaming(struct em28xx_dvb *dvb)
EM28XX_DVB_NUM_BUFS, EM28XX_DVB_NUM_BUFS,
max_dvb_packet_size, max_dvb_packet_size,
EM28XX_DVB_NUM_ISOC_PACKETS, EM28XX_DVB_NUM_ISOC_PACKETS,
em28xx_dvb_isoc_copy); em28xx_dvb_urb_data_copy);
} }
static int em28xx_stop_streaming(struct em28xx_dvb *dvb) static int em28xx_stop_streaming(struct em28xx_dvb *dvb)
......
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