Added insn_bits_supported field to subdevice info ioctl, as part
authorFrank Mori Hess <fmhess@speakeasy.net>
Tue, 16 Sep 2008 13:59:10 +0000 (13:59 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Tue, 16 Sep 2008 13:59:10 +0000 (13:59 +0000)
of a fix for:

BUG in do_test_for_insn_bits()
: Device or resource busy

when a program opens a device file
and one of the subdevices is busy when it
is opened.

comedi/comedi_fops.c
include/linux/comedi.h

index 99eee33506ff426ac7507eaabf893965b934a9b9..de4394716973c19110e5a050dfa6de2fcfbab86e 100644 (file)
@@ -434,6 +434,11 @@ static int do_subdinfo_ioctl(comedi_device * dev, comedi_subdinfo * arg,
                if (s->do_cmd)
                        us->subd_flags |= SDF_CMD;
 
+               if (s->insn_bits)
+                       us->insn_bits_support = COMEDI_SUPPORTED;
+               else
+                       us->insn_bits_support = COMEDI_UNSUPPORTED;
+
                us->settling_time_0 = s->settling_time_0;
        }
 
index 4f64572df593de4e140bbc2d811f4a2f97b02c11..ca9a43c447b906bbf72904dfcdbbf40400c0ba7c 100644 (file)
@@ -276,6 +276,13 @@ extern "C" {
                COMEDI_OPENDRAIN = 2
        };
 
+       enum comedi_support_level
+       {
+               COMEDI_UNKNOWN_SUPPORT = 0,
+               COMEDI_SUPPORTED,
+               COMEDI_UNSUPPORTED
+       };
+
 /* ioctls */
 
 #define CIO 'd'
@@ -385,6 +392,7 @@ extern "C" {
                unsigned int flags;
        };
 
+
        struct comedi_subdinfo_struct {
                unsigned int type;
                unsigned int n_chan;
@@ -395,7 +403,8 @@ extern "C" {
                unsigned int flags;     /* channel flags */
                unsigned int range_type;        /* lookup in kernel */
                unsigned int settling_time_0;
-               unsigned int unused[9];
+               unsigned insn_bits_support;     /* see support_level enum for values*/
+               unsigned int unused[8];
        };
 
        struct comedi_devinfo_struct {