Constified ranges, board structures, and miscellaneous data.
[comedi.git] / comedi / drivers / pcl711.c
index 5e69e45dc2ecdd89d3d2367b080e4f3718de23e7..70c0961a38b3c8b2e9899935260dd87171a02e5d 100644 (file)
@@ -89,14 +89,14 @@ supported.
 #define PCL711_DO_LO 13
 #define PCL711_DO_HI 14
 
-static comedi_lrange range_pcl711b_ai = { 5, {
+static const comedi_lrange range_pcl711b_ai = { 5, {
         BIP_RANGE( 5 ),
         BIP_RANGE( 2.5 ),
         BIP_RANGE( 1.25 ),
         BIP_RANGE( 0.625 ),
         BIP_RANGE( 0.3125 )
 }};
-static comedi_lrange range_acl8112hg_ai = { 12, {
+static const comedi_lrange range_acl8112hg_ai = { 12, {
        BIP_RANGE( 5 ),
        BIP_RANGE( 0.5 ),
        BIP_RANGE( 0.05 ),
@@ -110,7 +110,7 @@ static comedi_lrange range_acl8112hg_ai = { 12, {
        BIP_RANGE( 0.1 ),
        BIP_RANGE( 0.01 )
 }};
-static comedi_lrange range_acl8112dg_ai = { 9, {
+static const comedi_lrange range_acl8112dg_ai = { 9, {
         BIP_RANGE( 5 ),
         BIP_RANGE( 2.5 ),
         BIP_RANGE( 1.25 ),
@@ -122,8 +122,6 @@ static comedi_lrange range_acl8112dg_ai = { 9, {
        BIP_RANGE( 10 )
 }};
 
-typedef int bool;
-
 /*
  * flags
  */
@@ -131,10 +129,10 @@ typedef int bool;
 #define PCL711_TIMEOUT 100
 #define PCL711_DRDY 0x10
 
-static int i8253_osc_base = 500;       /* 2 Mhz */
+static const int i8253_osc_base = 500; /* 2 Mhz */
 
 typedef struct {
-       char *name;
+       const char *name;
        int is_pcl711b;
        int is_8112;
        int is_dg;
@@ -142,10 +140,10 @@ typedef struct {
        int n_aichan;
        int n_aochan;
        int maxirq;
-       comedi_lrange * ai_range_type;
+       const comedi_lrange * ai_range_type;
 } boardtype;
 
-static boardtype boardtypes[] =
+static const boardtype boardtypes[] =
 {
        {"pcl711", 0, 0, 0, 5, 8, 1, 0, &range_bipolar5},
        {"pcl711b", 1, 0, 0, 5, 8, 1, 7, &range_pcl711b_ai},
@@ -153,7 +151,7 @@ static boardtype boardtypes[] =
        {"acl8112dg", 0, 1, 1, 9, 16, 2, 15, &range_acl8112dg_ai},
 };
 #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype))
-#define this_board ((boardtype *)dev->board_ptr)
+#define this_board ((const boardtype *)dev->board_ptr)
 
 static int pcl711_attach(comedi_device *dev,comedi_devconfig *it);
 static int pcl711_detach(comedi_device *dev);
@@ -162,7 +160,7 @@ static comedi_driver driver_pcl711={
        module:         THIS_MODULE,
        attach:         pcl711_attach,
        detach:         pcl711_detach,
-       board_name:     boardtypes,
+       board_name:     &boardtypes[0].name,
        num_names:      n_boardtypes,
        offset:         sizeof(boardtype),
 };
@@ -181,7 +179,7 @@ typedef struct {
 
 #define devpriv ((pcl711_private *)dev->private)
 
-static irqreturn_t pcl711_interrupt(int irq, void *d, struct pt_regs *regs)
+static irqreturn_t pcl711_interrupt(int irq, void *d PT_REGS_ARG)
 {
        int lo, hi;
        int data;
@@ -212,7 +210,7 @@ static void pcl711_set_changain(comedi_device * dev, int chan)
        int chan_register;
 
        outb(CR_RANGE(chan), dev->iobase + PCL711_GAIN);
-       
+
        chan_register=CR_CHAN(chan);
 
        if (this_board->is_8112) {
@@ -263,7 +261,7 @@ static int pcl711_ai_insn(comedi_device *dev,comedi_subdevice *s,
                }
                rt_printk("comedi%d: pcl711: A/D timeout\n", dev->minor);
                return -ETIME;
-       
+
 ok:
                lo = inb(dev->iobase + PCL711_AD_LO);
 
@@ -534,13 +532,15 @@ static int pcl711_attach(comedi_device * dev, comedi_devconfig * it)
        s = dev->subdevices + 0;
        /* AI subdevice */
        s->type = COMEDI_SUBD_AI;
-       s->subdev_flags = SDF_READABLE|SDF_GROUND;
+       s->subdev_flags = SDF_READABLE | SDF_GROUND;
        s->n_chan = this_board->n_aichan;
        s->maxdata = 0xfff;
        s->len_chanlist = 1;
        s->range_table = this_board->ai_range_type;
        s->insn_read = pcl711_ai_insn;
        if(irq){
+               dev->read_subdev = s;
+               s->subdev_flags |= SDF_CMD_READ;
                s->do_cmdtest = pcl711_ai_cmdtest;
                s->do_cmd = pcl711_ai_cmd;
        }