iio: fix drivers that check buffer->scan_mask
Subsystems (2)
PATCH 1/1 iio: fix drivers that check buffer->scan_mask
If the in-kernel push interface is used we may have a different masks on the device buffer and the kernel buffer and in this case the device should generate data for the reunion of the buffers, which is available at indio_dev->active_scan_mask.
Compiled tested only except for bmc150-accel which was tested at runtime with the hardware.
--- drivers/iio/accel/bma180.c | 2 +- drivers/iio/accel/bmc150-accel.c | 2 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/adc/at91_adc.c | 5 ++--- drivers/iio/adc/ti_am335x_adc.c | 3 +-- drivers/iio/gyro/bmg160.c | 2 +- drivers/iio/imu/kmx61.c | 2 +- drivers/iio/proximity/sx9500.c | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-)
drivers/iio/accel/bma180.c +1 -1
@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =bma180_get_data_reg (data, bit);if (ret <0 ) {
drivers/iio/accel/bmc150-accel.c +1 -1
@@ -929,7 +929,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMC150_ACCEL_AXIS_TO_REG (bit));
drivers/iio/accel/kxcjk-1013.c +1 -1
@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kxcjk1013_get_acc_reg (data, bit);if (ret <0 ) {
drivers/iio/adc/at91_adc.c +2 -3
@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) {struct iio_dev *idev =iio_trigger_get_drvdata (trig);struct at91_adc_state *st =iio_priv (idev); -struct iio_buffer *buffer = idev->buffer;struct at91_adc_reg_desc *reg = st->registers;u32 status =at91_adc_readl (st, reg->trigger_register);int value;
@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status | value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHER,
@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status & ~value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHDR,
drivers/iio/adc/ti_am335x_adc.c +1 -2
@@ -189,12 +189,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)static int tiadc_buffer_postenable (struct iio_dev *indio_dev) {struct tiadc_device *adc_dev =iio_priv (indio_dev); -struct iio_buffer *buffer = indio_dev->buffer;unsigned int enb =0 ;u8 bit;tiadc_step_config (indio_dev); -for_each_set_bit (bit, buffer->scan_mask, adc_dev->channels) +for_each_set_bit (bit, indio_dev->active_scan_mask, adc_dev->channels) enb |= (get_adc_step_bit (adc_dev, bit) <<1 ); adc_dev->buffer_en_ch_steps = enb;
drivers/iio/gyro/bmg160.c +1 -1
@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMG160_AXIS_TO_REG (bit));
drivers/iio/imu/kmx61.c +1 -1
@@ -1215,7 +1215,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p) base =KMX61_MAG_XOUT_L ;mutex_lock (&data->lock); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kmx61_read_measurement (data, base, bit);if (ret <0 ) {
drivers/iio/proximity/sx9500.c +1 -1
@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =sx9500_read_proximity (data, &indio_dev->channels[bit], &val);
Signature · 1 line
1.9.1
Jonathan Cameron
maintainerQuoted 9 lines · Octavian Purdila
If the in-kernel push interface is used we may have a different masks on the device buffer and the kernel buffer and in this case the device should generate data for the reunion of the buffers, which is available at
indio_dev->active_scan_mask.Compiled tested only except for bmc150-accel which was tested at runtime with the hardware.
Signed-off-by Octavian Purdila <[email protected]>
Hmm. I'm going to take this via the togreg branch rather than through fixes. We don't have any mainline users of the functionality that this will cause issues with yet. For that matter I don't actually know of anyone using it in anger outside mainline either.
If anyone thinks I should send this via the fixes branch and mark it for stable then let me know.
Jonathan
Quoted 138 lines
--- drivers/iio/accel/bma180.c | 2 +- drivers/iio/accel/bmc150-accel.c | 2 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/adc/at91_adc.c | 5 ++--- drivers/iio/adc/ti_am335x_adc.c | 3 +-- drivers/iio/gyro/bmg160.c | 2 +- drivers/iio/imu/kmx61.c | 2 +- drivers/iio/proximity/sx9500.c | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-)drivers/iio/accel/bma180.c +1
-1@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =bma180_get_data_reg (data, bit);if (ret <0 ) {drivers/iio/accel/bmc150-accel.c +1
-1@@ -929,7 +929,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMC150_ACCEL_AXIS_TO_REG (bit));drivers/iio/accel/kxcjk-1013.c +1
-1@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kxcjk1013_get_acc_reg (data, bit);if (ret <0 ) {drivers/iio/adc/at91_adc.c +2
-3@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) {struct iio_dev *idev =iio_trigger_get_drvdata (trig);struct at91_adc_state *st =iio_priv (idev); -struct iio_buffer *buffer = idev->buffer;struct at91_adc_reg_desc *reg = st->registers;u32 status =at91_adc_readl (st, reg->trigger_register);int value;@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status | value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHER,@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status & ~value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHDR,drivers/iio/adc/ti_am335x_adc.c +1
-2@@ -189,12 +189,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)static int tiadc_buffer_postenable (struct iio_dev *indio_dev) {struct tiadc_device *adc_dev =iio_priv (indio_dev); -struct iio_buffer *buffer = indio_dev->buffer;unsigned int enb =0 ;u8 bit;tiadc_step_config (indio_dev); -for_each_set_bit (bit, buffer->scan_mask, adc_dev->channels) +for_each_set_bit (bit, indio_dev->active_scan_mask, adc_dev->channels) enb |= (get_adc_step_bit (adc_dev, bit) <<1 ); adc_dev->buffer_en_ch_steps = enb;drivers/iio/gyro/bmg160.c +1
-1@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMG160_AXIS_TO_REG (bit));drivers/iio/imu/kmx61.c +1
-1@@ -1215,7 +1215,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p) base =KMX61_MAG_XOUT_L ;mutex_lock (&data->lock); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kmx61_read_measurement (data, base, bit);if (ret <0 ) {drivers/iio/proximity/sx9500.c +1
-1@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =sx9500_read_proximity (data, &indio_dev->channels[bit], &val);
Quoted 9 lines · Jonathan Cameron
Quoted 8 lines · Octavian Purdila
If the in-kernel push interface is used we may have a different masks on the device buffer and the kernel buffer and in this case the device should generate data for the reunion of the buffers, which is available at
indio_dev->active_scan_mask.Compiled tested only except for bmc150-accel which was tested at runtime with the hardware.
Quoted 8 lines
Quoted 1 line
Signed-off-by Octavian Purdila <[email protected]>Hmm. I'm going to take this via the togreg branch rather than through fixes. We don't have any mainline users of the functionality that this will cause issues with yet. For that matter I don't actually know of anyone using it in anger outside mainline either.
If anyone thinks I should send this via the fixes branch and mark it for stable then let me know.
Actually I changed my mind.
Applied to the fixes-togreg branch of iio.git and marked for stable. Lets get this mess up out of the way asap as we are early in the cycle (would have held it for the merge window if later in cycle).
Quoted 146 lines
Jonathan
Quoted 130 lines
--- drivers/iio/accel/bma180.c | 2 +- drivers/iio/accel/bmc150-accel.c | 2 +- drivers/iio/accel/kxcjk-1013.c | 2 +- drivers/iio/adc/at91_adc.c | 5 ++--- drivers/iio/adc/ti_am335x_adc.c | 3 +-- drivers/iio/gyro/bmg160.c | 2 +- drivers/iio/imu/kmx61.c | 2 +- drivers/iio/proximity/sx9500.c | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-)drivers/iio/accel/bma180.c +1
-1@@ -659,7 +659,7 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =bma180_get_data_reg (data, bit);if (ret <0 ) {drivers/iio/accel/bmc150-accel.c +1
-1@@ -929,7 +929,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMC150_ACCEL_AXIS_TO_REG (bit));drivers/iio/accel/kxcjk-1013.c +1
-1@@ -956,7 +956,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kxcjk1013_get_acc_reg (data, bit);if (ret <0 ) {drivers/iio/adc/at91_adc.c +2
-3@@ -544,7 +544,6 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) {struct iio_dev *idev =iio_trigger_get_drvdata (trig);struct at91_adc_state *st =iio_priv (idev); -struct iio_buffer *buffer = idev->buffer;struct at91_adc_reg_desc *reg = st->registers;u32 status =at91_adc_readl (st, reg->trigger_register);int value;@@ -564,7 +563,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status | value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHER,@@ -579,7 +578,7 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)at91_adc_writel (st, reg->trigger_register, status & ~value); -for_each_set_bit (bit, buffer->scan_mask, +for_each_set_bit (bit, idev->active_scan_mask, st->num_channels) {struct iio_chan_spec const *chan = idev->channels + bit; at91_adc_writel(st, AT91_ADC_CHDR,drivers/iio/adc/ti_am335x_adc.c +1
-2@@ -189,12 +189,11 @@ static int tiadc_buffer_preenable(struct iio_dev *indio_dev)static int tiadc_buffer_postenable (struct iio_dev *indio_dev) {struct tiadc_device *adc_dev =iio_priv (indio_dev); -struct iio_buffer *buffer = indio_dev->buffer;unsigned int enb =0 ;u8 bit;tiadc_step_config (indio_dev); -for_each_set_bit (bit, buffer->scan_mask, adc_dev->channels) +for_each_set_bit (bit, indio_dev->active_scan_mask, adc_dev->channels) enb |= (get_adc_step_bit (adc_dev, bit) <<1 ); adc_dev->buffer_en_ch_steps = enb;drivers/iio/gyro/bmg160.c +1
-1@@ -822,7 +822,7 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)int bit, ret, i =0 ;mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =i2c_smbus_read_word_data (data->client,BMG160_AXIS_TO_REG (bit));drivers/iio/imu/kmx61.c +1
-1@@ -1215,7 +1215,7 @@ static irqreturn_t kmx61_trigger_handler(int irq, void *p) base =KMX61_MAG_XOUT_L ;mutex_lock (&data->lock); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =kmx61_read_measurement (data, base, bit);if (ret <0 ) {drivers/iio/proximity/sx9500.c +0
-0drivers/iio/proximity/sx9500.c static irqreturn_t sx9500_trigger_handler(int irq, void *private) · line 500
Quoted 8 lines
drivers/iio/proximity/sx9500.c +1
-1@@ -494,7 +494,7 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)mutex_lock (&data->mutex); -for_each_set_bit (bit, indio_dev->buffer->scan_mask, +for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { ret =sx9500_read_proximity (data, &indio_dev->channels[bit], &val);--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html