Module: xenomai-head
Branch: master
Commit: ff59c784952b920aab52152c4baab3d74e0e48a4
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=ff59c784952b920aab52152c4baab3d74e0e48a4

Author: Alexis Berlemont <alexis.berlem...@gmail.com>
Date:   Tue May 26 14:53:21 2009 +0200

Remove comedi_get_nbchan(), a specific function which became useless,
and add comedi_get_subd(), a more general function which might be
helpful at attach / detach time.

---

 include/comedi/subdevice.h      |    2 +-
 ksrc/drivers/comedi/subdevice.c |   22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/comedi/subdevice.h b/include/comedi/subdevice.h
index e7aab0c..53118a0 100644
--- a/include/comedi/subdevice.h
+++ b/include/comedi/subdevice.h
@@ -252,10 +252,10 @@ int comedi_check_chanlist(comedi_subd_t * subd,
 
 /* --- Upper layer functions --- */
 
+comedi_subd_t * comedi_get_subd(struct comedi_device *dev, int idx);
 comedi_subd_t * comedi_alloc_subd(int sizeof_priv,
                                  void (*setup)(comedi_subd_t *));
 int comedi_add_subd(struct comedi_device *dev, comedi_subd_t * subd);
-int comedi_get_nbchan(struct comedi_device *dev, int subd_key);
 int comedi_ioctl_subdinfo(comedi_cxt_t * cxt, void *arg);
 int comedi_ioctl_chaninfo(comedi_cxt_t * cxt, void *arg);
 int comedi_ioctl_rnginfo(comedi_cxt_t * cxt, void *arg);
diff --git a/ksrc/drivers/comedi/subdevice.c b/ksrc/drivers/comedi/subdevice.c
index 31d0b39..2a4ee9e 100644
--- a/ksrc/drivers/comedi/subdevice.c
+++ b/ksrc/drivers/comedi/subdevice.c
@@ -116,11 +116,6 @@ int comedi_check_chanlist(comedi_subd_t * subd,
 
 /* --- Upper layer functions --- */
 
-int comedi_get_nbchan(comedi_dev_t * dev, int subd_key)
-{
-       return dev->transfer->subds[subd_key]->chan_desc->length;
-}
-
 comedi_subd_t * comedi_alloc_subd(int sizeof_priv,
                                  void (*setup)(comedi_subd_t *))
 {
@@ -156,6 +151,23 @@ int comedi_add_subd(comedi_dev_t * dev, comedi_subd_t * 
subd)
        return i;
 }
 
+comedi_subd_t *comedi_get_subd(comedi_dev_t *dev, int idx)
+{
+       int i = 0;
+       comedi_subd_t *subd = NULL;
+       struct list_head *this;
+
+       /* This function is not optimized as we do not go through the
+          transfer structure */
+
+       list_for_each(this, &dev->subdvsq) {
+               if(idx == i++)
+                       subd = list_entry(this, comedi_subd_t, list);           
+       }
+
+       return subd;
+}
+
 /* --- IOCTL / FOPS functions --- */
 
 int comedi_ioctl_subdinfo(comedi_cxt_t * cxt, void *arg)


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

Reply via email to