comedi: Move "comedi_isadma.h" to <linux/comedi/comedi_isadma.h>
authorIan Abbott <abbotti@mev.co.uk>
Wed, 17 Nov 2021 12:06:03 +0000 (12:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 15:48:59 +0000 (16:48 +0100)
Some of the header files in "drivers/comedi/drivers/" are common enough
to be useful to out-of-tree comedi driver modules.  Using them for
out-of-tree module builds is hampered by the headers being outside the
"include/" directory so it is desirable to move them.

There are about a half a dozen or so Comedi device drivers that use the
"comedi_isadma" module to add ISA DMA support.  The macros and
declarations to use that module are in the "comedi_isadma.h" header file
in the comedi "drivers" directory.  Move it into
"include/linux/comedi/".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20211117120604.117740-6-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/comedi/drivers/comedi_isadma.c
drivers/comedi/drivers/comedi_isadma.h [deleted file]
drivers/comedi/drivers/das16.c
drivers/comedi/drivers/das1800.c
drivers/comedi/drivers/dt282x.c
drivers/comedi/drivers/ni_at_a2150.c
drivers/comedi/drivers/ni_labpc_isadma.c
drivers/comedi/drivers/pcl812.c
drivers/comedi/drivers/pcl816.c
drivers/comedi/drivers/pcl818.c
include/linux/comedi/comedi_isadma.h [new file with mode: 0644]

index 63457bd4ff78c246ef71c8292713af26c37b063e..700982464c5385586aeed5a0d1ebb636bf0f9d1a 100644 (file)
@@ -10,8 +10,7 @@
 #include <linux/dma-mapping.h>
 #include <asm/dma.h>
 #include <linux/comedi/comedidev.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /**
  * comedi_isadma_program - program and enable an ISA DMA transfer
diff --git a/drivers/comedi/drivers/comedi_isadma.h b/drivers/comedi/drivers/comedi_isadma.h
deleted file mode 100644 (file)
index 9d2b12d..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * COMEDI ISA DMA support functions
- * Copyright (c) 2014 H Hartley Sweeten <hsweeten@visionengravers.com>
- */
-
-#ifndef _COMEDI_ISADMA_H
-#define _COMEDI_ISADMA_H
-
-#include <linux/types.h>
-
-struct comedi_device;
-struct device;
-
-/*
- * These are used to avoid issues when <asm/dma.h> and the DMA_MODE_
- * defines are not available.
- */
-#define COMEDI_ISADMA_READ     0
-#define COMEDI_ISADMA_WRITE    1
-
-/**
- * struct comedi_isadma_desc - cookie for ISA DMA
- * @virt_addr: virtual address of buffer
- * @hw_addr:   hardware (bus) address of buffer
- * @chan:      DMA channel
- * @maxsize:   allocated size of buffer (in bytes)
- * @size:      transfer size (in bytes)
- * @mode:      DMA_MODE_READ or DMA_MODE_WRITE
- */
-struct comedi_isadma_desc {
-       void *virt_addr;
-       dma_addr_t hw_addr;
-       unsigned int chan;
-       unsigned int maxsize;
-       unsigned int size;
-       char mode;
-};
-
-/**
- * struct comedi_isadma - ISA DMA data
- * @dev:       device to allocate non-coherent memory for
- * @desc:      cookie for each DMA buffer
- * @n_desc:    the number of cookies
- * @cur_dma:   the current cookie in use
- * @chan:      the first DMA channel requested
- * @chan2:     the second DMA channel requested
- */
-struct comedi_isadma {
-       struct device *dev;
-       struct comedi_isadma_desc *desc;
-       int n_desc;
-       int cur_dma;
-       unsigned int chan;
-       unsigned int chan2;
-};
-
-#if IS_ENABLED(CONFIG_ISA_DMA_API)
-
-void comedi_isadma_program(struct comedi_isadma_desc *desc);
-unsigned int comedi_isadma_disable(unsigned int dma_chan);
-unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan,
-                                            unsigned int size);
-unsigned int comedi_isadma_poll(struct comedi_isadma *dma);
-void comedi_isadma_set_mode(struct comedi_isadma_desc *desc, char dma_dir);
-
-struct comedi_isadma *comedi_isadma_alloc(struct comedi_device *dev,
-                                         int n_desc, unsigned int dma_chan1,
-                                         unsigned int dma_chan2,
-                                         unsigned int maxsize, char dma_dir);
-void comedi_isadma_free(struct comedi_isadma *dma);
-
-#else  /* !IS_ENABLED(CONFIG_ISA_DMA_API) */
-
-static inline void comedi_isadma_program(struct comedi_isadma_desc *desc)
-{
-}
-
-static inline unsigned int comedi_isadma_disable(unsigned int dma_chan)
-{
-       return 0;
-}
-
-static inline unsigned int
-comedi_isadma_disable_on_sample(unsigned int dma_chan, unsigned int size)
-{
-       return 0;
-}
-
-static inline unsigned int comedi_isadma_poll(struct comedi_isadma *dma)
-{
-       return 0;
-}
-
-static inline void comedi_isadma_set_mode(struct comedi_isadma_desc *desc,
-                                         char dma_dir)
-{
-}
-
-static inline struct comedi_isadma *
-comedi_isadma_alloc(struct comedi_device *dev, int n_desc,
-                   unsigned int dma_chan1, unsigned int dma_chan2,
-                   unsigned int maxsize, char dma_dir)
-{
-       return NULL;
-}
-
-static inline void comedi_isadma_free(struct comedi_isadma *dma)
-{
-}
-
-#endif /* !IS_ENABLED(CONFIG_ISA_DMA_API) */
-
-#endif /* #ifndef _COMEDI_ISADMA_H */
index f6649ffa967080f776fbc51b9cb7a3de11b4bd24..937a69ce09770f899d0d41dcbd0e337dc9861159 100644 (file)
@@ -66,8 +66,7 @@
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8255.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 #define DAS16_DMA_SIZE 0xff00  /*  size in bytes of allocated dma buffer */
 
