diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-12-20 23:03:50 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-12-20 23:03:50 -0500 |
commit | 041387d98460b3947587929ef3a4773b8c48538f (patch) | |
tree | 3330eebba3fa1aa7c13479e527f07b03d7fb53ed /drivers/media/video/em28xx | |
parent | 56f0356321a876a1a356712f2486d6188a3b4992 (diff) | |
parent | b05948d9b7167e23af88cc65b9ffa4687eaf1f0d (diff) |
Manual merge with Linus (conflict in drivers/input/misc/wistron_bnts.c)
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 50 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 21 |
3 files changed, 11 insertions, 62 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 9f6e5e5355a1..0cfe75416ec6 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) | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | static void *rvmalloc(size_t size) | ||
120 | { | ||
121 | void *mem; | ||
122 | unsigned long adr; | ||
123 | |||
124 | size = PAGE_ALIGN(size); | ||
125 | |||
126 | mem = vmalloc_32((unsigned long)size); | ||
127 | if (!mem) | ||
128 | return NULL; | ||
129 | |||
130 | memset(mem, 0, size); | ||
131 | |||
132 | adr = (unsigned long)mem; | ||
133 | while (size > 0) { | ||
134 | SetPageReserved(vmalloc_to_page((void *)adr)); | ||
135 | adr += PAGE_SIZE; | ||
136 | size -= PAGE_SIZE; | ||
137 | } | ||
138 | |||
139 | return mem; | ||
140 | } | ||
141 | |||
142 | static void rvfree(void *mem, size_t size) | ||
143 | { | ||
144 | unsigned long adr; | ||
145 | |||
146 | if (!mem) | ||
147 | return; | ||
148 | |||
149 | size = PAGE_ALIGN(size); | ||
150 | |||
151 | adr = (unsigned long)mem; | ||
152 | while (size > 0) { | ||
153 | ClearPageReserved(vmalloc_to_page((void *)adr)); | ||
154 | adr += PAGE_SIZE; | ||
155 | size -= PAGE_SIZE; | ||
156 | } | ||
157 | |||
158 | vfree(mem); | ||
159 | } | ||
160 | 119 | ||
161 | /* | 120 | /* |
162 | * em28xx_request_buffers() | 121 | * em28xx_request_buffers() |
@@ -167,14 +126,16 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count) | |||
167 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ | 126 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ |
168 | void *buff = NULL; | 127 | void *buff = NULL; |
169 | u32 i; | 128 | u32 i; |
170 | em28xx_coredbg("requested %i buffers with size %i", count, imagesize); | 129 | em28xx_coredbg("requested %i buffers with size %zd", count, imagesize); |
171 | if (count > EM28XX_NUM_FRAMES) | 130 | if (count > EM28XX_NUM_FRAMES) |
172 | count = EM28XX_NUM_FRAMES; | 131 | count = EM28XX_NUM_FRAMES; |
173 | 132 | ||
174 | dev->num_frames = count; | 133 | dev->num_frames = count; |
175 | while (dev->num_frames > 0) { | 134 | while (dev->num_frames > 0) { |
176 | if ((buff = rvmalloc(dev->num_frames * imagesize))) | 135 | if ((buff = vmalloc_32(dev->num_frames * imagesize))) { |
136 | memset(buff, 0, dev->num_frames * imagesize); | ||
177 | break; | 137 | break; |
138 | } | ||
178 | dev->num_frames--; | 139 | dev->num_frames--; |
179 | } | 140 | } |
180 | 141 | ||
@@ -217,8 +178,7 @@ void em28xx_queue_unusedframes(struct em28xx *dev) | |||
217 | void em28xx_release_buffers(struct em28xx *dev) | 178 | void em28xx_release_buffers(struct em28xx *dev) |
218 | { | 179 | { |
219 | if (dev->num_frames) { | 180 | if (dev->num_frames) { |
220 | rvfree(dev->frame[0].bufmem, | 181 | vfree(dev->frame[0].bufmem); |
221 | dev->num_frames * PAGE_ALIGN(dev->frame[0].buf.length)); | ||
222 | dev->num_frames = 0; | 182 | dev->num_frames = 0; |
223 | } | 183 | } |
224 | } | 184 | } |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index b32d9852f34c..7f5603054f02 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); | |||
41 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); | 41 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); |
42 | 42 | ||
43 | #define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\ | 43 | #define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\ |
44 | printk(fmt , ##args); } while (0) | 44 | printk(fmt, ##args); } while (0) |
45 | #define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ | 45 | #define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ |
46 | printk(KERN_DEBUG "%s at %s: " fmt, \ | 46 | printk(KERN_DEBUG "%s at %s: " fmt, \ |
47 | dev->name, __FUNCTION__ , ##args); } while (0) | 47 | dev->name, __FUNCTION__ , ##args); } while (0) |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index abec32c175aa..06d76879bde2 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); | |||
189 | 189 | ||
190 | /********************* v4l2 interface ******************************************/ | 190 | /********************* v4l2 interface ******************************************/ |
191 | 191 | ||
192 | static inline unsigned long kvirt_to_pa(unsigned long adr) | ||
193 | { | ||
194 | unsigned long kva, ret; | ||
195 | |||
196 | kva = (unsigned long)page_address(vmalloc_to_page((void *)adr)); | ||
197 | kva |= adr & (PAGE_SIZE - 1); | ||
198 | ret = __pa(kva); | ||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | /* | 192 | /* |
203 | * em28xx_config() | 193 | * em28xx_config() |
204 | * inits registers with sane defaults | 194 | * inits registers with sane defaults |
@@ -616,7 +606,8 @@ static struct vm_operations_struct em28xx_vm_ops = { | |||
616 | static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | 606 | static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) |
617 | { | 607 | { |
618 | unsigned long size = vma->vm_end - vma->vm_start, | 608 | unsigned long size = vma->vm_end - vma->vm_start, |
619 | start = vma->vm_start, pos, page; | 609 | start = vma->vm_start; |
610 | void *pos; | ||
620 | u32 i; | 611 | u32 i; |
621 | 612 | ||
622 | struct em28xx *dev = filp->private_data; | 613 | struct em28xx *dev = filp->private_data; |
@@ -657,12 +648,10 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
657 | vma->vm_flags |= VM_IO; | 648 | vma->vm_flags |= VM_IO; |
658 | vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ | 649 | vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ |
659 | 650 | ||
660 | pos = (unsigned long)dev->frame[i].bufmem; | 651 | pos = dev->frame[i].bufmem; |
661 | while (size > 0) { /* size is page-aligned */ | 652 | while (size > 0) { /* size is page-aligned */ |
662 | page = vmalloc_to_pfn((void *)pos); | 653 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { |
663 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, | 654 | em28xx_videodbg("mmap: vm_insert_page failed\n"); |
664 | vma->vm_page_prot)) { | ||
665 | em28xx_videodbg("mmap: rename page map failed\n"); | ||
666 | up(&dev->fileop_lock); | 655 | up(&dev->fileop_lock); |
667 | return -EAGAIN; | 656 | return -EAGAIN; |
668 | } | 657 | } |