]> rtime.felk.cvut.cz Git - mf6xx.git/commitdiff
Minor changes. Still not tested.
authorRostislav Lisovy <lisovy@gmail.com>
Tue, 5 Apr 2011 21:00:58 +0000 (23:00 +0200)
committerRostislav Lisovy <lisovy@gmail.com>
Tue, 5 Apr 2011 21:00:58 +0000 (23:00 +0200)
src/comedi/simple_driver/kernel/mf624.c

index 34d886b674dc0529475b59c20438488b7a22d526..5b903f4a2886221069104cec5fa6ded8e030445d 100755 (executable)
@@ -55,6 +55,7 @@ none
 */
 #include <linux/comedidev.h>
 #include <linux/pci.h>
+#include "mf624.h"
 
 #define EXTDEBUG 
 #define MF624_EXIT_FAILURE     -1
@@ -129,13 +130,6 @@ static const mf624_board mf624_boards[] = {
 #define N_BOARDS       (sizeof(mf624_boards) / sizeof(mf624_board))
 
 
-static struct pci_device_id mf624_pci_table[] __devinitdata = {
-       { PCI_VENDOR_ID_MF624, PCI_DEVICE_ID_MF624, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-       { 0 }
-};
-MODULE_DEVICE_TABLE(pci, mf624_pci_table);
-
-
 /* Private data structure */
 typedef struct{
        int data;
@@ -188,19 +182,6 @@ static int mf624_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice
 /*static irqreturn_t mf624_interrupt(int irq, void *d, struct pt_regs *regs);*/
 
 
-/*
- * The comedi_driver structure tells the Comedi core module
- * which functions to call to configure/deconfigure (attach/detach)
- * the board, and also about the kernel module that contains
- * the device code.
- */
-static comedi_driver driver_mf624 = {
-       driver_name:    "mf624",
-       module:         THIS_MODULE,
-       attach:         mf624_attach,
-       detach:         mf624_detach,
-};
-
 
 #define thisboard      ((mf624_board *)dev->board_ptr)
 /*
@@ -209,7 +190,7 @@ static comedi_driver driver_mf624 = {
  * in the driver structure, dev->board_ptr contains that
  * address.
  */
-static int mf624_attach(comedi_device *dev, comedi_devconfig *it)
+static int mf624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
        comedi_subdevice *s;
        struct pci_dev* pcidev;
@@ -384,7 +365,7 @@ found:
  * allocated by _attach(). dev->private and dev->subdevices are
  * deallocated automatically by the core.
  */
-static int mf624_detach(comedi_device *dev)
+static int mf624_detach(struct comedi_device *dev)
 {
        //rt_printk("comedi%d: mf624: remove\n", dev->minor);
 
@@ -408,10 +389,11 @@ static int mf624_detach(comedi_device *dev)
 }
 
 /* read n samples on Analog Input channel */
-static int mf624_ai_rinsn(comedi_device *dev
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
+       struct comedi_insn *insn, lsampl_t *data)
 {
-       unsigned int dat, n, i, status, chan = CR_CHAN(insn->chanspec);
+       unsigned int dat, n, i, status;
+       unsigned int chan = CR_CHAN(insn->chanspec);
 
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: mf624_ai_rinsn called \n", dev->minor);
@@ -455,8 +437,8 @@ static int mf624_ai_rinsn(comedi_device *dev,
 
 
 /* Analog input configuration */
-static int mf624_ai_cfg(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_ai_cfg(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
 {
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: _insn_ai_cfg called\n", dev->minor);
@@ -466,10 +448,11 @@ static int mf624_ai_cfg(comedi_device *dev,
 
 
 /* write n samples on Analog Output channel */
-static int mf624_ao_winsn(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
 {
-       unsigned int i, chan = CR_CHAN(insn->chanspec), status;
+       unsigned int i, status;
+       unsigned int chan = CR_CHAN(insn->chanspec);
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: _ao_winsn called\n", dev->minor);
 #endif
@@ -493,8 +476,9 @@ static int mf624_ao_winsn(comedi_device *dev,
 
 
 /* Analog output configuration */
-static int mf624_ao_cfg(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data){
+static int mf624_ao_cfg(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
+{
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: _ao_cfg called\n, dev->minor");
 #endif
@@ -504,8 +488,8 @@ static int mf624_ao_cfg(comedi_device *dev,
 
 /* AO subdevices should have a read insn as well as a write insn.
  * Usually this means copying a value stored in devpriv. */
-static int mf624_ao_rinsn(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
 {
        unsigned int i, chan = CR_CHAN(insn->chanspec);
 
@@ -517,8 +501,8 @@ static int mf624_ao_rinsn(comedi_device *dev,
 }
 
 /* Write digital data */
-static int mf624_do_insn_bits(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
 {
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: _do_insn_bits called \
@@ -541,8 +525,8 @@ static int mf624_do_insn_bits(comedi_device *dev,
 }
 
 /* Read digital data */
-static int mf624_di_insn_bits(comedi_device *dev,
-       comedi_subdevice *s, comedi_insn *insn, lsampl_t *data)
+static int mf624_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, 
+       struct comedi_insn *insn, lsampl_t *data)
 {
 #ifdef EXTDEBUG
        rt_printk("comedi%d: mf624: _di_insn_bits called with \
@@ -561,11 +545,29 @@ static int mf624_di_insn_bits(comedi_device *dev,
 }
 
 
+static struct pci_device_id mf624_pci_table[] __devinitdata = {
+       { PCI_VENDOR_ID_MF624, PCI_DEVICE_ID_MF624, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+       { 0 }
+};
+MODULE_DEVICE_TABLE(pci, mf624_pci_table);
+
+/*
+ * The comedi_driver structure tells the Comedi core module
+ * which functions to call to configure/deconfigure (attach/detach)
+ * the board, and also about the kernel module that contains
+ * the device code.
+ */
+static comedi_driver driver_mf624 = {
+       driver_name:    "mf624",
+       module:         THIS_MODULE,
+       attach:         mf624_attach,
+       detach:         mf624_detach,
+};
+
+
 MODULE_AUTHOR("Francois Poulain <fpoulain@gmail.com>;\
                 (Rostislav Lisovy <lisovy@gmail.com>)");
 MODULE_DESCRIPTION("Humusoft MF624 Multifunction I/O Card");
 MODULE_LICENSE("GPL");
 
-
-/* A convenient macro that defines init_module() and cleanup_module(), as necessary. */
 COMEDI_INITCLEANUP(driver_mf624);