summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c50
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c3
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c22
3 files changed, 11 insertions, 64 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 9f6e5e5..0cfe754 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -116,47 +116,6 @@ void em28xx_print_ioctl(char *name, unsigned int cmd)
}
}
-static void *rvmalloc(size_t size)
-{
- void *mem;
- unsigned long adr;
-
- size = PAGE_ALIGN(size);
-
- mem = vmalloc_32((unsigned long)size);
- if (!mem)
- return NULL;
-
- memset(mem, 0, size);
-
- adr = (unsigned long)mem;
- while (size > 0) {
- SetPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-
- return mem;
-}
-
-static void rvfree(void *mem, size_t size)
-{
- unsigned long adr;
-
- if (!mem)
- return;
-
- size = PAGE_ALIGN(size);
-
- adr = (unsigned long)mem;
- while (size > 0) {
- ClearPageReserved(vmalloc_to_page((void *)adr));
- adr += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
-
- vfree(mem);
-}
/*
* em28xx_request_buffers()
@@ -167,14 +126,16 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count)
const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */
void *buff = NULL;
u32 i;
- em28xx_coredbg("requested %i buffers with size %i", count, imagesize);
+ em28xx_coredbg("requested %i buffers with size %zd", count, imagesize);
if (count > EM28XX_NUM_FRAMES)
count = EM28XX_NUM_FRAMES;
dev->num_frames = count;
while (dev->num_frames > 0) {
- if ((buff = rvmalloc(dev->num_frames * imagesize)))
+ if ((buff = vmalloc_32(dev->num_frames * imagesize))) {
+ memset(buff, 0, dev->num_frames * imagesize);
break;
+ }
dev->num_frames--;
}
@@ -217,8 +178,7 @@ void em28xx_queue_unusedframes(struct em28xx *dev)
void em28xx_release_buffers(struct em28xx *dev)
{
if (dev->num_frames) {
- rvfree(dev->frame[0].bufmem,
- dev->num_frames * PAGE_ALIGN(dev->frame[0].buf.length));
+ vfree(dev->frame[0].bufmem);
dev->num_frames = 0;
}
}
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index b32d985..d14bcf4 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -41,7 +41,7 @@ module_param(i2c_debug, int, 0644);
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
#define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\
- printk(fmt , ##args); } while (0)
+ printk(fmt, ##args); } while (0)
#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \
printk(KERN_DEBUG "%s at %s: " fmt, \
dev->name, __FUNCTION__ , ##args); } while (0)
@@ -497,7 +497,6 @@ static struct i2c_adapter em28xx_adap_template = {
static struct i2c_client em28xx_client_template = {
.name = "em28xx internal",
- .flags = I2C_CLIENT_ALLOW_USE,
};
/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index abec32c..3a56120 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -189,16 +189,6 @@ static DECLARE_RWSEM(em28xx_disconnect);
/********************* v4l2 interface ******************************************/
-static inline unsigned long 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);
- ret = __pa(kva);
- return ret;
-}
-
/*
* em28xx_config()
* inits registers with sane defaults
@@ -616,7 +606,8 @@ static struct vm_operations_struct em28xx_vm_ops = {
static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
{
unsigned long size = vma->vm_end - vma->vm_start,
- start = vma->vm_start, pos, page;
+ start = vma->vm_start;
+ void *pos;
u32 i;
struct em28xx *dev = filp->private_data;
@@ -657,12 +648,10 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma)
vma->vm_flags |= VM_IO;
vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */
- pos = (unsigned long)dev->frame[i].bufmem;
+ pos = dev->frame[i].bufmem;
while (size > 0) { /* size is page-aligned */
- page = vmalloc_to_pfn((void *)pos);
- if (remap_pfn_range(vma, start, page, PAGE_SIZE,
- vma->vm_page_prot)) {
- em28xx_videodbg("mmap: rename page map failed\n");
+ if (vm_insert_page(vma, start, vmalloc_to_page(pos))) {
+ em28xx_videodbg("mmap: vm_insert_page failed\n");
up(&dev->fileop_lock);
return -EAGAIN;
}
@@ -1895,7 +1884,6 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
}
static struct usb_driver em28xx_usb_driver = {
- .owner = THIS_MODULE,
.name = "em28xx",
.probe = em28xx_usb_probe,
.disconnect = em28xx_usb_disconnect,
OpenPOWER on IntegriCloud