dgnc module compiling on recent kernel

Hi, i’d like to compile the dgnc driver with a recent kernel :

2.6.31-gentoo-r6

i already patched a few things :

diff -rupNbB dgnc-1.3.orig/driver/dgnc_driver.c dgnc-1.3/driver/dgnc_driver.c
--- dgnc-1.3.orig/driver/dgnc_driver.c  2007-06-22 16:08:54.000000000 +0200  
+++ dgnc-1.3/driver/dgnc_driver.c       2010-03-12 15:00:37.000000000 +0100  
@@ -317,7 +317,7 @@ static int dgnc_start(void)                              
                                                                             
 #ifdef DGNC_SYSFS_SUPPORT                                                   
                        dgnc_class = class_create(THIS_MODULE, "dgnc_mgmt");
-                       class_device_create(dgnc_class, NULL,
+                       device_create(dgnc_class, NULL,
                                MKDEV(dgnc_Major, 0),
                                NULL, "dgnc_mgmt");
 #endif
@@ -419,7 +419,7 @@ void dgnc_cleanup_module(void)

        if (dgnc_Major_Control_Registered) {
 #ifdef DGNC_SYSFS_SUPPORT
-               class_device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
+               device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
                class_destroy(dgnc_class);
 #endif
                unregister_chrdev(dgnc_Major, "dgnc");
diff -rupNbB dgnc-1.3.orig/driver/dgnc_proc.c dgnc-1.3/driver/dgnc_proc.c
--- dgnc-1.3.orig/driver/dgnc_proc.c    2007-06-22 16:08:54.000000000 +0200
+++ dgnc-1.3/driver/dgnc_proc.c 2010-03-12 15:00:54.000000000 +0100
@@ -170,7 +170,7 @@ static struct dgnc_proc_entry dgnc_chann
  */
 static inline int dgnc_test_perm(int mode, int op)
 {
-       if (!current->euid)
+       if (!current->cred->euid)
                mode >>= 6;
        else if (in_egroup_p(0))
                mode >>= 3;
@@ -1444,7 +1444,7 @@ void dgnc_proc_register_basic_prescan(vo
        /*
         *      Register /proc/dgnc
         */
-        ProcDGNC = create_proc_entry("dgnc", (0700 | S_IFDIR), &proc_root);
+        ProcDGNC = create_proc_entry("dgnc", (0700 | S_IFDIR), NULL);
        dgnc_register_proc_table(dgnc_table, ProcDGNC);
 }

but now i’m stucked on this :

make[1]: Entering directory `/root/src/dgnc-1.3.compiled/driver'
make -C /lib/modules/2.6.31-gentoo-r6/build SUBDIRS=$PWD modules MYPWD=/root/src/dgnc-1.3.compiled/driver
make[2]: Entering directory `/usr/src/linux-2.6.31-gentoo-r6'                                            
  CC [M]  /root/src/dgnc-1.3.compiled/driver/dgnc_tty.o                                                  
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c: In function 'dgnc_tty_register':                          
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:238: error: 'struct tty_driver' has no member named 'refcount'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:269: error: 'struct tty_driver' has no member named 'open'    
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:270: error: 'struct tty_driver' has no member named 'close'   
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:271: error: 'struct tty_driver' has no member named 'ioctl'   
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:272: error: 'struct tty_driver' has no member named 'write'   
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:273: error: 'struct tty_driver' has no member named 'write_room'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:274: error: 'struct tty_driver' has no member named 'put_char'  
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:275: error: 'struct tty_driver' has no member named 'set_termios'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:276: error: 'struct tty_driver' has no member named 'chars_in_buffer'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:277: error: 'struct tty_driver' has no member named 'stop'           
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:278: error: 'struct tty_driver' has no member named 'start'          
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:279: error: 'struct tty_driver' has no member named 'throttle'       
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:280: error: 'struct tty_driver' has no member named 'unthrottle'     
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:281: error: 'struct tty_driver' has no member named 'flush_chars'    
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:282: error: 'struct tty_driver' has no member named 'flush_buffer'   
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:283: error: 'struct tty_driver' has no member named 'hangup'         
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:286: error: 'struct tty_driver' has no member named 'tiocmget'       
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:287: error: 'struct tty_driver' has no member named 'tiocmset'       
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:336: error: 'struct tty_driver' has no member named 'refcount'       
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:369: error: 'struct tty_driver' has no member named 'open'           
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:370: error: 'struct tty_driver' has no member named 'close'          
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:371: error: 'struct tty_driver' has no member named 'ioctl'          
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:372: error: 'struct tty_driver' has no member named 'write'          
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:373: error: 'struct tty_driver' has no member named 'write_room'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:374: error: 'struct tty_driver' has no member named 'put_char'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:375: error: 'struct tty_driver' has no member named 'set_termios'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:376: error: 'struct tty_driver' has no member named 'chars_in_buffer'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:377: error: 'struct tty_driver' has no member named 'stop'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:378: error: 'struct tty_driver' has no member named 'start'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:379: error: 'struct tty_driver' has no member named 'throttle'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:380: error: 'struct tty_driver' has no member named 'unthrottle'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:381: error: 'struct tty_driver' has no member named 'flush_chars'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:382: error: 'struct tty_driver' has no member named 'flush_buffer'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:383: error: 'struct tty_driver' has no member named 'hangup'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:386: error: 'struct tty_driver' has no member named 'tiocmget'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:387: error: 'struct tty_driver' has no member named 'tiocmset'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c: In function 'dgnc_input':
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:853: error: 'TTY_FLIPBUF_SIZE' undeclared (first use in this function)
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:853: error: (Each undeclared identifier is reported only once
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:853: error: for each function it appears in.)
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:883: error: 'struct tty_ldisc' has no member named 'receive_buf'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:959: error: request for member 'receive_buf' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c: In function 'dgnc_wakeup_writes':
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:1635: error: request for member 'write_wakeup' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:1638: error: request for member 'write_wakeup' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:1677: error: request for member 'write_wakeup' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:1680: error: request for member 'write_wakeup' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c: In function 'dgnc_tty_close':
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:2236: error: 'struct tty_driver' has no member named 'flush_buffer'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:2238: error: 'struct tty_driver' has no member named 'flush_buffer'
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c: In function 'dgnc_tty_ioctl':
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:3634: error: request for member 'ioctl' in something not a structure or union
/root/src/dgnc-1.3.compiled/driver/dgnc_tty.c:3640: error: request for member 'ioctl' in something not a structure or union
make[3]: *** [/root/src/dgnc-1.3.compiled/driver/dgnc_tty.o] Error 1
make[2]: *** [_module_/root/src/dgnc-1.3.compiled/driver] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.31-gentoo-r6'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/root/src/dgnc-1.3.compiled/driver'
make: *** [build] Error 2

has anybody here already gone though porting this driver on recent kernel ?

Thanks for your help.

Yann.

Have you tried the latest driver candidate?

ftp://ftp1.digi.com/support/beta/linux/dgnc/dgnc-1.3-18.src.rpm

it works, thanks a lot, sorry for not finding this by myself :frowning:

Hi, after upgrading to linux-2.6.32-gentoo-r7 kernel, dgnc-1.3-18 is no more compiling properly :

/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c: In function 'dgnc_found_board':
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:732: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:732: error: (Each undeclared identifier is reported only once
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:732: error: for each function it appears in.)
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c: In function 'dgnc_mbuf':
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:941: warning: cast from pointer to integer of different size
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c: In function 'dgnc_ms_sleep':
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:956: error: dereferencing pointer to incomplete type
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:956: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:957: error: implicit declaration of function 'schedule_timeout'
/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.c:958: error: implicit declaration of function 'signal_pending'
make[3]: *** [/root/src/dgnc-1.3.compiled/driver/build/dgnc_driver.o] Error 1
make[2]: *** [_module_/root/src/dgnc-1.3.compiled/driver/build] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.32-gentoo-r7'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/root/src/dgnc-1.3.compiled/driver/2.6.27'
make: *** [build] Error 2

thanks for your help.

Please confirm you are using the latest driver candidate from:

ftp://ftp1.digi.com/support/beta/linux/dgnc

There have been recent changes to accommodate newer kernels.

my previous post was with dgnc-1.3-18.src.rpm dated from “Oct 22”, i’ve just retried with the dgnc-1.3-18.src.rpm dated from “Apr 12” and result is the same.

We’ll need to see a complete log of the driver compilation starting with ./configure.

here it is :

# ./configure 
checking for awk... /usr/bin/awk
checking for arch... /usr/bin/arch
checking for cat... /bin/cat      
checking for chkconfig... /sbin/chkconfig
checking for chmod... /bin/chmod         
checking for chown... /bin/chown         
checking for cp... /bin/cp               
checking for depmod... /sbin/depmod      
checking for dialog... /usr/bin/dialog   
checking for echo... /bin/echo           
checking for fuser... /bin/fuser         
checking for grep... /bin/grep           
checking for init... /sbin/init          
checking for insmod... /sbin/insmod      
checking for kill... /bin/kill           
checking for ln... /bin/ln               
checking for ls... /bin/ls               
checking for lsmod... /sbin/lsmod        
checking for make... /usr/bin/make       
checking for mkdir... /bin/mkdir         
checking for mknod... /bin/mknod         
checking for modprobe... /sbin/modprobe  
checking for more... /bin/more           
checking for mv... /bin/mv               
checking for printf... /usr/bin/printf   
checking for ps... /bin/ps               
checking for rm... /bin/rm               
checking for rmdir... /bin/rmdir         
checking for rmmod... /sbin/rmmod        
checking for sed... /bin/sed             
checking for sh... /bin/sh               
checking for sleep... /usr/bin/sleep     
checking for stty... /bin/stty           
checking for tar... /bin/tar             
checking for tr... /usr/bin/tr           
checking for touch... /usr/bin/touch     
checking for true... /bin/true           
checking for udevd... /sbin/udevd        
checking for udevinfo... Not Found       
checking for uname... /usr/bin/uname     
checking for platform type... i386       
checking for gcc... gcc                  
checking for gcc version... < 3.2 (/////4.3.4//4.3.4/
4.3.4)                                               
checking for gcc... gcc                              
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes             
checking whether we are cross compiling... no            
checking for suffix of executables...                    
checking for suffix of object files... o                 
checking whether we are using the GNU C compiler... yes  
checking whether gcc accepts -g... yes                   
checking for gcc option to accept ANSI C... none needed  
checking for current kernel version...  2.6.32-gentoo-r7 -> 2.6.32--7 -> 2.6.32
checking for kernel headers...  "/lib/modules/2.6.32-gentoo-r7/build"          
checking extra version of kernel...  -gentoo-r7                                
checking if running kernel was compiled for SMP...  Yes                        
checking what type of build we will do... KBUILD.                              
checking for modules directory...  "/lib/modules/2.6.32-gentoo-r7"             
configure: checking for tgetent...                                             
configure: checking for libncurses...                                          
checking if Distro specified... None                                           
checking if New TTY Locking was specified... No - Defaulting to a value of "No"
checking if New TTY Buffering was specified... No - Defaulting to a value of "No"
checking if UDEV checking is overridden...  No                                   
checking if UDEV exists...  No                                                   
configure: creating ./config.status
config.status: creating Makefile
config.status: creating driver/build/Makefile
config.status: creating config/Makefile
config.status: creating config/dgnc
config.status: creating config/dgnc_udev
config.status: creating config/dgnc_mknod
config.status: creating config/dgnc_updatedevs
config.status: creating utest/Makefile
config.status: creating ditty/Makefile
config.status: creating include/config.h
config.status: executing default commands

# make
(cd driver/build; make all)
make[1]: Entering directory `/root/src/dgnc-1.3/driver/2.6.27'
make -C /lib/modules/2.6.32-gentoo-r7/build SUBDIRS=$PWD modules MYPWD=/root/src/dgnc-1.3/driver/2.6.27
make[2]: Entering directory `/usr/src/linux-2.6.32-gentoo-r7'
  CC [M]  /root/src/dgnc-1.3/driver/build/dgnc_cls.o
  CC [M]  /root/src/dgnc-1.3/driver/build/dgnc_driver.o
/root/src/dgnc-1.3/driver/build/dgnc_driver.c: In function 'dgnc_found_board':
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:738: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:738: error: (Each undeclared identifier is reported only once
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:738: error: for each function it appears in.)
/root/src/dgnc-1.3/driver/build/dgnc_driver.c: In function 'dgnc_mbuf':
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:947: warning: cast from pointer to integer of different size
/root/src/dgnc-1.3/driver/build/dgnc_driver.c: In function 'dgnc_ms_sleep':
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:962: error: dereferencing pointer to incomplete type
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:962: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:963: error: implicit declaration of function 'schedule_timeout'
/root/src/dgnc-1.3/driver/build/dgnc_driver.c:964: error: implicit declaration of function 'signal_pending'
make[3]: *** [/root/src/dgnc-1.3/driver/build/dgnc_driver.o] Error 1
make[2]: *** [_module_/root/src/dgnc-1.3/driver/build] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.32-gentoo-r7'
make[1]: *** [build] Error 2
make[1]: Leaving directory `/root/src/dgnc-1.3/driver/2.6.27'
make: *** [build] Error 2

thanks for your help.

Looks like this distro broke where some of the defines are supposed to be.

Please run the following to tell us where the Gentoo distro put them:

grep TASK_INTERRUPTIBLE /usr/src/linux-2.6.32-gentoo-r7/include/linux/*

grep schedule_timeout /usr/src/linux-2.6.32-gentoo-r7/include/linux/*

grep signal_pending /usr/src/linux-2.6.32-gentoo-r7/include/linux/*

i’m really surprised, linux-2.6.32-gentoo-r7 is just supposed to be a vanilla kernel plus some gentoo patches. the compilation was successful on linux-2.6.31-gentoo-r6 and the 3 grep you asked for returns the same results for both kernel :

# grep -l TASK_INTERRUPTIBLE /usr/src/linux-2.6.32-gentoo-r7/include/linux/*
/usr/src/linux-2.6.32-gentoo-r7/include/linux/sched.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/wait.h

# grep -l TASK_INTERRUPTIBLE /usr/src/linux-2.6.31-gentoo-r6/include/linux/*
/usr/src/linux-2.6.31-gentoo-r6/include/linux/sched.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/wait.h

# grep -l schedule_timeout /usr/src/linux-2.6.32-gentoo-r7/include/linux/*
/usr/src/linux-2.6.32-gentoo-r7/include/linux/poll.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/sched.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/usb.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/wait.h

# grep -l schedule_timeout /usr/src/linux-2.6.31-gentoo-r6/include/linux/*
/usr/src/linux-2.6.31-gentoo-r6/include/linux/poll.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/sched.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/usb.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/wait.h

# grep -l signal_pending /usr/src/linux-2.6.32-gentoo-r7/include/linux/*
/usr/src/linux-2.6.32-gentoo-r7/include/linux/errno.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/kthread.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/sched.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/tracehook.h
/usr/src/linux-2.6.32-gentoo-r7/include/linux/wait.h

# grep -l signal_pending /usr/src/linux-2.6.31-gentoo-r6/include/linux/*
/usr/src/linux-2.6.31-gentoo-r6/include/linux/errno.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/kthread.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/sched.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/tracehook.h
/usr/src/linux-2.6.31-gentoo-r6/include/linux/wait.h

did you successfully compiled dgnc against the 2.6.32 kernel ?

ok, sorry for being lazy, i have googled a bit since, and found that :

> This may be caused by commit d43c36dc6b357fa1806800f18aa30123c747a6d1.
> Can insert #include into drivers/char/rtc.c fix this?

and yes, it fixes it , here is the patch :

diff -rupNbB dgnc-1.3.orig/driver/2.6.27/dgnc_driver.c dgnc-1.3/driver/2.6.27/dgnc_driver.c
--- dgnc-1.3.orig/driver/2.6.27/dgnc_driver.c   2009-11-04 17:47:03.000000000 +0100
+++ dgnc-1.3/driver/2.6.27/dgnc_driver.c        2010-04-14 08:22:39.000000000 +0200
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "dgnc_driver.h"
 #include "dgnc_pci.h"

regards,

Yann.