staging: comedi: addi_apci_1564: use addi_watchdog module to init watchdog subdevice
authorChase Southwood <chase.southwood@gmail.com>
Sat, 12 Jul 2014 22:44:09 +0000 (17:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:19:34 +0000 (13:19 -0700)
Use the addi_watchdog module to provide support for the watchdog
subdevice.

Also, rearrange the subdevice init blocks so that the order makes sense.
Digital input/output subdevices and subdevices for DI/DO interrupt
support, followed by timer/counter/watchdog subdevices is the new order.

Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_1564.c

index 16f3b69871efe9ce87fdf71fc0c48b4e9103265a..190b02663bd00870fef388b3d1960c46e0f89c0d 100644 (file)
@@ -373,7 +373,7 @@ static int apci1564_auto_attach(struct comedi_device *dev,
                        dev->irq = pcidev->irq;
        }
 
-       ret = comedi_alloc_subdevices(dev, 4);
+       ret = comedi_alloc_subdevices(dev, 5);
        if (ret)
                return ret;
 
@@ -397,20 +397,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,
        s->insn_bits = apci1564_do_insn_bits;
        s->insn_read = apci1564_do_read;
 
-       /*  Allocate and Initialise Timer Subdevice Structures */
-       s = &dev->subdevices[2];
-       s->type = COMEDI_SUBD_TIMER;
-       s->subdev_flags = SDF_WRITEABLE;
-       s->n_chan = 1;
-       s->maxdata = 0;
-       s->len_chanlist = 1;
-       s->range_table = &range_digital;
-       s->insn_write = apci1564_timer_write;
-       s->insn_read = apci1564_timer_read;
-       s->insn_config = apci1564_timer_config;
-
        /* Change-Of-State (COS) interrupt subdevice */
-       s = &dev->subdevices[3];
+       s = &dev->subdevices[2];
        if (dev->irq) {
                dev->read_subdev = s;
                s->type = COMEDI_SUBD_DI;
@@ -428,6 +416,24 @@ static int apci1564_auto_attach(struct comedi_device *dev,
                s->type = COMEDI_SUBD_UNUSED;
        }
 
+       /*  Allocate and Initialise Timer Subdevice Structures */
+       s = &dev->subdevices[3];
+       s->type = COMEDI_SUBD_TIMER;
+       s->subdev_flags = SDF_WRITEABLE;
+       s->n_chan = 1;
+       s->maxdata = 0;
+       s->len_chanlist = 1;
+       s->range_table = &range_digital;
+       s->insn_write = apci1564_timer_write;
+       s->insn_read = apci1564_timer_read;
+       s->insn_config = apci1564_timer_config;
+
+       /* Initialize the watchdog subdevice */
+       s = &dev->subdevices[4];
+       ret = addi_watchdog_init(s, devpriv->amcc_iobase + APCI1564_WDOG_REG);
+       if (ret)
+               return ret;
+
        return 0;
 }
 
This page took 0.025932 seconds and 5 git commands to generate.