]> Pileus Git - ~andy/linux/commitdiff
staging:iio: Constify static iio_chan_spec arrays
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 9 Aug 2012 07:51:00 +0000 (08:51 +0100)
committerJonathan Cameron <jic23@kernel.org>
Tue, 14 Aug 2012 19:27:42 +0000 (20:27 +0100)
The per driver iio_chan_spec arrays are usually shared between multiple device
instances. So a single device instance may not modify the iio_chan_spec array
since this would also affect the other device instances. To make this restriction
explicit mark the per driver iio_chan_spec arrays as const.

Conversion was done automatically using the following coccinelle semantic patch:

// <smpl>
@disable optional_qualifier@
identifier channels;
@@
static
+const
struct iio_chan_spec channels[] = ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
22 files changed:
drivers/staging/iio/accel/adis16201_core.c
drivers/staging/iio/accel/adis16203_core.c
drivers/staging/iio/accel/adis16204_core.c
drivers/staging/iio/accel/adis16209_core.c
drivers/staging/iio/accel/adis16240_core.c
drivers/staging/iio/accel/kxsd9.c
drivers/staging/iio/accel/lis3l02dq_core.c
drivers/staging/iio/accel/sca3000_core.c
drivers/staging/iio/adc/ad7192.c
drivers/staging/iio/adc/ad7298_core.c
drivers/staging/iio/adc/ad7606.h
drivers/staging/iio/adc/ad7606_core.c
drivers/staging/iio/adc/lpc32xx_adc.c
drivers/staging/iio/adc/max1363.h
drivers/staging/iio/adc/max1363_core.c
drivers/staging/iio/adc/spear_adc.c
drivers/staging/iio/iio_simple_dummy.c
drivers/staging/iio/impedance-analyzer/ad5933.c
drivers/staging/iio/imu/adis16400_core.c
drivers/staging/iio/meter/ade7758.h
drivers/staging/iio/meter/ade7758_core.c
drivers/staging/iio/resolver/ad2s1210.c

index 204106b72d2418649974cfb91aeae9cc2df693bc..ec2332f568fac86c80a2c21cc31ee3899bb20d7a 100644 (file)
@@ -390,7 +390,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
        return -EINVAL;
 }
 
-static struct iio_chan_spec adis16201_channels[] = {
+static const struct iio_chan_spec adis16201_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index 22085e9dfd16f45e7ba0b55c34dce055fd71656b..34b76c51c78bdf49b8d1384e3ce02ecb8224a8e6 100644 (file)
@@ -355,7 +355,7 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
        }
 }
 
