From 01833a7205115fda585b76af037375dfa4821831 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Jul 2007 19:47:58 +0000 Subject: [PATCH] Constified ranges, board structures, and miscellaneous data. --- comedi/comedi_fops.c | 2 +- comedi/comedi_fops.h | 2 +- comedi/drivers/acl7225b.c | 4 +-- comedi/drivers/adl_pci6208.c | 6 ++--- comedi/drivers/adl_pci7296.c | 4 +-- comedi/drivers/adl_pci7432.c | 4 +-- comedi/drivers/adl_pci8164.c | 4 +-- comedi/drivers/adl_pci9111.c | 10 ++++---- comedi/drivers/adl_pci9118.c | 10 ++++---- comedi/drivers/adv_pci1710.c | 28 ++++++++++---------- comedi/drivers/adv_pci_dio.c | 20 +++++++-------- comedi/drivers/aio_aio12_8.c | 6 ++--- comedi/drivers/aio_iiro_16.c | 4 +-- comedi/drivers/amplc_dio200.c | 10 ++++---- comedi/drivers/amplc_pc236.c | 6 ++--- comedi/drivers/amplc_pc263.c | 6 ++--- comedi/drivers/amplc_pci224.c | 30 ++++++++++++---------- comedi/drivers/amplc_pci230.c | 8 +++--- comedi/drivers/cb_das16_cs.c | 8 +++--- comedi/drivers/cb_pcidas.c | 14 +++++----- comedi/drivers/cb_pcidas64.c | 36 +++++++++++++------------- comedi/drivers/cb_pcidda.c | 10 ++++---- comedi/drivers/cb_pcimdas.c | 8 +++--- comedi/drivers/cb_pcimdda.c | 6 ++--- comedi/drivers/comedi_bond.c | 4 +-- comedi/drivers/comedi_test.c | 10 ++++---- comedi/drivers/contec_pci_dio.c | 6 ++--- comedi/drivers/daqboard2000.c | 10 ++++---- comedi/drivers/das08.c | 20 +++++++-------- comedi/drivers/das08.h | 2 +- comedi/drivers/das08_cs.c | 6 ++--- comedi/drivers/das16.c | 26 +++++++++---------- comedi/drivers/das16m1.c | 6 ++--- comedi/drivers/das1800.c | 14 +++++----- comedi/drivers/das800.c | 16 ++++++------ comedi/drivers/dmm32at.c | 14 +++++----- comedi/drivers/dt2801.c | 22 ++++++++-------- comedi/drivers/dt2811.c | 28 ++++++++++---------- comedi/drivers/dt2815.c | 8 +++--- comedi/drivers/dt282x.c | 30 +++++++++++----------- comedi/drivers/dt3000.c | 12 ++++----- comedi/drivers/dt9812.c | 8 +++--- comedi/drivers/fl512.c | 2 +- comedi/drivers/icp_multi.c | 14 +++++----- comedi/drivers/ii_pci20kc.c | 16 ++++++------ comedi/drivers/jr3_pci.c | 2 +- comedi/drivers/ke_counter.c | 4 +-- comedi/drivers/me4000.c | 6 ++--- comedi/drivers/me4000.h | 2 +- comedi/drivers/me_daq.c | 12 ++++----- comedi/drivers/mite.c | 12 ++++----- comedi/drivers/mpc624.c | 4 +-- comedi/drivers/ni_6527.c | 6 ++--- comedi/drivers/ni_65xx.c | 2 +- comedi/drivers/ni_660x.c | 4 +-- comedi/drivers/ni_670x.c | 15 +++++++---- comedi/drivers/ni_at_a2150.c | 8 +++--- comedi/drivers/ni_at_ao.c | 2 +- comedi/drivers/ni_atmio.c | 4 +-- comedi/drivers/ni_atmio16d.c | 12 ++++----- comedi/drivers/ni_daq_dio24.c | 6 ++--- comedi/drivers/ni_labpc.c | 18 ++++++------- comedi/drivers/ni_labpc.h | 8 +++--- comedi/drivers/ni_labpc_cs.c | 6 ++--- comedi/drivers/ni_mio_common.c | 33 ++++++++++++------------ comedi/drivers/ni_mio_cs.c | 4 +-- comedi/drivers/ni_pcidio.c | 8 +++--- comedi/drivers/ni_pcimio.c | 8 +++--- comedi/drivers/ni_stc.h | 5 ++-- comedi/drivers/pcl711.c | 14 +++++----- comedi/drivers/pcl724.c | 4 +-- comedi/drivers/pcl726.c | 18 ++++++------- comedi/drivers/pcl730.c | 4 +-- comedi/drivers/pcl812.c | 44 ++++++++++++++++---------------- comedi/drivers/pcl816.c | 10 ++++---- comedi/drivers/pcl818.c | 26 +++++++++---------- comedi/drivers/pcm3724.c | 4 +-- comedi/drivers/pcmad.c | 4 +-- comedi/drivers/pcmda12.c | 8 +++--- comedi/drivers/pcmmio.c | 24 ++++++++--------- comedi/drivers/pcmuio.c | 6 ++--- comedi/drivers/poc.c | 6 ++--- comedi/drivers/quatech_daqp_cs.c | 6 ++--- comedi/drivers/rtd520.c | 10 ++++---- comedi/drivers/rti800.c | 14 +++++----- comedi/drivers/rti802.c | 2 +- comedi/drivers/s526.c | 4 +-- comedi/drivers/s626.c | 8 +++--- comedi/drivers/serial2002.c | 15 ++++++----- comedi/drivers/skel.c | 4 +-- comedi/drivers/ssv_dnp.c | 4 +-- comedi/drivers/usbdux.c | 4 +-- comedi/drivers/usbduxfast.c | 2 +- comedi/kcomedilib/get.c | 2 +- comedi/range.c | 14 +++++----- include/linux/comedidev.h | 20 +++++++-------- 96 files changed, 499 insertions(+), 493 deletions(-) diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 646bd459..d82ef211 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -1704,7 +1704,7 @@ static int comedi_fasync (int fd, struct file *file, int on) } -struct file_operations comedi_fops={ +const struct file_operations comedi_fops={ owner : THIS_MODULE, llseek : comedi_lseek, ioctl : comedi_ioctl, diff --git a/comedi/comedi_fops.h b/comedi/comedi_fops.h index 987cc3c6..baf9bc57 100644 --- a/comedi/comedi_fops.h +++ b/comedi/comedi_fops.h @@ -3,6 +3,6 @@ #define _COMEDI_FOPS_H extern struct class *comedi_class; -extern struct file_operations comedi_fops; +extern const struct file_operations comedi_fops; #endif //_COMEDI_FOPS_H diff --git a/comedi/drivers/acl7225b.c b/comedi/drivers/acl7225b.c index 3cdb48f0..9226749c 100644 --- a/comedi/drivers/acl7225b.c +++ b/comedi/drivers/acl7225b.c @@ -29,13 +29,13 @@ typedef struct { int io_range; // len of I/O space } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { { "acl7225b", ACL7225_SIZE, }, { "p16r16dio", P16R16DIO_SIZE, }, }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_acl7225b = { driver_name: "acl7225b", diff --git a/comedi/drivers/adl_pci6208.c b/comedi/drivers/adl_pci6208.c index 5b083095..aa460fe5 100644 --- a/comedi/drivers/adl_pci6208.c +++ b/comedi/drivers/adl_pci6208.c @@ -58,12 +58,12 @@ References: /* Board descriptions */ typedef struct { - char *name; + const char *name; unsigned short dev_id; /* `lspci` will show you this */ int ao_chans; //int ao_bits; } pci6208_board; -static pci6208_board pci6208_boards[] = { +static const pci6208_board pci6208_boards[] = { /*{ name : "pci6208v", dev_id : 0x6208, //not sure @@ -95,7 +95,7 @@ static struct pci_device_id pci6208_pci_table[] __devinitdata = { MODULE_DEVICE_TABLE(pci, pci6208_pci_table); /* Will be initialized in pci6208_find device(). */ -#define thisboard ((pci6208_board *)dev->board_ptr) +#define thisboard ((const pci6208_board *)dev->board_ptr) typedef struct{ int data; diff --git a/comedi/drivers/adl_pci7296.c b/comedi/drivers/adl_pci7296.c index 8301c283..488a6006 100644 --- a/comedi/drivers/adl_pci7296.c +++ b/comedi/drivers/adl_pci7296.c @@ -53,7 +53,7 @@ typedef struct skel_board_struct{ int device_id; }adl_pci7296_board; -static adl_pci7296_board adl_pci7296_boards[] = { +static const adl_pci7296_board adl_pci7296_boards[] = { { "pci7296", PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296 }, }; @@ -63,7 +63,7 @@ static struct pci_device_id adl_pci7296_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table); -#define thisboard ((adl_pci7296_board *)dev->board_ptr) +#define thisboard ((const adl_pci7296_board *)dev->board_ptr) typedef struct{ int data; diff --git a/comedi/drivers/adl_pci7432.c b/comedi/drivers/adl_pci7432.c index 65291f10..7fcdd5fb 100644 --- a/comedi/drivers/adl_pci7432.c +++ b/comedi/drivers/adl_pci7432.c @@ -45,7 +45,7 @@ typedef struct { int device_id; } adl_pci7432_board; -static adl_pci7432_board adl_pci7432_boards[] = { +static const adl_pci7432_board adl_pci7432_boards[] = { { "pci7432", PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432 }, }; @@ -55,7 +55,7 @@ static struct pci_device_id adl_pci7432_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table); -#define thisboard ((adl_pci7432_board *)dev->board_ptr) +#define thisboard ((const adl_pci7432_board *)dev->board_ptr) typedef struct{ int data; diff --git a/comedi/drivers/adl_pci8164.c b/comedi/drivers/adl_pci8164.c index b0bf682d..0ff2a77c 100644 --- a/comedi/drivers/adl_pci8164.c +++ b/comedi/drivers/adl_pci8164.c @@ -57,7 +57,7 @@ typedef struct { int device_id; } adl_pci8164_board; -static adl_pci8164_board adl_pci8164_boards[] = { +static const adl_pci8164_board adl_pci8164_boards[] = { { "pci8164", PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164 }, }; @@ -67,7 +67,7 @@ static struct pci_device_id adl_pci8164_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table); -#define thisboard ((adl_pci8164_board *)dev->board_ptr) +#define thisboard ((const adl_pci8164_board *)dev->board_ptr) typedef struct{ int data; diff --git a/comedi/drivers/adl_pci9111.c b/comedi/drivers/adl_pci9111.c index dedc8560..a3de23d6 100644 --- a/comedi/drivers/adl_pci9111.c +++ b/comedi/drivers/adl_pci9111.c @@ -270,7 +270,7 @@ static int pci9111_detach (comedi_device *dev); static void pci9111_ai_munge(comedi_device *dev, comedi_subdevice *s, void *data, unsigned int num_bytes, unsigned int start_chan_index ); -static comedi_lrange pci9111_hr_ai_range= +static const comedi_lrange pci9111_hr_ai_range= { 5, { @@ -302,13 +302,13 @@ typedef struct { int ai_resolution_mask; int ao_resolution; // resolution of D/A int ao_resolution_mask; - comedi_lrange *ai_range_list; // rangelist for A/D - comedi_lrange *ao_range_list; // rangelist for D/A + const comedi_lrange *ai_range_list; // rangelist for A/D + const comedi_lrange *ao_range_list; // rangelist for D/A unsigned int ai_acquisition_period_min_ns; } pci9111_board_struct; -static pci9111_board_struct pci9111_boards[] = +static const pci9111_board_struct pci9111_boards[] = { { name: "pci9111_hr", @@ -1253,7 +1253,7 @@ static int pci9111_attach(comedi_device *dev,comedi_devconfig *it) unsigned long io_base, io_range, lcr_io_base, lcr_io_range; struct pci_dev* pci_device; int error,i; - pci9111_board_struct* board; + const pci9111_board_struct* board; if(alloc_private(dev, sizeof(pci9111_private_data_struct)) < 0) { diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index ce277346..61e8e42d 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -152,7 +152,7 @@ Configuration options: #define EXTTRG_AI 0 /* ext trg is used by AI */ -static comedi_lrange range_pci9118dg_hr={ 8, { +static const comedi_lrange range_pci9118dg_hr={ 8, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), @@ -164,7 +164,7 @@ static comedi_lrange range_pci9118dg_hr={ 8, { } }; -static comedi_lrange range_pci9118hg={ 8, { +static const comedi_lrange range_pci9118hg={ 8, { BIP_RANGE(5), BIP_RANGE(0.5), BIP_RANGE(0.05), @@ -194,8 +194,8 @@ typedef struct { int n_aochan; // num of D/A chans int ai_maxdata; // resolution of A/D int ao_maxdata; // resolution of D/A - comedi_lrange *rangelist_ai; // rangelist for A/D - comedi_lrange *rangelist_ao; // rangelist for D/A + const comedi_lrange *rangelist_ai; // rangelist for A/D + const comedi_lrange *rangelist_ao; // rangelist for D/A unsigned int ai_ns_min; // max sample speed of card v ns unsigned int ai_pacer_min; // minimal pacer value (c1*c2 or c1 in burst) int half_fifo_size; // size of FIFO/2 @@ -208,7 +208,7 @@ static struct pci_device_id pci9118_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, pci9118_pci_table); -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pci9118dg", PCI_VENDOR_ID_AMCC, 0x80d9, AMCC_OP_REG_SIZE, IORANGE_9118, diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index a46a499a..29b2e600 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -121,7 +121,7 @@ Configuration options: #define Syncont_SC0 1 /* set synchronous output mode */ -static comedi_lrange range_pci1710_3={ 9, { +static const comedi_lrange range_pci1710_3={ 9, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), @@ -134,9 +134,9 @@ static comedi_lrange range_pci1710_3={ 9, { } }; -static char range_codes_pci1710_3[]={0x00, 0x01, 0x02, 0x03, 0x04, 0x10, 0x11, 0x12, 0x13 }; +static const char range_codes_pci1710_3[]={0x00, 0x01, 0x02, 0x03, 0x04, 0x10, 0x11, 0x12, 0x13 }; -static comedi_lrange range_pci1710hg={ 12, { +static const comedi_lrange range_pci1710hg={ 12, { BIP_RANGE(5), BIP_RANGE(0.5), BIP_RANGE(0.05), @@ -152,9 +152,9 @@ static comedi_lrange range_pci1710hg={ 12, { } }; -static char range_codes_pci1710hg[]={0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13 }; +static const char range_codes_pci1710hg[]={0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13 }; -static comedi_lrange range_pci17x1={ 5, { +static const comedi_lrange range_pci17x1={ 5, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -163,9 +163,9 @@ static comedi_lrange range_pci17x1={ 5, { } }; -static char range_codes_pci17x1[]={0x00, 0x01, 0x02, 0x03, 0x04 }; +static const char range_codes_pci17x1[]={0x00, 0x01, 0x02, 0x03, 0x04 }; -static comedi_lrange range_pci1720={ 4, { +static const comedi_lrange range_pci1720={ 4, { UNI_RANGE(5), UNI_RANGE(10), BIP_RANGE(5), @@ -173,7 +173,7 @@ static comedi_lrange range_pci1720={ 4, { } }; -static comedi_lrange range_pci171x_da={ 2, { +static const comedi_lrange range_pci171x_da={ 2, { UNI_RANGE(5), UNI_RANGE(10), } @@ -196,9 +196,9 @@ typedef struct { int n_counter; // num of counters int ai_maxdata; // resolution of A/D int ao_maxdata; // resolution of D/A - comedi_lrange *rangelist_ai; // rangelist for A/D - char *rangecode_ai; // range codes for programming - comedi_lrange *rangelist_ao; // rangelist for D/A + const comedi_lrange *rangelist_ai; // rangelist for A/D + const char *rangecode_ai; // range codes for programming + const comedi_lrange *rangelist_ao; // rangelist for D/A unsigned int ai_ns_min; // max sample speed of card v ns unsigned int fifo_half_size; // size of FIFO/2 } boardtype; @@ -213,7 +213,7 @@ static struct pci_device_id pci1710_pci_table[] = __devinitdata { }; MODULE_DEVICE_TABLE(pci, pci1710_pci_table); -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pci1710", 0x1710, IORANGE_171x, 1, TYPE_PCI171X, @@ -291,7 +291,7 @@ typedef struct{ } pci1710_private; #define devpriv ((pci1710_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) /* ============================================================================== @@ -304,7 +304,7 @@ static void start_pacer(comedi_device * dev, int mode, unsigned int divisor1, un static int pci1710_reset(comedi_device *dev); static int pci171x_ai_cancel(comedi_device * dev, comedi_subdevice * s); -static unsigned int muxonechan[] ={ 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707, // used for gain list programming +static const unsigned int muxonechan[] ={ 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707, // used for gain list programming 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f}; diff --git a/comedi/drivers/adv_pci_dio.c b/comedi/drivers/adv_pci_dio.c index 9c9f1e49..aa8bb028 100644 --- a/comedi/drivers/adv_pci_dio.c +++ b/comedi/drivers/adv_pci_dio.c @@ -213,7 +213,7 @@ static struct pci_device_id pci_dio_pci_table[] = __devinitdata { }; MODULE_DEVICE_TABLE(pci, pci_dio_pci_table); -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pci1730", PCI_VENDOR_ID_ADVANTECH, 0x1730, PCIDIO_MAINREG, TYPE_PCI1730, @@ -348,7 +348,7 @@ struct pci_dio_private_st { static pci_dio_private *pci_priv=NULL; /* list of allocated cards */ #define devpriv ((pci_dio_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) /* ============================================================================== @@ -356,7 +356,7 @@ static pci_dio_private *pci_priv=NULL; /* list of allocated cards */ static int pci_dio_insn_bits_di_b(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data) { - diosubd_data *d=(diosubd_data *)s->private; + const diosubd_data *d=(const diosubd_data *)s->private; int i; data[1]=0; @@ -373,7 +373,7 @@ static int pci_dio_insn_bits_di_b(comedi_device *dev, comedi_subdevice *s, static int pci_dio_insn_bits_di_w(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data) { - diosubd_data *d=(diosubd_data *)s->private; + const diosubd_data *d=(const diosubd_data *)s->private; int i; data[1]=0; @@ -389,7 +389,7 @@ static int pci_dio_insn_bits_di_w(comedi_device *dev, comedi_subdevice *s, static int pci_dio_insn_bits_do_b(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data) { - diosubd_data *d=(diosubd_data *)s->private; + const diosubd_data *d=(const diosubd_data *)s->private; int i; if (data[0]) { @@ -409,7 +409,7 @@ static int pci_dio_insn_bits_do_b(comedi_device *dev, comedi_subdevice *s, static int pci_dio_insn_bits_do_w(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { - diosubd_data *d=(diosubd_data *)s->private; + const diosubd_data *d=(const diosubd_data *)s->private; int i; if (data[0]) { @@ -785,7 +785,7 @@ static int pci1760_attach(comedi_device *dev, comedi_devconfig *it) ============================================================================== */ static int pci_dio_add_di(comedi_device *dev, comedi_subdevice *s, - diosubd_data *d, int subdev) + const diosubd_data *d, int subdev) { s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE|SDF_GROUND|SDF_COMMON|d->specflags; @@ -802,7 +802,7 @@ static int pci_dio_add_di(comedi_device *dev, comedi_subdevice *s, s->insn_bits=pci_dio_insn_bits_di_w; break; } - s->private=d; + s->private=(void *)d; return 0; } @@ -811,7 +811,7 @@ static int pci_dio_add_di(comedi_device *dev, comedi_subdevice *s, ============================================================================== */ static int pci_dio_add_do(comedi_device *dev, comedi_subdevice *s, - diosubd_data *d, int subdev) + const diosubd_data *d, int subdev) { s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE|SDF_GROUND|SDF_COMMON; @@ -829,7 +829,7 @@ static int pci_dio_add_do(comedi_device *dev, comedi_subdevice *s, s->insn_bits=pci_dio_insn_bits_do_w; break; } - s->private=d; + s->private=(void *)d; return 0; } diff --git a/comedi/drivers/aio_aio12_8.c b/comedi/drivers/aio_aio12_8.c index 34573c8f..725fb5a9 100644 --- a/comedi/drivers/aio_aio12_8.c +++ b/comedi/drivers/aio_aio12_8.c @@ -76,14 +76,14 @@ typedef struct const char *name; } board_type; -static board_type board_types[] = +static const board_type board_types[] = { { name: "aio_aio12_8" }, }; -#define thisboard ((board_type *) dev->board_ptr) +#define thisboard ((const board_type *) dev->board_ptr) typedef struct { @@ -160,7 +160,7 @@ static int aio_aio12_8_ao_write (comedi_device *dev, comedi_subdevice *s, return insn->n; } -static comedi_lrange range_aio_aio12_8 = +static const comedi_lrange range_aio_aio12_8 = { 4, { diff --git a/comedi/drivers/aio_iiro_16.c b/comedi/drivers/aio_iiro_16.c index 6ea8d210..fce8cc3c 100644 --- a/comedi/drivers/aio_iiro_16.c +++ b/comedi/drivers/aio_iiro_16.c @@ -50,7 +50,7 @@ typedef struct aio_iiro_16_board_struct int di; } aio_iiro_16_board; -static aio_iiro_16_board aio_iiro_16_boards[] = +static const aio_iiro_16_board aio_iiro_16_boards[] = { { name: "aio_iiro_16", @@ -59,7 +59,7 @@ static aio_iiro_16_board aio_iiro_16_boards[] = }, }; -#define thisboard ((aio_iiro_16_board *) dev->board_ptr) +#define thisboard ((const aio_iiro_16_board *) dev->board_ptr) typedef struct { diff --git a/comedi/drivers/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index 54998a20..bd1f046d 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -286,7 +286,7 @@ typedef struct dio200_board_struct { enum dio200_layout layout; } dio200_board; -static dio200_board dio200_boards[] = { +static const dio200_board dio200_boards[] = { { name: "pc212e", bustype: isa_bustype, @@ -349,7 +349,7 @@ typedef struct dio200_layout_struct { char has_clk_gat_sce; /* has clock/gate selection registers */ } dio200_layout; -static dio200_layout dio200_layouts[] = { +static const dio200_layout dio200_layouts[] = { [pc212_layout] = { n_subdevs: 6, sdtype: { sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, sd_intr }, @@ -403,7 +403,7 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((dio200_board *)dev->board_ptr) +#define thisboard ((const dio200_board *)dev->board_ptr) #define thislayout (&dio200_layouts[((dio200_board *)dev->board_ptr)->layout]) /* this structure is for data unique to this hardware driver. If @@ -1208,7 +1208,7 @@ dio200_attach(comedi_device *dev,comedi_devconfig *it) unsigned long iobase = 0; unsigned int irq = 0; int bus = 0, slot = 0; - dio200_layout *layout; + const dio200_layout *layout; int share_irq = 0; int sdx; unsigned n; @@ -1365,7 +1365,7 @@ dio200_attach(comedi_device *dev,comedi_devconfig *it) static int dio200_detach(comedi_device *dev) { - dio200_layout *layout; + const dio200_layout *layout; unsigned n; printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index d21c010e..f76edb65 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -98,11 +98,11 @@ enum pc236_model {pc36at_model, pci236_model}; typedef struct pc236_board_struct{ const char *name; - char *fancy_name; + const char *fancy_name; enum pc236_bustype bustype; enum pc236_model model; }pc236_board; -static pc236_board pc236_boards[] = { +static const pc236_board pc236_boards[] = { { name: "pc36at", fancy_name: "PC36AT", @@ -126,7 +126,7 @@ MODULE_DEVICE_TABLE(pci, pc236_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((pc236_board *)dev->board_ptr) +#define thisboard ((const pc236_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 3f932eb1..7a525307 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -68,11 +68,11 @@ enum pc263_model {pc263_model, pci263_model}; typedef struct pc263_board_struct{ const char *name; - char *fancy_name; + const char *fancy_name; enum pc263_bustype bustype; enum pc263_model model; }pc263_board; -static pc263_board pc263_boards[] = { +static const pc263_board pc263_boards[] = { { name: "pc263", fancy_name: "PC263", @@ -96,7 +96,7 @@ MODULE_DEVICE_TABLE(pci, pc263_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((pc263_board *)dev->board_ptr) +#define thisboard ((const pc263_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/amplc_pci224.c b/comedi/drivers/amplc_pci224.c index 696b7481..62d9c652 100644 --- a/comedi/drivers/amplc_pci224.c +++ b/comedi/drivers/amplc_pci224.c @@ -272,7 +272,7 @@ Caveats: */ /* The software selectable internal ranges for PCI224 (option[2] == 0). */ -static comedi_lrange range_pci224_internal = { +static const comedi_lrange range_pci224_internal = { 8, { BIP_RANGE(10), @@ -286,7 +286,7 @@ static comedi_lrange range_pci224_internal = { } }; -static unsigned short hwrange_pci224_internal[8] = { +static const unsigned short hwrange_pci224_internal[8] = { PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_10, PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_5, PCI224_DACCON_POLAR_BI | PCI224_DACCON_VREF_2_5, @@ -298,7 +298,7 @@ static unsigned short hwrange_pci224_internal[8] = { }; /* The software selectable external ranges for PCI224 (option[2] == 1). */ -static comedi_lrange range_pci224_external = { +static const comedi_lrange range_pci224_external = { 2, { RANGE_ext(-1, 1), /* bipolar [-Vref,+Vref] */ @@ -306,14 +306,14 @@ static comedi_lrange range_pci224_external = { } }; -static unsigned short hwrange_pci224_external[2] = { +static const unsigned short hwrange_pci224_external[2] = { PCI224_DACCON_POLAR_BI, PCI224_DACCON_POLAR_UNI, }; /* The hardware selectable Vref*2 external range for PCI234 * (option[2] == 1, option[3+n] == 0). */ -static comedi_lrange range_pci234_ext2 = { +static const comedi_lrange range_pci234_ext2 = { 1, { RANGE_ext(-2, 2), @@ -322,7 +322,7 @@ static comedi_lrange range_pci234_ext2 = { /* The hardware selectable Vref external range for PCI234 * (option[2] == 1, option[3+n] == 1). */ -static comedi_lrange range_pci234_ext = { +static const comedi_lrange range_pci234_ext = { 1, { RANGE_ext(-1, 1), @@ -330,7 +330,7 @@ static comedi_lrange range_pci234_ext = { }; /* This serves for all the PCI234 ranges. */ -static unsigned short hwrange_pci234[1] = { +static const unsigned short hwrange_pci234[1] = { PCI224_DACCON_POLAR_BI, /* bipolar - hardware ignores it! */ }; @@ -348,7 +348,7 @@ typedef struct pci224_board_struct { unsigned int ao_bits; } pci224_board; -static pci224_board pci224_boards[] = { +static const pci224_board pci224_boards[] = { { name: "pci224", model: pci224_model, @@ -386,7 +386,7 @@ MODULE_DEVICE_TABLE(pci, pci224_pci_table); feel free to suggest moving the variable to the comedi_device struct. */ typedef struct { struct pci_dev *pci_dev; /* PCI device */ - unsigned short *hwrange; + const unsigned short *hwrange; unsigned long iobase1; spinlock_t ao_spinlock; lsampl_t *ao_readback; @@ -1419,7 +1419,9 @@ pci224_attach(comedi_device *dev,comedi_devconfig *it) /* Sort out channel range options. */ if (thisboard->model == pci234_model) { /* PCI234 range options. */ - s->range_table_list = kmalloc( + const comedi_lrange **range_table_list; + + s->range_table_list = range_table_list = kmalloc( sizeof(comedi_lrange *) * s->n_chan, GFP_KERNEL); if (!s->range_table_list) { @@ -1437,18 +1439,18 @@ pci224_attach(comedi_device *dev,comedi_devconfig *it) if (n < COMEDI_NDEVCONFOPTS - 3 && it->options[3+n] == 1) { if (it->options[2] == 1) { - s->range_table_list[n] = + range_table_list[n] = &range_pci234_ext; } else { - s->range_table_list[n] = + range_table_list[n] = &range_bipolar5; } } else { if (it->options[2] == 1) { - s->range_table_list[n] = + range_table_list[n] = &range_pci234_ext2; } else { - s->range_table_list[n] = + range_table_list[n] = &range_bipolar10; } } diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index 85b20f1b..c5f395f9 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -173,7 +173,7 @@ typedef struct pci230_board_struct{ int ao_bits; int have_dio; }pci230_board; -static pci230_board pci230_boards[] = { +static const pci230_board pci230_boards[] = { { name: "pci230", id: PCI_DEVICE_ID_PCI230, @@ -210,7 +210,7 @@ MODULE_DEVICE_TABLE(pci, pci230_pci_table); * Useful for shorthand access to the particular board structure */ #define n_pci230_boards (sizeof(pci230_boards)/sizeof(pci230_boards[0])) -#define thisboard ((pci230_board *)dev->board_ptr) +#define thisboard ((const pci230_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, @@ -239,7 +239,7 @@ struct pci230_private{ #define devpriv ((struct pci230_private *)dev->private) /* PCI230 analogue input range table */ -static comedi_lrange pci230_ai_range = { 7, { +static const comedi_lrange pci230_ai_range = { 7, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -250,7 +250,7 @@ static comedi_lrange pci230_ai_range = { 7, { }}; /* PCI230 analogue output range table */ -static comedi_lrange pci230_ao_range = { 2, { +static const comedi_lrange pci230_ao_range = { 2, { UNI_RANGE(10), BIP_RANGE(10) }}; diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index f70624c5..d16fe010 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -56,11 +56,11 @@ Status: experimental typedef struct das16cs_board_struct{ - char *name; + const char *name; int device_id; int n_ao_chans; }das16cs_board; -static das16cs_board das16cs_boards[] = { +static const das16cs_board das16cs_boards[] = { { device_id: 0x0000, /* unknown */ name: "PC-CARD DAS16/16", @@ -73,7 +73,7 @@ static das16cs_board das16cs_boards[] = { }, }; #define n_boards (sizeof(das16cs_boards)/sizeof(das16cs_boards[0])) -#define thisboard ((das16cs_board *)dev->board_ptr) +#define thisboard ((const das16cs_board *)dev->board_ptr) typedef struct{ dev_link_t *link; @@ -95,7 +95,7 @@ static comedi_driver driver_das16cs={ static dev_link_t *dev_list = NULL; -static comedi_lrange das16cs_ai_range = { 4, { +static const comedi_lrange das16cs_ai_range = { 4, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index d0e7ba4e..4db26d62 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -196,7 +196,7 @@ static inline unsigned int DAC_DATA_REG( unsigned int channel ) // bit in hexadecimal representation of range index that indicates unipolar input range #define IS_UNIPOLAR 0x4 // analog input ranges for most boards -static comedi_lrange cb_pcidas_ranges = +static const comedi_lrange cb_pcidas_ranges = { 8, { @@ -212,7 +212,7 @@ static comedi_lrange cb_pcidas_ranges = }; // pci-das1001 input ranges -static comedi_lrange cb_pcidas_alt_ranges = +static const comedi_lrange cb_pcidas_alt_ranges = { 8, { @@ -228,7 +228,7 @@ static comedi_lrange cb_pcidas_alt_ranges = }; // analog output ranges -static comedi_lrange cb_pcidas_ao_ranges = +static const comedi_lrange cb_pcidas_ao_ranges = { 4, { @@ -247,7 +247,7 @@ enum trimpot_model typedef struct cb_pcidas_board_struct { - char *name; + const char *name; unsigned short device_id; int ai_se_chans; // Inputs in single-ended mode int ai_diff_chans; // Inputs in differential mode @@ -257,12 +257,12 @@ typedef struct cb_pcidas_board_struct int has_ao_fifo; // analog output has fifo int ao_scan_speed; // analog output speed for 1602 series (for a scan, not conversion) int fifo_size; // number of samples fifo can hold - comedi_lrange *ranges; + const comedi_lrange *ranges; enum trimpot_model trimpot; unsigned has_dac08 : 1; } cb_pcidas_board; -static cb_pcidas_board cb_pcidas_boards[] = +static const cb_pcidas_board cb_pcidas_boards[] = { { name: "pci-das1602/16", @@ -398,7 +398,7 @@ MODULE_DEVICE_TABLE(pci, cb_pcidas_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((cb_pcidas_board *)dev->board_ptr) +#define thisboard ((const cb_pcidas_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index 5d02a75a..6bd77a5b 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -417,7 +417,7 @@ static inline uint8_t attenuate_bit( unsigned int channel ) }; // analog input ranges for 64xx boards -static comedi_lrange ai_ranges_64xx = +static const comedi_lrange ai_ranges_64xx = { 8, { @@ -433,7 +433,7 @@ static comedi_lrange ai_ranges_64xx = }; /* analog input ranges for 60xx boards */ -static comedi_lrange ai_ranges_60xx = +static const comedi_lrange ai_ranges_60xx = { 4, { @@ -445,7 +445,7 @@ static comedi_lrange ai_ranges_60xx = }; /* analog input ranges for 6030, etc boards */ -static comedi_lrange ai_ranges_6030 = +static const comedi_lrange ai_ranges_6030 = { 14, { @@ -467,7 +467,7 @@ static comedi_lrange ai_ranges_6030 = }; /* analog input ranges for 6052, etc boards */ -static comedi_lrange ai_ranges_6052 = +static const comedi_lrange ai_ranges_6052 = { 15, { @@ -490,7 +490,7 @@ static comedi_lrange ai_ranges_6052 = }; // analog input ranges for 4020 board -static comedi_lrange ai_ranges_4020 = +static const comedi_lrange ai_ranges_4020 = { 2, { @@ -500,7 +500,7 @@ static comedi_lrange ai_ranges_4020 = }; // analog output ranges -static comedi_lrange ao_ranges_64xx = +static const comedi_lrange ao_ranges_64xx = { 4, { @@ -510,7 +510,7 @@ static comedi_lrange ao_ranges_64xx = UNI_RANGE(10), } }; -static int ao_range_code_64xx[] = +static const int ao_range_code_64xx[] = { 0x0, 0x1, @@ -518,19 +518,19 @@ static int ao_range_code_64xx[] = 0x3, }; -static comedi_lrange ao_ranges_60xx = +static const comedi_lrange ao_ranges_60xx = { 1, { BIP_RANGE(10), } }; -static int ao_range_code_60xx[] = +static const int ao_range_code_60xx[] = { 0x0, }; -static comedi_lrange ao_ranges_6030 = +static const comedi_lrange ao_ranges_6030 = { 2, { @@ -538,13 +538,13 @@ static comedi_lrange ao_ranges_6030 = UNI_RANGE(10), } }; -static int ao_range_code_6030[] = +static const int ao_range_code_6030[] = { 0x0, 0x2, }; -static comedi_lrange ao_ranges_4020 = +static const comedi_lrange ao_ranges_4020 = { 2, { @@ -552,7 +552,7 @@ static comedi_lrange ao_ranges_4020 = BIP_RANGE(10), } }; -static int ao_range_code_4020[] = +static const int ao_range_code_4020[] = { 0x1, 0x0, @@ -575,17 +575,17 @@ typedef struct hw_fifo_info_struct typedef struct pcidas64_board_struct { - char *name; + const char *name; int device_id; // pci device id int ai_se_chans; // number of ai inputs in single-ended mode int ai_bits; // analog input resolution int ai_speed; // fastest conversion period in ns - comedi_lrange *ai_range_table; + const comedi_lrange *ai_range_table; int ao_nchan; // number of analog out channels int ao_bits; // analog output resolution int ao_scan_speed; // analog output speed (for a scan, not conversion) - comedi_lrange *ao_range_table; - int *ao_range_code; + const comedi_lrange *ao_range_table; + const int *ao_range_code; const hw_fifo_info_t *const ai_fifo; enum register_layout layout; // different board families have slightly different registers unsigned has_8255 : 1; @@ -1200,7 +1200,7 @@ COMEDI_INITCLEANUP(driver_cb_pcidas); static unsigned int ai_range_bits_6xxx( const comedi_device *dev, unsigned int range_index ) { - comedi_krange *range = &board( dev )->ai_range_table->range[ range_index ]; + const comedi_krange *range = &board( dev )->ai_range_table->range[ range_index ]; unsigned int bits = 0; switch( range->max ) diff --git a/comedi/drivers/cb_pcidda.c b/comedi/drivers/cb_pcidda.c index 665e819b..1bb45876 100644 --- a/comedi/drivers/cb_pcidda.c +++ b/comedi/drivers/cb_pcidda.c @@ -112,7 +112,7 @@ Please report sucess/failure with other different cards to #define DADATA 8 // FIRST D/A DATA REGISTER (0) -static comedi_lrange cb_pcidda_ranges = +static const comedi_lrange cb_pcidda_ranges = { 6, { @@ -132,7 +132,7 @@ static comedi_lrange cb_pcidda_ranges = */ typedef struct cb_pcidda_board_struct { - char *name; + const char *name; char status; // Driver status: // 0 - tested // 1 - manual read, not tested @@ -140,9 +140,9 @@ typedef struct cb_pcidda_board_struct unsigned short device_id; int ao_chans; int ao_bits; - comedi_lrange *ranges; + const comedi_lrange *ranges; } cb_pcidda_board; -static cb_pcidda_board cb_pcidda_boards[] = +static const cb_pcidda_board cb_pcidda_boards[] = { { name: "pci-dda02/12", @@ -208,7 +208,7 @@ MODULE_DEVICE_TABLE(pci, cb_pcidda_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((cb_pcidda_board *)dev->board_ptr) +#define thisboard ((const cb_pcidda_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/cb_pcimdas.c b/comedi/drivers/cb_pcimdas.c index 4393bc39..7c36755c 100644 --- a/comedi/drivers/cb_pcimdas.c +++ b/comedi/drivers/cb_pcimdas.c @@ -85,7 +85,7 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more /* Board description */ typedef struct cb_pcimdas_board_struct { - char *name; + const char *name; unsigned short device_id; int ai_se_chans; // Inputs in single-ended mode int ai_diff_chans; // Inputs in differential mode @@ -98,10 +98,10 @@ typedef struct cb_pcimdas_board_struct int fifo_size; // number of samples fifo can hold int dio_bits; // number of dio bits int has_dio; // has DIO - comedi_lrange *ranges; + const comedi_lrange *ranges; } cb_pcimdas_board; -static cb_pcimdas_board cb_pcimdas_boards[] = +static const cb_pcimdas_board cb_pcimdas_boards[] = { { name: "PCIM-DAS1602/16", @@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(pci, cb_pcimdas_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((cb_pcimdas_board *)dev->board_ptr) +#define thisboard ((const cb_pcimdas_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/cb_pcimdda.c b/comedi/drivers/cb_pcimdda.c index 793b1353..1f54407c 100644 --- a/comedi/drivers/cb_pcimdda.c +++ b/comedi/drivers/cb_pcimdda.c @@ -100,7 +100,7 @@ Configuration Options: * will someday support more than 1 board... */ typedef struct board_struct { - char *name; + const char *name; unsigned short device_id; int ao_chans; int ao_bits; @@ -118,7 +118,7 @@ enum DIO_METHODS { DIO_INTERNAL /* unimplemented */ }; -static board boards[] = { +static const board boards[] = { { name: "cb_pcimdda06-16", device_id: PCI_ID_PCIM_DDA06_16, @@ -135,7 +135,7 @@ static board boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((board *)dev->board_ptr) +#define thisboard ((const board *)dev->board_ptr) /* Number of boards in boards[] */ #define N_BOARDS (sizeof(boards) / sizeof(board)) diff --git a/comedi/drivers/comedi_bond.c b/comedi/drivers/comedi_bond.c index 022b0175..14eaaa2d 100644 --- a/comedi/drivers/comedi_bond.c +++ b/comedi/drivers/comedi_bond.c @@ -124,7 +124,7 @@ struct BondingBoard }; typedef struct BondingBoard BondingBoard; -static BondingBoard bondingBoards[] = { +static const BondingBoard bondingBoards[] = { { name: MODULE_NAME, }, @@ -133,7 +133,7 @@ static BondingBoard bondingBoards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((BondingBoard *)dev->board_ptr) +#define thisboard ((const BondingBoard *)dev->board_ptr) struct BondedDevice { diff --git a/comedi/drivers/comedi_test.c b/comedi/drivers/comedi_test.c index d6a9d02e..37f8a6c8 100644 --- a/comedi/drivers/comedi_test.c +++ b/comedi/drivers/comedi_test.c @@ -67,7 +67,7 @@ typedef struct waveform_board_struct{ #define N_CHANS 8 -static waveform_board waveform_boards[] = { +static const waveform_board waveform_boards[] = { { name: "comedi_test", ai_chans: N_CHANS, @@ -75,7 +75,7 @@ static waveform_board waveform_boards[] = { have_dio: 0, }, }; -#define thisboard ((waveform_board *)dev->board_ptr) +#define thisboard ((const waveform_board *)dev->board_ptr) /* Data unique to this driver */ typedef struct{ @@ -121,7 +121,7 @@ static sampl_t fake_waveform(comedi_device *dev, unsigned int channel, static const int nano_per_micro = 1000; // 1000 nanosec in a microsec // fake analog input ranges -static comedi_lrange waveform_ai_ranges = +static const comedi_lrange waveform_ai_ranges = { 2, { @@ -429,7 +429,7 @@ static sampl_t fake_sawtooth(comedi_device *dev, unsigned int range_index, unsig comedi_subdevice *s = dev->read_subdev; unsigned int offset = s->maxdata / 2; u64 value; - comedi_krange *krange = &s->range_table->range[range_index]; + const comedi_krange *krange = &s->range_table->range[range_index]; u64 binary_amplitude; binary_amplitude = s->maxdata; @@ -449,7 +449,7 @@ static sampl_t fake_squarewave(comedi_device *dev, unsigned int range_index, uns comedi_subdevice *s = dev->read_subdev; unsigned int offset = s->maxdata / 2; u64 value; - comedi_krange *krange = &s->range_table->range[range_index]; + const comedi_krange *krange = &s->range_table->range[range_index]; current_time %= devpriv->usec_period; value = s->maxdata; diff --git a/comedi/drivers/contec_pci_dio.c b/comedi/drivers/contec_pci_dio.c index b277aba2..9eceb718 100644 --- a/comedi/drivers/contec_pci_dio.c +++ b/comedi/drivers/contec_pci_dio.c @@ -43,7 +43,7 @@ typedef enum contec_model { } contec_model; typedef struct contec_board { - char *name; + const char *name; int model; int in_ports; int out_ports; @@ -51,7 +51,7 @@ typedef struct contec_board { int out_offs; int out_boffs; } contec_board; -static contec_board contec_boards[] = { +static const contec_board contec_boards[] = { { "PIO1616L", PIO1616L, 16, 16, 0, 2, 10 }, }; @@ -62,7 +62,7 @@ static struct pci_device_id contec_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, contec_pci_table); -#define thisboard ((contec_board *)dev->board_ptr) +#define thisboard ((const contec_board *)dev->board_ptr) typedef struct{ int data; diff --git a/comedi/drivers/daqboard2000.c b/comedi/drivers/daqboard2000.c index 1a915e49..82241404 100644 --- a/comedi/drivers/daqboard2000.c +++ b/comedi/drivers/daqboard2000.c @@ -141,7 +141,7 @@ Configuration options: #define DAQBOARD2000_CPLD_DONE 0x0004 // Available ranges -static comedi_lrange range_daqboard2000_ai = { 13, { +static const comedi_lrange range_daqboard2000_ai = { 13, { RANGE(-10, 10), RANGE(-5, 5), RANGE(-2.5, 2.5), @@ -157,7 +157,7 @@ static comedi_lrange range_daqboard2000_ai = { 13, { RANGE(0, 0.3125) }}; -static comedi_lrange range_daqboard2000_ao = { 1, { +static const comedi_lrange range_daqboard2000_ao = { 1, { RANGE(-10, 10) }}; @@ -303,15 +303,15 @@ static comedi_driver driver_daqboard2000 = { }; typedef struct { - char *name; + const char *name; int id; }boardtype; -static boardtype boardtypes[]={ +static const boardtype boardtypes[]={ { "ids2", DAQBOARD2000_SUBSYSTEM_IDS2 }, { "ids4", DAQBOARD2000_SUBSYSTEM_IDS4 }, }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static struct pci_device_id daqboard2000_pci_table[] __devinitdata = { { 0x1616, 0x0409, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, diff --git a/comedi/drivers/das08.c b/comedi/drivers/das08.c index 82d35972..be9ef55a 100644 --- a/comedi/drivers/das08.c +++ b/comedi/drivers/das08.c @@ -164,7 +164,7 @@ static int das08jr_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn * static int das08ao_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); static void i8254_set_mode_low(unsigned int base, int channel, unsigned int mode); -static comedi_lrange range_das08_pgl = { 9, { +static const comedi_lrange range_das08_pgl = { 9, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -175,7 +175,7 @@ static comedi_lrange range_das08_pgl = { 9, { UNI_RANGE(2.5), UNI_RANGE(1.25) }}; -static comedi_lrange range_das08_pgh = { 12, { +static const comedi_lrange range_das08_pgh = { 12, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(1), @@ -189,7 +189,7 @@ static comedi_lrange range_das08_pgh = { 12, { UNI_RANGE(0.1), UNI_RANGE(0.01), }}; -static comedi_lrange range_das08_pgm = { 9, { +static const comedi_lrange range_das08_pgm = { 9, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(0.5), @@ -215,7 +215,7 @@ static comedi_lrange range_das08_pgm = { 9, { */ -static comedi_lrange *das08_ai_lranges[]={ +static const comedi_lrange * const das08_ai_lranges[]={ &range_unknown, &range_bipolar5, &range_das08_pgh, @@ -223,11 +223,11 @@ static comedi_lrange *das08_ai_lranges[]={ &range_das08_pgm, }; -static int das08_pgh_gainlist[] = { 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 }; -static int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; -static int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; +static const int das08_pgh_gainlist[] = { 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 }; +static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; +static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; -static int *das08_gainlists[] = { +static const int * const das08_gainlists[] = { NULL, NULL, das08_pgh_gainlist, @@ -235,7 +235,7 @@ static int *das08_gainlists[] = { das08_pgm_gainlist, }; -static struct das08_board_struct das08_boards[]={ +static const struct das08_board_struct das08_boards[]={ { name: "das08", // cio-das08.pdf bustype: isa, @@ -489,7 +489,7 @@ static struct pci_device_id das08_pci_table[] __devinitdata = { MODULE_DEVICE_TABLE(pci, das08_pci_table); #define devpriv ((struct das08_private_struct *)dev->private) -#define thisboard ((struct das08_board_struct *)dev->board_ptr) +#define thisboard ((const struct das08_board_struct *)dev->board_ptr) #define TIMEOUT 100000 diff --git a/comedi/drivers/das08.h b/comedi/drivers/das08.h index 1a12d2be..34721282 100644 --- a/comedi/drivers/das08.h +++ b/comedi/drivers/das08.h @@ -63,7 +63,7 @@ struct i8254_struct struct das08_private_struct{ unsigned int do_mux_bits; // bits for do/mux register on boards without seperate do register unsigned int do_bits; // bits for do register on boards with register dedicated to digital out only - unsigned int *pg_gainlist; + const unsigned int *pg_gainlist; struct pci_dev *pdev; // struct for pci-das08 unsigned int pci_iobase; // additional base address for pci-das08 struct i8254_struct i8254; diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index 0d63dd81..d658fc10 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -63,7 +63,7 @@ Command support does not exist, but could be added for this board. */ static dev_link_t *dev_list = NULL; -#define thisboard ((struct das08_board_struct *)dev->board_ptr) +#define thisboard ((const struct das08_board_struct *)dev->board_ptr) static int das08_cs_attach(comedi_device *dev,comedi_devconfig *it); @@ -131,7 +131,7 @@ static int das08_cs_attach(comedi_device *dev,comedi_devconfig *it) static int pc_debug = PCMCIA_DEBUG; module_param(pc_debug, int, 0644); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +static const char *version = "das08.c pcmcia code (Frank Hess), modified from dummy_cs.c 1.31 2001/08/24 12:13:13 (David Hinds)"; #else #define DEBUG(n, args...) @@ -165,7 +165,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *); database. */ -static dev_info_t dev_info = "pcm-das08"; +static const dev_info_t dev_info = "pcm-das08"; /* A dev_link_t structure has fields for most things that are needed diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index f9c007f3..0051fc88 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -236,31 +236,31 @@ static const int sample_size = 2; // size in bytes of a sample from board #define DAS1600_WS 0x02 #define DAS1600_CLK_10MHZ 0x01 -static comedi_lrange range_das1x01_bip = { 4, { +static const comedi_lrange range_das1x01_bip = { 4, { BIP_RANGE( 10 ), BIP_RANGE( 1 ), BIP_RANGE( 0.1 ), BIP_RANGE( 0.01 ), }}; -static comedi_lrange range_das1x01_unip = { 4, { +static const comedi_lrange range_das1x01_unip = { 4, { UNI_RANGE( 10 ), UNI_RANGE( 1 ), UNI_RANGE( 0.1 ), UNI_RANGE( 0.01 ), }}; -static comedi_lrange range_das1x02_bip = { 4, { +static const comedi_lrange range_das1x02_bip = { 4, { BIP_RANGE( 10 ), BIP_RANGE( 5 ), BIP_RANGE( 2.5 ), BIP_RANGE( 1.25 ), }}; -static comedi_lrange range_das1x02_unip = { 4, { +static const comedi_lrange range_das1x02_unip = { 4, { UNI_RANGE( 10 ), UNI_RANGE( 5 ), UNI_RANGE( 2.5 ), UNI_RANGE( 1.25 ), }}; -static comedi_lrange range_das16jr = { 9, { +static const comedi_lrange range_das16jr = { 9, { // also used by 16/330 BIP_RANGE( 10 ), BIP_RANGE( 5 ), @@ -272,7 +272,7 @@ static comedi_lrange range_das16jr = { 9, { UNI_RANGE( 2.5 ), UNI_RANGE( 1.25 ), }}; -static comedi_lrange range_das16jr_16 = { 8, { +static const comedi_lrange range_das16jr_16 = { 8, { BIP_RANGE( 10 ), BIP_RANGE( 5 ), BIP_RANGE( 2.5 ), @@ -283,9 +283,9 @@ static comedi_lrange range_das16jr_16 = { 8, { UNI_RANGE( 1.25 ), }}; -static int das16jr_gainlist[] = { 8, 0, 1, 2, 3, 4, 5, 6, 7 }; -static int das16jr_16_gainlist[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; -static int das1600_gainlist[] = { 0, 1, 2, 3 }; +static const int das16jr_gainlist[] = { 8, 0, 1, 2, 3, 4, 5, 6, 7 }; +static const int das16jr_16_gainlist[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static const int das1600_gainlist[] = { 0, 1, 2, 3 }; enum { das16_pg_none = 0, das16_pg_16jr, @@ -293,21 +293,21 @@ enum { das16_pg_1601, das16_pg_1602, }; -static int *das16_gainlists[] = { +static const int * const das16_gainlists[] = { NULL, das16jr_gainlist, das16jr_16_gainlist, das1600_gainlist, das1600_gainlist, }; -static comedi_lrange *das16_ai_uni_lranges[]={ +static const comedi_lrange * const das16_ai_uni_lranges[]={ &range_unknown, &range_das16jr, &range_das16jr_16, &range_das1x01_unip, &range_das1x02_unip, }; -static comedi_lrange *das16_ai_bip_lranges[]={ +static const comedi_lrange *const das16_ai_bip_lranges[]={ &range_unknown, &range_das16jr, &range_das16jr_16, @@ -361,7 +361,7 @@ typedef struct das16_board_struct{ unsigned int id; } das16_board; -static struct das16_board_struct das16_boards[]={ +static const struct das16_board_struct das16_boards[]={ { name: "das-16", ai: das16_ai_rinsn, diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index cf339f79..de878967 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -117,7 +117,7 @@ irq can be omitted, although the cmd interface will not work without it. #define DAS16M1_82C55 0x400 #define DAS16M1_8254_THIRD 0x404 -static comedi_lrange range_das16m1 = +static const comedi_lrange range_das16m1 = { 9, { BIP_RANGE( 5 ), @@ -153,7 +153,7 @@ typedef struct das16m1_board_struct{ unsigned int ai_speed; }das16m1_board; -static das16m1_board das16m1_boards[]={ +static const das16m1_board das16m1_boards[]={ { name: "cio-das16/m1", // CIO-DAS16_M1.pdf ai_speed: 1000, // 1MHz max speed @@ -187,7 +187,7 @@ struct das16m1_private_struct { unsigned int divisor2; // divides master clock to obtain conversion speed }; #define devpriv ((struct das16m1_private_struct *)(dev->private)) -#define thisboard ((struct das16m1_board_struct *)(dev->board_ptr)) +#define thisboard ((const das16m1_board *)(dev->board_ptr)) COMEDI_INITCLEANUP(driver_das16m1); diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index aff0b521..721438c1 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -202,7 +202,7 @@ static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode); static unsigned int suggest_transfer_size(comedi_cmd *cmd); // analog input ranges -static comedi_lrange range_ai_das1801 = { +static const comedi_lrange range_ai_das1801 = { 8, { RANGE( -5, 5 ), @@ -216,7 +216,7 @@ static comedi_lrange range_ai_das1801 = { } }; -static comedi_lrange range_ai_das1802 = { +static const comedi_lrange range_ai_das1802 = { 8, { RANGE(-10, 10), @@ -239,14 +239,14 @@ typedef struct das1800_board_struct{ int do_n_chan; /* number of digital output channels */ int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 == waveform analog out */ int ao_n_chan; /* number of analog out channels */ - comedi_lrange *range_ai; /* available input ranges */ + const comedi_lrange *range_ai; /* available input ranges */ }das1800_board; /* Warning: the maximum conversion speeds listed below are * not always achievable depending on board setup (see * user manual.) */ -static das1800_board das1800_boards[] = +static const das1800_board das1800_boards[] = { { name: "das-1701st", @@ -450,7 +450,7 @@ static das1800_board das1800_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((das1800_board *)dev->board_ptr) +#define thisboard ((const das1800_board *)dev->board_ptr) typedef struct{ volatile unsigned int count; /* number of data points left to be taken */ @@ -475,7 +475,7 @@ typedef struct{ #define devpriv ((das1800_private *)dev->private) // analog out range for boards with basic analog out -static comedi_lrange range_ao_1 = { +static const comedi_lrange range_ao_1 = { 1, { RANGE(-10, 10), @@ -484,7 +484,7 @@ static comedi_lrange range_ao_1 = { // analog out range for 'ao' boards /* -static comedi_lrange range_ao_2 = { +static const comedi_lrange range_ao_2 = { 2, { RANGE(-10, 10), diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index 4d5fc16c..e34411f8 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -108,19 +108,19 @@ cmd triggers supported: typedef struct das800_board_struct{ const char *name; int ai_speed; - comedi_lrange *ai_range; + const comedi_lrange *ai_range; int resolution; }das800_board; //analog input ranges -static comedi_lrange range_das800_ai = { +static const comedi_lrange range_das800_ai = { 1, { RANGE( -5, 5 ), } }; -static comedi_lrange range_das801_ai = { +static const comedi_lrange range_das801_ai = { 9, { RANGE(-5, 5), @@ -135,7 +135,7 @@ static comedi_lrange range_das801_ai = { } }; -static comedi_lrange range_cio_das801_ai = { +static const comedi_lrange range_cio_das801_ai = { 9, { RANGE(-5, 5), @@ -150,7 +150,7 @@ static comedi_lrange range_cio_das801_ai = { } }; -static comedi_lrange range_das802_ai = { +static const comedi_lrange range_das802_ai = { 9, { RANGE(-5, 5), @@ -165,7 +165,7 @@ static comedi_lrange range_das802_ai = { } }; -static comedi_lrange range_das80216_ai = { +static const comedi_lrange range_das80216_ai = { 8, { RANGE(-10, 10), @@ -181,7 +181,7 @@ static comedi_lrange range_das80216_ai = { enum{das800, ciodas800, das801, ciodas801, das802, ciodas802, ciodas80216}; -static das800_board das800_boards[] = +static const das800_board das800_boards[] = { { name: "das-800", @@ -229,7 +229,7 @@ static das800_board das800_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((das800_board *)dev->board_ptr) +#define thisboard ((const das800_board *)dev->board_ptr) typedef struct{ volatile unsigned int count; /* number of data points left to be taken */ diff --git a/comedi/drivers/dmm32at.c b/comedi/drivers/dmm32at.c index 6f99c5ba..1a2c4659 100644 --- a/comedi/drivers/dmm32at.c +++ b/comedi/drivers/dmm32at.c @@ -168,7 +168,7 @@ Configuration Options: #define DMM32AT_DIRCH 0x08 /* board AI ranges in comedi structure */ -static comedi_lrange dmm32at_airanges = +static const comedi_lrange dmm32at_airanges = { 4, { @@ -181,7 +181,7 @@ static comedi_lrange dmm32at_airanges = /* register values for above ranges */ -static unsigned char dmm32at_rangebits[] = { +static const unsigned char dmm32at_rangebits[] = { DMM32AT_RANGE_U10, DMM32AT_RANGE_U5, DMM32AT_RANGE_B10, @@ -191,7 +191,7 @@ static unsigned char dmm32at_rangebits[] = { /* only one of these ranges is valid, as set by a jumper on the * board. The application should only use the range set by the jumper */ -static comedi_lrange dmm32at_aoranges = +static const comedi_lrange dmm32at_aoranges = { 4, { @@ -211,14 +211,14 @@ typedef struct dmm32at_board_struct{ const char *name; int ai_chans; int ai_bits; - comedi_lrange *ai_ranges; + const comedi_lrange *ai_ranges; int ao_chans; int ao_bits; - comedi_lrange *ao_ranges; + const comedi_lrange *ao_ranges; int have_dio; int dio_chans; }dmm32at_board; -static dmm32at_board dmm32at_boards[] = { +static const dmm32at_board dmm32at_boards[] = { { name: "dmm32at", ai_chans: 32, @@ -236,7 +236,7 @@ static dmm32at_board dmm32at_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((dmm32at_board *)dev->board_ptr) +#define thisboard ((const dmm32at_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If * several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/dt2801.c b/comedi/drivers/dt2801.c index 3f750fae..12f5a44a 100644 --- a/comedi/drivers/dt2801.c +++ b/comedi/drivers/dt2801.c @@ -103,14 +103,14 @@ COMEDI_INITCLEANUP(driver_dt2801); #if 0 // ignore 'defined but not used' warning -static comedi_lrange range_dt2801_ai_pgh_bipolar={ 4, { +static const comedi_lrange range_dt2801_ai_pgh_bipolar={ 4, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ), }}; #endif -static comedi_lrange range_dt2801_ai_pgl_bipolar={ 4, { +static const comedi_lrange range_dt2801_ai_pgl_bipolar={ 4, { RANGE( -10, 10 ), RANGE( -1, 1 ), RANGE( -0.1, 0.1 ), @@ -118,14 +118,14 @@ static comedi_lrange range_dt2801_ai_pgl_bipolar={ 4, { }}; #if 0 // ignore 'defined but not used' warning -static comedi_lrange range_dt2801_ai_pgh_unipolar={ 4, { +static const comedi_lrange range_dt2801_ai_pgh_unipolar={ 4, { RANGE( 0, 10 ), RANGE( 0, 5 ), RANGE( 0, 2.5 ), RANGE( 0, 1.25 ), }}; #endif -static comedi_lrange range_dt2801_ai_pgl_unipolar={ 4, { +static const comedi_lrange range_dt2801_ai_pgl_unipolar={ 4, { RANGE( 0, 10 ), RANGE( 0, 1 ), RANGE( 0, 0.1 ), @@ -133,7 +133,7 @@ static comedi_lrange range_dt2801_ai_pgl_unipolar={ 4, { }}; typedef struct{ - char *name; + const char *name; int boardcode; int ad_diff; int ad_chan; @@ -145,7 +145,7 @@ typedef struct{ /* Typeid's for the different boards of the DT2801-series (taken from the test-software, that comes with the board) */ -static boardtype_t boardtypes[] = +static const boardtype_t boardtypes[] = { { name: "dt2801", @@ -221,11 +221,11 @@ static boardtype_t boardtypes[] = }, }; #define n_boardtypes ((sizeof(boardtypes))/(sizeof(boardtypes[0]))) -#define boardtype (*(boardtype_t *)dev->board_ptr) +#define boardtype (*(const boardtype_t *)dev->board_ptr) typedef struct{ - comedi_lrange *dac_range_types[2]; + const comedi_lrange *dac_range_types[2]; lsampl_t ao_readback[2]; }dt2801_private; #define devpriv ((dt2801_private *)dev->private) @@ -441,7 +441,7 @@ static int probe_number_of_ai_chans(comedi_device *dev) } -static comedi_lrange *dac_range_table[]={ +static const comedi_lrange *dac_range_table[]={ &range_bipolar10, &range_bipolar5, &range_bipolar2_5, @@ -449,13 +449,13 @@ static comedi_lrange *dac_range_table[]={ &range_unipolar5 }; -static comedi_lrange *dac_range_lkup(int opt) +static const comedi_lrange *dac_range_lkup(int opt) { if(opt<0 || opt>5)return &range_unknown; return dac_range_table[opt]; } -static comedi_lrange *ai_range_lkup(int type,int opt) +static const comedi_lrange *ai_range_lkup(int type,int opt) { switch(type){ case 0: diff --git a/comedi/drivers/dt2811.c b/comedi/drivers/dt2811.c index 0e17e8c9..314582d1 100644 --- a/comedi/drivers/dt2811.c +++ b/comedi/drivers/dt2811.c @@ -49,39 +49,39 @@ Configuration options: #include -static char *driver_name = "dt2811"; +static const char *driver_name = "dt2811"; -static comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { +static const comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { RANGE( 0, 5 ), RANGE( 0, 2.5 ), RANGE( 0, 1.25 ), RANGE( 0, 0.625 ) }}; -static comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { 4, { +static const comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { 4, { RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ), RANGE( -0.625, 0.625 ), RANGE( -0.3125, 0.3125 ) }}; -static comedi_lrange range_dt2811_pgh_ai_5_bipolar = { 4, { +static const comedi_lrange range_dt2811_pgh_ai_5_bipolar = { 4, { RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ), RANGE( -0.625, 0.625 ) }}; -static comedi_lrange range_dt2811_pgl_ai_5_unipolar = { 4, { +static const comedi_lrange range_dt2811_pgl_ai_5_unipolar = { 4, { RANGE( 0, 5 ), RANGE( 0, 0.5 ), RANGE( 0, 0.05 ), RANGE( 0, 0.01 ) }}; -static comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { 4, { +static const comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { 4, { RANGE( -2.5, 2.5 ), RANGE( -0.25, 0.25 ), RANGE( -0.025, 0.025 ), RANGE( -0.005, 0.005 ) }}; -static comedi_lrange range_dt2811_pgl_ai_5_bipolar = { 4, { +static const comedi_lrange range_dt2811_pgl_ai_5_bipolar = { 4, { RANGE( -5, 5 ), RANGE( -0.5, 0.5 ), RANGE( -0.05, 0.05 ), @@ -187,11 +187,11 @@ static comedi_lrange range_dt2811_pgl_ai_5_bipolar = { 4, { typedef struct { const char *name; - comedi_lrange *bip_5; - comedi_lrange *bip_2_5; - comedi_lrange *unip_5; + const comedi_lrange *bip_5; + const comedi_lrange *bip_2_5; + const comedi_lrange *unip_5; }boardtype; -static boardtype boardtypes[]={ +static const boardtype boardtypes[]={ { "dt2811-pgh", &range_dt2811_pgh_ai_5_bipolar, &range_dt2811_pgh_ai_2_5_bipolar, @@ -203,7 +203,7 @@ static boardtype boardtypes[]={ &range_dt2811_pgl_ai_5_unipolar, }, }; -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static int dt2811_attach(comedi_device *dev,comedi_devconfig *it); static int dt2811_detach(comedi_device *dev); @@ -239,13 +239,13 @@ typedef struct { enum { dac_bipolar_5, dac_bipolar_2_5, dac_unipolar_5 } dac_range[2]; - comedi_lrange * range_type_list[2]; + const comedi_lrange * range_type_list[2]; lsampl_t ao_readback[2]; } dt2811_private; #define devpriv ((dt2811_private *)dev->private) -static comedi_lrange *dac_range_types[] = +static const comedi_lrange *dac_range_types[] = { &range_bipolar5, &range_bipolar2_5, diff --git a/comedi/drivers/dt2815.c b/comedi/drivers/dt2815.c index a8e61602..c519ea61 100644 --- a/comedi/drivers/dt2815.c +++ b/comedi/drivers/dt2815.c @@ -62,10 +62,10 @@ Configuration options: #include -static comedi_lrange range_dt2815_ao_32_current = { 1, { +static const comedi_lrange range_dt2815_ao_32_current = { 1, { RANGE_mA( 0, 32 ) }}; -static comedi_lrange range_dt2815_ao_20_current = { 1, { +static const comedi_lrange range_dt2815_ao_20_current = { 1, { RANGE_mA( 4, 20 ) }}; @@ -87,7 +87,7 @@ COMEDI_INITCLEANUP(driver_dt2815); static void dt2815_free_resources(comedi_device * dev); typedef struct { - comedi_lrange * range_type_list[8]; + const comedi_lrange * range_type_list[8]; lsampl_t ao_readback[8]; } dt2815_private; @@ -177,7 +177,7 @@ static int dt2815_attach(comedi_device * dev, comedi_devconfig * it) { comedi_subdevice *s; int i; - comedi_lrange *current_range_type, *voltage_range_type; + const comedi_lrange *current_range_type, *voltage_range_type; unsigned long iobase; iobase = it->options[0]; diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index fcfc6f80..bd58dcc0 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -154,37 +154,37 @@ Notes: #define DT2821_XCLK 0x0002 /* (R/W) external clock enable */ #define DT2821_BDINIT 0x0001 /* (W) initialize board */ -static comedi_lrange range_dt282x_ai_lo_bipolar = { 4, { +static const comedi_lrange range_dt282x_ai_lo_bipolar = { 4, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ) }}; -static comedi_lrange range_dt282x_ai_lo_unipolar = { 4, { +static const comedi_lrange range_dt282x_ai_lo_unipolar = { 4, { RANGE( 0, 10 ), RANGE( 0, 5 ), RANGE( 0, 2.5 ), RANGE( 0, 1.25 ) }}; -static comedi_lrange range_dt282x_ai_5_bipolar = { 4, { +static const comedi_lrange range_dt282x_ai_5_bipolar = { 4, { RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ), RANGE( -0.625, 0.625 ), }}; -static comedi_lrange range_dt282x_ai_5_unipolar = { 4, { +static const comedi_lrange range_dt282x_ai_5_unipolar = { 4, { RANGE( 0, 5 ), RANGE( 0, 2.5 ), RANGE( 0, 1.25 ), RANGE( 0, 0.625 ), }}; -static comedi_lrange range_dt282x_ai_hi_bipolar = { 4, { +static const comedi_lrange range_dt282x_ai_hi_bipolar = { 4, { RANGE( -10, 10 ), RANGE( -1, 1 ), RANGE( -0.1, 0.1 ), RANGE( -0.02, 0.02 ) }}; -static comedi_lrange range_dt282x_ai_hi_unipolar = { 4, { +static const comedi_lrange range_dt282x_ai_hi_unipolar = { 4, { RANGE( 0, 10 ), RANGE( 0, 1 ), RANGE( 0, 0.1 ), @@ -203,7 +203,7 @@ typedef struct { int dabits; } boardtype_t; -static boardtype_t boardtypes[] = +static const boardtype_t boardtypes[] = { { name: "dt2821", adbits: 12, @@ -333,7 +333,7 @@ static boardtype_t boardtypes[] = }, }; #define n_boardtypes sizeof(boardtypes)/sizeof(boardtype_t) -#define this_board ((boardtype_t *)dev->board_ptr) +#define this_board ((const boardtype_t *)dev->board_ptr) typedef struct { @@ -341,7 +341,7 @@ typedef struct { int da0_2scomp; /* same, for DAC0 */ int da1_2scomp; /* same, for DAC1 */ - comedi_lrange *darangelist[2]; + const comedi_lrange *darangelist[2]; sampl_t ao[2]; @@ -364,7 +364,7 @@ typedef struct { } dt282x_private; #define devpriv ((dt282x_private *)dev->private) -#define boardtype (*(boardtype_t *)dev->board_ptr) +#define boardtype (*(const boardtype_t *)dev->board_ptr) /* * Some useless abstractions @@ -1145,15 +1145,15 @@ static int dt282x_dio_insn_config(comedi_device *dev,comedi_subdevice *s, } -static comedi_lrange *ai_range_table[]={ +static const comedi_lrange * const ai_range_table[]={ &range_dt282x_ai_lo_bipolar, &range_dt282x_ai_lo_unipolar, &range_dt282x_ai_5_bipolar, &range_dt282x_ai_5_unipolar }; -static comedi_lrange *ai_range_pgl_table[]={ +static const comedi_lrange * const ai_range_pgl_table[]={ &range_dt282x_ai_hi_bipolar, &range_dt282x_ai_hi_unipolar }; -static comedi_lrange *opt_ai_range_lkup(int ispgl,int x) +static const comedi_lrange *opt_ai_range_lkup(int ispgl,int x) { if(ispgl){ if(x<0 || x>=2)x=0; @@ -1163,13 +1163,13 @@ static comedi_lrange *opt_ai_range_lkup(int ispgl,int x) return ai_range_table[x]; } } -static comedi_lrange *ao_range_table[]={ +static const comedi_lrange * const ao_range_table[]={ &range_bipolar10, &range_unipolar10, &range_bipolar5, &range_unipolar5, &range_bipolar2_5 }; -static comedi_lrange *opt_ao_range_lkup(int x) +static const comedi_lrange *opt_ao_range_lkup(int x) { if(x<0 || x>=5)x=0; return ao_range_table[x]; diff --git a/comedi/drivers/dt3000.c b/comedi/drivers/dt3000.c index 569c1861..0cfd0d71 100644 --- a/comedi/drivers/dt3000.c +++ b/comedi/drivers/dt3000.c @@ -60,13 +60,13 @@ AO commands are not supported. #define PCI_VENDOR_ID_DT 0x1116 -static comedi_lrange range_dt3000_ai = { 4, { +static const comedi_lrange range_dt3000_ai = { 4, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), RANGE( -1.25, 1.25 ) }}; -static comedi_lrange range_dt3000_ai_pgl = { 4, { +static const comedi_lrange range_dt3000_ai_pgl = { 4, { RANGE( -10, 10 ), RANGE( -1, 1 ), RANGE( -0.1, 0.1 ), @@ -74,17 +74,17 @@ static comedi_lrange range_dt3000_ai_pgl = { 4, { }}; typedef struct{ - char *name; + const char *name; unsigned int device_id; int adchan; int adbits; int ai_speed; - comedi_lrange *adrange; + const comedi_lrange *adrange; int dachan; int dabits; }dt3k_boardtype; -static dt3k_boardtype dt3k_boardtypes[]={ +static const dt3k_boardtype dt3k_boardtypes[]={ { name: "dt3001", device_id: 0x22, adchan: 16, @@ -150,7 +150,7 @@ static dt3k_boardtype dt3k_boardtypes[]={ }, }; #define n_dt3k_boards sizeof(dt3k_boardtypes)/sizeof(dt3k_boardtype) -#define this_board ((dt3k_boardtype *)dev->board_ptr) +#define this_board ((const dt3k_boardtype *)dev->board_ptr) static struct pci_device_id dt3k_pci_table[] __devinitdata = { { PCI_VENDOR_ID_DT, 0x0022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, diff --git a/comedi/drivers/dt9812.c b/comedi/drivers/dt9812.c index 4fc973b7..658fa148 100644 --- a/comedi/drivers/dt9812.c +++ b/comedi/drivers/dt9812.c @@ -99,22 +99,22 @@ typedef struct slot_dt9812 { comedi_dt9812_t *comedi; } slot_dt9812_t; -static comedi_lrange dt9812_10_ain_range={ 1, { +static const comedi_lrange dt9812_10_ain_range={ 1, { BIP_RANGE(10), } }; -static comedi_lrange dt9812_2pt5_ain_range={ 1, { +static const comedi_lrange dt9812_2pt5_ain_range={ 1, { UNI_RANGE(2.5), } }; -static comedi_lrange dt9812_10_aout_range={ 1, { +static const comedi_lrange dt9812_10_aout_range={ 1, { BIP_RANGE(10), } }; -static comedi_lrange dt9812_2pt5_aout_range={ 1, { +static const comedi_lrange dt9812_2pt5_aout_range={ 1, { UNI_RANGE(2.5), } }; diff --git a/comedi/drivers/fl512.c b/comedi/drivers/fl512.c index 831f375e..7b82eb40 100644 --- a/comedi/drivers/fl512.c +++ b/comedi/drivers/fl512.c @@ -29,7 +29,7 @@ typedef struct { } fl512_private; #define devpriv ((fl512_private *) dev->private) -static comedi_lrange range_fl512 = +static const comedi_lrange range_fl512 = { 4, { BIP_RANGE(0.5), BIP_RANGE(1), diff --git a/comedi/drivers/icp_multi.c b/comedi/drivers/icp_multi.c index b4b7b04a..8c97c44f 100644 --- a/comedi/drivers/icp_multi.c +++ b/comedi/drivers/icp_multi.c @@ -111,7 +111,7 @@ Options: // Define analogue range -static comedi_lrange range_analog={ 4, { +static const comedi_lrange range_analog={ 4, { UNI_RANGE(5), UNI_RANGE(10), BIP_RANGE(5), @@ -119,7 +119,7 @@ static comedi_lrange range_analog={ 4, { } }; -static char range_codes_analog[]={0x00, 0x20, 0x10, 0x30}; +static const char range_codes_analog[]={0x00, 0x20, 0x10, 0x30}; /* @@ -152,12 +152,12 @@ typedef struct { int n_ctrs; // num of counters int ai_maxdata; // resolution of A/D int ao_maxdata; // resolution of D/A - comedi_lrange *rangelist_ai; // rangelist for A/D - char *rangecode; // range codes for programming - comedi_lrange *rangelist_ao; // rangelist for D/A + const comedi_lrange *rangelist_ai; // rangelist for A/D + const char *rangecode; // range codes for programming + const comedi_lrange *rangelist_ao; // rangelist for D/A } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"icp_multi", // Driver name DEVICE_ID, // PCI device ID @@ -210,7 +210,7 @@ typedef struct{ } icp_multi_private; #define devpriv ((icp_multi_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) /* ============================================================================== diff --git a/comedi/drivers/ii_pci20kc.c b/comedi/drivers/ii_pci20kc.c index 3b057ef8..54f89848 100644 --- a/comedi/drivers/ii_pci20kc.c +++ b/comedi/drivers/ii_pci20kc.c @@ -140,7 +140,7 @@ typedef union { void *iobase; struct { void *iobase; - comedi_lrange *ao_range_list[2]; /* range of channels of ao module */ + const comedi_lrange *ao_range_list[2]; /* range of channels of ao module */ lsampl_t last_data[2]; }pci20006; struct { @@ -275,7 +275,7 @@ static int pci20006_insn_read(comedi_device * dev, comedi_subdevice * s, static int pci20006_insn_write(comedi_device * dev, comedi_subdevice * s, comedi_insn *insn, lsampl_t *data); -static comedi_lrange *pci20006_range_list[] = { +static const comedi_lrange *pci20006_range_list[] = { &range_bipolar10, &range_unipolar10, &range_bipolar5, @@ -350,14 +350,14 @@ static int pci20006_insn_write(comedi_device * dev, comedi_subdevice * s, static int pci20341_insn_read(comedi_device * dev, comedi_subdevice * s, comedi_insn *insn, lsampl_t *data); -static int pci20341_timebase[] = { 0x00, 0x00, 0x00, 0x04 }; -static int pci20341_settling_time[] = { 0x58, 0x58, 0x93, 0x99 }; +static const int pci20341_timebase[] = { 0x00, 0x00, 0x00, 0x04 }; +static const int pci20341_settling_time[] = { 0x58, 0x58, 0x93, 0x99 }; -static comedi_lrange range_bipolar0_5 = { 1, { BIP_RANGE(0.5) }}; -static comedi_lrange range_bipolar0_05 = { 1, { BIP_RANGE(0.05) }}; -static comedi_lrange range_bipolar0_025 = { 1, { BIP_RANGE(0.025) }}; +static const comedi_lrange range_bipolar0_5 = { 1, { BIP_RANGE(0.5) }}; +static const comedi_lrange range_bipolar0_05 = { 1, { BIP_RANGE(0.05) }}; +static const comedi_lrange range_bipolar0_025 = { 1, { BIP_RANGE(0.025) }}; -static comedi_lrange *pci20341_ranges[] = { +static const comedi_lrange * const pci20341_ranges[] = { &range_bipolar5, &range_bipolar0_5, &range_bipolar0_05, diff --git a/comedi/drivers/jr3_pci.c b/comedi/drivers/jr3_pci.c index 8937398b..54e07435 100644 --- a/comedi/drivers/jr3_pci.c +++ b/comedi/drivers/jr3_pci.c @@ -158,7 +158,7 @@ typedef struct { int length; comedi_krange range; } range[9]; - comedi_lrange *range_table_list[8 * 7 + 2]; + const comedi_lrange * range_table_list[8 * 7 + 2]; lsampl_t maxdata_list[8 * 7 + 2]; u16 errors; int retries; diff --git a/comedi/drivers/ke_counter.c b/comedi/drivers/ke_counter.c index f8c7a8e8..3cb02506 100644 --- a/comedi/drivers/ke_counter.c +++ b/comedi/drivers/ke_counter.c @@ -56,13 +56,13 @@ MODULE_DEVICE_TABLE(pci, cnt_pci_table); typedef struct { - char *name; + const char *name; int device_id; int cnt_channel_nbr; int cnt_bits; } cnt_board_struct; -static cnt_board_struct cnt_boards[] = +static const cnt_board_struct cnt_boards[] = { { name: CNT_DRIVER_NAME, diff --git a/comedi/drivers/me4000.c b/comedi/drivers/me4000.c index 13186c6a..3fedb93c 100644 --- a/comedi/drivers/me4000.c +++ b/comedi/drivers/me4000.c @@ -64,7 +64,7 @@ broken. #include "me4000_fw.h" #endif -me4000_board_t me4000_boards[] = { +static const me4000_board_t me4000_boards[] = { { "ME-4650" , 0x4650, { 0, 0 }, { 16, 0, 0, 0 }, { 4 }, { 0 } }, { "ME-4660" , 0x4660, { 0, 0 }, { 32, 0, 16, 0 }, { 4 }, { 3 } }, @@ -247,7 +247,7 @@ static unsigned char me4000_inb(comedi_device *dev, unsigned long port){ -static comedi_lrange me4000_ai_range= +static const comedi_lrange me4000_ai_range= { 4, { @@ -260,7 +260,7 @@ static comedi_lrange me4000_ai_range= -static comedi_lrange me4000_ao_range= +static const comedi_lrange me4000_ao_range= { 1, { diff --git a/comedi/drivers/me4000.h b/comedi/drivers/me4000.h index f501263c..feeed106 100644 --- a/comedi/drivers/me4000.h +++ b/comedi/drivers/me4000.h @@ -343,7 +343,7 @@ typedef struct me4000_board { } me4000_board_t; -#define thisboard ((me4000_board_t *)dev->board_ptr) +#define thisboard ((const me4000_board_t *)dev->board_ptr) /*============================================================================= diff --git a/comedi/drivers/me_daq.c b/comedi/drivers/me_daq.c index 0b86ad58..96081c6c 100644 --- a/comedi/drivers/me_daq.c +++ b/comedi/drivers/me_daq.c @@ -150,7 +150,7 @@ from http://www.comedi.org static int me_attach(comedi_device *dev, comedi_devconfig *it); static int me_detach(comedi_device *dev); -static comedi_lrange me2000_ai_range= +static const comedi_lrange me2000_ai_range= { 8, { @@ -165,7 +165,7 @@ static comedi_lrange me2000_ai_range= } }; -static comedi_lrange me2600_ai_range= +static const comedi_lrange me2600_ai_range= { 8, { @@ -180,7 +180,7 @@ static comedi_lrange me2600_ai_range= } }; -static comedi_lrange me2600_ao_range= +static const comedi_lrange me2600_ao_range= { 3, { @@ -209,15 +209,15 @@ typedef struct int ao_channel_nbr; // DA config int ao_resolution; int ao_resolution_mask; - comedi_lrange *ao_range_list; + const comedi_lrange *ao_range_list; int ai_channel_nbr; // AD config int ai_resolution; int ai_resolution_mask; - comedi_lrange *ai_range_list; + const comedi_lrange *ai_range_list; int dio_channel_nbr; // DIO config } me_board_struct; -static me_board_struct me_boards[] = +static const me_board_struct me_boards[] = { { // -- ME-2600i -- name: ME_DRIVER_NAME, diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index d9181251..d85ee842 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -619,7 +619,7 @@ static void mite_decode(char **bit_str, unsigned int bits); /* names of bits in mite registers */ -static char *mite_CHOR_strings[] = { +static const char * const mite_CHOR_strings[] = { "start", "cont", "stop", "abort", "freset", "clrlc", "clrrb", "clrdone", "clr_lpause", "set_lpause", "clr_send_tc", @@ -631,7 +631,7 @@ static char *mite_CHOR_strings[] = { "dmareset", }; -static char *mite_CHCR_strings[] = { +static const char * const mite_CHCR_strings[] = { "continue", "ringbuff", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", @@ -642,7 +642,7 @@ static char *mite_CHCR_strings[] = { "clr_linkp_ie", "set_linkp_ie", "clr_dma_ie", "set_dma_ie", }; -static char *mite_MCR_strings[] = { +static const char * const mite_MCR_strings[] = { "amdevice", "1", "2", "3", "4", "5", "portio", "portvxi", "psizebyte", "psizehalf (byte & half = word)", "aseqxp1", "11", @@ -653,7 +653,7 @@ static char *mite_MCR_strings[] = { "28", "29", "30", "stopen", }; -static char *mite_DCR_strings[] = { +static const char * const mite_DCR_strings[] = { "amdevice", "1", "2", "3", "4", "5", "portio", "portvxi", "psizebyte", "psizehalf (byte & half = word)", "aseqxp1", "aseqxp2", @@ -664,7 +664,7 @@ static char *mite_DCR_strings[] = { "28", "wsdevc", "wsdevs", "rwdevpack", }; -static char *mite_LKCR_strings[] = { +static const char * const mite_LKCR_strings[] = { "amdevice", "1", "2", "3", "4", "5", "portio", "portvxi", "psizebyte", "psizehalf (byte & half = word)", "asequp", "aseqdown", @@ -676,7 +676,7 @@ static char *mite_LKCR_strings[] = { }; -static char *mite_CHSR_strings[] = { +static const char * const mite_CHSR_strings[] = { "d.err0", "d.err1", "m.err0", "m.err1", "l.err0", "l.err1", "drq0", "drq1", "end", "xferr", "operr0", "operr1", diff --git a/comedi/drivers/mpc624.c b/comedi/drivers/mpc624.c index b21e67d6..1d2a566c 100644 --- a/comedi/drivers/mpc624.c +++ b/comedi/drivers/mpc624.c @@ -127,7 +127,7 @@ typedef struct #define devpriv ((skel_private *)dev->private) //---------------------------------------------------------------------------- -static comedi_lrange range_mpc624_bipolar1 = +static const comedi_lrange range_mpc624_bipolar1 = { 1, { @@ -136,7 +136,7 @@ static comedi_lrange range_mpc624_bipolar1 = BIP_RANGE(2.02) } }; -static comedi_lrange range_mpc624_bipolar10 = +static const comedi_lrange range_mpc624_bipolar10 = { 1, { diff --git a/comedi/drivers/ni_6527.c b/comedi/drivers/ni_6527.c index e3ea9cf5..a6902b41 100644 --- a/comedi/drivers/ni_6527.c +++ b/comedi/drivers/ni_6527.c @@ -91,9 +91,9 @@ COMEDI_INITCLEANUP(driver_ni6527); typedef struct{ int dev_id; - char *name; + const char *name; }ni6527_board; -static ni6527_board ni6527_boards[] = { +static const ni6527_board ni6527_boards[] = { { dev_id: 0x2b20, name: "pci-6527", @@ -105,7 +105,7 @@ static ni6527_board ni6527_boards[] = { }; #define n_ni6527_boards (sizeof(ni6527_boards)/sizeof(ni6527_boards[0])) -#define this_board ((ni6527_board *)dev->board_ptr) +#define this_board ((const ni6527_board *)dev->board_ptr) static struct pci_device_id ni6527_pci_table[] __devinitdata = { { PCI_VENDOR_ID_NATINST, 0x2b10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, diff --git a/comedi/drivers/ni_65xx.c b/comedi/drivers/ni_65xx.c index ca0798e3..3a6171cc 100644 --- a/comedi/drivers/ni_65xx.c +++ b/comedi/drivers/ni_65xx.c @@ -120,7 +120,7 @@ typedef struct{ unsigned num_do_ports; unsigned invert_outputs : 1; }ni_65xx_board; -static ni_65xx_board ni_65xx_boards[] = { +static const ni_65xx_board ni_65xx_boards[] = { { dev_id: 0x7085, name: "pci-6509", diff --git a/comedi/drivers/ni_660x.c b/comedi/drivers/ni_660x.c index ebe5e6a0..5afcbb21 100644 --- a/comedi/drivers/ni_660x.c +++ b/comedi/drivers/ni_660x.c @@ -318,7 +318,7 @@ typedef struct int cnt_bits; /* number of bits in each counter */ } ni_660x_board; -static ni_660x_board ni_660x_boards[] = +static const ni_660x_board ni_660x_boards[] = { { dev_id : 0x2c60, @@ -342,7 +342,7 @@ static struct pci_device_id ni_660x_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, ni_660x_pci_table); -#define thisboard ((ni_660x_board *)dev->board_ptr) +#define thisboard ((const ni_660x_board *)dev->board_ptr) /* initialized in ni_660x_find_device() */ typedef struct diff --git a/comedi/drivers/ni_670x.c b/comedi/drivers/ni_670x.c index de38ab00..c31a88d4 100644 --- a/comedi/drivers/ni_670x.c +++ b/comedi/drivers/ni_670x.c @@ -63,11 +63,11 @@ Commands are not supported. typedef struct ni_670x_board_struct { unsigned short dev_id; - char *name; + const char *name; unsigned short ao_chans; unsigned short ao_bits; }ni_670x_board; -static ni_670x_board ni_670x_boards[] = +static const ni_670x_board ni_670x_boards[] = { { dev_id : 0x2c90, @@ -166,11 +166,16 @@ static int ni_670x_attach(comedi_device *dev,comedi_devconfig *it) s->n_chan = thisboard->ao_chans; s->maxdata = 0xffff; if(s->n_chan == 32){ - s->range_table_list = kmalloc(sizeof(comedi_lrange *)*32, + const comedi_lrange **range_table_list; + + range_table_list = kmalloc(sizeof(comedi_lrange *)*32, GFP_KERNEL); + if(!range_table_list) + return -ENOMEM; + s->range_table_list = range_table_list; for(i=0;i<16;i++){ - s->range_table_list[i] = &range_bipolar10; - s->range_table_list[16+i] = &range_0_20mA; + range_table_list[i] = &range_bipolar10; + range_table_list[16+i] = &range_0_20mA; } }else{ s->range_table = &range_bipolar10; diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index aa2459f2..2235d049 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -119,14 +119,14 @@ TRIG_WAKE_EOS #define HW_COUNT_DISABLE 0x30 // disable hardware counting of conversions typedef struct a2150_board_struct{ - char *name; + const char *name; int clock[4]; // master clock periods, in nanoseconds int num_clocks; // number of available master clock speeds int ai_speed; // maximum conversion rate in nanoseconds }a2150_board; //analog input range -static comedi_lrange range_a2150 = { +static const comedi_lrange range_a2150 = { 1, { RANGE( -2.828, 2.828 ), @@ -135,7 +135,7 @@ static comedi_lrange range_a2150 = { // enum must match board indices enum{a2150_c, a2150_s}; -static a2150_board a2150_boards[] = +static const a2150_board a2150_boards[] = { { name: "at-a2150c", @@ -153,7 +153,7 @@ static a2150_board a2150_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((a2150_board *)dev->board_ptr) +#define thisboard ((const a2150_board *)dev->board_ptr) typedef struct{ volatile unsigned int count; /* number of data points left to be taken */ diff --git a/comedi/drivers/ni_at_ao.c b/comedi/drivers/ni_at_ao.c index 997b5545..62aaedab 100644 --- a/comedi/drivers/ni_at_ao.c +++ b/comedi/drivers/ni_at_ao.c @@ -156,7 +156,7 @@ typedef struct atao_board_struct{ const char *name; int n_ao_chans; }atao_board; -static atao_board atao_boards[] = { +static const atao_board atao_boards[] = { { name: "ai-ao-6", n_ao_chans: 6, diff --git a/comedi/drivers/ni_atmio.c b/comedi/drivers/ni_atmio.c index 8cdffcf9..521c5824 100644 --- a/comedi/drivers/ni_atmio.c +++ b/comedi/drivers/ni_atmio.c @@ -115,7 +115,7 @@ are not supported. #define MAX_N_CALDACS 32 -static ni_board ni_boards[]={ +static const ni_board ni_boards[]={ { device_id: 44, isapnp_id: 0x0000, /* XXX unknown */ name: "at-mio-16e-1", @@ -268,7 +268,7 @@ static ni_board ni_boards[]={ } }; -static int ni_irqpin[]={-1,-1,-1,0,1,2,-1,3,-1,-1,4,5,6,-1,-1,7}; +static const int ni_irqpin[]={-1,-1,-1,0,1,2,-1,3,-1,-1,4,5,6,-1,-1,7}; #define interrupt_pin(a) (ni_irqpin[(a)]) diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index dcb72931..642d9287 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -109,7 +109,7 @@ typedef struct{ const char *name; int has_8255; }atmio16_board_t; -static atmio16_board_t atmio16_boards[]={ +static const atmio16_board_t atmio16_boards[]={ { name: "atmio16", has_8255: 0, @@ -121,7 +121,7 @@ static atmio16_board_t atmio16_boards[]={ }; #define n_atmio16_boards sizeof(atmio16_boards)/sizeof(atmio16_boards[0]) -#define boardtype ((atmio16_board_t *)dev->board_ptr) +#define boardtype ((const atmio16_board_t *)dev->board_ptr) /* function prototypes */ @@ -147,21 +147,21 @@ static comedi_driver driver_atmio16d={ COMEDI_INITCLEANUP(driver_atmio16d); /* range structs */ -static comedi_lrange range_atmio16d_ai_10_bipolar = { 4, { +static const comedi_lrange range_atmio16d_ai_10_bipolar = { 4, { BIP_RANGE( 10 ), BIP_RANGE( 1 ), BIP_RANGE( 0.1 ), BIP_RANGE( 0.02 ) } }; -static comedi_lrange range_atmio16d_ai_5_bipolar = { 4, { +static const comedi_lrange range_atmio16d_ai_5_bipolar = { 4, { BIP_RANGE( 5 ), BIP_RANGE( 0.5 ), BIP_RANGE( 0.05 ), BIP_RANGE( 0.01 ) } }; -static comedi_lrange range_atmio16d_ai_unipolar = { 4, { +static const comedi_lrange range_atmio16d_ai_unipolar = { 4, { UNI_RANGE( 10 ), UNI_RANGE( 1 ), UNI_RANGE( 0.1 ), @@ -177,7 +177,7 @@ typedef struct { enum { dac_bipolar, dac_unipolar } dac0_range, dac1_range; enum { dac_internal, dac_external } dac0_reference, dac1_reference; enum { dac_2comp, dac_straight } dac0_coding, dac1_coding; - comedi_lrange *ao_range_type_list[2]; + const comedi_lrange *ao_range_type_list[2]; lsampl_t ao_readback[2]; unsigned int com_reg_1_state; /* current state of command register 1 */ unsigned int com_reg_2_state; /* current state of command register 2 */ diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index a3478b38..63bdd23f 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -83,7 +83,7 @@ typedef struct dio24_board_struct{ }dio24_board; -static dio24_board dio24_boards[] = +static const dio24_board dio24_boards[] = { { name: "daqcard-dio24", @@ -102,7 +102,7 @@ static dio24_board dio24_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((dio24_board *)dev->board_ptr) +#define thisboard ((const dio24_board *)dev->board_ptr) typedef struct{ int data; /* number of data points left to be taken */ @@ -250,7 +250,7 @@ static void dio24_cs_detach(struct pcmcia_device *); database. */ -static dev_info_t dev_info = "ni_daq_dio24"; +static const dev_info_t dev_info = "ni_daq_dio24"; /* A dev_link_t structure has fields for most things that are needed diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index e4e11678..2cef71b9 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -199,7 +199,7 @@ enum scan_mode //analog input ranges #define NUM_LABPC_PLUS_AI_RANGES 16 // indicates unipolar ranges -static int labpc_plus_is_unipolar[NUM_LABPC_PLUS_AI_RANGES] = +static const int labpc_plus_is_unipolar[NUM_LABPC_PLUS_AI_RANGES] = { 0, 0, @@ -219,7 +219,7 @@ static int labpc_plus_is_unipolar[NUM_LABPC_PLUS_AI_RANGES] = 1, }; // map range index to gain bits -static int labpc_plus_ai_gain_bits[NUM_LABPC_PLUS_AI_RANGES] = +static const int labpc_plus_ai_gain_bits[NUM_LABPC_PLUS_AI_RANGES] = { 0x00, 0x10, @@ -238,7 +238,7 @@ static int labpc_plus_ai_gain_bits[NUM_LABPC_PLUS_AI_RANGES] = 0x60, 0x70, }; -static comedi_lrange range_labpc_plus_ai = { +static const comedi_lrange range_labpc_plus_ai = { NUM_LABPC_PLUS_AI_RANGES, { BIP_RANGE(5), @@ -262,7 +262,7 @@ static comedi_lrange range_labpc_plus_ai = { #define NUM_LABPC_1200_AI_RANGES 14 // indicates unipolar ranges -static int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES] = +static const int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES] = { 0, 0, @@ -280,7 +280,7 @@ static int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES] = 1, }; // map range index to gain bits -static int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES] = +static const int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES] = { 0x00, 0x20, @@ -297,7 +297,7 @@ static int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES] = 0x60, 0x70, }; -static comedi_lrange range_labpc_1200_ai = { +static const comedi_lrange range_labpc_1200_ai = { NUM_LABPC_1200_AI_RANGES, { BIP_RANGE(5), @@ -319,7 +319,7 @@ static comedi_lrange range_labpc_1200_ai = { //analog output ranges #define AO_RANGE_IS_UNIPOLAR 0x1 -comedi_lrange range_labpc_ao = { +static const comedi_lrange range_labpc_ao = { 2, { BIP_RANGE(5), @@ -346,7 +346,7 @@ static inline void labpc_writeb(unsigned int byte, unsigned long address) writeb(byte, (void*) address); } -static labpc_board labpc_boards[] = +static const labpc_board labpc_boards[] = { { name: "lab-pc-1200", @@ -399,7 +399,7 @@ static labpc_board labpc_boards[] = }, }; -labpc_board labpc_cs_boards[NUM_LABPC_CS_BOARDS] = +const labpc_board labpc_cs_boards[NUM_LABPC_CS_BOARDS] = { { name: "daqcard-1200", diff --git a/comedi/drivers/ni_labpc.h b/comedi/drivers/ni_labpc.h index 59a10bda..7c7aa9cf 100644 --- a/comedi/drivers/ni_labpc.h +++ b/comedi/drivers/ni_labpc.h @@ -38,9 +38,9 @@ typedef struct labpc_board_struct{ enum labpc_bustype bustype; // ISA/PCI/etc. enum labpc_register_layout register_layout; // 1200 has extra registers compared to pc+ int has_ao; // has analog output true/false - comedi_lrange *ai_range_table; - int *ai_range_code; - int *ai_range_is_unipolar; + const comedi_lrange *ai_range_table; + const int *ai_range_code; + const int *ai_range_is_unipolar; unsigned ai_scan_up : 1; // board can auto scan up in ai channels, not just down unsigned memory_mapped_io : 1; /* uses memory mapped io instead of ioports */ }labpc_board; @@ -74,7 +74,7 @@ typedef struct{ }labpc_private; #define NUM_LABPC_CS_BOARDS 2 -extern labpc_board labpc_cs_boards[NUM_LABPC_CS_BOARDS]; +extern const labpc_board labpc_cs_boards[NUM_LABPC_CS_BOARDS]; int labpc_common_attach( comedi_device *dev, unsigned long iobase, unsigned int irq, unsigned int dma ); diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index 3128285f..8b387356 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -94,7 +94,7 @@ static int labpc_attach(comedi_device *dev,comedi_devconfig *it); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((labpc_board *)dev->board_ptr) +#define thisboard ((const labpc_board *)dev->board_ptr) static comedi_driver driver_labpc_cs = { @@ -145,7 +145,7 @@ static int labpc_attach(comedi_device *dev, comedi_devconfig *it) static int pc_debug = PCMCIA_DEBUG; module_param(pc_debug, int, 0644); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +static const char *version = "ni_labpc.c, based on dummy_cs.c 1.31 2001/08/24 12:13:13"; #else #define DEBUG(n, args...) @@ -192,7 +192,7 @@ static void labpc_cs_detach(struct pcmcia_device *); database. */ -static dev_info_t dev_info = "daqcard-1200"; +static const dev_info_t dev_info = "daqcard-1200"; /* A dev_link_t structure has fields for most things that are needed diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index a3011e74..0e002c0a 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -74,7 +74,7 @@ static const unsigned old_RTSI_clock_channel = 7; /* Note: this table must match the ai_gain_* definitions */ -static short ni_gainlkup[][16]={ +static const short ni_gainlkup[][16]={ /* ai_gain_16 */ { 0, 1, 2, 3, 4, 5, 6, 7, 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }, @@ -95,7 +95,7 @@ static short ni_gainlkup[][16]={ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, }; -static comedi_lrange range_ni_E_ai={ 16, { +static const comedi_lrange range_ni_E_ai={ 16, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2.5, 2.5 ), @@ -113,7 +113,7 @@ static comedi_lrange range_ni_E_ai={ 16, { RANGE( 0, 0.2 ), RANGE( 0, 0.1 ), }}; -static comedi_lrange range_ni_E_ai_limited={ 8, { +static const comedi_lrange range_ni_E_ai_limited={ 8, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -1, 1 ), @@ -123,7 +123,7 @@ static comedi_lrange range_ni_E_ai_limited={ 8, { RANGE( 0, 1 ), RANGE( 0, 0.1 ), }}; -static comedi_lrange range_ni_E_ai_limited14={ 14, { +static const comedi_lrange range_ni_E_ai_limited14={ 14, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2, 2 ), @@ -139,13 +139,13 @@ static comedi_lrange range_ni_E_ai_limited14={ 14, { RANGE( 0, 0.2 ), RANGE( 0, 0.1 ), }}; -static comedi_lrange range_ni_E_ai_bipolar4={ 4, { +static const comedi_lrange range_ni_E_ai_bipolar4={ 4, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -0.5, 0.5 ), RANGE( -0.05, 0.05 ), }}; -static comedi_lrange range_ni_E_ai_611x={ 8, { +static const comedi_lrange range_ni_E_ai_611x={ 8, { RANGE( -50, 50 ), RANGE( -20, 20 ), RANGE( -10, 10 ), @@ -155,13 +155,13 @@ static comedi_lrange range_ni_E_ai_611x={ 8, { RANGE( -0.5, 0.5 ), RANGE( -0.2, 0.2 ), }}; -static comedi_lrange range_ni_M_ai_622x={ 4, { +static const comedi_lrange range_ni_M_ai_622x={ 4, { RANGE(-10, 10), RANGE(-5, 5), RANGE(-1, 1), RANGE(-0.2, 0.2), }}; -static comedi_lrange range_ni_M_ai_628x={ 7, { +static const comedi_lrange range_ni_M_ai_628x={ 7, { RANGE( -10, 10 ), RANGE( -5, 5 ), RANGE( -2, 2 ), @@ -170,17 +170,17 @@ static comedi_lrange range_ni_M_ai_628x={ 7, { RANGE( -0.2, 0.2 ), RANGE( -0.1, 0.1 ), }}; -static comedi_lrange range_ni_S_ai_6143 = { 1, { +static const comedi_lrange range_ni_S_ai_6143 = { 1, { RANGE( -5, +5 ), }}; -static comedi_lrange range_ni_E_ao_ext = { 4, { +static const comedi_lrange range_ni_E_ao_ext = { 4, { RANGE( -10, 10 ), RANGE( 0, 10 ), RANGE_ext( -1, 1 ), RANGE_ext( 0, 1 ), }}; -static comedi_lrange *ni_range_lkup[]={ +static const comedi_lrange * const ni_range_lkup[]={ &range_ni_E_ai, &range_ni_E_ai_limited, &range_ni_E_ai_limited14, @@ -1021,7 +1021,7 @@ static void handle_b_interrupt(comedi_device *dev, unsigned short b_status, } #ifdef DEBUG_STATUS_A -static char *status_a_strings[]={ +static const char * const status_a_strings[]={ "passthru0","fifo","G0_gate","G0_TC", "stop","start","sc_tc","start1", "start2","sc_tc_error","overflow","overrun", @@ -1043,7 +1043,7 @@ static void ni_mio_print_status_a(int status) #endif #ifdef DEBUG_STATUS_B -static char *status_b_strings[]={ +static const char * const status_b_strings[]={ "passthru1","fifo","G1_gate","G1_TC", "UI2_TC","UPDATE","UC_TC","BC_TC", "start1","overrun","start","bc_tc_error", @@ -2571,7 +2571,7 @@ static int ni_m_series_ao_config_chanlist(comedi_device *dev, comedi_subdevice * } for(i=0;irange_table->range + range; @@ -4119,16 +4119,17 @@ static void caldac_setup(comedi_device *dev,comedi_subdevice *s) s->n_chan=n_chans; if(diffbits){ + unsigned int *maxdata_list; if(n_chans>MAX_N_CALDACS){ printk("BUG! MAX_N_CALDACS too small\n"); } - s->maxdata_list=devpriv->caldac_maxdata_list; + s->maxdata_list=maxdata_list=devpriv->caldac_maxdata_list; chan=0; for(i=0;imaxdata_list[chan]= + maxdata_list[chan]= (1<board_ptr) +#define this_board ((const nidio_board *)dev->board_ptr) static struct pci_device_id ni_pcidio_pci_table[] __devinitdata = { { PCI_VENDOR_ID_NATINST, 0x1150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, @@ -614,7 +614,7 @@ out: } #ifdef DEBUG_FLAGS -static char *flags_strings[] = { +static const char * const flags_strings[] = { "TransferReady", "CountExpired", "2", "3", "4", "Waited", "PrimaryTC", "SecondaryTC", }; diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index 55ea61a1..e914bbe0 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -190,7 +190,7 @@ MODULE_DEVICE_TABLE(pci, ni_pci_table); 63 different possibilities. An AO channel can not act as it's own OFFSET or REFERENCE. */ -static comedi_lrange range_ni_M_628x_ao = { 8, { +static const comedi_lrange range_ni_M_628x_ao = { 8, { RANGE(-10, 10), RANGE(-5, 5), RANGE(-2, 2), @@ -201,16 +201,16 @@ static comedi_lrange range_ni_M_628x_ao = { 8, { RANGE(4, 6), RANGE_ext(-1, 1) }}; -static comedi_lrange range_ni_M_625x_ao = { 3, { +static const comedi_lrange range_ni_M_625x_ao = { 3, { RANGE(-10, 10), RANGE(-5, 5), RANGE_ext(-1, 1) }}; -static comedi_lrange range_ni_M_622x_ao = { 1, { +static const comedi_lrange range_ni_M_622x_ao = { 1, { RANGE(-10, 10), }}; -static ni_board ni_boards[]={ +static const ni_board ni_boards[]={ { device_id: 0x0162, // NI also says 0x1620. typo? name: "pci-mio-16xe-50", n_adchan: 16, diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index ace806e6..1579c9e1 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -923,7 +923,7 @@ enum ni_reg_type { ni_reg_6143 = 0x20 }; -static comedi_lrange range_ni_E_ao_ext; +static const comedi_lrange range_ni_E_ao_ext; enum m_series_register_offsets { @@ -1313,7 +1313,7 @@ typedef struct ni_board_struct{ int n_aochan; int aobits; int ao_fifo_depth; - comedi_lrange *ao_range_table; + const comedi_lrange *ao_range_table; unsigned ao_speed; unsigned num_p0_dio_channels; @@ -1326,7 +1326,6 @@ typedef struct ni_board_struct{ enum caldac_enum caldac[3]; }ni_board; -static ni_board ni_boards[]; #define n_ni_boards (sizeof(ni_boards)/sizeof(ni_board)) #define boardtype (*(ni_board *)dev->board_ptr) diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index 53cd0c51..70c0961a 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -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 ), @@ -129,7 +129,7 @@ static comedi_lrange range_acl8112dg_ai = { 9, { #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 { const char *name; @@ -140,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}, @@ -151,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); diff --git a/comedi/drivers/pcl724.c b/comedi/drivers/pcl724.c index c26127a1..82470b5e 100644 --- a/comedi/drivers/pcl724.c +++ b/comedi/drivers/pcl724.c @@ -69,7 +69,7 @@ typedef struct { char is_pet48; } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pcl724", 24, 1, 0x00fc, PCL724_SIZE, 0, 0, }, {"pcl722", 144, 6, 0x00fc, PCL722_SIZE, 1, 0, }, @@ -80,7 +80,7 @@ static boardtype boardtypes[] = }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_pcl724={ driver_name: "pcl724", diff --git a/comedi/drivers/pcl726.c b/comedi/drivers/pcl726.c index d9d6c24f..8a917582 100644 --- a/comedi/drivers/pcl726.c +++ b/comedi/drivers/pcl726.c @@ -92,22 +92,22 @@ Interrupts are not supported. #define PCL727_DI_HI 0 #define PCL727_DI_LO 1 -static comedi_lrange range_4_20mA={ 1, {RANGE_mA(4,20)}}; -static comedi_lrange range_0_20mA={ 1, {RANGE_mA(0,20)}}; +static const comedi_lrange range_4_20mA={ 1, {RANGE_mA(4,20)}}; +static const comedi_lrange range_0_20mA={ 1, {RANGE_mA(0,20)}}; -static comedi_lrange *rangelist_726[]={ +static const comedi_lrange * const rangelist_726[]={ &range_unipolar5, &range_unipolar10, &range_bipolar5, &range_bipolar10, &range_4_20mA, &range_unknown }; -static comedi_lrange *rangelist_727[]={ +static const comedi_lrange * const rangelist_727[]={ &range_unipolar5, &range_unipolar10, &range_bipolar5, &range_4_20mA }; -static comedi_lrange *rangelist_728[]={ +static const comedi_lrange * const rangelist_728[]={ &range_unipolar5, &range_unipolar10, &range_bipolar5, &range_bipolar10, &range_4_20mA, &range_0_20mA @@ -127,10 +127,10 @@ typedef struct { int di_lo; int do_hi; int do_lo; - comedi_lrange **range_type_list;// list of supported ranges + const comedi_lrange * const *range_type_list;// list of supported ranges } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pcl726", 6, 6, 0x0000, PCL726_SIZE, 1, PCL726_DI_HI, PCL726_DI_LO, PCL726_DO_HI, PCL726_DO_LO, @@ -149,7 +149,7 @@ static boardtype boardtypes[] = &rangelist_728[0], }, }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_pcl726={ driver_name: "pcl726", @@ -164,7 +164,7 @@ COMEDI_INITCLEANUP(driver_pcl726); typedef struct{ int bipolar[12]; - comedi_lrange *rangelist[12]; + const comedi_lrange *rangelist[12]; lsampl_t ao_readback[12]; }pcl726_private; #define devpriv ((pcl726_private *)dev->private) diff --git a/comedi/drivers/pcl730.c b/comedi/drivers/pcl730.c index 94ca5d60..ef868e48 100644 --- a/comedi/drivers/pcl730.c +++ b/comedi/drivers/pcl730.c @@ -33,14 +33,14 @@ typedef struct { unsigned int io_range; // len of I/O space } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { { "pcl730", PCL730_SIZE, }, { "iso730", PCL730_SIZE, }, { "acl7130", ACL7130_SIZE, }, }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_pcl730 = { driver_name: "pcl730", diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index 0b7b5a91..d0e847bc 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -164,90 +164,90 @@ See the head of the source file pcl812.c for configuration options. #define MAX_CHANLIST_LEN 256 /* length of scan list */ -static comedi_lrange range_pcl812pg_ai = { 5, { +static const comedi_lrange range_pcl812pg_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_pcl812pg2_ai = { 5, { +static const comedi_lrange range_pcl812pg2_ai = { 5, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), BIP_RANGE(0.625), }}; -static comedi_lrange range812_bipolar1_25 = { 1, { +static const comedi_lrange range812_bipolar1_25 = { 1, { BIP_RANGE(1.25), }}; -static comedi_lrange range812_bipolar0_625 = { 1, { +static const comedi_lrange range812_bipolar0_625 = { 1, { BIP_RANGE(0.625), }}; -static comedi_lrange range812_bipolar0_3125 = { 1, { +static const comedi_lrange range812_bipolar0_3125 = { 1, { BIP_RANGE(0.3125), }}; -static comedi_lrange range_pcl813b_ai = { 4, { +static const comedi_lrange range_pcl813b_ai = { 4, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), BIP_RANGE(0.625), }}; -static comedi_lrange range_pcl813b2_ai = { 4, { +static const comedi_lrange range_pcl813b2_ai = { 4, { UNI_RANGE(10), UNI_RANGE(5), UNI_RANGE(2.5), UNI_RANGE(1.25), }}; -static comedi_lrange range_iso813_1_ai = { 5, { +static const comedi_lrange range_iso813_1_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_iso813_1_2_ai = { 5, { +static const comedi_lrange range_iso813_1_2_ai = { 5, { UNI_RANGE(10), UNI_RANGE(5), UNI_RANGE(2.5), UNI_RANGE(1.25), UNI_RANGE(0.625), }}; -static comedi_lrange range_iso813_2_ai = { 4, { +static const comedi_lrange range_iso813_2_ai = { 4, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), BIP_RANGE(0.625), }}; -static comedi_lrange range_iso813_2_2_ai = { 4, { +static const comedi_lrange range_iso813_2_2_ai = { 4, { UNI_RANGE(10), UNI_RANGE(5), UNI_RANGE(2.5), UNI_RANGE(1.25), }}; -static comedi_lrange range_acl8113_1_ai = { 4, { +static const comedi_lrange range_acl8113_1_ai = { 4, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), BIP_RANGE(0.625), }}; -static comedi_lrange range_acl8113_1_2_ai = { 4, { +static const comedi_lrange range_acl8113_1_2_ai = { 4, { UNI_RANGE(10), UNI_RANGE(5), UNI_RANGE(2.5), UNI_RANGE(1.25), }}; -static comedi_lrange range_acl8113_2_ai = { 3, { +static const comedi_lrange range_acl8113_2_ai = { 3, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), }}; -static comedi_lrange range_acl8113_2_2_ai = { 3, { +static const comedi_lrange range_acl8113_2_2_ai = { 3, { UNI_RANGE(10), UNI_RANGE(5), UNI_RANGE(2.5), }}; -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), @@ -258,7 +258,7 @@ static comedi_lrange range_acl8112dg_ai = { 9, { UNI_RANGE(1.25), BIP_RANGE(10), }}; -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), @@ -272,7 +272,7 @@ static comedi_lrange range_acl8112hg_ai = { 12, { BIP_RANGE(0.1), BIP_RANGE(0.01), }}; -static comedi_lrange range_a821pgh_ai = { 4, { +static const comedi_lrange range_a821pgh_ai = { 4, { BIP_RANGE(5), BIP_RANGE(0.5), BIP_RANGE(0.05), @@ -294,15 +294,15 @@ typedef struct { int ai_maxdata; // AI resolution unsigned int ai_ns_min; // max sample speed of card v ns unsigned int i8254_osc_base; // clock base - comedi_lrange *rangelist_ai; // rangelist for A/D - comedi_lrange *rangelist_ao; // rangelist for D/A + const comedi_lrange *rangelist_ai; // rangelist for A/D + const comedi_lrange *rangelist_ao; // rangelist for D/A unsigned int IRQbits; // allowed IRQ unsigned char DMAbits; // allowed DMA chans unsigned char io_range; // iorange for this board unsigned char haveMPC508; // 1=board use MPC508A multiplexor } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pcl812", boardPCL812, 16, 0, 2, 16, 16, 0x0fff, 33000, 500, &range_bipolar10, &range_unipolar5, @@ -361,7 +361,7 @@ static boardtype boardtypes[] = }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_pcl812={ driver_name: "pcl812", diff --git a/comedi/drivers/pcl816.c b/comedi/drivers/pcl816.c index 2ee3c1a0..ad23dab5 100644 --- a/comedi/drivers/pcl816.c +++ b/comedi/drivers/pcl816.c @@ -93,7 +93,7 @@ Configuration Options: #define MAGIC_DMA_WORD 0x5a5a -static comedi_lrange range_pcl816 = { 8, { +static const comedi_lrange range_pcl816 = { 8, { BIP_RANGE (10), BIP_RANGE (5), BIP_RANGE (2.5), @@ -112,8 +112,8 @@ typedef struct { int n_aochan; // num of D/A chans int n_dichan; // num of DI chans int n_dochan; // num of DO chans - comedi_lrange *ai_range_type; // default A/D rangelist - comedi_lrange *ao_range_type; // dafault D/A rangelist + const comedi_lrange *ai_range_type; // default A/D rangelist + const comedi_lrange *ao_range_type; // dafault D/A rangelist unsigned int io_range; // len of IO space unsigned int IRQbits; // allowed interrupts unsigned int DMAbits; // allowed DMA chans @@ -125,7 +125,7 @@ typedef struct { } boardtype; -static boardtype boardtypes[] = { +static const boardtype boardtypes[] = { {"pcl816", 8, 16, 10000, 1, 16, 16, &range_pcl816, &range_pcl816, PCLx1x_RANGE, 0x00fc, // IRQ mask @@ -148,7 +148,7 @@ static boardtype boardtypes[] = { #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) #define devpriv ((pcl816_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static int pcl816_attach (comedi_device * dev, comedi_devconfig * it); static int pcl816_detach (comedi_device * dev); diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index 5f890161..c137bfd6 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -194,7 +194,7 @@ A word or two about DMA. Driver support DMA operations at two ways: #define MAGIC_DMA_WORD 0x5a5a -static comedi_lrange range_pcl818h_ai = { 9, { +static const comedi_lrange range_pcl818h_ai = { 9, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), @@ -206,7 +206,7 @@ static comedi_lrange range_pcl818h_ai = { 9, { BIP_RANGE(10), }}; -static comedi_lrange range_pcl818hg_ai = { 10, { +static const comedi_lrange range_pcl818hg_ai = { 10, { BIP_RANGE(5), BIP_RANGE(0.5), BIP_RANGE(0.05), @@ -221,24 +221,24 @@ static comedi_lrange range_pcl818hg_ai = { 10, { BIP_RANGE(0.01), }}; -static comedi_lrange range_pcl818l_l_ai = { 4, { +static const comedi_lrange range_pcl818l_l_ai = { 4, { BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), BIP_RANGE(0.625), }}; -static comedi_lrange range_pcl818l_h_ai = { 4, { +static const comedi_lrange range_pcl818l_h_ai = { 4, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), BIP_RANGE(1.25), }}; -static comedi_lrange range718_bipolar1 = { 1, { BIP_RANGE(1), }}; -static comedi_lrange range718_bipolar0_5 = { 1, { BIP_RANGE(0.5), }}; -static comedi_lrange range718_unipolar2 = { 1, { UNI_RANGE(2), }}; -static comedi_lrange range718_unipolar1 = { 1, { BIP_RANGE(1), }}; +static const comedi_lrange range718_bipolar1 = { 1, { BIP_RANGE(1), }}; +static const comedi_lrange range718_bipolar0_5 = { 1, { BIP_RANGE(0.5), }}; +static const comedi_lrange range718_unipolar2 = { 1, { UNI_RANGE(2), }}; +static const comedi_lrange range718_unipolar1 = { 1, { BIP_RANGE(1), }}; static int pcl818_attach(comedi_device *dev,comedi_devconfig *it); static int pcl818_detach(comedi_device *dev); @@ -257,8 +257,8 @@ typedef struct { int n_aochan; // num of D/A chans int n_dichan; // num of DI chans int n_dochan; // num of DO chans - comedi_lrange *ai_range_type; // default A/D rangelist - comedi_lrange *ao_range_type; // default D/A rangelist + const comedi_lrange *ai_range_type; // default A/D rangelist + const comedi_lrange *ao_range_type; // default D/A rangelist unsigned int io_range; // len of IO space unsigned int IRQbits; // allowed interrupts unsigned int DMAbits; // allowed DMA chans @@ -268,7 +268,7 @@ typedef struct { int is_818; } boardtype; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pcl818l", 4, 16, 8, 25000, 1, 16, 16, &range_pcl818l_l_ai, &range_unipolar5, PCLx1x_RANGE, 0x00fc, 0x0a, 0xfff, 0xfff, 0, 1 }, @@ -349,11 +349,11 @@ typedef struct { } pcl818_private; -static unsigned int muxonechan[] ={ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // used for gain list programming +static const unsigned int muxonechan[] ={ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // used for gain list programming 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; #define devpriv ((pcl818_private *)dev->private) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) /* ============================================================================== diff --git a/comedi/drivers/pcm3724.c b/comedi/drivers/pcm3724.c index ddbdf547..0e1475a0 100644 --- a/comedi/drivers/pcm3724.c +++ b/comedi/drivers/pcm3724.c @@ -78,13 +78,13 @@ typedef struct { int dio_1; int dio_2; } priv_pcm3724; -static boardtype boardtypes[] = +static const boardtype boardtypes[] = { {"pcm3724", 48, 2, 0x00fc, PCM3724_SIZE,}, }; #define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static comedi_driver driver_pcm3724={ driver_name: "pcm3724", diff --git a/comedi/drivers/pcmad.c b/comedi/drivers/pcmad.c index 53bbfc9b..96e09c1b 100644 --- a/comedi/drivers/pcmad.c +++ b/comedi/drivers/pcmad.c @@ -58,7 +58,7 @@ struct pcmad_board_struct{ const char *name; int n_ai_bits; }; -static struct pcmad_board_struct pcmad_boards[]={ +static const struct pcmad_board_struct pcmad_boards[]={ { name: "pcmad12", n_ai_bits: 12, @@ -68,7 +68,7 @@ static struct pcmad_board_struct pcmad_boards[]={ n_ai_bits: 16, }, }; -#define this_board ((struct pcmad_board_struct *)(dev->board_ptr)) +#define this_board ((const struct pcmad_board_struct *)(dev->board_ptr)) #define n_pcmad_boards (sizeof(pcmad_boards)/sizeof(pcmad_boards[0])) struct pcmad_priv_struct{ diff --git a/comedi/drivers/pcmda12.c b/comedi/drivers/pcmda12.c index 464211e8..c51f0627 100644 --- a/comedi/drivers/pcmda12.c +++ b/comedi/drivers/pcmda12.c @@ -71,12 +71,12 @@ Configuration Options: */ typedef struct pcmda12_board_struct { - const char * const name; + const char *name; } pcmda12_board; /* note these have no effect and are merely here for reference.. these are configured by jumpering the board! */ -static comedi_lrange pcmda12_ranges = +static const comedi_lrange pcmda12_ranges = { 3, { @@ -84,7 +84,7 @@ static comedi_lrange pcmda12_ranges = } }; -static pcmda12_board pcmda12_boards[] = +static const pcmda12_board pcmda12_boards[] = { { name: "pcmda12", @@ -94,7 +94,7 @@ static pcmda12_board pcmda12_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((pcmda12_board *)dev->board_ptr) +#define thisboard ((const pcmda12_board *)dev->board_ptr) typedef struct { diff --git a/comedi/drivers/pcmmio.c b/comedi/drivers/pcmmio.c index 7b58cc3e..58d42cd7 100644 --- a/comedi/drivers/pcmmio.c +++ b/comedi/drivers/pcmmio.c @@ -153,7 +153,7 @@ static int ao_winsn(comedi_device *, comedi_subdevice *, comedi_insn *, lsampl_t */ typedef struct pcmmio_board_struct { - const char * const name; + const char *name; const int dio_num_asics; const int dio_num_ports; const int total_iosize; @@ -161,21 +161,17 @@ typedef struct pcmmio_board_struct const int ao_bits; const int n_ai_chans; const int n_ao_chans; - comedi_lrange *ai_range_table, *ao_range_table; + const comedi_lrange *ai_range_table, *ao_range_table; comedi_insn_fn_t ai_rinsn, ao_rinsn, ao_winsn; } pcmmio_board; -static struct { - int length; - comedi_krange ranges[4]; -} ranges_ai = { 4, { RANGE(-5.,5.), RANGE(-10.,10.), RANGE(0.,5.), RANGE(0.,10.) } }; +static const comedi_lrange ranges_ai = +{ 4, { RANGE(-5.,5.), RANGE(-10.,10.), RANGE(0.,5.), RANGE(0.,10.) } }; -static struct { - int length; - comedi_krange ranges[6]; -} ranges_ao = { 6, { RANGE(0.,5.), RANGE(0.,10.) , RANGE(-5.,5.), RANGE(-10.,10.), RANGE(-2.5, 2.5), RANGE(-2.5, 7.5) } }; +static const comedi_lrange ranges_ao = +{ 6, { RANGE(0.,5.), RANGE(0.,10.) , RANGE(-5.,5.), RANGE(-10.,10.), RANGE(-2.5, 2.5), RANGE(-2.5, 7.5) } }; -static pcmmio_board pcmmio_boards[] = +static const pcmmio_board pcmmio_boards[] = { { name: "pcmmio", @@ -186,8 +182,8 @@ static pcmmio_board pcmmio_boards[] = ao_bits: 16, n_ai_chans: 16, n_ao_chans: 8, - ai_range_table: (comedi_lrange *)&ranges_ai, - ao_range_table: (comedi_lrange *)&ranges_ao, + ai_range_table: &ranges_ai, + ao_range_table: &ranges_ao, ai_rinsn: ai_rinsn, ao_rinsn: ao_rinsn, ao_winsn: ao_winsn @@ -197,7 +193,7 @@ static pcmmio_board pcmmio_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((pcmmio_board *)dev->board_ptr) +#define thisboard ((const pcmmio_board *)dev->board_ptr) /* this structure is for data unique to this subdevice. */ typedef struct diff --git a/comedi/drivers/pcmuio.c b/comedi/drivers/pcmuio.c index 58ef5d21..d36e6b8b 100644 --- a/comedi/drivers/pcmuio.c +++ b/comedi/drivers/pcmuio.c @@ -149,13 +149,13 @@ Configuration Options: */ typedef struct pcmuio_board_struct { - const char * const name; + const char *name; const int num_asics; const int num_channels_per_port; const int num_ports; } pcmuio_board; -static pcmuio_board pcmuio_boards[] = +static const pcmuio_board pcmuio_boards[] = { { name: "pcmuio48", @@ -172,7 +172,7 @@ static pcmuio_board pcmuio_boards[] = /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((pcmuio_board *)dev->board_ptr) +#define thisboard ((const pcmuio_board *)dev->board_ptr) /* this structure is for data unique to this subdevice. */ typedef struct diff --git a/comedi/drivers/poc.c b/comedi/drivers/poc.c index 712e9712..bd7ad8b5 100644 --- a/comedi/drivers/poc.c +++ b/comedi/drivers/poc.c @@ -61,9 +61,9 @@ struct boarddef_struct{ int (*winsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *); int (*rinsn)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *); int (*insnbits)(comedi_device *,comedi_subdevice *,comedi_insn *,lsampl_t *); - comedi_lrange* range; + const comedi_lrange *range; }; -static struct boarddef_struct boards[]={ +static const struct boarddef_struct boards[]={ { name: "dac02", iosize: 8, @@ -95,7 +95,7 @@ static struct boarddef_struct boards[]={ }, }; #define n_boards (sizeof(boards)/sizeof(boards[0])) -#define this_board ((struct boarddef_struct *)dev->board_ptr) +#define this_board ((const struct boarddef_struct *)dev->board_ptr) static comedi_driver driver_poc= { diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index 615a7544..ada97c20 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -233,14 +233,14 @@ static local_info_t *dev_table[MAX_DEV] = { NULL, /* ... */ }; * +/- 1.25V, and the D/A converter has only one: +/- 5V. */ -static comedi_lrange range_daqp_ai = { 4, { +static const comedi_lrange range_daqp_ai = { 4, { BIP_RANGE( 10 ), BIP_RANGE( 5 ), BIP_RANGE( 2.5 ), BIP_RANGE( 1.25 ) }}; -static comedi_lrange range_daqp_ao = { 1, {BIP_RANGE(5)}}; +static const comedi_lrange range_daqp_ao = { 1, {BIP_RANGE(5)}}; /*====================================================================*/ @@ -1063,7 +1063,7 @@ static void daqp_cs_detach(struct pcmcia_device *); database. */ -static dev_info_t dev_info = "quatech_daqp_cs"; +static const dev_info_t dev_info = "quatech_daqp_cs"; /*====================================================================== diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index 03f15b98..8e3eb037 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -197,7 +197,7 @@ Configuration options: /* The board has 3 input modes and the gains of 1,2,4,...32 (, 64, 128) */ -static comedi_lrange rtd_ai_7520_range = { 18, { +static const comedi_lrange rtd_ai_7520_range = { 18, { /* +-5V input range gain steps */ BIP_RANGE(5.0), BIP_RANGE(5.0/2), @@ -223,7 +223,7 @@ static comedi_lrange rtd_ai_7520_range = { 18, { }}; /* PCI4520 has two more gains (6 more entries) */ -static comedi_lrange rtd_ai_4520_range = { 24, { +static const comedi_lrange rtd_ai_4520_range = { 24, { /* +-5V input range gain steps */ BIP_RANGE(5.0), BIP_RANGE(5.0/2), @@ -254,7 +254,7 @@ static comedi_lrange rtd_ai_4520_range = { 24, { }}; /* Table order matches range values */ -static comedi_lrange rtd_ao_range = { 4, { +static const comedi_lrange rtd_ao_range = { 4, { RANGE(0, 5), RANGE(0, 10), RANGE(-5, 5), @@ -275,7 +275,7 @@ typedef struct rtdBoard_struct{ int rangeUniStart; /* start of +10V range */ } rtdBoard; -static rtdBoard rtd520Boards[] = { +static const rtdBoard rtd520Boards[] = { { name: "DM7520", device_id: 0x7520, @@ -328,7 +328,7 @@ MODULE_DEVICE_TABLE(pci, rtd520_pci_table); /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((rtdBoard *)dev->board_ptr) +#define thisboard ((const rtdBoard *)dev->board_ptr) /* This structure is for data unique to this hardware driver. diff --git a/comedi/drivers/rti800.c b/comedi/drivers/rti800.c index 7b500a87..2ad6ad0f 100644 --- a/comedi/drivers/rti800.c +++ b/comedi/drivers/rti800.c @@ -97,19 +97,19 @@ Configuration options: #include "am9513.h" -static comedi_lrange range_rti800_ai_10_bipolar = { 4, { +static const comedi_lrange range_rti800_ai_10_bipolar = { 4, { BIP_RANGE( 10 ), BIP_RANGE( 1 ), BIP_RANGE( 0.1 ), BIP_RANGE( 0.02 ) }}; -static comedi_lrange range_rti800_ai_5_bipolar = { 4, { +static const comedi_lrange range_rti800_ai_5_bipolar = { 4, { BIP_RANGE( 5 ), BIP_RANGE( 0.5 ), BIP_RANGE( 0.05 ), BIP_RANGE( 0.01 ) }}; -static comedi_lrange range_rti800_ai_unipolar = { 4, { +static const comedi_lrange range_rti800_ai_unipolar = { 4, { UNI_RANGE( 10 ), UNI_RANGE( 1 ), UNI_RANGE( 0.1 ), @@ -120,11 +120,11 @@ typedef struct{ const char *name; int has_ao; }boardtype; -static boardtype boardtypes[]={ +static const boardtype boardtypes[]={ { "rti800", 0 }, { "rti815", 1 }, }; -#define this_board ((boardtype *)dev->board_ptr) +#define this_board ((const boardtype *)dev->board_ptr) static int rti800_attach(comedi_device *dev,comedi_devconfig *it); static int rti800_detach(comedi_device *dev); @@ -157,7 +157,7 @@ typedef struct { enum { dac_2comp, dac_straight } dac0_coding, dac1_coding; - comedi_lrange * ao_range_type_list[2]; + const comedi_lrange * ao_range_type_list[2]; lsampl_t ao_readback[2]; int muxgain_bits; } rti800_private; @@ -172,7 +172,7 @@ static irqreturn_t rti800_interrupt(int irq, void *dev PT_REGS_ARG) } // settling delay times in usec for different gains -static int gaindelay[]={10,20,40,80}; +static const int gaindelay[]={10,20,40,80}; static int rti800_ai_insn_read(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) diff --git a/comedi/drivers/rti802.c b/comedi/drivers/rti802.c index 782c5e70..a26cc11d 100644 --- a/comedi/drivers/rti802.c +++ b/comedi/drivers/rti802.c @@ -62,7 +62,7 @@ typedef struct { enum { dac_2comp, dac_straight } dac_coding[8]; - comedi_lrange * range_type_list[8]; + const comedi_lrange * range_type_list[8]; lsampl_t ao_readback[8]; } rti802_private; diff --git a/comedi/drivers/s526.c b/comedi/drivers/s526.c index a6a9c09f..44f82545 100644 --- a/comedi/drivers/s526.c +++ b/comedi/drivers/s526.c @@ -177,7 +177,7 @@ typedef struct s526_board_struct{ int have_dio; }s526_board; -static s526_board s526_boards[] = { +static const s526_board s526_boards[] = { { name: "s526", gpct_chans: 4, @@ -196,7 +196,7 @@ static s526_board s526_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((s526_board *)dev->board_ptr) +#define thisboard ((const s526_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/s626.c b/comedi/drivers/s626.c index 506fa899..69e4ed9f 100644 --- a/comedi/drivers/s626.c +++ b/comedi/drivers/s626.c @@ -77,7 +77,7 @@ MODULE_DESCRIPTION("Sensoray 626 Comedi driver module"); MODULE_LICENSE("GPL"); typedef struct s626_board_struct{ - char *name; + const char *name; int ai_chans; int ai_bits; int ao_chans; @@ -87,7 +87,7 @@ typedef struct s626_board_struct{ int enc_chans; } s626_board; -static s626_board s626_boards[] = { +static const s626_board s626_boards[] = { { name: "s626", ai_chans: S626_ADC_CHANNELS, @@ -100,7 +100,7 @@ static s626_board s626_boards[] = { } }; -#define thisboard ((s626_board *)dev->board_ptr) +#define thisboard ((const s626_board *)dev->board_ptr) #define PCI_VENDOR_ID_S626 0x1131 #define PCI_DEVICE_ID_S626 0x7146 @@ -464,7 +464,7 @@ static enc_private enc_private_data[]={ #define I2C_B1(ATTR,VAL) ( ( (ATTR) << 4 ) | ( (VAL) << 16 ) ) #define I2C_B0(ATTR,VAL) ( ( (ATTR) << 2 ) | ( (VAL) << 8 ) ) -static comedi_lrange s626_range_table={ 2,{ +static const comedi_lrange s626_range_table={ 2,{ RANGE(-5 , 5), RANGE(-10, 10), }}; diff --git a/comedi/drivers/serial2002.c b/comedi/drivers/serial2002.c index 1e27c38e..f46da7a1 100644 --- a/comedi/drivers/serial2002.c +++ b/comedi/drivers/serial2002.c @@ -50,7 +50,7 @@ typedef struct serial2002_board_struct { const char *name; } serial2002_board; -serial2002_board serial2002_boards[] = { +static const serial2002_board serial2002_boards[] = { { name: "serial2002" } @@ -58,7 +58,7 @@ serial2002_board serial2002_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((serial2002_board *)dev->board_ptr) +#define thisboard ((const serial2002_board *)dev->board_ptr) typedef struct { // HACK... @@ -434,6 +434,8 @@ static void serial_2002_open(comedi_device *dev) { } if (c) { comedi_subdevice *s; + const comedi_lrange **range_table_list = NULL; + unsigned int *maxdata_list; int j, chan; for (chan = 0, j = 0 ; j < 32 ; j++) { @@ -443,11 +445,12 @@ static void serial_2002_open(comedi_device *dev) { s->n_chan = chan; s->maxdata = 0; if (s->maxdata_list) { kfree(s->maxdata_list); } - s->maxdata_list = kmalloc(sizeof(lsampl_t)*s->n_chan, GFP_KERNEL); + s->maxdata_list = maxdata_list = + kmalloc(sizeof(lsampl_t)*s->n_chan, GFP_KERNEL); if (s->range_table_list) { kfree(s->range_table_list); } if (range) { s->range_table = 0; - s->range_table_list = + s->range_table_list = range_table_list = kmalloc(sizeof(serial2002_range_table_t)*s->n_chan, GFP_KERNEL); } for (chan = 0, j = 0 ; j < 32 ; j++) { @@ -457,9 +460,9 @@ static void serial_2002_open(comedi_device *dev) { range[j].length = 1; range[j].range.min = c[j].min; range[j].range.max = c[j].max; - s->range_table_list[chan] = (comedi_lrange*)&range[j]; + range_table_list[chan] = (const comedi_lrange*)&range[j]; } - s->maxdata_list[chan] = ((long long)1<board_ptr) +#define thisboard ((const skel_board *)dev->board_ptr) /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, diff --git a/comedi/drivers/ssv_dnp.c b/comedi/drivers/ssv_dnp.c index 96a1192b..2c2542dd 100644 --- a/comedi/drivers/ssv_dnp.c +++ b/comedi/drivers/ssv_dnp.c @@ -61,7 +61,7 @@ typedef struct dnp_board_struct{ int have_dio; } dnp_board; -static dnp_board dnp_boards[] = { /* we only support one DNP 'board' */ +static const dnp_board dnp_boards[] = { /* we only support one DNP 'board' */ { /* variant at the moment */ name: "dnp-1486", ai_chans: 16, @@ -72,7 +72,7 @@ static dnp_board dnp_boards[] = { /* we only support one DNP 'board /* Useful for shorthand access to the particular board structure ----------- */ -#define thisboard ((dnp_board *)dev->board_ptr) +#define thisboard ((const dnp_board *)dev->board_ptr) /* This structure is for data unique to the DNP driver --------------------- */ diff --git a/comedi/drivers/usbdux.c b/comedi/drivers/usbdux.c index ba2d1a9f..19c7cfe7 100644 --- a/comedi/drivers/usbdux.c +++ b/comedi/drivers/usbdux.c @@ -194,7 +194,7 @@ sampling rate. If you sample two channels you get 4kHz and so on. ///////////////////////////////////////////// // comedi constants -static comedi_lrange range_usbdux_ai_range = { 4, { +static const comedi_lrange range_usbdux_ai_range = { 4, { BIP_RANGE( 4.096 ), BIP_RANGE( 4.096/2 ), UNI_RANGE( 4.096 ), @@ -202,7 +202,7 @@ static comedi_lrange range_usbdux_ai_range = { 4, { } }; -static comedi_lrange range_usbdux_ao_range = { 2, { +static const comedi_lrange range_usbdux_ao_range = { 2, { BIP_RANGE( 4.096 ), UNI_RANGE( 4.096 ), } }; diff --git a/comedi/drivers/usbduxfast.c b/comedi/drivers/usbduxfast.c index fffa3515..cef25c8e 100644 --- a/comedi/drivers/usbduxfast.c +++ b/comedi/drivers/usbduxfast.c @@ -130,7 +130,7 @@ Status: testing ///////////////////////////////////////////// // comedi constants -static comedi_lrange range_usbduxfast_ai_range = { 2, { +static const comedi_lrange range_usbduxfast_ai_range = { 2, { BIP_RANGE( 0.75 ), BIP_RANGE( 0.5 ), } }; diff --git a/comedi/kcomedilib/get.c b/comedi/kcomedilib/get.c index d8f1beec..3c96995c 100644 --- a/comedi/kcomedilib/get.c +++ b/comedi/kcomedilib/get.c @@ -151,7 +151,7 @@ int comedi_get_krange(comedi_t *d,unsigned int subdevice,unsigned int chan,unsig { comedi_device *dev = (comedi_device *)d; comedi_subdevice *s = dev->subdevices + subdevice; - comedi_lrange *lr; + const comedi_lrange *lr; if (s->range_table_list) { lr=s->range_table_list[chan]; diff --git a/comedi/range.c b/comedi/range.c index 34d0aa30..170370f6 100644 --- a/comedi/range.c +++ b/comedi/range.c @@ -25,12 +25,12 @@ #include -comedi_lrange range_bipolar10={ 1, {BIP_RANGE(10)}}; -comedi_lrange range_bipolar5={ 1, {BIP_RANGE(5)}}; -comedi_lrange range_bipolar2_5={ 1, {BIP_RANGE(2.5)}}; -comedi_lrange range_unipolar10={ 1, {UNI_RANGE(10)}}; -comedi_lrange range_unipolar5={ 1, {UNI_RANGE(5)}}; -comedi_lrange range_unknown={ 1, {{0,1000000,UNIT_none}}}; +const comedi_lrange range_bipolar10={ 1, {BIP_RANGE(10)}}; +const comedi_lrange range_bipolar5={ 1, {BIP_RANGE(5)}}; +const comedi_lrange range_bipolar2_5={ 1, {BIP_RANGE(2.5)}}; +const comedi_lrange range_unipolar10={ 1, {UNI_RANGE(10)}}; +const comedi_lrange range_unipolar5={ 1, {UNI_RANGE(5)}}; +const comedi_lrange range_unknown={ 1, {{0,1000000,UNIT_none}}}; /* COMEDI_RANGEINFO @@ -49,7 +49,7 @@ int do_rangeinfo_ioctl(comedi_device *dev, comedi_rangeinfo *arg) { comedi_rangeinfo it; int minor,subd,chan; - comedi_lrange *lr; + const comedi_lrange *lr; comedi_subdevice *s; comedi_device *query_dev; diff --git a/include/linux/comedidev.h b/include/linux/comedidev.h index 7d87a592..718debe6 100644 --- a/include/linux/comedidev.h +++ b/include/linux/comedidev.h @@ -114,15 +114,15 @@ struct comedi_subdevice_struct{ int io_bits; lsampl_t maxdata; /* if maxdata==0, use list */ - lsampl_t *maxdata_list; /* list is channel specific */ + const lsampl_t *maxdata_list; /* list is channel specific */ unsigned int flags; - unsigned int *flaglist; + const unsigned int *flaglist; unsigned int settling_time_0; - comedi_lrange *range_table; - comedi_lrange **range_table_list; + const comedi_lrange *range_table; + const comedi_lrange * const *range_table_list; unsigned int *chanlist; /* driver-owned chanlist (not used) */ @@ -391,12 +391,12 @@ unsigned comedi_get_subdevice_runflags(comedi_subdevice *s); #define BIP_RANGE(a) {-(a)*1e6,(a)*1e6,0} #define UNI_RANGE(a) {0,(a)*1e6,0} -extern comedi_lrange range_bipolar10; -extern comedi_lrange range_bipolar5; -extern comedi_lrange range_bipolar2_5; -extern comedi_lrange range_unipolar10; -extern comedi_lrange range_unipolar5; -extern comedi_lrange range_unknown; +extern const comedi_lrange range_bipolar10; +extern const comedi_lrange range_bipolar5; +extern const comedi_lrange range_bipolar2_5; +extern const comedi_lrange range_unipolar10; +extern const comedi_lrange range_unipolar5; +extern const comedi_lrange range_unknown; #define range_digital range_unipolar5 -- 2.26.2