]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Merge branch 'master' into can-usb1
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 1 Oct 2011 16:29:51 +0000 (18:29 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sat, 1 Oct 2011 16:29:51 +0000 (18:29 +0200)
lincan/include/ioctl.h
lincan/src/ioctl.c
lincan/src/kthread.c
lincan/src/main.c

index 4318758fedb75c96bc52dcd46ca001a96d3e6519..90f3e7d847b4bad0d76af6e76ed28fbef0640111 100644 (file)
@@ -32,7 +32,7 @@
 /* Publication of enhanced or derived LinCAN files is required although.  */
 /**************************************************************************/
 
-int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+long can_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 int can_ioctl_query(struct canuser_t *canuser, unsigned long what);
 int can_ioctl_remote_read(struct canuser_t *canuser, struct canmsg_t *rtr_msg,
                           unsigned long rtr_id, int options);
index 2d410f19b531ffa4a1223719071049db70433135..e6dee366a4fbc0b59fccda4216d117cb551cb767 100644 (file)
@@ -37,7 +37,7 @@
 #include "../include/main.h"
 #include "../include/ioctl.h"
 
-int can_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+long can_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        int i=0;
        unsigned short channel=0;
index a1563cebead4215c2402ce42537e4304b937322a..d92a1a96c9cd998ca2cc90d10fb051719a2fd681 100644 (file)
@@ -27,7 +27,9 @@
   #include <linux/semaphore.h>
 #endif
 
-#include <linux/smp_lock.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
+  #include <linux/smp_lock.h>
+#endif
 
 #include "../include/kthread.h"
 
index 367c98db26e13da5687768b0ec9927fa7b24da43..a0740eb16cb357b9cbed438eabf9c7e895caeff1 100644 (file)
@@ -204,6 +204,13 @@ devfs_handle_t  devfs_handles[MAX_TOT_MSGOBJS];
 #endif
 #endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
+static int can_oldapi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+{
+       return can_ioctl(file, cmd, arg);
+}
+#endif /* 2.6.36 */
+
 /* Pointers to dynamically allocated memory are maintained in a linked list
  * to ease memory deallocation.
  */
@@ -217,7 +224,11 @@ struct file_operations can_fops=
        read:           can_read,
        write:          can_write,
        poll:           can_poll,
-       ioctl:          can_ioctl,
+  #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
+       ioctl:          can_oldapi_ioctl,
+  #else /* Linux 3.x */
+       unlocked_ioctl: can_ioctl,
+  #endif /* Linux 3.x */
        open:           can_open,
        release:        can_close,
   #ifdef CAN_ENABLE_KERN_FASYNC