list 10 insn limit on insn lists
authorFrank Mori Hess <fmhess@speakeasy.net>
Sat, 17 Jul 2004 22:55:05 +0000 (22:55 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Sat, 17 Jul 2004 22:55:05 +0000 (22:55 +0000)
comedi/comedi_fops.c
include/linux/sched.h

index 8413912507dd979688da347be905b2409d258e7b..79fec01a09c04dcb1512f1bcda5005074fe6a6d8 100644 (file)
@@ -552,7 +552,6 @@ static int parse_insn(comedi_device *dev,comedi_insn *insn,lsampl_t *data,void *
  */
 /* arbitrary limits */
 #define MAX_SAMPLES 256
-#define MAX_INSNS 10
 static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file)
 {
        comedi_insnlist insnlist;
@@ -564,11 +563,6 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file)
        if(copy_from_user(&insnlist,arg,sizeof(comedi_insnlist)))
                return -EFAULT;
 
-       if(insnlist.n_insns>=MAX_INSNS){
-               DPRINTK("insnlist too long\n");
-               return -EINVAL;
-       }
-
        data=kmalloc(sizeof(lsampl_t)*MAX_SAMPLES,GFP_KERNEL);
        if(!data){
                DPRINTK("kmalloc failed\n");
@@ -618,6 +612,8 @@ static int do_insnlist_ioctl(comedi_device *dev,void *arg,void *file)
                                goto error;
                        }
                }
+               if(need_resched())
+                       schedule();
        }
 
 error:
index 753d54f7a751513924088ccaf0137ca2f2b95666..5e040ddc60103483113ab054f043c49571053b31 100644 (file)
 #define signal_pending(x)      (((x)->signal) & (~(x)->blocked))
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) /* not sure exactly when need_resched() was added */
+static inline int need_resched(void)
+{
+       return current->need_resched;
+}
+#endif
+
 #include_next <linux/sched.h>
 
 #endif