Message ID | 20181202115830.20363-4-sst@poczta.fm (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | staging: iio: adc: ad7280a: channel and attr init refactor | expand |
On Sun, 2 Dec 2018 12:58:30 +0100 Slawomir Stepien <sst@poczta.fm> wrote: > These for loops have just only one instruction as its body. However this > body is complex, so add braces to them. > > Signed-off-by: Slawomir Stepien <sst@poczta.fm> This is fine. I'll pick it up when 1 and 2 are updated. Thanks, Jonathan > --- > drivers/staging/iio/adc/ad7280a.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c > index 6faa85bf6f7e..6ec5a0d2a438 100644 > --- a/drivers/staging/iio/adc/ad7280a.c > +++ b/drivers/staging/iio/adc/ad7280a.c > @@ -574,7 +574,7 @@ static int ad7280_channel_init(struct ad7280_state *st) > if (!st->channels) > return -ENOMEM; > > - for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) > + for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) { > for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6; > ch++, cnt++) { > if (ch < AD7280A_AUX_ADC_1) > @@ -584,6 +584,7 @@ static int ad7280_channel_init(struct ad7280_state *st) > > ad7280_common_fields_init(st, cnt, dev, ch); > } > + } > > ad7280_all_voltage_channel_init(st, cnt, dev); > cnt++; > @@ -642,7 +643,7 @@ static int ad7280_attr_init(struct ad7280_state *st) > if (!st->iio_attr) > return -ENOMEM; > > - for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) > + for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) { > for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6; > ch++, cnt++) { > ret = ad7280_balance_switch_attr_init(st, cnt, dev, ch); > @@ -654,6 +655,7 @@ static int ad7280_attr_init(struct ad7280_state *st) > if (ret < 0) > return ret; > } > + } > > ad7280_attributes[cnt] = NULL; >
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 6faa85bf6f7e..6ec5a0d2a438 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -574,7 +574,7 @@ static int ad7280_channel_init(struct ad7280_state *st) if (!st->channels) return -ENOMEM; - for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) + for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) { for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6; ch++, cnt++) { if (ch < AD7280A_AUX_ADC_1) @@ -584,6 +584,7 @@ static int ad7280_channel_init(struct ad7280_state *st) ad7280_common_fields_init(st, cnt, dev, ch); } + } ad7280_all_voltage_channel_init(st, cnt, dev); cnt++; @@ -642,7 +643,7 @@ static int ad7280_attr_init(struct ad7280_state *st) if (!st->iio_attr) return -ENOMEM; - for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) + for (dev = 0, cnt = 0; dev <= st->slave_num; dev++) { for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_CELL_VOLTAGE_6; ch++, cnt++) { ret = ad7280_balance_switch_attr_init(st, cnt, dev, ch); @@ -654,6 +655,7 @@ static int ad7280_attr_init(struct ad7280_state *st) if (ret < 0) return ret; } + } ad7280_attributes[cnt] = NULL;
These for loops have just only one instruction as its body. However this body is complex, so add braces to them. Signed-off-by: Slawomir Stepien <sst@poczta.fm> --- drivers/staging/iio/adc/ad7280a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)