]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: comedi_fc: export cfc_bytes_per_scan()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Sat, 8 Mar 2014 00:31:24 +0000 (17:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Mar 2014 20:55:53 +0000 (13:55 -0700)
This helper function is a bit long to be inlined. Move it to the
source file and export it.

The mite driver is the only external user right now. Update the
Kconfig to select COMEDI_FC when COMEDI_MITE is enabled.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/Kconfig
drivers/staging/comedi/drivers/comedi_fc.c
drivers/staging/comedi/drivers/comedi_fc.h

index 89e25b4203ad25b65434dbe102851bc043d65ba7..b89b1454a283bf96355a704806bff6c1dcc05c1d 100644 (file)
@@ -1101,6 +1101,7 @@ config COMEDI_S626
 
 config COMEDI_MITE
        depends on HAS_DMA
+       select COMEDI_FC
        tristate
 
 config COMEDI_NI_TIOCMD
index 157b61caa724cadc79cc559fd2b0728da348715d..5d8aa80179d84c1eddd8ed890f018dfeb4252aa5 100644 (file)
 
 #include "comedi_fc.h"
 
+unsigned int cfc_bytes_per_scan(struct comedi_subdevice *s)
+{
+       unsigned int chanlist_len = s->async->cmd.chanlist_len;
+       unsigned int num_samples;
+       unsigned int bits_per_sample;
+
+       switch (s->type) {
+       case COMEDI_SUBD_DI:
+       case COMEDI_SUBD_DO:
+       case COMEDI_SUBD_DIO:
+               bits_per_sample = 8 * bytes_per_sample(s);
+               num_samples = (chanlist_len + bits_per_sample - 1) /
+                               bits_per_sample;
+               break;
+       default:
+               num_samples = chanlist_len;
+               break;
+       }
+       return num_samples * bytes_per_sample(s);
+}
+EXPORT_SYMBOL_GPL(cfc_bytes_per_scan);
+
 static void increment_scan_progress(struct comedi_subdevice *s,
                                    unsigned int num_bytes)
 {
index b8d125e81a0f03d5e0ef6caa4818f596aca92eba..2d57ad4f776bf0bc4f57751f48f9d59e3dc56c37 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "../comedidev.h"
 
+unsigned int cfc_bytes_per_scan(struct comedi_subdevice *);
+
 /* Writes an array of data points to comedi's buffer */
 unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *,
                                       void *data, unsigned int num_bytes);
@@ -45,27 +47,6 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *,
 unsigned int cfc_handle_events(struct comedi_device *,
                               struct comedi_subdevice *);
 
-static inline unsigned int cfc_bytes_per_scan(struct comedi_subdevice *s)
-{
-       unsigned int chanlist_len = s->async->cmd.chanlist_len;
-       unsigned int num_samples;
-       unsigned int bits_per_sample;
-
-       switch (s->type) {
-       case COMEDI_SUBD_DI:
-       case COMEDI_SUBD_DO:
-       case COMEDI_SUBD_DIO:
-               bits_per_sample = 8 * bytes_per_sample(s);
-               num_samples = (chanlist_len + bits_per_sample - 1) /
-                               bits_per_sample;
-               break;
-       default:
-               num_samples = chanlist_len;
-               break;
-       }
-       return num_samples * bytes_per_sample(s);
-}
-
 /**
  * cfc_check_trigger_src() - trivially validate a comedi_cmd trigger source
  * @src: pointer to the trigger source to validate