A basic device driver problem! - Redhat

This is a discussion on A basic device driver problem! - Redhat ; Dear all, I compiled a single device driver, but there's some problem like this: $gcc -O2 -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -c CharDriver.c CharDriver.c:22: warning: initialization from incompatible pointer type CharDriver.c: In function `device_read': CharDriver.c:50: `VERIFY_WRITE' undeclared (first use in this function) ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: A basic device driver problem!

  1. A basic device driver problem!

    Dear all,
    I compiled a single device driver, but there's some problem like this:

    $gcc -O2 -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -c
    CharDriver.c
    CharDriver.c:22: warning: initialization from incompatible pointer type
    CharDriver.c: In function `device_read':
    CharDriver.c:50: `VERIFY_WRITE' undeclared (first use in this function)
    CharDriver.c:50: (Each undeclared identifier is reported only once
    CharDriver.c:50: for each function it appears in.)
    make: *** [CharDriver.O] Error 1

    My linux kernel version is 2.4.20, it seems 'VERIFY_WRITE' not exist, how
    can I solve this problem? thank you!



  2. Re: A basic device driver problem!

    John Huntington schrieb:
    > Dear all,
    > I compiled a single device driver, but there's some problem like this:
    >
    > $gcc -O2 -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -c
    > CharDriver.c
    > CharDriver.c:22: warning: initialization from incompatible pointer type
    > CharDriver.c: In function `device_read':
    > CharDriver.c:50: `VERIFY_WRITE' undeclared (first use in this function)
    > CharDriver.c:50: (Each undeclared identifier is reported only once
    > CharDriver.c:50: for each function it appears in.)
    > make: *** [CharDriver.O] Error 1
    >
    > My linux kernel version is 2.4.20, it seems 'VERIFY_WRITE' not exist, how
    > can I solve this problem? thank you!
    >
    >


    cd
    grep -r VERIFY_WRITE * | grep define:
    [...]
    include/asm/uaccess.h:#define VERIFY_WRITE 1
    [...]

    So, look at your source (CharDriver.c) if
    there is an

    #include

    at the beginning.

    Most likely your link
    /usr/include/asm
    is missing. It should point to
    /usr/src/linux/include/asm-i386/
    or whatever your architecture is.

    A real dirty solution would be to put an

    #define VERIFY_WRITE 1

    at the beginning of CharDriver.c.

    HTH Martin

+ Reply to Thread