staging: comedi: comedidev.h: remove 'new_size' param from subdevice (*buf_change)
[firefly-linux-kernel-4.4.55.git] / drivers / staging / comedi / comedidev.h
index 83fd1553ff93d5317a3a9ca33efcdd8b38038380..f3999f5e809183c5163d3d25fd8221a9cd634a90 100644 (file)
@@ -75,13 +75,9 @@ struct comedi_subdevice {
                          struct comedi_cmd *);
        int (*poll)(struct comedi_device *, struct comedi_subdevice *);
        int (*cancel)(struct comedi_device *, struct comedi_subdevice *);
-       /* int (*do_lock)(struct comedi_device *, struct comedi_subdevice *); */
-       /* int (*do_unlock)(struct comedi_device *, \
-                       struct comedi_subdevice *); */
 
        /* called when the buffer changes */
-       int (*buf_change)(struct comedi_device *dev,
-                         struct comedi_subdevice *s, unsigned long new_size);
+       int (*buf_change)(struct comedi_device *, struct comedi_subdevice *);
 
        void (*munge)(struct comedi_device *dev, struct comedi_subdevice *s,
                      void *data, unsigned int num_bytes,
@@ -280,7 +276,6 @@ static inline const void *comedi_board(const struct comedi_device *dev)
  */
 
 void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s);
-void comedi_error(const struct comedi_device *dev, const char *s);
 
 /* we can expand the number of bits used to encode devices/subdevices into
  the minor number soon, after more distros support > 8 bit minor numbers
@@ -289,6 +284,7 @@ enum comedi_minor_bits {
        COMEDI_DEVICE_MINOR_MASK = 0xf,
        COMEDI_SUBDEVICE_MINOR_MASK = 0xf0
 };
+
 static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
 static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
 
@@ -363,6 +359,12 @@ static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s,
        return s->range_table->range[range].min >= 0;
 }
 
+static inline bool comedi_range_is_external(struct comedi_subdevice *s,
+                                           unsigned int range)
+{
+       return !!(s->range_table->range[range].flags & RF_EXTERNAL);
+}
+
 static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s,
                                                unsigned int chan,
                                                unsigned int range)
@@ -377,6 +379,13 @@ static inline bool comedi_chan_range_is_unipolar(struct comedi_subdevice *s,
        return s->range_table_list[chan]->range[range].min >= 0;
 }
 
+static inline bool comedi_chan_range_is_external(struct comedi_subdevice *s,
+                                                unsigned int chan,
+                                                unsigned int range)
+{
+       return !!(s->range_table_list[chan]->range[range].flags & RF_EXTERNAL);
+}
+
 /* munge between offset binary and two's complement values */
 static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s,
                                               unsigned int val)
@@ -388,8 +397,8 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd)
 {
        if (subd->subdev_flags & SDF_LSAMPL)
                return sizeof(unsigned int);
-       else
-               return sizeof(short);
+
+       return sizeof(short);
 }
 
 /*
@@ -556,9 +565,9 @@ int comedi_pcmcia_auto_config(struct pcmcia_device *, struct comedi_driver *);
 void comedi_pcmcia_auto_unconfig(struct pcmcia_device *);
 
 int comedi_pcmcia_driver_register(struct comedi_driver *,
-                                       struct pcmcia_driver *);
+                                 struct pcmcia_driver *);
 void comedi_pcmcia_driver_unregister(struct comedi_driver *,
-                                       struct pcmcia_driver *);
+                                    struct pcmcia_driver *);
 
 /**
  * module_comedi_pcmcia_driver() - Helper macro for registering a comedi PCMCIA driver