index a43d3414a12211c594bb022c5c1a46df24e82f5f..f09608c0f4ff7ebcad5288a6114c5997c9206fb7 100644 (file)
@@ -75,8 +75,7 @@
 #include <linux/io.h>
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /* misc. defines */
 #define DAS1800_SIZE           16      /* uses 16 io addresses */
index 078f8fba7183add386ede4dcd156bd729a8d59a4..4ae80e6c72662bc22152d8d0caf5a0c86a015816 100644 (file)
@@ -52,8 +52,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/comedi/comedidev.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /*
  * Register map
index 9942d770add85092fd5d1c7d7ec402efa4098822..df8d219e67234e74ba7ca97743ec48b4286e2ee6 100644 (file)
@@ -41,8 +41,7 @@
 #include <linux/io.h>
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 #define A2150_DMA_BUFFER_SIZE  0xff00  /*  size in bytes of dma buffer */
 
index dd37ec0d9b15911870b1886360744eae5fed7f9a..0652ca8345b680d5397ee760f381de7841875a86 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/comedi/comedidev.h>
+#include <linux/comedi/comedi_isadma.h>
 
-#include "comedi_isadma.h"
 #include "ni_labpc.h"
 #include "ni_labpc_regs.h"
 #include "ni_labpc_isadma.h"
