aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-06-24 04:14:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 13:52:20 -0400
commite795d912d71734890759e6341c69d20bebb0d10b (patch)
tree7b95c2891b08e86bcd067ee4f4e0310ba5ad7e2b /drivers/media/video/gspca
parenta68f723cef2c97c30e84c39a847c0c5feff5f0d5 (diff)
V4L/DVB: gspca - main: Don't use the PG_Reserved flag for mmapped buffers
Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/gspca.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index b7a5655cfd55..03a24510d66f 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -506,36 +506,6 @@ static int gspca_is_compressed(__u32 format)
506 return 0; 506 return 0;
507} 507}
508 508
509static void *rvmalloc(long size)
510{
511 void *mem;
512 unsigned long adr;
513
514 mem = vmalloc_32(size);
515 if (mem != NULL) {
516 adr = (unsigned long) mem;
517 while (size > 0) {
518 SetPageReserved(vmalloc_to_page((void *) adr));
519 adr += PAGE_SIZE;
520 size -= PAGE_SIZE;
521 }
522 }
523 return mem;
524}
525
526static void rvfree(void *mem, long size)
527{
528 unsigned long adr;
529
530 adr = (unsigned long) mem;
531 while (size > 0) {
532 ClearPageReserved(vmalloc_to_page((void *) adr));
533 adr += PAGE_SIZE;
534 size -= PAGE_SIZE;
535 }
536 vfree(mem);
537}
538
539static int frame_alloc(struct gspca_dev *gspca_dev, 509static int frame_alloc(struct gspca_dev *gspca_dev,
540 unsigned int count) 510 unsigned int count)
541{ 511{
@@ -550,7 +520,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
550 gspca_dev->frsz = frsz; 520 gspca_dev->frsz = frsz;
551 if (count > GSPCA_MAX_FRAMES) 521 if (count > GSPCA_MAX_FRAMES)
552 count = GSPCA_MAX_FRAMES; 522 count = GSPCA_MAX_FRAMES;
553 gspca_dev->frbuf = rvmalloc(frsz * count); 523 gspca_dev->frbuf = vmalloc_32(frsz * count);
554 if (!gspca_dev->frbuf) { 524 if (!gspca_dev->frbuf) {
555 err("frame alloc failed"); 525 err("frame alloc failed");
556 return -ENOMEM; 526 return -ENOMEM;
@@ -582,8 +552,7 @@ static void frame_free(struct gspca_dev *gspca_dev)
582 552
583 PDEBUG(D_STREAM, "frame free"); 553 PDEBUG(D_STREAM, "frame free");
584 if (gspca_dev->frbuf != NULL) { 554 if (gspca_dev->frbuf != NULL) {
585 rvfree(gspca_dev->frbuf, 555 vfree(gspca_dev->frbuf);
586 gspca_dev->nframes * gspca_dev->frsz);
587 gspca_dev->frbuf = NULL; 556 gspca_dev->frbuf = NULL;
588 for (i = 0; i < gspca_dev->nframes; i++) 557 for (i = 0; i < gspca_dev->nframes; i++)
589 gspca_dev->frame[i].data = NULL; 558 gspca_dev->frame[i].data = NULL;