Skip to content

Commit 4165456

Browse files
Demon000jic23
authored andcommitted
iio: addac: ad74413r: correct comparator gpio getters mask usage
The value of the GPIOs is currently altered using offsets rather than masks. Make use of __assign_bit and the BIT macro to turn the offsets into masks. Fixes: fea251b ("iio: addac: add AD74413R driver") Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220111074703.3677392-2-cosmin.tanislav@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 8a3e4a5 commit 4165456

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/iio/addac/ad74413r.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ struct ad74413r_state {
134134
#define AD74413R_CH_EN_MASK(x) BIT(x)
135135

136136
#define AD74413R_REG_DIN_COMP_OUT 0x25
137-
#define AD74413R_DIN_COMP_OUT_SHIFT_X(x) x
138137

139138
#define AD74413R_REG_ADC_RESULT_X(x) (0x26 + (x))
140139
#define AD74413R_ADC_RESULT_MAX GENMASK(15, 0)
@@ -316,7 +315,7 @@ static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset)
316315
if (ret)
317316
return ret;
318317

319-
status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset);
318+
status &= BIT(real_offset);
320319

321320
return status ? 1 : 0;
322321
}
@@ -337,8 +336,7 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
337336
for_each_set_bit_from(offset, mask, chip->ngpio) {
338337
unsigned int real_offset = st->comp_gpio_offsets[offset];
339338

340-
if (val & BIT(real_offset))
341-
*bits |= offset;
339+
__assign_bit(offset, bits, val & BIT(real_offset));
342340
}
343341

344342
return ret;

0 commit comments

Comments
 (0)