X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fmedia%2Fusbvideo.c;h=543d465e7dfa99bcbdec209bebccd5d7ef9abdfc;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=1107e398d6f3861c0cbc57311bb9ea04a5887407;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c index 1107e398d..543d465e7 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/usb/media/usbvideo.c @@ -60,21 +60,6 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, /*******************************/ /* Memory management functions */ /*******************************/ - -/* - * Here we want the physical address of the memory. - * This is used when initializing the contents of the area. - */ -unsigned long usbvideo_kvirt_to_pa(unsigned long adr) -{ - unsigned long kva, ret; - - kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); - kva |= adr & (PAGE_SIZE-1); /* restore the offset */ - ret = __pa(kva); - return ret; -} - static void *usbvideo_rvmalloc(unsigned long size) { void *mem; @@ -519,72 +504,6 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd) } } -/* - * usbvideo_DrawLine() - * - * A standard implementation of Bresenham's line drawing algorithm. - * This procedure is provided primarily for debugging or demo - * purposes. - */ -void usbvideo_DrawLine( - struct usbvideo_frame *frame, - int x1, int y1, - int x2, int y2, - unsigned char cr, unsigned char cg, unsigned char cb) -{ - int i, dx, dy, np, d; - int dinc1, dinc2, x, xinc1, xinc2, y, yinc1, yinc2; - - if ((dx = x2 - x1) < 0) - dx = -dx; - if ((dy = y2 - y1) < 0) - dy = -dy; - if (dx >= dy) { - np = dx + 1; - d = (2 * dy) - dx; - dinc1 = dy << 1; - dinc2 = (dy - dx) << 1; - xinc1 = 1; - xinc2 = 1; - yinc1 = 0; - yinc2 = 1; - } else { - np = dy + 1; - d = (2 * dx) - dy; - dinc1 = dx << 1; - dinc2 = (dx - dy) << 1; - xinc1 = 0; - xinc2 = 1; - yinc1 = 1; - yinc2 = 1; - } - /* Make sure x and y move in the right directions */ - if (x1 > x2) { - xinc1 = -xinc1; - xinc2 = -xinc2; - } - if (y1 > y2) { - yinc1 = -yinc1; - yinc2 = -yinc2; - } - for (i=0, x=x1, y=y1; i < np; i++) { - if (frame->palette == VIDEO_PALETTE_RGB24) { -/* TODO */ RGB24_PUTPIXEL(frame, x, y, cr, cg, cb); - } - if (d < 0) { - d += dinc1; - x += xinc1; - y += yinc1; - } else { - d += dinc2; - x += xinc2; - y += yinc2; - } - } -} - -EXPORT_SYMBOL(usbvideo_DrawLine); - /* * usbvideo_TestPattern() * @@ -673,6 +592,8 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) EXPORT_SYMBOL(usbvideo_TestPattern); + +#ifdef DEBUG /* * usbvideo_HexDump() * @@ -702,16 +623,7 @@ void usbvideo_HexDump(const unsigned char *data, int len) EXPORT_SYMBOL(usbvideo_HexDump); -/* Debugging aid */ -void usbvideo_SayAndWait(const char *what) -{ - wait_queue_head_t wq; - init_waitqueue_head(&wq); - info("Say: %s", what); - interruptible_sleep_on_timeout (&wq, HZ*3); /* Timeout */ -} - -EXPORT_SYMBOL(usbvideo_SayAndWait); +#endif /* ******************************************************************** */ @@ -1168,8 +1080,8 @@ static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma) pos = (unsigned long) uvd->fbuf; while (size > 0) { - page = usbvideo_kvirt_to_pa(pos); - if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) + page = vmalloc_to_pfn((void *)pos); + if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) return -EAGAIN; start += PAGE_SIZE; @@ -1910,9 +1822,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd) /* Unschedule all of the iso td's */ for (i=0; i < USBVIDEO_NUMSBUF; i++) { - j = usb_unlink_urb(uvd->sbuf[i].urb); - if (j < 0) - err("%s: usb_unlink_urb() error %d.", __FUNCTION__, j); + usb_kill_urb(uvd->sbuf[i].urb); } if (uvd->debug > 1) info("%s: streaming=0", __FUNCTION__);