Skip to content

Commit 1a0c10e

Browse files
committed
media: dvb-usb-v2: stop using coherent memory for URBs
There's no need to use coherent buffers there. So, let the DVB core do the allocation. That should give some performance gain outside x86. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent 14f4eae commit 1a0c10e

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

‎drivers/media/usb/dvb-usb-v2/usb_urb.c‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ static int usb_urb_alloc_bulk_urbs(struct usb_data_stream *stream)
155155
stream->props.u.bulk.buffersize,
156156
usb_urb_complete, stream);
157157

158-
stream->urb_list[i]->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
159-
stream->urb_list[i]->transfer_dma = stream->dma_addr[i];
158+
stream->urb_list[i]->transfer_flags = URB_FREE_BUFFER;
160159
stream->urbs_initialized++;
161160
}
162161
return 0;
@@ -187,13 +186,12 @@ static int usb_urb_alloc_isoc_urbs(struct usb_data_stream *stream)
187186
urb->complete = usb_urb_complete;
188187
urb->pipe = usb_rcvisocpipe(stream->udev,
189188
stream->props.endpoint);
190-
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
189+
urb->transfer_flags = URB_ISO_ASAP | URB_FREE_BUFFER;
191190
urb->interval = stream->props.u.isoc.interval;
192191
urb->number_of_packets = stream->props.u.isoc.framesperurb;
193192
urb->transfer_buffer_length = stream->props.u.isoc.framesize *
194193
stream->props.u.isoc.framesperurb;
195194
urb->transfer_buffer = stream->buf_list[i];
196-
urb->transfer_dma = stream->dma_addr[i];
197195

198196
for (j = 0; j < stream->props.u.isoc.framesperurb; j++) {
199197
urb->iso_frame_desc[j].offset = frame_offset;
@@ -212,11 +210,7 @@ static int usb_free_stream_buffers(struct usb_data_stream *stream)
212210
if (stream->state & USB_STATE_URB_BUF) {
213211
while (stream->buf_num) {
214212
stream->buf_num--;
215-
dev_dbg(&stream->udev->dev, "%s: free buf=%d\n",
216-
__func__, stream->buf_num);
217-
usb_free_coherent(stream->udev, stream->buf_size,
218-
stream->buf_list[stream->buf_num],
219-
stream->dma_addr[stream->buf_num]);
213+
stream->buf_list[stream->buf_num] = NULL;
220214
}
221215
}
222216

@@ -236,9 +230,7 @@ static int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num,
236230
__func__, num * size);
237231

238232
for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) {
239-
stream->buf_list[stream->buf_num] = usb_alloc_coherent(
240-
stream->udev, size, GFP_ATOMIC,
241-
&stream->dma_addr[stream->buf_num]);
233+
stream->buf_list[stream->buf_num] = kzalloc(size, GFP_ATOMIC);
242234
if (!stream->buf_list[stream->buf_num]) {
243235
dev_dbg(&stream->udev->dev, "%s: alloc buf=%d failed\n",
244236
__func__, stream->buf_num);
@@ -250,7 +242,6 @@ static int usb_alloc_stream_buffers(struct usb_data_stream *stream, int num,
250242
__func__, stream->buf_num,
251243
stream->buf_list[stream->buf_num],
252244
(long long)stream->dma_addr[stream->buf_num]);
253-
memset(stream->buf_list[stream->buf_num], 0, size);
254245
stream->state |= USB_STATE_URB_BUF;
255246
}
256247

0 commit comments

Comments
 (0)