kmx61.c (ea04d2965874ca5753e756b335449c5322a85733) | kmx61.c (6a191c7025f80c328156a358871f5d947f443aa9) |
---|---|
1/* 2 * KMX61 - Kionix 6-axis Accelerometer/Magnetometer 3 * 4 * Copyright (c) 2014, Intel Corporation. 5 * 6 * This file is subject to the terms and conditions of version 2 of 7 * the GNU General Public License. See the file COPYING in the main 8 * directory of this archive for more details. --- 1204 unchanged lines hidden (view full) --- 1213} 1214 1215static irqreturn_t kmx61_trigger_handler(int irq, void *p) 1216{ 1217 struct iio_poll_func *pf = p; 1218 struct iio_dev *indio_dev = pf->indio_dev; 1219 struct kmx61_data *data = kmx61_get_data(indio_dev); 1220 int bit, ret, i = 0; | 1/* 2 * KMX61 - Kionix 6-axis Accelerometer/Magnetometer 3 * 4 * Copyright (c) 2014, Intel Corporation. 5 * 6 * This file is subject to the terms and conditions of version 2 of 7 * the GNU General Public License. See the file COPYING in the main 8 * directory of this archive for more details. --- 1204 unchanged lines hidden (view full) --- 1213} 1214 1215static irqreturn_t kmx61_trigger_handler(int irq, void *p) 1216{ 1217 struct iio_poll_func *pf = p; 1218 struct iio_dev *indio_dev = pf->indio_dev; 1219 struct kmx61_data *data = kmx61_get_data(indio_dev); 1220 int bit, ret, i = 0; |
1221 u8 base; |
|
1221 s16 buffer[8]; 1222 | 1222 s16 buffer[8]; 1223 |
1224 if (indio_dev == data->acc_indio_dev) 1225 base = KMX61_ACC_XOUT_L; 1226 else 1227 base = KMX61_MAG_XOUT_L; 1228 |
|
1223 mutex_lock(&data->lock); 1224 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 1225 indio_dev->masklength) { | 1229 mutex_lock(&data->lock); 1230 for_each_set_bit(bit, indio_dev->buffer->scan_mask, 1231 indio_dev->masklength) { |
1226 ret = kmx61_read_measurement(data, KMX61_ACC_XOUT_L, bit); | 1232 ret = kmx61_read_measurement(data, base, bit); |
1227 if (ret < 0) { 1228 mutex_unlock(&data->lock); 1229 goto err; 1230 } 1231 buffer[i++] = ret; 1232 } 1233 mutex_unlock(&data->lock); 1234 --- 355 unchanged lines hidden --- | 1233 if (ret < 0) { 1234 mutex_unlock(&data->lock); 1235 goto err; 1236 } 1237 buffer[i++] = ret; 1238 } 1239 mutex_unlock(&data->lock); 1240 --- 355 unchanged lines hidden --- |