| Linux kernel & device driver programming |
| [ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] |
1 /* 1 /*
2 * VIDEO MOTION CODECs internal API for video 2 * VIDEO MOTION CODECs internal API for video devices
3 * 3 *
4 * Interface for MJPEG (and maybe later MPEG/W 4 * Interface for MJPEG (and maybe later MPEG/WAVELETS) codec's
5 * bound to a master device. 5 * bound to a master device.
6 * 6 *
7 * (c) 2002 Wolfgang Scherr <scherr@net4you.at 7 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
8 * 8 *
9 * $Id: videocodec.c,v 1.1.2.8 2003/03/29 07:1 9 * $Id: videocodec.c,v 1.1.2.8 2003/03/29 07:16:04 rbultje Exp $
10 * 10 *
11 * ------------------------------------------- 11 * ------------------------------------------------------------------------
12 * 12 *
13 * This program is free software; you can redi 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Publi 14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either versio 15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version. 16 * (at your option) any later version.
17 * 17 *
18 * This program is distributed in the hope tha 18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details 21 * GNU General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU 23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to t 24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 * 26 *
27 * ------------------------------------------- 27 * ------------------------------------------------------------------------
28 */ 28 */
29 29
30 #define VIDEOCODEC_VERSION "v0.2" 30 #define VIDEOCODEC_VERSION "v0.2"
31 31
32 #include <linux/kernel.h> 32 #include <linux/kernel.h>
33 #include <linux/module.h> 33 #include <linux/module.h>
34 #include <linux/init.h> 34 #include <linux/init.h>
35 #include <linux/types.h> 35 #include <linux/types.h>
36 #include <linux/slab.h> 36 #include <linux/slab.h>
37 37
38 // kernel config is here (procfs flag) 38 // kernel config is here (procfs flag)
>> 39 #include <linux/config.h>
39 40
40 #ifdef CONFIG_PROC_FS 41 #ifdef CONFIG_PROC_FS
41 #include <linux/proc_fs.h> 42 #include <linux/proc_fs.h>
42 #include <asm/uaccess.h> 43 #include <asm/uaccess.h>
43 #endif 44 #endif
44 45
45 #include "videocodec.h" 46 #include "videocodec.h"
46 47
47 static int debug = 0; 48 static int debug = 0;
48 module_param(debug, int, 0); 49 module_param(debug, int, 0);
49 MODULE_PARM_DESC(debug, "Debug level (0-4)"); 50 MODULE_PARM_DESC(debug, "Debug level (0-4)");
50 51
51 #define dprintk(num, format, args...) \ 52 #define dprintk(num, format, args...) \
52 do { \ 53 do { \
53 if (debug >= num) \ 54 if (debug >= num) \
54 printk(format, ##args) 55 printk(format, ##args); \
55 } while (0) 56 } while (0)
56 57
57 struct attached_list { 58 struct attached_list {
58 struct videocodec *codec; 59 struct videocodec *codec;
59 struct attached_list *next; 60 struct attached_list *next;
60 }; 61 };
61 62
62 struct codec_list { 63 struct codec_list {
63 const struct videocodec *codec; 64 const struct videocodec *codec;
64 int attached; 65 int attached;
65 struct attached_list *list; 66 struct attached_list *list;
66 struct codec_list *next; 67 struct codec_list *next;
67 }; 68 };
68 69
69 static struct codec_list *codeclist_top = NULL 70 static struct codec_list *codeclist_top = NULL;
70 71
71 /* =========================================== 72 /* ================================================= */
72 /* function prototypes of the master/slave int 73 /* function prototypes of the master/slave interface */
73 /* =========================================== 74 /* ================================================= */
74 75
75 struct videocodec * 76 struct videocodec *
76 videocodec_attach (struct videocodec_master *m 77 videocodec_attach (struct videocodec_master *master)
77 { 78 {
78 struct codec_list *h = codeclist_top; 79 struct codec_list *h = codeclist_top;
79 struct attached_list *a, *ptr; 80 struct attached_list *a, *ptr;
80 struct videocodec *codec; 81 struct videocodec *codec;
81 int res; 82 int res;
82 83
83 if (!master) { 84 if (!master) {
84 dprintk(1, KERN_ERR "videocode 85 dprintk(1, KERN_ERR "videocodec_attach: no data\n");
85 return NULL; 86 return NULL;
86 } 87 }
87 88
88 dprintk(2, 89 dprintk(2,
89 "videocodec_attach: '%s', flag !! 90 "videocodec_attach: '%s', type: %x, flags %lx, magic %lx\n",
90 master->name, master->flags, m !! 91 master->name, master->type, master->flags, master->magic);
91 92
92 if (!h) { 93 if (!h) {
93 dprintk(1, 94 dprintk(1,
94 KERN_ERR 95 KERN_ERR
95 "videocodec_attach: no 96 "videocodec_attach: no device available\n");
96 return NULL; 97 return NULL;
97 } 98 }
98 99
99 while (h) { 100 while (h) {
100 // attach only if the slave ha 101 // attach only if the slave has at least the flags
101 // expected by the master 102 // expected by the master
102 if ((master->flags & h->codec- 103 if ((master->flags & h->codec->flags) == master->flags) {
103 dprintk(4, "videocodec 104 dprintk(4, "videocodec_attach: try '%s'\n",
104 h->codec->name 105 h->codec->name);
105 106
106 if (!try_module_get(h- 107 if (!try_module_get(h->codec->owner))
107 return NULL; 108 return NULL;
108 109
109 codec = 110 codec =
110 kmalloc(sizeof(str 111 kmalloc(sizeof(struct videocodec), GFP_KERNEL);
111 if (!codec) { 112 if (!codec) {
112 dprintk(1, 113 dprintk(1,
113 KERN_E 114 KERN_ERR
114 "video 115 "videocodec_attach: no mem\n");
115 goto out_modul 116 goto out_module_put;
116 } 117 }
117 memcpy(codec, h->codec 118 memcpy(codec, h->codec, sizeof(struct videocodec));
118 119
119 snprintf(codec->name, 120 snprintf(codec->name, sizeof(codec->name),
120 "%s[%d]", cod 121 "%s[%d]", codec->name, h->attached);
121 codec->master_data = m 122 codec->master_data = master;
122 res = codec->setup(cod 123 res = codec->setup(codec);
123 if (res == 0) { 124 if (res == 0) {
124 dprintk(3, "vi 125 dprintk(3, "videocodec_attach '%s'\n",
125 codec- 126 codec->name);
126 ptr = kzalloc( !! 127 ptr = (struct attached_list *)
>> 128 kmalloc(sizeof(struct attached_list),
>> 129 GFP_KERNEL);
127 if (!ptr) { 130 if (!ptr) {
128 dprint 131 dprintk(1,
129 132 KERN_ERR
130 133 "videocodec_attach: no memory\n");
131 goto o 134 goto out_kfree;
132 } 135 }
>> 136 memset(ptr, 0,
>> 137 sizeof(struct attached_list));
133 ptr->codec = c 138 ptr->codec = codec;
134 139
135 a = h->list; 140 a = h->list;
136 if (!a) { 141 if (!a) {
137 h->lis 142 h->list = ptr;
138 dprint 143 dprintk(4,
139 144 "videocodec: first element\n");
140 } else { 145 } else {
141 while 146 while (a->next)
142 147 a = a->next; // find end
143 a->nex 148 a->next = ptr;
144 dprint 149 dprintk(4,
145 150 "videocodec: in after '%s'\n",
146 151 h->codec->name);
147 } 152 }
148 153
149 h->attached += 154 h->attached += 1;
150 return codec; 155 return codec;
151 } else { 156 } else {
152 kfree(codec); 157 kfree(codec);
153 } 158 }
154 } 159 }
155 h = h->next; 160 h = h->next;
156 } 161 }
157 162
158 dprintk(1, KERN_ERR "videocodec_attach 163 dprintk(1, KERN_ERR "videocodec_attach: no codec found!\n");
159 return NULL; 164 return NULL;
160 165
161 out_module_put: 166 out_module_put:
162 module_put(h->codec->owner); 167 module_put(h->codec->owner);
163 out_kfree: 168 out_kfree:
164 kfree(codec); 169 kfree(codec);
165 return NULL; 170 return NULL;
166 } 171 }
167 172
168 int 173 int
169 videocodec_detach (struct videocodec *codec) 174 videocodec_detach (struct videocodec *codec)
170 { 175 {
171 struct codec_list *h = codeclist_top; 176 struct codec_list *h = codeclist_top;
172 struct attached_list *a, *prev; 177 struct attached_list *a, *prev;
173 int res; 178 int res;
174 179
175 if (!codec) { 180 if (!codec) {
176 dprintk(1, KERN_ERR "videocode 181 dprintk(1, KERN_ERR "videocodec_detach: no data\n");
177 return -EINVAL; 182 return -EINVAL;
178 } 183 }
179 184
180 dprintk(2, 185 dprintk(2,
181 "videocodec_detach: '%s', type 186 "videocodec_detach: '%s', type: %x, flags %lx, magic %lx\n",
182 codec->name, codec->type, code 187 codec->name, codec->type, codec->flags, codec->magic);
183 188
184 if (!h) { 189 if (!h) {
185 dprintk(1, 190 dprintk(1,
186 KERN_ERR "videocodec_d 191 KERN_ERR "videocodec_detach: no device left...\n");
187 return -ENXIO; 192 return -ENXIO;
188 } 193 }
189 194
190 while (h) { 195 while (h) {
191 a = h->list; 196 a = h->list;
192 prev = NULL; 197 prev = NULL;
193 while (a) { 198 while (a) {
194 if (codec == a->codec) 199 if (codec == a->codec) {
195 res = a->codec 200 res = a->codec->unset(a->codec);
196 if (res >= 0) 201 if (res >= 0) {
197 dprint 202 dprintk(3,
198 203 "videocodec_detach: '%s'\n",
199 204 a->codec->name);
200 a->cod 205 a->codec->master_data = NULL;
201 } else { 206 } else {
202 dprint 207 dprintk(1,
203 208 KERN_ERR
204 209 "videocodec_detach: '%s'\n",
205 210 a->codec->name);
206 a->cod 211 a->codec->master_data = NULL;
207 } 212 }
208 if (prev == NU 213 if (prev == NULL) {
209 h->lis 214 h->list = a->next;
210 dprint 215 dprintk(4,
211 216 "videocodec: delete first\n");
212 } else { 217 } else {
213 prev-> 218 prev->next = a->next;
214 dprint 219 dprintk(4,
215 220 "videocodec: delete middle\n");
216 } 221 }
217 module_put(a-> 222 module_put(a->codec->owner);
218 kfree(a->codec 223 kfree(a->codec);
219 kfree(a); 224 kfree(a);
220 h->attached -= 225 h->attached -= 1;
221 return 0; 226 return 0;
222 } 227 }
223 prev = a; 228 prev = a;
224 a = a->next; 229 a = a->next;
225 } 230 }
226 h = h->next; 231 h = h->next;
227 } 232 }
228 233
229 dprintk(1, KERN_ERR "videocodec_detach 234 dprintk(1, KERN_ERR "videocodec_detach: given codec not found!\n");
230 return -EINVAL; 235 return -EINVAL;
231 } 236 }
232 237
233 int 238 int
234 videocodec_register (const struct videocodec * 239 videocodec_register (const struct videocodec *codec)
235 { 240 {
236 struct codec_list *ptr, *h = codeclist 241 struct codec_list *ptr, *h = codeclist_top;
237 242
238 if (!codec) { 243 if (!codec) {
239 dprintk(1, KERN_ERR "videocode 244 dprintk(1, KERN_ERR "videocodec_register: no data!\n");
240 return -EINVAL; 245 return -EINVAL;
241 } 246 }
242 247
243 dprintk(2, 248 dprintk(2,
244 "videocodec: register '%s', ty 249 "videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
245 codec->name, codec->type, code 250 codec->name, codec->type, codec->flags, codec->magic);
246 251
247 ptr = kzalloc(sizeof(struct codec_list !! 252 ptr =
>> 253 (struct codec_list *) kmalloc(sizeof(struct codec_list),
>> 254 GFP_KERNEL);
248 if (!ptr) { 255 if (!ptr) {
249 dprintk(1, KERN_ERR "videocode 256 dprintk(1, KERN_ERR "videocodec_register: no memory\n");
250 return -ENOMEM; 257 return -ENOMEM;
251 } 258 }
>> 259 memset(ptr, 0, sizeof(struct codec_list));
252 ptr->codec = codec; 260 ptr->codec = codec;
253 261
254 if (!h) { 262 if (!h) {
255 codeclist_top = ptr; 263 codeclist_top = ptr;
256 dprintk(4, "videocodec: hooked 264 dprintk(4, "videocodec: hooked in as first element\n");
257 } else { 265 } else {
258 while (h->next) 266 while (h->next)
259 h = h->next; // fin 267 h = h->next; // find the end
260 h->next = ptr; 268 h->next = ptr;
261 dprintk(4, "videocodec: hooked 269 dprintk(4, "videocodec: hooked in after '%s'\n",
262 h->codec->name); 270 h->codec->name);
263 } 271 }
264 272
265 return 0; 273 return 0;
266 } 274 }
267 275
268 int 276 int
269 videocodec_unregister (const struct videocodec 277 videocodec_unregister (const struct videocodec *codec)
270 { 278 {
271 struct codec_list *prev = NULL, *h = c 279 struct codec_list *prev = NULL, *h = codeclist_top;
272 280
273 if (!codec) { 281 if (!codec) {
274 dprintk(1, KERN_ERR "videocode 282 dprintk(1, KERN_ERR "videocodec_unregister: no data!\n");
275 return -EINVAL; 283 return -EINVAL;
276 } 284 }
277 285
278 dprintk(2, 286 dprintk(2,
279 "videocodec: unregister '%s', 287 "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n",
280 codec->name, codec->type, code 288 codec->name, codec->type, codec->flags, codec->magic);
281 289
282 if (!h) { 290 if (!h) {
283 dprintk(1, 291 dprintk(1,
284 KERN_ERR 292 KERN_ERR
285 "videocodec_unregister 293 "videocodec_unregister: no device left...\n");
286 return -ENXIO; 294 return -ENXIO;
287 } 295 }
288 296
289 while (h) { 297 while (h) {
290 if (codec == h->codec) { 298 if (codec == h->codec) {
291 if (h->attached) { 299 if (h->attached) {
292 dprintk(1, 300 dprintk(1,
293 KERN_E 301 KERN_ERR
294 "video 302 "videocodec: '%s' is used\n",
295 h->cod 303 h->codec->name);
296 return -EBUSY; 304 return -EBUSY;
297 } 305 }
298 dprintk(3, "videocodec 306 dprintk(3, "videocodec: unregister '%s' is ok.\n",
299 h->codec->name 307 h->codec->name);
300 if (prev == NULL) { 308 if (prev == NULL) {
301 codeclist_top 309 codeclist_top = h->next;
302 dprintk(4, 310 dprintk(4,
303 "video 311 "videocodec: delete first element\n");
304 } else { 312 } else {
305 prev->next = h 313 prev->next = h->next;
306 dprintk(4, 314 dprintk(4,
307 "video 315 "videocodec: delete middle element\n");
308 } 316 }
309 kfree(h); 317 kfree(h);
310 return 0; 318 return 0;
311 } 319 }
312 prev = h; 320 prev = h;
313 h = h->next; 321 h = h->next;
314 } 322 }
315 323
316 dprintk(1, 324 dprintk(1,
317 KERN_ERR 325 KERN_ERR
318 "videocodec_unregister: given 326 "videocodec_unregister: given codec not found!\n");
319 return -EINVAL; 327 return -EINVAL;
320 } 328 }
321 329
322 #ifdef CONFIG_PROC_FS 330 #ifdef CONFIG_PROC_FS
323 /* ============ */ 331 /* ============ */
324 /* procfs stuff */ 332 /* procfs stuff */
325 /* ============ */ 333 /* ============ */
326 334
327 static char *videocodec_buf = NULL; 335 static char *videocodec_buf = NULL;
328 static int videocodec_bufsize = 0; 336 static int videocodec_bufsize = 0;
329 337
330 static int 338 static int
331 videocodec_build_table (void) 339 videocodec_build_table (void)
332 { 340 {
333 struct codec_list *h = codeclist_top; 341 struct codec_list *h = codeclist_top;
334 struct attached_list *a; 342 struct attached_list *a;
335 int i = 0, size; 343 int i = 0, size;
336 344
337 // sum up amount of slaves plus their 345 // sum up amount of slaves plus their attached masters
338 while (h) { 346 while (h) {
339 i += h->attached + 1; 347 i += h->attached + 1;
340 h = h->next; 348 h = h->next;
341 } 349 }
342 #define LINESIZE 100 350 #define LINESIZE 100
343 size = LINESIZE * (i + 1); 351 size = LINESIZE * (i + 1);
344 352
345 dprintk(3, "videocodec_build table: %d 353 dprintk(3, "videocodec_build table: %d entries, %d bytes\n", i,
346 size); 354 size);
347 355
348 kfree(videocodec_buf); !! 356 if (videocodec_buf)
349 videocodec_buf = kmalloc(size, GFP_KER !! 357 kfree(videocodec_buf);
350 !! 358 videocodec_buf = (char *) kmalloc(size, GFP_KERNEL);
351 if (!videocodec_buf) <<
352 return 0; <<
353 359
354 i = 0; 360 i = 0;
355 i += scnprintf(videocodec_buf + i, siz 361 i += scnprintf(videocodec_buf + i, size - 1,
356 "<S>lave or attached <M> 362 "<S>lave or attached <M>aster name type flags magic ");
357 i += scnprintf(videocodec_buf + i, siz 363 i += scnprintf(videocodec_buf + i, size -i - 1, "(connected as)\n");
358 364
359 h = codeclist_top; 365 h = codeclist_top;
360 while (h) { 366 while (h) {
361 if (i > (size - LINESIZE)) 367 if (i > (size - LINESIZE))
362 break; // security ch 368 break; // security check
363 i += scnprintf(videocodec_buf 369 i += scnprintf(videocodec_buf + i, size -i -1,
364 "S %32s %04x %08 370 "S %32s %04x %08lx %08lx (TEMPLATE)\n",
365 h->codec->name, 371 h->codec->name, h->codec->type,
366 h->codec->flags, 372 h->codec->flags, h->codec->magic);
367 a = h->list; 373 a = h->list;
368 while (a) { 374 while (a) {
369 if (i > (size - LINESI 375 if (i > (size - LINESIZE))
370 break; // sec 376 break; // security check
371 i += scnprintf(videoco 377 i += scnprintf(videocodec_buf + i, size -i -1,
372 "M %32s 378 "M %32s %04x %08lx %08lx (%s)\n",
373 a->codec 379 a->codec->master_data->name,
374 a->codec 380 a->codec->master_data->type,
375 a->codec 381 a->codec->master_data->flags,
376 a->codec 382 a->codec->master_data->magic,
377 a->codec 383 a->codec->name);
378 a = a->next; 384 a = a->next;
379 } 385 }
380 h = h->next; 386 h = h->next;
381 } 387 }
382 388
383 return i; 389 return i;
384 } 390 }
385 391
386 //The definition: 392 //The definition:
387 //typedef int (read_proc_t)(char *page, char * 393 //typedef int (read_proc_t)(char *page, char **start, off_t off,
388 // int count, int *eo 394 // int count, int *eof, void *data);
389 395
390 static int 396 static int
391 videocodec_info (char *buffer, 397 videocodec_info (char *buffer,
392 char **buffer_location, 398 char **buffer_location,
393 off_t offset, 399 off_t offset,
394 int buffer_length, 400 int buffer_length,
395 int *eof, 401 int *eof,
396 void *data) 402 void *data)
397 { 403 {
398 int size; 404 int size;
399 405
400 dprintk(3, "videocodec_info: offset: % 406 dprintk(3, "videocodec_info: offset: %ld, len %d / size %d\n",
401 offset, buffer_length, videoco 407 offset, buffer_length, videocodec_bufsize);
402 408
403 if (offset == 0) { 409 if (offset == 0) {
404 videocodec_bufsize = videocode 410 videocodec_bufsize = videocodec_build_table();
405 } 411 }
406 if ((offset < 0) || (offset >= videoco 412 if ((offset < 0) || (offset >= videocodec_bufsize)) {
407 dprintk(4, 413 dprintk(4,
408 "videocodec_info: call 414 "videocodec_info: call delivers no result, return 0\n");
409 *eof = 1; 415 *eof = 1;
410 return 0; 416 return 0;
411 } 417 }
412 418
413 if (buffer_length < (videocodec_bufsiz 419 if (buffer_length < (videocodec_bufsize - offset)) {
414 dprintk(4, "videocodec_info: % 420 dprintk(4, "videocodec_info: %ld needed, %d got\n",
415 videocodec_bufsize - o 421 videocodec_bufsize - offset, buffer_length);
416 size = buffer_length; 422 size = buffer_length;
417 } else { 423 } else {
418 dprintk(4, "videocodec_info: l 424 dprintk(4, "videocodec_info: last reading of %ld bytes\n",
419 videocodec_bufsize - o 425 videocodec_bufsize - offset);
420 size = videocodec_bufsize - of 426 size = videocodec_bufsize - offset;
421 *eof = 1; 427 *eof = 1;
422 } 428 }
423 429
424 memcpy(buffer, videocodec_buf + offset 430 memcpy(buffer, videocodec_buf + offset, size);
425 /* doesn't work... 431 /* doesn't work... */
426 /* copy_to_user(buffer, videocodec_buf 432 /* copy_to_user(buffer, videocodec_buf+offset, size); */
427 /* *buffer_location = videocodec_buf+o 433 /* *buffer_location = videocodec_buf+offset; */
428 434
429 return size; 435 return size;
430 } 436 }
431 #endif 437 #endif
432 438
433 /* ===================== */ 439 /* ===================== */
434 /* hook in driver module */ 440 /* hook in driver module */
435 /* ===================== */ 441 /* ===================== */
436 static int __init 442 static int __init
437 videocodec_init (void) 443 videocodec_init (void)
438 { 444 {
439 #ifdef CONFIG_PROC_FS 445 #ifdef CONFIG_PROC_FS
440 static struct proc_dir_entry *videocod 446 static struct proc_dir_entry *videocodec_proc_entry;
441 #endif 447 #endif
442 448
443 printk(KERN_INFO "Linux video codec in 449 printk(KERN_INFO "Linux video codec intermediate layer: %s\n",
444 VIDEOCODEC_VERSION); 450 VIDEOCODEC_VERSION);
445 451
446 #ifdef CONFIG_PROC_FS 452 #ifdef CONFIG_PROC_FS
447 videocodec_buf = NULL; 453 videocodec_buf = NULL;
448 videocodec_bufsize = 0; 454 videocodec_bufsize = 0;
449 455
450 videocodec_proc_entry = create_proc_en 456 videocodec_proc_entry = create_proc_entry("videocodecs", 0, NULL);
451 if (videocodec_proc_entry) { 457 if (videocodec_proc_entry) {
452 videocodec_proc_entry->read_pr 458 videocodec_proc_entry->read_proc = videocodec_info;
453 videocodec_proc_entry->write_p 459 videocodec_proc_entry->write_proc = NULL;
454 videocodec_proc_entry->data = 460 videocodec_proc_entry->data = NULL;
455 videocodec_proc_entry->owner = 461 videocodec_proc_entry->owner = THIS_MODULE;
456 } else { 462 } else {
457 dprintk(1, KERN_ERR "videocode 463 dprintk(1, KERN_ERR "videocodec: can't init procfs.\n");
458 } 464 }
459 #endif 465 #endif
460 return 0; 466 return 0;
461 } 467 }
462 468
463 static void __exit 469 static void __exit
464 videocodec_exit (void) 470 videocodec_exit (void)
465 { 471 {
466 #ifdef CONFIG_PROC_FS 472 #ifdef CONFIG_PROC_FS
467 remove_proc_entry("videocodecs", NULL) 473 remove_proc_entry("videocodecs", NULL);
468 kfree(videocodec_buf); !! 474 if (videocodec_buf)
>> 475 kfree(videocodec_buf);
469 #endif 476 #endif
470 } 477 }
471 478
472 EXPORT_SYMBOL(videocodec_attach); 479 EXPORT_SYMBOL(videocodec_attach);
473 EXPORT_SYMBOL(videocodec_detach); 480 EXPORT_SYMBOL(videocodec_detach);
474 EXPORT_SYMBOL(videocodec_register); 481 EXPORT_SYMBOL(videocodec_register);
475 EXPORT_SYMBOL(videocodec_unregister); 482 EXPORT_SYMBOL(videocodec_unregister);
476 483
477 module_init(videocodec_init); 484 module_init(videocodec_init);
478 module_exit(videocodec_exit); 485 module_exit(videocodec_exit);
479 486
480 MODULE_AUTHOR("Wolfgang Scherr <scherr@net4you 487 MODULE_AUTHOR("Wolfgang Scherr <scherr@net4you.at>");
481 MODULE_DESCRIPTION("Intermediate API module fo 488 MODULE_DESCRIPTION("Intermediate API module for video codecs "
482 VIDEOCODEC_VERSION); 489 VIDEOCODEC_VERSION);
483 MODULE_LICENSE("GPL"); 490 MODULE_LICENSE("GPL");
484 491
| This page was automatically generated by the LXR engine. |