staging: comedi: move (*insn_{read, write}) timeout debug messages to core
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 10 Feb 2014 18:49:45 +0000 (11:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2014 17:28:46 +0000 (09:28 -0800)
Have the comedi core display a standard dev_dbg() message when a timeout
occurs and remove all the driver specific messages.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 files changed:
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/drivers/adl_pci9111.c
drivers/staging/comedi/drivers/adl_pci9118.c
drivers/staging/comedi/drivers/adv_pci1710.c
drivers/staging/comedi/drivers/aio_aio12_8.c
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/cb_das16_cs.c
drivers/staging/comedi/drivers/cb_pcidas64.c
drivers/staging/comedi/drivers/das08.c
drivers/staging/comedi/drivers/das16m1.c
drivers/staging/comedi/drivers/dt2815.c
drivers/staging/comedi/drivers/dt282x.c
drivers/staging/comedi/drivers/dyna_pci10xx.c
drivers/staging/comedi/drivers/icp_multi.c
drivers/staging/comedi/drivers/me_daq.c
drivers/staging/comedi/drivers/ni_at_a2150.c
drivers/staging/comedi/drivers/ni_daq_700.c
drivers/staging/comedi/drivers/pcl812.c
drivers/staging/comedi/drivers/pcl816.c
drivers/staging/comedi/drivers/pcl818.c
drivers/staging/comedi/drivers/skel.c

index b36b76060d03b638b48f3bda05461702ad791780..ac1edd9d1e21ad4c81f88f40443dd40e5d8bf6ad 100644 (file)
@@ -1194,6 +1194,11 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
                switch (insn->insn) {
                case INSN_READ:
                        ret = s->insn_read(dev, s, insn, data);
+                       if (ret == -ETIMEDOUT) {
+                               dev_dbg(dev->class_dev,
+                                       "subdevice %d read instruction timed out\n",
+                                       s->index);
+                       }
                        break;
                case INSN_WRITE:
                        maxdata = s->maxdata_list
@@ -1207,8 +1212,14 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn,
                                        break;
                                }
                        }
