114
114
#define BNO055_UID_LEN 16
115
115
116
116
struct bno055_sysfs_attr {
117
- int * vals ;
117
+ const int * vals ;
118
118
int len ;
119
- int * fusion_vals ;
120
- int * hw_xlate ;
119
+ const int * fusion_vals ;
120
+ const int * hw_xlate ;
121
121
int type ;
122
122
};
123
123
124
- static int bno055_acc_lpf_vals [] = {
124
+ static const int bno055_acc_lpf_vals [] = {
125
125
7 , 810000 , 15 , 630000 , 31 , 250000 , 62 , 500000 ,
126
126
125 , 0 , 250 , 0 , 500 , 0 , 1000 , 0 ,
127
127
};
128
128
129
- static struct bno055_sysfs_attr bno055_acc_lpf = {
129
+ static const struct bno055_sysfs_attr bno055_acc_lpf = {
130
130
.vals = bno055_acc_lpf_vals ,
131
131
.len = ARRAY_SIZE (bno055_acc_lpf_vals ),
132
- .fusion_vals = (int []){62 , 500000 },
132
+ .fusion_vals = (const int []){62 , 500000 },
133
133
.type = IIO_VAL_INT_PLUS_MICRO ,
134
134
};
135
135
136
- static int bno055_acc_range_vals [] = {
136
+ static const int bno055_acc_range_vals [] = {
137
137
/* G: 2, 4, 8, 16 */
138
138
1962 , 3924 , 7848 , 15696
139
139
};
140
140
141
- static struct bno055_sysfs_attr bno055_acc_range = {
141
+ static const struct bno055_sysfs_attr bno055_acc_range = {
142
142
.vals = bno055_acc_range_vals ,
143
143
.len = ARRAY_SIZE (bno055_acc_range_vals ),
144
144
.fusion_vals = (int []){3924 }, /* 4G */
@@ -165,33 +165,33 @@ static struct bno055_sysfs_attr bno055_acc_range = {
165
165
* = hwval * (dps_range/(2^15 * k))
166
166
* where k is rad-to-deg factor
167
167
*/
168
- static int bno055_gyr_scale_vals [] = {
168
+ static const int bno055_gyr_scale_vals [] = {
169
169
125 , 1877467 , 250 , 1877467 , 500 , 1877467 ,
170
170
1000 , 1877467 , 2000 , 1877467 ,
171
171
};
172
172
173
- static struct bno055_sysfs_attr bno055_gyr_scale = {
173
+ static const struct bno055_sysfs_attr bno055_gyr_scale = {
174
174
.vals = bno055_gyr_scale_vals ,
175
175
.len = ARRAY_SIZE (bno055_gyr_scale_vals ),
176
- .fusion_vals = (int []){1 , 900 },
177
- .hw_xlate = (int []){4 , 3 , 2 , 1 , 0 },
176
+ .fusion_vals = (const int []){1 , 900 },
177
+ .hw_xlate = (const int []){4 , 3 , 2 , 1 , 0 },
178
178
.type = IIO_VAL_FRACTIONAL ,
179
179
};
180
180
181
- static int bno055_gyr_lpf_vals [] = {12 , 23 , 32 , 47 , 64 , 116 , 230 , 523 };
182
- static struct bno055_sysfs_attr bno055_gyr_lpf = {
181
+ static const int bno055_gyr_lpf_vals [] = {12 , 23 , 32 , 47 , 64 , 116 , 230 , 523 };
182
+ static const struct bno055_sysfs_attr bno055_gyr_lpf = {
183
183
.vals = bno055_gyr_lpf_vals ,
184
184
.len = ARRAY_SIZE (bno055_gyr_lpf_vals ),
185
- .fusion_vals = (int []){32 },
186
- .hw_xlate = (int []){5 , 4 , 7 , 3 , 6 , 2 , 1 , 0 },
185
+ .fusion_vals = (const int []){32 },
186
+ .hw_xlate = (const int []){5 , 4 , 7 , 3 , 6 , 2 , 1 , 0 },
187
187
.type = IIO_VAL_INT ,
188
188
};
189
189
190
- static int bno055_mag_odr_vals [] = {2 , 6 , 8 , 10 , 15 , 20 , 25 , 30 };
191
- static struct bno055_sysfs_attr bno055_mag_odr = {
190
+ static const int bno055_mag_odr_vals [] = {2 , 6 , 8 , 10 , 15 , 20 , 25 , 30 };
191
+ static const struct bno055_sysfs_attr bno055_mag_odr = {
192
192
.vals = bno055_mag_odr_vals ,
193
193
.len = ARRAY_SIZE (bno055_mag_odr_vals ),
194
- .fusion_vals = (int []){20 },
194
+ .fusion_vals = (const int []){20 },
195
195
.type = IIO_VAL_INT ,
196
196
};
197
197
@@ -548,7 +548,8 @@ static const struct iio_chan_spec bno055_channels[] = {
548
548
};
549
549
550
550
static int bno055_get_regmask (struct bno055_priv * priv , int * val , int * val2 ,
551
- int reg , int mask , struct bno055_sysfs_attr * attr )
551
+ int reg , int mask ,
552
+ const struct bno055_sysfs_attr * attr )
552
553
{
553
554
const int shift = __ffs (mask );
554
555
int hwval , idx ;
@@ -577,7 +578,8 @@ static int bno055_get_regmask(struct bno055_priv *priv, int *val, int *val2,
577
578
}
578
579
579
580
static int bno055_set_regmask (struct bno055_priv * priv , int val , int val2 ,
580
- int reg , int mask , struct bno055_sysfs_attr * attr )
581
+ int reg , int mask ,
582
+ const struct bno055_sysfs_attr * attr )
581
583
{
582
584
const int shift = __ffs (mask );
583
585
int best_delta ;
@@ -758,7 +760,8 @@ static int bno055_read_simple_chan(struct iio_dev *indio_dev,
758
760
}
759
761
}
760
762
761
- static int bno055_sysfs_attr_avail (struct bno055_priv * priv , struct bno055_sysfs_attr * attr ,
763
+ static int bno055_sysfs_attr_avail (struct bno055_priv * priv ,
764
+ const struct bno055_sysfs_attr * attr ,
762
765
const int * * vals , int * length )
763
766
{
764
767
if (priv -> operation_mode != BNO055_OPR_MODE_AMG ) {
0 commit comments