staging: comedi: daqboard2000: use shorter, consistent prefix
authorIan Abbott <abbotti@mev.co.uk>
Wed, 4 Jan 2017 10:55:43 +0000 (10:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Jan 2017 16:38:32 +0000 (17:38 +0100)
Use a consistent prefix of `db2k_` or `DB2K_` for identifiers.  The
existing prefixes `DAQBOARD2000_` and `daqboard2000_` are a bit on the
lengthy side.

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

index 5949ec1eaad98a1e151d9cb8e445c549164e339a..7a086cfa27127062de1552d7be6ea8e2ac64035f 100644 (file)
 #include "8255.h"
 #include "plx9080.h"
 
-#define DAQBOARD2000_FIRMWARE          "daqboard2000_firmware.bin"
+#define DB2K_FIRMWARE          "daqboard2000_firmware.bin"
 
-#define DAQBOARD2000_SUBSYSTEM_IDS2    0x0002  /* Daqboard/2000 - 2 Dacs */
-#define DAQBOARD2000_SUBSYSTEM_IDS4    0x0004  /* Daqboard/2000 - 4 Dacs */
+#define DB2K_SUBSYSTEM_IDS2    0x0002  /* Daqboard/2000 - 2 Dacs */
+#define DB2K_SUBSYSTEM_IDS4    0x0004  /* Daqboard/2000 - 4 Dacs */
 
-static const struct comedi_lrange range_daqboard2000_ai = {
+static const struct comedi_lrange db2k_ai_range = {
        13, {
                BIP_RANGE(10),
                BIP_RANGE(5),
@@ -245,30 +245,28 @@ static const struct comedi_lrange range_daqboard2000_ai = {
 /* "New CPLD" signature. */
 #define DB2K_CPLD_VERSION_NEW                          0x5000
 
-struct daq200_boardtype {
+struct db2k_boardtype {
        const char *name;
        int id;
 };
 
-static const struct daq200_boardtype boardtypes[] = {
-       {"ids2", DAQBOARD2000_SUBSYSTEM_IDS2},
-       {"ids4", DAQBOARD2000_SUBSYSTEM_IDS4},
+static const struct db2k_boardtype db2k_boardtypes[] = {
+       {"ids2", DB2K_SUBSYSTEM_IDS2},
+       {"ids4", DB2K_SUBSYSTEM_IDS4},
 };
 
-struct daqboard2000_private {
+struct db2k_private {
        void __iomem *plx;
 };
 
-static void daqboard2000_write_acq_scan_list_entry(struct comedi_device *dev,
-                                                  u16 entry)
+static void db2k_write_acq_scan_list_entry(struct comedi_device *dev, u16 entry)
 {
        writew(entry & 0x00ff, dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO);
        writew((entry >> 8) & 0x00ff,
               dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO);
 }
 
-static void daqboard2000_setup_sampling(struct comedi_device *dev, int chan,
-                                       int gain)
+static void db2k_setup_sampling(struct comedi_device *dev, int chan, int gain)
 {
        u16 word0, word1, word2, word3;
 
@@ -302,16 +300,14 @@ static void daqboard2000_setup_sampling(struct comedi_device *dev, int chan,
        /* These should be read from EEPROM */
        word2 |= 0x0800;        /* offset */
        word3 |= 0xc000;        /* gain */
-       daqboard2000_write_acq_scan_list_entry(dev, word0);
-       daqboard2000_write_acq_scan_list_entry(dev, word1);
-       daqboard2000_write_acq_scan_list_entry(dev, word2);
-       daqboard2000_write_acq_scan_list_entry(dev, word3);
+       db2k_write_acq_scan_list_entry(dev, word0);
+       db2k_write_acq_scan_list_entry(dev, word1);
+       db2k_write_acq_scan_list_entry(dev, word2);
+       db2k_write_acq_scan_list_entry(dev, word3);
 }
 
-static int daqboard2000_ai_status(struct comedi_device *dev,
-                                 struct comedi_subdevice *s,
-                                 struct comedi_insn *insn,
-                                 unsigned long context)
+static int db2k_ai_status(struct comedi_device *dev, struct comedi_subdevice *s,
+                         struct comedi_insn *insn, unsigned long context)
 {
        unsigned int status;
 
@@ -321,10 +317,9 @@ static int daqboard2000_ai_status(struct comedi_device *dev,
        return -EBUSY;
 }
 
-static int daqboard2000_ai_insn_read(struct comedi_device *dev,
-                                    struct comedi_subdevice *s,
-                                    struct comedi_insn *insn,
-                                    unsigned int *data)
+static int db2k_ai_insn_read(struct comedi_device *dev,
+                            struct comedi_subdevice *s,
+                            struct comedi_insn *insn, unsigned int *data)
 {
        int gain, chan;
        int ret;
@@ -353,12 +348,12 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev,
         * forced to fix it.  --ds
         */
        for (i = 0; i < insn->n; i++) {
-               daqboard2000_setup_sampling(dev, chan, gain);
+               db2k_setup_sampling(dev, chan, gain);
                /* Enable reading from the scanlist FIFO */
                writew(DB2K_ACQ_CONTROL_SEQ_START_SCAN_LIST,
                       dev->mmio + DB2K_REG_ACQ_CONTROL);
 
-               ret = comedi_timeout(dev, s, insn, daqboard2000_ai_status,
+               ret = comedi_timeout(dev, s, insn, db2k_ai_status,
                                     DB2K_ACQ_STATUS_CONFIG_PIPE_FULL);
                if (ret)
                        return ret;
@@ -366,13 +361,13 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev,
                writew(DB2K_ACQ_CONTROL_ADC_PACER_ENABLE,
                       dev->mmio + DB2K_REG_ACQ_CONTROL);
 
-               ret = comedi_timeout(dev, s, insn, daqboard2000_ai_status,
+               ret = comedi_timeout(dev, s, insn, db2k_ai_status,
                                     DB2K_ACQ_STATUS_LOGIC_SCANNING);
                if (ret)
                        return ret;
 
                ret =
-               comedi_timeout(dev, s, insn, daqboard2000_ai_status,
+               comedi_timeout(dev, s, insn, db2k_ai_status,
                               DB2K_ACQ_STATUS_RESULTS_FIFO_HAS_DATA);
                if (ret)
                        return ret;
@@ -387,10 +382,8 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev,
        return i;
 }
 
-static int daqboard2000_ao_eoc(struct comedi_device *dev,
-                              struct comedi_subdevice *s,
-                              struct comedi_insn *insn,
-                              unsigned long context)
+static int db2k_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s,
+                      struct comedi_insn *insn, unsigned long context)
 {
        unsigned int chan = CR_CHAN(insn->chanspec);
        unsigned int status;
@@ -401,10 +394,9 @@ static int daqboard2000_ao_eoc(struct comedi_device *dev,
        return -EBUSY;
 }
 
-static int daqboard2000_ao_insn_write(struct comedi_device *dev,
-                                     struct comedi_subdevice *s,
-                                     struct comedi_insn *insn,
-                                     unsigned int *data)
+static int db2k_ao_insn_write(struct comedi_device *dev,
+                             struct comedi_subdevice *s,
+                             struct comedi_insn *insn, unsigned int *data)
 {
        unsigned int chan = CR_CHAN(insn->chanspec);
        int i;
@@ -415,7 +407,7 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev,
 
                writew(val, dev->mmio + DB2K_REG_DAC_SETTING(chan));
 
-               ret = comedi_timeout(dev, s, insn, daqboard2000_ao_eoc, 0);
+               ret = comedi_timeout(dev, s, insn, db2k_ao_eoc, 0);
                if (ret)
                        return ret;
 
@@ -425,9 +417,9 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev,
        return insn->n;
 }
 
-static void daqboard2000_reset_local_bus(struct comedi_device *dev)
+static void db2k_reset_local_bus(struct comedi_device *dev)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
        u32 cntrl;
 
        cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
@@ -439,9 +431,9 @@ static void daqboard2000_reset_local_bus(struct comedi_device *dev)
        mdelay(10);
 }
 
-static void daqboard2000_reload_plx(struct comedi_device *dev)
+static void db2k_reload_plx(struct comedi_device *dev)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
        u32 cntrl;
 
        cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
@@ -456,9 +448,9 @@ static void daqboard2000_reload_plx(struct comedi_device *dev)
        mdelay(10);
 }
 
-static void daqboard2000_pulse_prog_pin(struct comedi_device *dev)
+static void db2k_pulse_prog_pin(struct comedi_device *dev)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
        u32 cntrl;
 
        cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
@@ -470,7 +462,7 @@ static void daqboard2000_pulse_prog_pin(struct comedi_device *dev)
        mdelay(10);     /* Not in the original code, but I like symmetry... */
 }
 
-static int daqboard2000_wait_cpld_init(struct comedi_device *dev)
+static int db2k_wait_cpld_init(struct comedi_device *dev)
 {
        int result = -ETIMEDOUT;
        int i;
@@ -489,7 +481,7 @@ static int daqboard2000_wait_cpld_init(struct comedi_device *dev)
        return result;
 }
 
-static int daqboard2000_wait_cpld_txready(struct comedi_device *dev)
+static int db2k_wait_cpld_txready(struct comedi_device *dev)
 {
        int i;
 
@@ -503,13 +495,12 @@ static int daqboard2000_wait_cpld_txready(struct comedi_device *dev)
        return -ETIMEDOUT;
 }
 
-static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data,
-                                  bool new_cpld)
+static int db2k_write_cpld(struct comedi_device *dev, u16 data, bool new_cpld)
 {
        int result = 0;
 
        if (new_cpld) {
-               result = daqboard2000_wait_cpld_txready(dev);
+               result = db2k_wait_cpld_txready(dev);
                if (result)
                        return result;
        } else {
@@ -522,9 +513,9 @@ static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data,
        return result;
 }
 
-static int daqboard2000_wait_fpga_programmed(struct comedi_device *dev)
+static int db2k_wait_fpga_programmed(struct comedi_device *dev)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
        int i;
 
        /* Time out after 200 tries -> 20ms */
@@ -539,11 +530,10 @@ static int daqboard2000_wait_fpga_programmed(struct comedi_device *dev)
        return -ETIMEDOUT;
 }
 
-static int daqboard2000_load_firmware(struct comedi_device *dev,
-                                     const u8 *cpld_array, size_t len,
-                                     unsigned long context)
+static int db2k_load_firmware(struct comedi_device *dev, const u8 *cpld_array,
+                             size_t len, unsigned long context)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
        int result = -EIO;
        u32 cntrl;
        int retry;
@@ -576,10 +566,10 @@ static int daqboard2000_load_firmware(struct comedi_device *dev,
                return -EIO;
 
        for (retry = 0; retry < 3; retry++) {
-               daqboard2000_reset_local_bus(dev);
-               daqboard2000_reload_plx(dev);
-               daqboard2000_pulse_prog_pin(dev);
-               result = daqboard2000_wait_cpld_init(dev);
+               db2k_reset_local_bus(dev);
+               db2k_reload_plx(dev);
+               db2k_pulse_prog_pin(dev);
+               result = db2k_wait_cpld_init(dev);
                if (result)
                        continue;
 
@@ -588,26 +578,26 @@ static int daqboard2000_load_firmware(struct comedi_device *dev,
                for (; i < len; i += 2) {
                        u16 data = (cpld_array[i] << 8) + cpld_array[i + 1];
 
-                       result = daqboard2000_write_cpld(dev, data, new_cpld);
+                       result = db2k_write_cpld(dev, data, new_cpld);
                        if (result)
                                break;
                }
                if (result == 0)
-                       result = daqboard2000_wait_fpga_programmed(dev);
+                       result = db2k_wait_fpga_programmed(dev);
                if (result == 0) {
-                       daqboard2000_reset_local_bus(dev);
-                       daqboard2000_reload_plx(dev);
+                       db2k_reset_local_bus(dev);
+                       db2k_reload_plx(dev);
                        break;
                }
        }
        return result;
 }
 
-static void daqboard2000_adc_stop_dma_transfer(struct comedi_device *dev)
+static void db2k_adc_stop_dma_transfer(struct comedi_device *dev)
 {
 }
 
-static void daqboard2000_adc_disarm(struct comedi_device *dev)
+static void db2k_adc_disarm(struct comedi_device *dev)
 {
        /* Disable hardware triggers */
        udelay(2);
@@ -628,10 +618,10 @@ static void daqboard2000_adc_disarm(struct comedi_device *dev)
               dev->mmio + DB2K_REG_ACQ_CONTROL);
 
        /* Stop the input dma (abort channel 1) */
-       daqboard2000_adc_stop_dma_transfer(dev);
+       db2k_adc_stop_dma_transfer(dev);
 }
 
-static void daqboard2000_activate_reference_dacs(struct comedi_device *dev)
+static void db2k_activate_reference_dacs(struct comedi_device *dev)
 {
        unsigned int val;
        int timeout;
@@ -657,34 +647,33 @@ static void daqboard2000_activate_reference_dacs(struct comedi_device *dev)
        }
 }
 
-static void daqboard2000_initialize_ctrs(struct comedi_device *dev)
+static void db2k_initialize_ctrs(struct comedi_device *dev)
 {
 }
 
-static void daqboard2000_initialize_tmrs(struct comedi_device *dev)
+static void db2k_initialize_tmrs(struct comedi_device *dev)
 {
 }
 
-static void daqboard2000_dac_disarm(struct comedi_device *dev)
+static void db2k_dac_disarm(struct comedi_device *dev)
 {
 }
 
-static void daqboard2000_initialize_adc(struct comedi_device *dev)
+static void db2k_initialize_adc(struct comedi_device *dev)
 {
-       daqboard2000_adc_disarm(dev);
-       daqboard2000_activate_reference_dacs(dev);
-       daqboard2000_initialize_ctrs(dev);
-       daqboard2000_initialize_tmrs(dev);
+       db2k_adc_disarm(dev);
+       db2k_activate_reference_dacs(dev);
+       db2k_initialize_ctrs(dev);
+       db2k_initialize_tmrs(dev);
 }
 
-static void daqboard2000_initialize_dac(struct comedi_device *dev)
+static void db2k_initialize_dac(struct comedi_device *dev)
 {
-       daqboard2000_dac_disarm(dev);
+       db2k_dac_disarm(dev);
 }
 
-static int daqboard2000_8255_cb(struct comedi_device *dev,
-                               int dir, int port, int data,
-                               unsigned long iobase)
+static int db2k_8255_cb(struct comedi_device *dev, int dir, int port, int data,
+                       unsigned long iobase)
 {
        if (dir) {
                writew(data, dev->mmio + iobase + port * 2);
@@ -693,33 +682,33 @@ static int daqboard2000_8255_cb(struct comedi_device *dev,
        return readw(dev->mmio + iobase + port * 2);
 }
 
-static const void *daqboard2000_find_boardinfo(struct comedi_device *dev,
-                                              struct pci_dev *pcidev)
+static const void *db2k_find_boardinfo(struct comedi_device *dev,
+                                      struct pci_dev *pcidev)
 {
-       const struct daq200_boardtype *board;
+       const struct db2k_boardtype *board;
        int i;
 
        if (pcidev->subsystem_vendor != PCI_VENDOR_ID_IOTECH)
                return NULL;
 
-       for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
-               board = &boardtypes[i];
+       for (i = 0; i < ARRAY_SIZE(db2k_boardtypes); i++) {
+               board = &db2k_boardtypes[i];
                if (pcidev->subsystem_device == board->id)
                        return board;
        }
        return NULL;
 }
 
-static int daqboard2000_auto_attach(struct comedi_device *dev,
-                                   unsigned long context_unused)
+static int db2k_auto_attach(struct comedi_device *dev,
+                           unsigned long context_unused)
 {
        struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-       const struct daq200_boardtype *board;
-       struct daqboard2000_private *devpriv;
+       const struct db2k_boardtype *board;
+       struct db2k_private *devpriv;
        struct comedi_subdevice *s;
        int result;
 
-       board = daqboard2000_find_boardinfo(dev, pcidev);
+       board = db2k_find_boardinfo(dev, pcidev);
        if (!board)
                return -ENODEV;
        dev->board_ptr = board;
@@ -743,13 +732,12 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
                return result;
 
        result = comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev,
-                                     DAQBOARD2000_FIRMWARE,
-                                     daqboard2000_load_firmware, 0);
+                                     DB2K_FIRMWARE, db2k_load_firmware, 0);
        if (result < 0)
                return result;
 
-       daqboard2000_initialize_adc(dev);
-       daqboard2000_initialize_dac(dev);
+       db2k_initialize_adc(dev);
+       db2k_initialize_dac(dev);
 
        s = &dev->subdevices[0];
        /* ai subdevice */
@@ -757,8 +745,8 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
        s->subdev_flags = SDF_READABLE | SDF_GROUND;
        s->n_chan = 24;
        s->maxdata = 0xffff;
-       s->insn_read = daqboard2000_ai_insn_read;
-       s->range_table = &range_daqboard2000_ai;
+       s->insn_read = db2k_ai_insn_read;
+       s->range_table = &db2k_ai_range;
 
        s = &dev->subdevices[1];
        /* ao subdevice */
@@ -766,7 +754,7 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
        s->subdev_flags = SDF_WRITABLE;
        s->n_chan = 2;
        s->maxdata = 0xffff;
-       s->insn_write = daqboard2000_ao_insn_write;
+       s->insn_write = db2k_ao_insn_write;
        s->range_table = &range_bipolar10;
 
        result = comedi_alloc_subdev_readback(s);
@@ -774,48 +762,46 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
                return result;
 
        s = &dev->subdevices[2];
-       return subdev_8255_init(dev, s, daqboard2000_8255_cb,
+       return subdev_8255_init(dev, s, db2k_8255_cb,
                                DB2K_REG_DIO_P2_EXP_IO_8_BIT);
 }
 
-static void daqboard2000_detach(struct comedi_device *dev)
+static void db2k_detach(struct comedi_device *dev)
 {
-       struct daqboard2000_private *devpriv = dev->private;
+       struct db2k_private *devpriv = dev->private;
 
        if (devpriv && devpriv->plx)
                iounmap(devpriv->plx);
        comedi_pci_detach(dev);
 }
 
-static struct comedi_driver daqboard2000_driver = {
+static struct comedi_driver db2k_driver = {
        .driver_name    = "daqboard2000",
        .module         = THIS_MODULE,
-       .auto_attach    = daqboard2000_auto_attach,
-       .detach         = daqboard2000_detach,
+       .auto_attach    = db2k_auto_attach,
+       .detach         = db2k_detach,
 };
 
-static int daqboard2000_pci_probe(struct pci_dev *dev,
-                                 const struct pci_device_id *id)
+static int db2k_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       return comedi_pci_auto_config(dev, &daqboard2000_driver,
-                                     id->driver_data);
+       return comedi_pci_auto_config(dev, &db2k_driver, id->driver_data);
 }
 
-static const struct pci_device_id daqboard2000_pci_table[] = {
+static const struct pci_device_id db2k_pci_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_IOTECH, 0x0409) },
        { 0 }
 };
-MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table);
+MODULE_DEVICE_TABLE(pci, db2k_pci_table);
 
-static struct pci_driver daqboard2000_pci_driver = {
+static struct pci_driver db2k_pci_driver = {
        .name           = "daqboard2000",
-       .id_table       = daqboard2000_pci_table,
-       .probe          = daqboard2000_pci_probe,
+       .id_table       = db2k_pci_table,
+       .probe          = db2k_pci_probe,
        .remove         = comedi_pci_auto_unconfig,
 };
-module_comedi_pci_driver(daqboard2000_driver, daqboard2000_pci_driver);
+module_comedi_pci_driver(db2k_driver, db2k_pci_driver);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org");
 MODULE_DESCRIPTION("Comedi low-level driver");
 MODULE_LICENSE("GPL");
-MODULE_FIRMWARE(DAQBOARD2000_FIRMWARE);
+MODULE_FIRMWARE(DB2K_FIRMWARE);