-                       if (ret == 0)
+                       if (ret == 0) {
                                ret = s->insn_write(dev, s, insn, data);
+                               if (ret == -ETIMEDOUT) {
+                                       dev_dbg(dev->class_dev,
+                                               "subdevice %d write instruction timed out\n",
+                                               s->index);
+                               }
+                       }
                        break;
                case INSN_BITS:
                        if (insn->n != 2) {
index c741e8a041460c64e9e9d33c4e6b0e6d974b7b5a..647b2d814d6187e83dae45f7543eeb15395ef700 100644 (file)
@@ -748,7 +748,6 @@ static int pci9111_ai_insn_read(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, pci9111_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D read timeout");
                        data[i] = 0;
                        pci9111_fifo_reset(dev);
                        return ret;
index 6492bd81efe8649814d301bebd69930141431922..9218e9293cf5c9f79fd84fc12a01d35e1081fc4b 100644 (file)
@@ -614,7 +614,6 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D insn timeout");
                        data[n] = 0;
                        outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */
                        return ret;
index 36ed579cdd950b72166ec10f6a31b3cc99c3d8f9..16c4bb00022cfd32193e6fb8444c62aff8f5f310 100644 (file)
@@ -467,7 +467,6 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, pci171x_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D insn timeout");
                        outb(0, dev->iobase + PCI171x_CLRFIFO);
                        outb(0, dev->iobase + PCI171x_CLRINT);
                        data[n] = 0;
index 3f994ed3db42d514e4755560960c1190dbfe68aa..324746b1493171175b8455b5161e2c53fa8e8aec 100644 (file)
@@ -140,10 +140,8 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev,
 
                /*  Wait for conversion to complete */
                ret = comedi_timeout(dev, s, insn, aio_aio12_8_ai_eoc, 0);
-               if (ret) {
-                       dev_err(dev->class_dev, "ADC timeout\n");
+               if (ret)
                        return ret;
-               }
 
                data[n] = inw(dev->iobase + AIO12_8_ADC_REG) & s->maxdata;
        }
index b606bdb2826ea1c161c62ed30a9c2b893ee4747c..99e60835dc4a9417941f5a15e3b948f678be3019 100644 (file)
@@ -895,10 +895,8 @@ static int pci230_ai_rinsn(struct comedi_device *dev,
 
                /* wait for conversion to end */
                ret = comedi_timeout(dev, s, insn, pci230_ai_eoc, 0);
-               if (ret) {
-                       dev_err(dev->class_dev, "timeout\n");
+               if (ret)
                        return ret;
-               }
 
                /* read data */
                data[n] = pci230_ai_read(dev);
index 549844cf2b35944f768980a2f3a8603cccef7751..e0ed193522e08e55b42f9202b27dafd46e824777 100644 (file)
@@ -152,10 +152,8 @@ static int das16cs_ai_rinsn(struct comedi_device *dev,
                outw(0, dev->iobase + DAS16CS_ADC_DATA);
 
                ret = comedi_timeout(dev, s, insn, das16cs_ai_eoc, 0);
-               if (ret) {
-                       dev_dbg(dev->class_dev, "cb_das16_cs: ai timeout\n");
+               if (ret)
                        return ret;
-               }
 
                data[i] = inw(dev->iobase + DAS16CS_ADC_DATA);
        }
index 21e13a5cea11edd9161f4f4dee498b4884b7b93e..f9afcbe1da545cf653a447004ec13162a8404271 100644 (file)
@@ -1792,10 +1792,8 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
 
                /*  wait for data */
                ret = comedi_timeout(dev, s, insn, cb_pcidas64_ai_eoc, 0);
-               if (ret) {
-                       comedi_error(dev, " analog input read insn timed out");
+               if (ret)
                        return ret;
-               }
 
                if (thisboard->layout == LAYOUT_4020)
                        data[n] = readl(devpriv->dio_counter_iobase +
index b9916315adc6263749c3ea6922f39daf33999ff6..c5e352fb55557aad9a26d9ee2f39ecadc373c8f5 100644 (file)
@@ -257,10 +257,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
                outb_p(0, dev->iobase + DAS08_TRIG_12BIT);
 
                ret = comedi_timeout(dev, s, insn, das08_ai_eoc, 0);
-               if (ret) {
-                       dev_err(dev->class_dev, "timeout\n");
+               if (ret)
                        return ret;
-               }
 
                msb = inb(dev->iobase + DAS08_MSB);
                lsb = inb(dev->iobase + DAS08_LSB);
index a94b7a4e495ecd7cc6d671b3cedc39affba6685e..0a90ab341758a8903a049e2ee1666ec711ab1167 100644 (file)
@@ -370,10 +370,8 @@ static int das16m1_ai_rinsn(struct comedi_device *dev,
                outb(0, dev->iobase);
 
                ret = comedi_timeout(dev, s, insn, das16m1_ai_eoc, 0);
-               if (ret) {
-                       comedi_error(dev, "timeout");
+               if (ret)
                        return ret;
-               }
 
                data[n] = munge_sample(inw(dev->iobase));
        }
index 1ab1dd76dfd74c0bf5629bf449c8a89b879f0570..b9ac4ed8babb1e8acabbef4c1953ad0143488ebe 100644 (file)
@@ -108,22 +108,14 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
                hi = (data[i] & 0xff0) >> 4;
 
                ret = comedi_timeout(dev, s, insn, dt2815_ao_status, 0x00);
-               if (ret) {
-                       dev_dbg(dev->class_dev,
-                               "failed to write low byte on %d\n",
-                               chan);
+               if (ret)
                        return ret;
-               }
 
                outb(lo, dev->iobase + DT2815_DATA);
 
                ret = comedi_timeout(dev, s, insn, dt2815_ao_status, 0x10);
-               if (ret) {
-                       dev_dbg(dev->class_dev,
-                               "failed to write high byte on %d\n",
-                               chan);
+               if (ret)
                        return ret;
-               }
 
                devpriv->ao_readback[chan] = data[i];
        }
index f768210184c1946644c192daf9307dd1714141dc..6cc8f1d5b8315ad3d99d3249cf893e364a96c6ff 100644 (file)
@@ -554,10 +554,8 @@ static int dt282x_ai_insn_read(struct comedi_device *dev,
 
        outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR);
        ret = comedi_timeout(dev, s, insn, dt282x_ai_timeout, DT2821_MUXBUSY);
-       if (ret) {
-               comedi_error(dev, "timeout\n");
+       if (ret)
                return ret;
-       }
 
        for (i = 0; i < insn->n; i++) {
                outw(devpriv->supcsr | DT2821_STRIG,
@@ -565,10 +563,8 @@ static int dt282x_ai_insn_read(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, dt282x_ai_timeout,
                                     DT2821_ADDONE);
-               if (ret) {
-                       comedi_error(dev, "timeout\n");
+               if (ret)
                        return ret;
-               }
 
                data[i] =
                    inw(dev->iobase +
@@ -704,10 +700,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
        outw(devpriv->supcsr | DT2821_PRLD, dev->iobase + DT2821_SUPCSR);
        ret = comedi_timeout(dev, s, NULL, dt282x_ai_timeout, DT2821_MUXBUSY);
-       if (ret) {
-               comedi_error(dev, "timeout\n");
+       if (ret)
                return ret;
-       }
 
        if (cmd->scan_begin_src == TRIG_FOLLOW) {
                outw(devpriv->supcsr | DT2821_STRIG,
index 6d03b8fe1c24c1838559e862165f2c8f0fdfd776..78d44a9c8a71b12bb36d10a4ff7637be51479de1 100644 (file)
@@ -95,8 +95,6 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev,
                ret = comedi_timeout(dev, s, insn, dyna_pci10xx_ai_eoc, 0);
                if (ret) {
                        data[n] = 0;
-                       dev_dbg(dev->class_dev,
-                               "timeout reading analog input\n");
                        break;
                }
 
index 7fb6ca0a2f2660128d84d0e5494d1f883b86e4d5..ee30f2b8a54b6c51d1785dabdd4149f64a4a44d1 100644 (file)
@@ -216,7 +216,6 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev,
                /*  Wait for conversion to complete, or get fed up waiting */
                ret = comedi_timeout(dev, s, insn, icp_multi_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D insn timeout");
                        /*  Clear data received */
                        data[n] = 0;
                        break;
@@ -287,8 +286,6 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev,
                 *  ready for new data, or get fed up waiting */
                ret = comedi_timeout(dev, s, insn, icp_multi_ao_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "D/A insn timeout");
-
                        /*  Disable interrupt */
                        devpriv->IntEnable &= ~DAC_READY;
                        writew(devpriv->IntEnable,
index 288fb21b6f65617cdac81f94215cd5f2e90b394a..0ff126b1fdfd3914a434b0500c9384def9a44fce 100644 (file)
@@ -305,10 +305,8 @@ static int me_ai_insn_read(struct comedi_device *dev,
 
        /* wait for ADC fifo not empty flag */
        ret = comedi_timeout(dev, s, insn, me_ai_eoc, 0);
-       if (ret) {
-               dev_err(dev->class_dev, "Cannot get single value\n");
+       if (ret)
                return ret;
-       }
 
        /* get value from ADC fifo */
        val = readw(dev_private->me_regbase + ME_READ_AD_FIFO);
index 07239c967f9d6c8bc478837bad606e6764c9d868..740f14994f97d5a8a0776e251557b7c4cecca205 100644 (file)
@@ -538,10 +538,8 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
         */
        for (n = 0; n < 36; n++) {
                ret = comedi_timeout(dev, s, insn, a2150_ai_eoc, 0);
-               if (ret) {
-                       comedi_error(dev, "timeout");
+               if (ret)
                        return ret;
-               }
 
                inw(dev->iobase + FIFO_DATA_REG);
        }
@@ -549,10 +547,8 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
        /*  read data */
        for (n = 0; n < insn->n; n++) {
                ret = comedi_timeout(dev, s, insn, a2150_ai_eoc, 0);
-               if (ret) {
-                       comedi_error(dev, "timeout");
+               if (ret)
                        return ret;
-               }
 
                data[n] = inw(dev->iobase + FIFO_DATA_REG);
                data[n] ^= 0x8000;
index e56bfeb89a81839112ecc0be5cbe1d8a2c33ad8d..171a71d20c88fa1137735ee2d843a33d308fd4b5 100644 (file)
@@ -150,22 +150,8 @@ static int daq700_ai_rinsn(struct comedi_device *dev,
 
                /* wait for conversion to end */
                ret = comedi_timeout(dev, s, insn, daq700_ai_eoc, 0);
-               if (ret) {
-                       switch (ret) {
-                       case -EOVERFLOW:
-                               dev_info(dev->class_dev,
-                                        "Overflow/run Error\n");
-                               break;
-                       case -ENODATA:
-                               dev_info(dev->class_dev, "Data Error\n");
-                               break;
-                       default:
-                               dev_info(dev->class_dev,
-                                        "timeout during ADC conversion\n");
-                               break;
-                       }
+               if (ret)
                        return ret;
-               }
 
                /* read data */
                d = inw(dev->iobase + ADFIFO_R);
index 2ad6c73dfd687ae6771a1679e33e9b1779ebbf89..feb9e98524aa906ee660622d91be81ac2c44691e 100644 (file)
@@ -434,10 +434,8 @@ static int pcl812_ai_insn_read(struct comedi_device *dev,
                udelay(5);
 
                ret = comedi_timeout(dev, s, insn, pcl812_ai_eoc, 0);
-               if (ret) {
-                       dev_dbg(dev->class_dev, "A/D insn read timeout\n");
+               if (ret)
                        break;
-               }
 
                hi = inb(dev->iobase + PCL812_AD_HI);
                data[n] = ((hi & 0xf) << 8) | inb(dev->iobase + PCL812_AD_LO);
@@ -464,10 +462,8 @@ static int acl8216_ai_insn_read(struct comedi_device *dev,
                udelay(5);
 
                ret = comedi_timeout(dev, s, insn, pcl812_ai_eoc, 0);
-               if (ret) {
-                       dev_dbg(dev->class_dev, "A/D insn read timeout\n");
+               if (ret)
                        break;
-               }
 
                data[n] =
                    (inb(dev->iobase +
index db00d079c9c93b48439219d1dc59734e23f006ce..4bf2efb2c0279120997091476917d5c0979b7ee5 100644 (file)
@@ -196,7 +196,6 @@ static int pcl816_ai_insn_read(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, pcl816_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D insn timeout\n");
                        data[0] = 0;
                        /* clear INT (conversion end) flag */
                        outb(0, dev->iobase + PCL816_CLRINT);
index ff5cc1b8bed76d33957439657c51960fe58f76e8..9087e54537ec08bebbcda57340d6e53b7b5c53e5 100644 (file)
@@ -375,7 +375,6 @@ static int pcl818_ai_insn_read(struct comedi_device *dev,
 
                ret = comedi_timeout(dev, s, insn, pcl818_ai_eoc, 0);
                if (ret) {
-                       comedi_error(dev, "A/D insn timeout");
                        /* clear INT (conversion end) flag */
                        outb(0, dev->iobase + PCL818_CLRINT);
                        return ret;
index a4933683a5758a6cfcbf660f440f1540890fe084..39008cf30ecb14acd4a4706fe2ade9ed87612b50 100644 (file)
@@ -190,10 +190,8 @@ static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
 
                /* wait for conversion to end */
                ret = comedi_timeout(dev, s, insn, skel_ai_eoc, 0);
-               if (ret) {
-                       dev_warn(dev->class_dev, "ai timeout\n");
+               if (ret)
                        return ret;
-               }
 
                /* read data */
                /* d = inw(dev->iobase + SKEL_AI_DATA); */