提交 8a3e4a56 编写于 作者: C Cosmin Tanislav 提交者: Jonathan Cameron

iio: addac: ad74413r: use ngpio size when iterating over mask

ngpio is the actual number of GPIOs handled by the GPIO chip,
as opposed to the max number of GPIOs.

Fixes: fea251b6 ("iio: addac: add AD74413R driver")
Signed-off-by: NCosmin Tanislav <cosmin.tanislav@analog.com>
Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220111074703.3677392-1-cosmin.tanislav@analog.comSigned-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 e7a3290d
......@@ -288,7 +288,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
unsigned int offset = 0;
int ret;
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
for_each_set_bit_from(offset, mask, chip->ngpio) {
unsigned int real_offset = st->gpo_gpio_offsets[offset];
ret = ad74413r_set_gpo_config(st, real_offset,
......@@ -334,7 +334,7 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
if (ret)
return ret;
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
for_each_set_bit_from(offset, mask, chip->ngpio) {
unsigned int real_offset = st->comp_gpio_offsets[offset];
if (val & BIT(real_offset))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册