-static struct iio_chan_spec adis16203_channels[] = {
+static const struct iio_chan_spec adis16203_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index 5f2e5f11c5437bb514aed98a2953c85fca6cfc88..02fb101aca93f873ae7f0b33ea18fe408d2c6e92 100644 (file)
@@ -397,7 +397,7 @@ static int adis16204_write_raw(struct iio_dev *indio_dev,
        return -EINVAL;
 }
 
-static struct iio_chan_spec adis16204_channels[] = {
+static const struct iio_chan_spec adis16204_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1, /* Note was not previously indexed */
index 494570508c364d3639474050adbef7ceed673d72..4fa2229d8736ff4281a82abd30c7ce99abb9b34d 100644 (file)
@@ -390,7 +390,7 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
        return -EINVAL;
 }
 
-static struct iio_chan_spec adis16209_channels[] = {
+static const struct iio_chan_spec adis16209_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index b30b7874ffb09f434231bd43a48b5f8a8128e3e2..dafc0d8cbf63107d163d14559ad9eb4b3f1bbcea 100644 (file)
@@ -448,7 +448,7 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
        return -EINVAL;
 }
 
-static struct iio_chan_spec adis16240_channels[] = {
+static const struct iio_chan_spec adis16240_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index 8cf7cd943c90957166637e3a9cde38235f5c7e2a..713469fd2ac02984051b8d1b3984b05cf20f4a8e 100644 (file)
@@ -186,7 +186,7 @@ error_ret:
                .address = KXSD9_REG_##axis,                            \
        }
 
-static struct iio_chan_spec kxsd9_channels[] = {
+static const struct iio_chan_spec kxsd9_channels[] = {
        KXSD9_ACCEL_CHAN(X), KXSD9_ACCEL_CHAN(Y), KXSD9_ACCEL_CHAN(Z),
        {
                .type = IIO_VOLTAGE,
index 9d263484fb869bd4df3a8d3ace8e1e9ae3758d62..0c2b4bae0a9b433c201de489d247e48f50c880ba 100644 (file)
@@ -538,7 +538,7 @@ static irqreturn_t lis3l02dq_event_handler(int irq, void *private)
                .event_mask = LIS3L02DQ_EVENT_MASK,             \
         }
 
-static struct iio_chan_spec lis3l02dq_channels[] = {
+static const struct iio_chan_spec lis3l02dq_channels[] = {
        LIS3L02DQ_CHAN(0, IIO_MOD_X),
        LIS3L02DQ_CHAN(1, IIO_MOD_Y),
        LIS3L02DQ_CHAN(2, IIO_MOD_Z),
index c218d71abf1fcb12a4374864e0c8abf8791afa83..cc040e14adba2c146c4c52fa533cb51bdbb74c27 100644 (file)
@@ -450,7 +450,7 @@ static IIO_DEVICE_ATTR(revision, S_IRUGO, sca3000_show_rev, NULL, 0);
                .event_mask = SCA3000_EVENT_MASK,               \
         }
 
-static struct iio_chan_spec sca3000_channels[] = {
+static const struct iio_chan_spec sca3000_channels[] = {
        SCA3000_CHAN(0, IIO_MOD_X),
        SCA3000_CHAN(1, IIO_MOD_Y),
        SCA3000_CHAN(2, IIO_MOD_Z),
index 22c3923d55eb34fc31c1313a570498d31dcb95a1..e381d4b5a6ed922c3d30ea1e685f1b82df77c948 100644 (file)
@@ -967,7 +967,7 @@ static const struct iio_info ad7195_info = {
          .scan_index = _si,                                            \
          .scan_type =  IIO_ST('s', 24, 32, 0)}
 
-static struct iio_chan_spec ad7192_channels[] = {
+static const struct iio_chan_spec ad7192_channels[] = {
        AD7192_CHAN_DIFF(1, 2, NULL, AD7192_CH_AIN1P_AIN2M, 0),
        AD7192_CHAN_DIFF(3, 4, NULL, AD7192_CH_AIN3P_AIN4M, 1),
        AD7192_CHAN_TEMP(0, AD7192_CH_TEMP, 2),
index 6141f4a70cfa53686d3c99c25fe0dd0f1af62577..4c75114e7d7cbb6d4890acafc74f50e5a0ab17af 100644 (file)
@@ -38,7 +38,7 @@
                },                                                      \
        }
 
-static struct iio_chan_spec ad7298_channels[] = {
+static const struct iio_chan_spec ad7298_channels[] = {
        {
                .type = IIO_TEMP,
                .indexed = 1,
index 10f59896597f95742d1951cf52c9f9d58c3e5ad4..9221a74efd18a00cf31c24c79b3e271a7a181d85 100644 (file)
@@ -51,7 +51,7 @@ struct ad7606_platform_data {
 struct ad7606_chip_info {
        const char                      *name;
        u16                             int_vref_mv;
-       struct iio_chan_spec            *channels;
+       const struct iio_chan_spec      *channels;
        unsigned                        num_channels;
 };
 
index ccb97fecdea792d6252cf3176b9dbce13fd2611b..bae61cbe921259cbc9eb0a71136534f36b2da97f 100644 (file)
@@ -241,7 +241,7 @@ static const struct attribute_group ad7606_attribute_group_range = {
                .scan_type = IIO_ST('s', 16, 16, 0),            \
        }
 
-static struct iio_chan_spec ad7606_8_channels[] = {
+static const struct iio_chan_spec ad7606_8_channels[] = {
        AD7606_CHANNEL(0),
        AD7606_CHANNEL(1),
        AD7606_CHANNEL(2),
@@ -253,7 +253,7 @@ static struct iio_chan_spec ad7606_8_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(8),
 };
 
-static struct iio_chan_spec ad7606_6_channels[] = {
+static const struct iio_chan_spec ad7606_6_channels[] = {
        AD7606_CHANNEL(0),
        AD7606_CHANNEL(1),
        AD7606_CHANNEL(2),
@@ -263,7 +263,7 @@ static struct iio_chan_spec ad7606_6_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(6),
 };
 
-static struct iio_chan_spec ad7606_4_channels[] = {
+static const struct iio_chan_spec ad7606_4_channels[] = {
        AD7606_CHANNEL(0),
        AD7606_CHANNEL(1),
        AD7606_CHANNEL(2),
index 348d051fc2f8a567ec26c113fcc3eda668cb9c6d..7e9bd0001cc7f9d1c239faf578e8b557d7c2cb01 100644 (file)
@@ -108,7 +108,7 @@ static const struct iio_info lpc32xx_adc_iio_info = {
        .scan_index = _index,                           \
 }
 
-static struct iio_chan_spec lpc32xx_adc_iio_channels[] = {
+static const struct iio_chan_spec lpc32xx_adc_iio_channels[] = {
        LPC32XX_ADC_CHANNEL(0),
        LPC32XX_ADC_CHANNEL(1),
        LPC32XX_ADC_CHANNEL(2),
index 2cd0112067b21fb3ca1df3c070208fbbf0987ac9..c746918683f14aa5b922797ba939943c8035de04 100644 (file)
@@ -100,7 +100,7 @@ enum max1363_modes {
  */
 struct max1363_chip_info {
        const struct iio_info           *info;
-       struct iio_chan_spec *channels;
+       const struct iio_chan_spec *channels;
        int num_channels;
        const enum max1363_modes        *mode_list;
        enum max1363_modes              default_mode;
index 6799ce23a395391c17a0347061b04376d91a0487..816bb2c2e0c5210a4b8aee2b590849aad13537f0 100644 (file)
@@ -335,12 +335,12 @@ static const enum max1363_modes max1363_mode_list[] = {
        IIO_CHAN_SOFT_TIMESTAMP(8)                      \
        }
 
-static struct iio_chan_spec max1036_channels[] = MAX1363_4X_CHANS(8, 0);
-static struct iio_chan_spec max1136_channels[] = MAX1363_4X_CHANS(10, 0);
-static struct iio_chan_spec max1236_channels[] = MAX1363_4X_CHANS(12, 0);
-static struct iio_chan_spec max1361_channels[] =
+static const struct iio_chan_spec max1036_channels[] = MAX1363_4X_CHANS(8, 0);
+static const struct iio_chan_spec max1136_channels[] = MAX1363_4X_CHANS(10, 0);
+static const struct iio_chan_spec max1236_channels[] = MAX1363_4X_CHANS(12, 0);
+static const struct iio_chan_spec max1361_channels[] =
        MAX1363_4X_CHANS(10, MAX1363_EV_M);
-static struct iio_chan_spec max1363_channels[] =
+static const struct iio_chan_spec max1363_channels[] =
        MAX1363_4X_CHANS(12, MAX1363_EV_M);
 
 /* Applies to max1236, max1237 */
@@ -392,9 +392,9 @@ static const enum max1363_modes max1238_mode_list[] = {
        MAX1363_CHAN_B(11, 10, d11m10, 23, bits, 0),    \
        IIO_CHAN_SOFT_TIMESTAMP(24)                     \
        }
-static struct iio_chan_spec max1038_channels[] = MAX1363_12X_CHANS(8);
-static struct iio_chan_spec max1138_channels[] = MAX1363_12X_CHANS(10);
-static struct iio_chan_spec max1238_channels[] = MAX1363_12X_CHANS(12);
+static const struct iio_chan_spec max1038_channels[] = MAX1363_12X_CHANS(8);
+static const struct iio_chan_spec max1138_channels[] = MAX1363_12X_CHANS(10);
+static const struct iio_chan_spec max1238_channels[] = MAX1363_12X_CHANS(12);
 
 static const enum max1363_modes max11607_mode_list[] = {
        _s0, _s1, _s2, _s3,
@@ -433,9 +433,9 @@ static const enum max1363_modes max11608_mode_list[] = {
        MAX1363_CHAN_B(7, 6, d7m6, 15, bits, 0),        \
        IIO_CHAN_SOFT_TIMESTAMP(16)                     \
 }
-static struct iio_chan_spec max11602_channels[] = MAX1363_8X_CHANS(8);
-static struct iio_chan_spec max11608_channels[] = MAX1363_8X_CHANS(10);
-static struct iio_chan_spec max11614_channels[] = MAX1363_8X_CHANS(12);
+static const struct iio_chan_spec max11602_channels[] = MAX1363_8X_CHANS(8);
+static const struct iio_chan_spec max11608_channels[] = MAX1363_8X_CHANS(10);
+static const struct iio_chan_spec max11614_channels[] = MAX1363_8X_CHANS(12);
 
 static const enum max1363_modes max11644_mode_list[] = {
        _s0, _s1, s0to1, d0m1, d1m0,
@@ -449,8 +449,8 @@ static const enum max1363_modes max11644_mode_list[] = {
        IIO_CHAN_SOFT_TIMESTAMP(4)                      \
        }
 
-static struct iio_chan_spec max11646_channels[] = MAX1363_2X_CHANS(10);
-static struct iio_chan_spec max11644_channels[] = MAX1363_2X_CHANS(12);
+static const struct iio_chan_spec max11646_channels[] = MAX1363_2X_CHANS(10);
+static const struct iio_chan_spec max11644_channels[] = MAX1363_2X_CHANS(12);
 
 enum { max1361,
        max1362,
index 64d630e6fe293a2e8e38cca6e6bf5c68e2552d0a..675c427c02ade52528676a3a9546347dd03da0b9 100644 (file)
@@ -189,7 +189,7 @@ static int spear_read_raw(struct iio_dev *indio_dev,
        },                                              \
 }
 
-static struct iio_chan_spec spear_adc_iio_channels[] = {
+static const struct iio_chan_spec spear_adc_iio_channels[] = {
        SPEAR_ADC_CHAN(0),
        SPEAR_ADC_CHAN(1),
        SPEAR_ADC_CHAN(2),
index 155a49a9da7e007a353f0c3ec1704f526a1e6b46..22eea8305ff2adc0cdb2894020e2cc8fcef1f250 100644 (file)
@@ -63,7 +63,7 @@ static const struct iio_dummy_accel_calibscale dummy_scales[] = {
  * This array of structures tells the IIO core about what the device
  * actually provides for a given channel.
  */
-static struct iio_chan_spec iio_dummy_channels[] = {
+static const struct iio_chan_spec iio_dummy_channels[] = {
        /* indexed ADC channel in_voltage0_raw etc */
        {
                .type = IIO_VOLTAGE,
index a8e51bc04439adc78ba87ea2160418f509e37b3d..e239ea91f407186c77811a5b71d8c2d0b486545e 100644 (file)
@@ -108,7 +108,7 @@ static struct ad5933_platform_data ad5933_default_pdata  = {
        .vref_mv = 3300,
 };
 
-static struct iio_chan_spec ad5933_channels[] = {
+static const struct iio_chan_spec ad5933_channels[] = {
        {
                .type = IIO_TEMP,
                .indexed = 1,
index 1f4c17779b5a64e18f48865aa6ecb0e6d49387f4..4ce9e3dbe87c4e9253e38c9be11ef9f0b8e3fbae 100644 (file)
@@ -610,7 +610,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
        }
 }
 
-static struct iio_chan_spec adis16400_channels[] = {
+static const struct iio_chan_spec adis16400_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
@@ -740,7 +740,7 @@ static struct iio_chan_spec adis16400_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(12)
 };
 
-static struct iio_chan_spec adis16350_channels[] = {
+static const struct iio_chan_spec adis16350_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
@@ -865,7 +865,7 @@ static struct iio_chan_spec adis16350_channels[] = {
        IIO_CHAN_SOFT_TIMESTAMP(11)
 };
 
-static struct iio_chan_spec adis16300_channels[] = {
+static const struct iio_chan_spec adis16300_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index ec202b4ecfb2f0e69644dd391ef9a0409b33f342..1e11ad5ae5a462c47b13bfb8739bd5d05605297a 100644 (file)
@@ -122,7 +122,7 @@ struct ade7758_state {
        u8                      *tx;
        u8                      *rx;
        struct mutex            buf_lock;
-       struct iio_chan_spec    *ade7758_ring_channels;
+       const struct iio_chan_spec *ade7758_ring_channels;
        struct spi_transfer     ring_xfer[4];
        struct spi_message      ring_msg;
        /*
index 7014a0078446a95835047e9f19bf8dc53c91db60..6d3725a1cd78b92f34b23e9a026b13abc3ae53ca 100644 (file)
@@ -661,7 +661,7 @@ static const struct attribute_group ade7758_attribute_group = {
        .attrs = ade7758_attributes,
 };
 
-static struct iio_chan_spec ade7758_channels[] = {
+static const struct iio_chan_spec ade7758_channels[] = {
        {
                .type = IIO_VOLTAGE,
                .indexed = 1,
index f313859476c188af4deea1f70c203daaaa3b4d52..4ba4d05ed4233a7ddebc70f62c7e6f0040e3941e 100644 (file)
@@ -575,7 +575,7 @@ static IIO_DEVICE_ATTR(lot_low_thrd, S_IRUGO | S_IWUSR,
                       AD2S1210_REG_LOT_LOW_THRD);
 
 
-static struct iio_chan_spec ad2s1210_channels[] = {
+static const struct iio_chan_spec ad2s1210_channels[] = {
        {
                .type = IIO_ANGL,
                .indexed = 1,