staging: comedi: comedidev.h: remove 'new_size' param from subdevice (*buf_change)
[firefly-linux-kernel-4.4.55.git] / drivers / staging / comedi / comedi_fops.c
index 9670b244fc69cc077b60c1d0f6fb05245431053c..2182c7463cdbdaa8bc0dbc5a38770d7f2ca67998 100644 (file)
@@ -268,7 +268,7 @@ static int resize_async_buffer(struct comedi_device *dev,
                return retval;
 
        if (s->buf_change) {
-               retval = s->buf_change(dev, s, new_size);
+               retval = s->buf_change(dev, s);
                if (retval < 0)
                        return retval;
        }
@@ -1227,10 +1227,9 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
                                /* Most drivers ignore the base channel in
                                 * insn->chanspec.  Fix this here if
                                 * the subdevice has <= 32 channels.  */
-                               unsigned int shift;
-                               unsigned int orig_mask;
+                               unsigned int orig_mask = data[0];
+                               unsigned int shift = 0;
 
-                               orig_mask = data[0];
                                if (s->n_chan <= 32) {
                                        shift = CR_CHAN(insn->chanspec);
                                        if (shift > 0) {
@@ -1238,8 +1237,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
                                                data[0] <<= shift;
                                                data[1] <<= shift;
                                        }
-                               } else
-                                       shift = 0;
+                               }
                                ret = s->insn_bits(dev, s, insn, data);
                                data[0] = orig_mask;
                                if (shift > 0)
@@ -1662,14 +1660,6 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg,
                s->lock = file;
        spin_unlock_irqrestore(&s->spin_lock, flags);
 
-#if 0
-       if (ret < 0)
-               return ret;
-
-       if (s->lock_f)
-               ret = s->lock_f(dev, s);
-#endif
-
        return ret;
 }
 
@@ -1704,14 +1694,8 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg,
        if (s->lock && s->lock != file)
                return -EACCES;
 
-       if (s->lock == file) {
-#if 0
-               if (s->unlock)
-                       s->unlock(dev, s);
-#endif
-
+       if (s->lock == file)
                s->lock = NULL;
-       }
 
        return 0;
 }
@@ -2178,7 +2162,7 @@ out:
 }
 
 static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
-                               loff_t *offset)
+                          loff_t *offset)
 {
        struct comedi_subdevice *s;
        struct comedi_async *async;
@@ -2222,10 +2206,8 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
                n = nbytes;
 
                m = comedi_buf_read_n_available(s);
-               /* printk("%d available\n",m); */
                if (async->buf_read_ptr + m > async->prealloc_bufsz)
                        m = async->prealloc_bufsz - async->buf_read_ptr;
-               /* printk("%d contiguous\n",m); */
                if (m < n)
                        n = m;
 
@@ -2445,7 +2427,7 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
        struct device *csdev;
        unsigned i;
 
-       dev = kzalloc(sizeof(struct comedi_device), GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL)
                return ERR_PTR(-ENOMEM);
        comedi_device_init(dev);