Commit 15072bba authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] dvb_usb_v2: usb_urb.c use dynamic debugs

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bce1c029
...@@ -37,7 +37,8 @@ static void usb_urb_complete(struct urb *urb) ...@@ -37,7 +37,8 @@ static void usb_urb_complete(struct urb *urb)
case -ESHUTDOWN: case -ESHUTDOWN:
return; return;
default: /* error */ default: /* error */
deb_ts("urb completition error %d.\n", urb->status); pr_debug("%s: URB completition failed=%d\n", __func__,
urb->status);
break; break;
} }
...@@ -46,8 +47,8 @@ static void usb_urb_complete(struct urb *urb) ...@@ -46,8 +47,8 @@ static void usb_urb_complete(struct urb *urb)
case PIPE_ISOCHRONOUS: case PIPE_ISOCHRONOUS:
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
if (urb->iso_frame_desc[i].status != 0) if (urb->iso_frame_desc[i].status != 0)
deb_ts("iso frame descriptor has an" \ pr_debug("%s: iso frame descriptor has an" \
" error: %d\n", " error=%d\n", __func__,
urb->iso_frame_desc[i].status); urb->iso_frame_desc[i].status);
else if (urb->iso_frame_desc[i].actual_length > 0) else if (urb->iso_frame_desc[i].actual_length > 0)
stream->complete(stream, stream->complete(stream,
...@@ -74,8 +75,7 @@ int usb_urb_kill(struct usb_data_stream *stream) ...@@ -74,8 +75,7 @@ int usb_urb_kill(struct usb_data_stream *stream)
{ {
int i; int i;
for (i = 0; i < stream->urbs_submitted; i++) { for (i = 0; i < stream->urbs_submitted; i++) {
deb_ts("killing URB no. %d.\n", i); pr_debug("%s: kill URB=%d\n", __func__, i);
/* stop the URB */ /* stop the URB */
usb_kill_urb(stream->urb_list[i]); usb_kill_urb(stream->urb_list[i]);
} }
...@@ -95,7 +95,7 @@ int usb_urb_submit(struct usb_data_stream *stream, ...@@ -95,7 +95,7 @@ int usb_urb_submit(struct usb_data_stream *stream,
} }
for (i = 0; i < stream->urbs_initialized; i++) { for (i = 0; i < stream->urbs_initialized; i++) {
deb_ts("submitting URB no. %d\n", i); pr_debug("%s: submit URB=%d\n", __func__, i);
ret = usb_submit_urb(stream->urb_list[i], GFP_ATOMIC); ret = usb_submit_urb(stream->urb_list[i], GFP_ATOMIC);
if (ret) { if (ret) {
err("could not submit URB no. %d - get them all back", err("could not submit URB no. %d - get them all back",
...@@ -116,7 +116,6 @@ int usb_urb_free_urbs(struct usb_data_stream *stream) ...@@ -116,7 +116,6 @@ int usb_urb_free_urbs(struct usb_data_stream *stream)
for (i = 0; i < stream->urbs_initialized; i++) { for (i = 0; i < stream->urbs_initialized; i++) {
if (stream->urb_list[i] != NULL) { if (stream->urb_list[i] != NULL) {
deb_mem("freeing URB no. %d.\n", i);
pr_debug("%s: free URB=%d\n", __func__, i); pr_debug("%s: free URB=%d\n", __func__, i);
/* free the URBs */ /* free the URBs */
usb_free_urb(stream->urb_list[i]); usb_free_urb(stream->urb_list[i]);
...@@ -136,7 +135,7 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream) ...@@ -136,7 +135,7 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream)
pr_debug("%s: alloc URB=%d\n", __func__, i); pr_debug("%s: alloc URB=%d\n", __func__, i);
stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC); stream->urb_list[i] = usb_alloc_urb(0, GFP_ATOMIC);
if (!stream->urb_list[i]) { if (!stream->urb_list[i]) {
deb_mem("not enough memory for urb_alloc_urb!.\n"); pr_debug("%s: failed\n", __func__);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
usb_free_urb(stream->urb_list[j]); usb_free_urb(stream->urb_list[j]);
return -ENOMEM; return -ENOMEM;
...@@ -168,7 +167,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream) ...@@ -168,7 +167,7 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream)
stream->urb_list[i] = usb_alloc_urb( stream->urb_list[i] = usb_alloc_urb(
stream->props.u.isoc.framesperurb, GFP_ATOMIC); stream->props.u.isoc.framesperurb, GFP_ATOMIC);
if (!stream->urb_list[i]) { if (!stream->urb_list[i]) {
deb_mem("not enough memory for urb_alloc_urb!\n"); pr_debug("%s: failed\n", __func__);
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
usb_free_urb(stream->urb_list[j]); usb_free_urb(stream->urb_list[j]);
return -ENOMEM; return -ENOMEM;
...@@ -206,7 +205,8 @@ int usb_free_stream_buffers(struct usb_data_stream *stream) ...@@ -206,7 +205,8 @@ int usb_free_stream_buffers(struct usb_data_stream *stream)
if (stream->state & USB_STATE_URB_BUF) { if (stream->state & USB_STATE_URB_BUF) {
while (stream->buf_num) { while (stream->buf_num) {
stream->buf_num--; stream->buf_num--;
deb_mem("freeing buffer %d\n", stream->buf_num); pr_debug("%s: free buf=%d\n", __func__,
stream->buf_num);
usb_free_coherent(stream->udev, stream->buf_size, usb_free_coherent(stream->udev, stream->buf_size,
stream->buf_list[stream->buf_num], stream->buf_list[stream->buf_num],
stream->dma_addr[stream->buf_num]); stream->dma_addr[stream->buf_num]);
...@@ -224,27 +224,27 @@ int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num, ...@@ -224,27 +224,27 @@ int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num,
stream->buf_num = 0; stream->buf_num = 0;
stream->buf_size = size; stream->buf_size = size;
deb_mem("all in all I will use %lu bytes for streaming\n", num * size); pr_debug("%s: all in all I will use %lu bytes for streaming\n",
__func__, num * size);
for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) { for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) {
deb_mem("allocating buffer %d\n", stream->buf_num); pr_debug("%s: alloc buf=%d\n", __func__, stream->buf_num);
stream->buf_list[stream->buf_num] = usb_alloc_coherent( stream->buf_list[stream->buf_num] = usb_alloc_coherent(
stream->udev, size, GFP_ATOMIC, stream->udev, size, GFP_ATOMIC,
&stream->dma_addr[stream->buf_num]); &stream->dma_addr[stream->buf_num]);
if (stream->buf_list[stream->buf_num] == NULL) { if (stream->buf_list[stream->buf_num] == NULL) {
deb_mem("not enough memory for urb-buffer" \ pr_debug("%s: failed\n", __func__);
" allocation.\n");
usb_free_stream_buffers(stream); usb_free_stream_buffers(stream);
return -ENOMEM; return -ENOMEM;
} }
deb_mem("buffer %d: %p (dma: %llu)\n",
pr_debug("%s: buf %d: %p (dma %llu)\n", __func__,
stream->buf_num, stream->buf_num,
stream->buf_list[stream->buf_num], stream->buf_list[stream->buf_num],
(long long)stream->dma_addr[stream->buf_num]); (long long)stream->dma_addr[stream->buf_num]);
memset(stream->buf_list[stream->buf_num], 0, size); memset(stream->buf_list[stream->buf_num], 0, size);
stream->state |= USB_STATE_URB_BUF; stream->state |= USB_STATE_URB_BUF;
} }
deb_mem("allocation successful\n");
return 0; return 0;
} }
...@@ -258,12 +258,14 @@ int usb_urb_reconfig(struct usb_data_stream *stream, ...@@ -258,12 +258,14 @@ int usb_urb_reconfig(struct usb_data_stream *stream,
return 0; return 0;
/* check allocated buffers are large enough for the request */ /* check allocated buffers are large enough for the request */
if (props->type == USB_BULK) if (props->type == USB_BULK) {
buf_size = stream->props.u.bulk.buffersize; buf_size = stream->props.u.bulk.buffersize;
else if (props->type == USB_ISOC) } else if (props->type == USB_ISOC) {
buf_size = props->u.isoc.framesize * props->u.isoc.framesperurb; buf_size = props->u.isoc.framesize * props->u.isoc.framesperurb;
else } else {
err("invalid endpoint type=%d", props->type);
return -EINVAL; return -EINVAL;
}
if (stream->buf_num < props->count || stream->buf_size < buf_size) { if (stream->buf_num < props->count || stream->buf_size < buf_size) {
err("cannot reconfigure as allocated buffers are too small"); err("cannot reconfigure as allocated buffers are too small");
......
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