diff options
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-core.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 54 |
1 files changed, 7 insertions, 47 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 9f6e5e5355a1..e8a1c2247567 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -39,7 +39,7 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); | |||
39 | #define em28xx_coredbg(fmt, arg...) do {\ | 39 | #define em28xx_coredbg(fmt, arg...) do {\ |
40 | if (core_debug) \ | 40 | if (core_debug) \ |
41 | printk(KERN_INFO "%s %s :"fmt, \ | 41 | printk(KERN_INFO "%s %s :"fmt, \ |
42 | dev->name, __FUNCTION__ , ##arg); } while (0) | 42 | dev->name, __FUNCTION__, ##arg); } while (0) |
43 | 43 | ||
44 | static unsigned int reg_debug; | 44 | static unsigned int reg_debug; |
45 | module_param(reg_debug,int,0644); | 45 | module_param(reg_debug,int,0644); |
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); | |||
48 | #define em28xx_regdbg(fmt, arg...) do {\ | 48 | #define em28xx_regdbg(fmt, arg...) do {\ |
49 | if (reg_debug) \ | 49 | if (reg_debug) \ |
50 | printk(KERN_INFO "%s %s :"fmt, \ | 50 | printk(KERN_INFO "%s %s :"fmt, \ |
51 | dev->name, __FUNCTION__ , ##arg); } while (0) | 51 | dev->name, __FUNCTION__, ##arg); } while (0) |
52 | 52 | ||
53 | static unsigned int isoc_debug; | 53 | static unsigned int isoc_debug; |
54 | module_param(isoc_debug,int,0644); | 54 | module_param(isoc_debug,int,0644); |
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); | |||
57 | #define em28xx_isocdbg(fmt, arg...) do {\ | 57 | #define em28xx_isocdbg(fmt, arg...) do {\ |
58 | if (isoc_debug) \ | 58 | if (isoc_debug) \ |
59 | printk(KERN_INFO "%s %s :"fmt, \ | 59 | printk(KERN_INFO "%s %s :"fmt, \ |
60 | dev->name, __FUNCTION__ , ##arg); } while (0) | 60 | dev->name, __FUNCTION__, ##arg); } while (0) |
61 | 61 | ||
62 | static int alt = EM28XX_PINOUT; | 62 | static int alt = EM28XX_PINOUT; |
63 | module_param(alt, int, 0644); | 63 | module_param(alt, int, 0644); |
@@ -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() |
@@ -173,8 +132,10 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count) | |||
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 | } |