Skip to content

Commit

Permalink
iio: trigger: stm32-timer: fix get trigger mode
Browse files Browse the repository at this point in the history
Fix reading trigger mode, when other bit-fields are set. SMCR register
value must be masked to read SMS (slave mode selection) only.

Fixes: 9eba381 ("iio: make stm32 trigger driver use
INDIO_HARDWARE_TRIGGERED mode")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Fabrice Gasnier authored and Jonathan Cameron committed Aug 20, 2017
1 parent fdd0d32 commit a359bb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/trigger/stm32-timer-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static int stm32_get_trigger_mode(struct iio_dev *indio_dev,

regmap_read(priv->regmap, TIM_SMCR, &smcr);

return smcr == TIM_SMCR_SMS ? 0 : -EINVAL;
return (smcr & TIM_SMCR_SMS) == TIM_SMCR_SMS ? 0 : -EINVAL;
}

static const struct iio_enum stm32_trigger_mode_enum = {
Expand Down

0 comments on commit a359bb2

Please sign in to comment.