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 hw_xlate_len ;
122
122
int type ;
123
123
};
124
124
125
- static int bno055_acc_lpf_vals [] = {
125
+ static const int bno055_acc_lpf_vals [] = {
126
126
7 , 810000 , 15 , 630000 , 31 , 250000 , 62 , 500000 ,
127
127
125 , 0 , 250 , 0 , 500 , 0 , 1000 , 0 ,
128
128
};
129
129
130
- static struct bno055_sysfs_attr bno055_acc_lpf = {
130
+ static const struct bno055_sysfs_attr bno055_acc_lpf = {
131
131
.vals = bno055_acc_lpf_vals ,
132
132
.len = ARRAY_SIZE (bno055_acc_lpf_vals ),
133
- .fusion_vals = (int []){62 , 500000 },
133
+ .fusion_vals = (const int []){62 , 500000 },
134
134
.type = IIO_VAL_INT_PLUS_MICRO ,
135
135
};
136
136
137
- static int bno055_acc_range_vals [] = {
137
+ static const int bno055_acc_range_vals [] = {
138
138
/* G: 2, 4, 8, 16 */
139
139
1962 , 3924 , 7848 , 15696
140
140
};
141
141
142
- static struct bno055_sysfs_attr bno055_acc_range = {
142
+ static const struct bno055_sysfs_attr bno055_acc_range = {
143
143
.vals = bno055_acc_range_vals ,
144
144
.len = ARRAY_SIZE (bno055_acc_range_vals ),
145
- .fusion_vals = (int []){3924 }, /* 4G */
145
+ .fusion_vals = (const int []){3924 }, /* 4G */
146
146
.type = IIO_VAL_INT ,
147
147
};
148
148
@@ -166,37 +166,37 @@ static struct bno055_sysfs_attr bno055_acc_range = {
166
166
* = hwval * (dps_range/(2^15 * k))
167
167
* where k is rad-to-deg factor
168
168
*/
169
- static int bno055_gyr_scale_vals [] = {
169
+ static const int bno055_gyr_scale_vals [] = {
170
170
125 , 1877467 , 250 , 1877467 , 500 , 1877467 ,
171
171
1000 , 1877467 , 2000 , 1877467 ,
172
172
};
173
173
174
- static int bno055_gyr_scale_hw_xlate [] = {0 , 1 , 2 , 3 , 4 };
175
- static struct bno055_sysfs_attr bno055_gyr_scale = {
174
+ static const int bno055_gyr_scale_hw_xlate [] = {0 , 1 , 2 , 3 , 4 };
175
+ static const struct bno055_sysfs_attr bno055_gyr_scale = {
176
176
.vals = bno055_gyr_scale_vals ,
177
177
.len = ARRAY_SIZE (bno055_gyr_scale_vals ),
178
- .fusion_vals = (int []){1 , 900 },
178
+ .fusion_vals = (const int []){1 , 900 },
179
179
.hw_xlate = bno055_gyr_scale_hw_xlate ,
180
180
.hw_xlate_len = ARRAY_SIZE (bno055_gyr_scale_hw_xlate ),
181
181
.type = IIO_VAL_FRACTIONAL ,
182
182
};
183
183
184
- static int bno055_gyr_lpf_vals [] = {12 , 23 , 32 , 47 , 64 , 116 , 230 , 523 };
185
- static int bno055_gyr_lpf_hw_xlate [] = {5 , 4 , 7 , 3 , 6 , 2 , 1 , 0 };
186
- static struct bno055_sysfs_attr bno055_gyr_lpf = {
184
+ static const int bno055_gyr_lpf_vals [] = {12 , 23 , 32 , 47 , 64 , 116 , 230 , 523 };
185
+ static const int bno055_gyr_lpf_hw_xlate [] = {5 , 4 , 7 , 3 , 6 , 2 , 1 , 0 };
186
+ static const struct bno055_sysfs_attr bno055_gyr_lpf = {
187
187
.vals = bno055_gyr_lpf_vals ,
188
188
.len = ARRAY_SIZE (bno055_gyr_lpf_vals ),
189
- .fusion_vals = (int []){32 },
189
+ .fusion_vals = (const int []){32 },
190
190
.hw_xlate = bno055_gyr_lpf_hw_xlate ,
191
191
.hw_xlate_len = ARRAY_SIZE (bno055_gyr_lpf_hw_xlate ),
192
192
.type = IIO_VAL_INT ,
193
193
};
194
194
195
- static int bno055_mag_odr_vals [] = {2 , 6 , 8 , 10 , 15 , 20 , 25 , 30 };
196
- static struct bno055_sysfs_attr bno055_mag_odr = {
195
+ static const int bno055_mag_odr_vals [] = {2 , 6 , 8 , 10 , 15 , 20 , 25 , 30 };
196
+ static const struct bno055_sysfs_attr bno055_mag_odr = {
197
197
.vals = bno055_mag_odr_vals ,
198
198
.len = ARRAY_SIZE (bno055_mag_odr_vals ),
199
- .fusion_vals = (int []){20 },
199
+ .fusion_vals = (const int []){20 },
200
200
.type = IIO_VAL_INT ,
201
201
};
202
202
@@ -553,7 +553,8 @@ static const struct iio_chan_spec bno055_channels[] = {
553
553
};
554
554
555
555
static int bno055_get_regmask (struct bno055_priv * priv , int * val , int * val2 ,
556
- int reg , int mask , struct bno055_sysfs_attr * attr )
556
+ int reg , int mask ,
557
+ const struct bno055_sysfs_attr * attr )
557
558
{
558
559
const int shift = __ffs (mask );
559
560
int hwval , idx ;
@@ -582,7 +583,8 @@ static int bno055_get_regmask(struct bno055_priv *priv, int *val, int *val2,
582
583
}
583
584
584
585
static int bno055_set_regmask (struct bno055_priv * priv , int val , int val2 ,
585
- int reg , int mask , struct bno055_sysfs_attr * attr )
586
+ int reg , int mask ,
587
+ const struct bno055_sysfs_attr * attr )
586
588
{
587
589
const int shift = __ffs (mask );
588
590
int best_delta ;
@@ -763,7 +765,8 @@ static int bno055_read_simple_chan(struct iio_dev *indio_dev,
763
765
}
764
766
}
765
767
766
- static int bno055_sysfs_attr_avail (struct bno055_priv * priv , struct bno055_sysfs_attr * attr ,
768
+ static int bno055_sysfs_attr_avail (struct bno055_priv * priv ,
769
+ const struct bno055_sysfs_attr * attr ,
767
770
const int * * vals , int * length )
768
771
{
769
772
if (priv -> operation_mode != BNO055_OPR_MODE_AMG ) {
0 commit comments