Module: xenomai-abe
Branch: comedi
Commit: 2c9cf77ed0017f3319691c387f2be5aea9f0154e
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=2c9cf77ed0017f3319691c387f2be5aea9f0154e

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Fri Sep 11 01:01:53 2009 +0200

Add comedi_presetup_transfer() function to be called before attach
procedure; this function was added to prevent IRQ descriptor
overwrite.

---

 include/comedi/transfer.h      |    1 +
 ksrc/drivers/comedi/device.c   |    2 ++
 ksrc/drivers/comedi/transfer.c |   23 ++++++++++++++++++-----
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/include/comedi/transfer.h b/include/comedi/transfer.h
index 00f1051..d0d5d04 100644
--- a/include/comedi/transfer.h
+++ b/include/comedi/transfer.h
@@ -79,6 +79,7 @@ int comedi_rdproc_transfer(char *page,
 
 /* --- Upper layer functions --- */
 
+void comedi_presetup_transfer(comedi_cxt_t * cxt);
 int comedi_setup_transfer(comedi_cxt_t * cxt);
 int comedi_cleanup_transfer(comedi_cxt_t * cxt);
 int comedi_reserve_transfer(comedi_cxt_t * cxt, int idx_subd);
diff --git a/ksrc/drivers/comedi/device.c b/ksrc/drivers/comedi/device.c
index 6c30f4c..aff6e70 100644
--- a/ksrc/drivers/comedi/device.c
+++ b/ksrc/drivers/comedi/device.c
@@ -440,6 +440,8 @@ int comedi_ioctl_devcfg(comedi_cxt_t * cxt, void *arg)
                if (test_bit
                    (COMEDI_DEV_ATTACHED, &(comedi_get_dev(cxt)->flags)))
                        return -EINVAL;
+               /* Pre-initialization of the transfer structure */
+               comedi_presetup_transfer(cxt);
                /* Links the device with the driver */
                if ((ret = comedi_device_attach(cxt, arg)) != 0)
                        return ret;
diff --git a/ksrc/drivers/comedi/transfer.c b/ksrc/drivers/comedi/transfer.c
index f5a8705..effd26f 100644
--- a/ksrc/drivers/comedi/transfer.c
+++ b/ksrc/drivers/comedi/transfer.c
@@ -80,16 +80,13 @@ int comedi_cleanup_transfer(comedi_cxt_t * cxt)
        return 0;
 }
 
-int comedi_setup_transfer(comedi_cxt_t * cxt)
+void comedi_presetup_transfer(comedi_cxt_t *cxt)
 {
        comedi_dev_t *dev = NULL;
        comedi_trf_t *tsf;
-       comedi_subd_t *subd;
-       struct list_head *this;
-       int i = 0, ret = 0;
 
        __comedi_dbg(1, core_dbg, 
-                    "comedi_setup_transfer: minor=%d\n",
+                    "comedi_presetup_transfer: minor=%d\n",
                     comedi_get_minor(cxt));
 
        dev = comedi_get_dev(cxt);
@@ -105,6 +102,22 @@ int comedi_setup_transfer(comedi_cxt_t * cxt)
        /* 0 is also considered as a valid IRQ, then 
           the IRQ number must be initialized with another value */
        tsf->irq_desc.irq = COMEDI_IRQ_UNUSED;
+}
+
+int comedi_setup_transfer(comedi_cxt_t * cxt)
+{
+       comedi_dev_t *dev = NULL;
+       comedi_trf_t *tsf;
+       comedi_subd_t *subd;
+       struct list_head *this;
+       int i = 0, ret = 0;
+
+       __comedi_dbg(1, core_dbg, 
+                    "comedi_setup_transfer: minor=%d\n",
+                    comedi_get_minor(cxt));
+
+       dev = comedi_get_dev(cxt);
+       tsf = &dev->transfer;
 
        /* Recovers the subdevices count 
           (as they are registered in a linked list */


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to