index 790f54476a9138905b89116830fdd54823d258db..70dbc129fcf55810a96498a3372cdf63bf113c64 100644 (file)
 #include <linux/io.h>
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /*
  * Register I/O map
index 77b30246d966296953ae4ca0c1e8e3049f69a8ea..a5e5320be648c45e83efb5dba3733bdbee6ba2ef 100644 (file)
@@ -37,8 +37,7 @@
 #include <linux/interrupt.h>
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /*
  * Register I/O map
index e5b7793cce053369df66aae26cda9e3154c75d2e..29e503de8267b3562f97407e25917e15c105768a 100644 (file)
@@ -99,8 +99,7 @@
 #include <linux/interrupt.h>
 #include <linux/comedi/comedidev.h>
 #include <linux/comedi/comedi_8254.h>
-
-#include "comedi_isadma.h"
+#include <linux/comedi/comedi_isadma.h>
 
 /*
  * Register I/O map
diff --git a/include/linux/comedi/comedi_isadma.h b/include/linux/comedi/comedi_isadma.h
new file mode 100644 (file)
index 0000000..9d2b12d
--- /dev/null
@@ -0,0 +1,114 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * COMEDI ISA DMA support functions
+ * Copyright (c) 2014 H Hartley Sweeten <hsweeten@visionengravers.com>
+ */
+
+#ifndef _COMEDI_ISADMA_H
+#define _COMEDI_ISADMA_H
+
+#include <linux/types.h>
+
+struct comedi_device;
+struct device;
+
+/*
+ * These are used to avoid issues when <asm/dma.h> and the DMA_MODE_
+ * defines are not available.
+ */
+#define COMEDI_ISADMA_READ     0
+#define COMEDI_ISADMA_WRITE    1
+
+/**
+ * struct comedi_isadma_desc - cookie for ISA DMA
+ * @virt_addr: virtual address of buffer
+ * @hw_addr:   hardware (bus) address of buffer
+ * @chan:      DMA channel
+ * @maxsize:   allocated size of buffer (in bytes)
+ * @size:      transfer size (in bytes)
+ * @mode:      DMA_MODE_READ or DMA_MODE_WRITE
+ */
+struct comedi_isadma_desc {
+       void *virt_addr;
+       dma_addr_t hw_addr;
+       unsigned int chan;
+       unsigned int maxsize;
+       unsigned int size;
+       char mode;
+};
+
+/**
+ * struct comedi_isadma - ISA DMA data
+ * @dev:       device to allocate non-coherent memory for
+ * @desc:      cookie for each DMA buffer
+ * @n_desc:    the number of cookies
+ * @cur_dma:   the current cookie in use
+ * @chan:      the first DMA channel requested
+ * @chan2:     the second DMA channel requested
+ */
+struct comedi_isadma {
+       struct device *dev;
+       struct comedi_isadma_desc *desc;
+       int n_desc;
+       int cur_dma;
+       unsigned int chan;
+       unsigned int chan2;
+};
+
+#if IS_ENABLED(CONFIG_ISA_DMA_API)
+
+void comedi_isadma_program(struct comedi_isadma_desc *desc);
+unsigned int comedi_isadma_disable(unsigned int dma_chan);
+unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan,
+                                            unsigned int size);
+unsigned int comedi_isadma_poll(struct comedi_isadma *dma);
+void comedi_isadma_set_mode(struct comedi_isadma_desc *desc, char dma_dir);
+
+struct comedi_isadma *comedi_isadma_alloc(struct comedi_device *dev,
+                                         int n_desc, unsigned int dma_chan1,
+                                         unsigned int dma_chan2,
+                                         unsigned int maxsize, char dma_dir);
+void comedi_isadma_free(struct comedi_isadma *dma);
+
+#else  /* !IS_ENABLED(CONFIG_ISA_DMA_API) */
+
+static inline void comedi_isadma_program(struct comedi_isadma_desc *desc)
+{
+}
+
+static inline unsigned int comedi_isadma_disable(unsigned int dma_chan)
+{
+       return 0;
+}
+
+static inline unsigned int
+comedi_isadma_disable_on_sample(unsigned int dma_chan, unsigned int size)
+{
+       return 0;
+}
+
+static inline unsigned int comedi_isadma_poll(struct comedi_isadma *dma)
+{
+       return 0;
+}
+
+static inline void comedi_isadma_set_mode(struct comedi_isadma_desc *desc,
+                                         char dma_dir)
+{
+}
+
+static inline struct comedi_isadma *
+comedi_isadma_alloc(struct comedi_device *dev, int n_desc,
+                   unsigned int dma_chan1, unsigned int dma_chan2,
+                   unsigned int maxsize, char dma_dir)
+{
+       return NULL;
+}
+
+static inline void comedi_isadma_free(struct comedi_isadma *dma)
+{
+}
+
+#endif /* !IS_ENABLED(CONFIG_ISA_DMA_API) */
+
+#endif /* #ifndef _COMEDI_ISADMA_H */