LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   A curious problem with driver transplant (https://www.linuxquestions.org/questions/linux-hardware-18/a-curious-problem-with-driver-transplant-337574/)

hzrenjer 06-27-2005 04:51 AM

A curious problem with driver transplant
 
hello,
I have a osprey 560 card with SDI input.But osprey's driver which is based on bttv-0.7.97 is only available for kernel2.4.
Now,I want to transplant the code(related to SDI )to bttv-0.9.15.
I met with a curious problem.When I haved finished the transplant,I make,the errors are as fllowed:

/gpio-osprey.c: In function `do_osprey_firmware_load':
/gpio-osprey.c:794: warning: implicit declaration of function `open'
/gpio-osprey.c:800: warning: implicit declaration of function `lseek'
/gpio-osprey.c:804: warning: implicit declaration of function `sys_close'
/gpio-osprey.c:816: warning: implicit declaration of function `read'
/gpio-osprey.c:824: warning: implicit declaration of function `close'
......
Building modules, stage 2.
MODPOST
*** Warning: "close" [/bttv-0.9.15/bttv.ko] undefined!
*** Warning: "open" [/bttv-0.9.15/bttv.ko] undefined!
*** Warning: "read" [/bttv-0.9.15/bttv.ko] undefined!
*** Warning: "lseek" [/bttv-0.9.15/bttv.ko] undefined!

The function 'do_osprey_firmware_load' is as such £º

/* all this because the allowed maximum length is too small */

#define __KERNEL_SYSCALLS__
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>

static int errno;
static int do_osprey_firmware_load(const char *fn, char **fp)
{
int fd;
long l;
char *dp;

fd = open(fn, 0, 0);
if (fd == -1)
{
printk(KERN_INFO "gpio: Unable to load firmware '%s'.\n", fn);
return 0;
}
l = lseek(fd, 0L, 2);
if (l <= 0 || l > (256*1024))
{
printk(KERN_INFO "gpio: Firmware '%s' has bad length %ld\n", fn,l);
sys_close(fd);
return 0;
}
lseek(fd, 0L, 0);
dp = vmalloc(l);
if (dp == NULL)
{
printk(KERN_INFO "Out of memory loading firmware '%s'.\n", fn);
sys_close(fd);
return 0;
}
if (read(fd, dp, l) != l)
{
printk(KERN_INFO "Failed to read firmware '%s'.\n", fn);
vfree(dp);
sys_close(fd);
return 0;
}
close(fd);
*fp = dp;
return (int) l;
}

What caused the warnings? Is there anyone could help me?
Thanks.

Matir 06-27-2005 09:57 PM

Are you porting this to 2.6? Much of the kernel interface for modules has been changed since 2.4.


All times are GMT -5. The time now is 06:54 AM.