From 0b02af932b7e7777074d78203e8e336a9dc30400 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 17 Sep 2025 15:39:22 -0500 Subject: [PATCH] iio: adc: ad7124: inline ad7124_enable_channel() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Inline ad7124_enable_channel() at the only call site. This simplifies the code by avoiding a bit of extra indirection. ch->nr is replaced by address as that is the same value and avoids more indirection. Signed-off-by: David Lechner Reviewed-by: Nuno Sá Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7124.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c index ad6edbc792db3..f4f445e286302 100644 --- a/drivers/iio/adc/ad7124.c +++ b/drivers/iio/adc/ad7124.c @@ -631,14 +631,6 @@ static int ad7124_push_config(struct ad7124_state *st, struct ad7124_channel_con return ad7124_write_config(st, cfg, free_cfg_slot); } -static int ad7124_enable_channel(struct ad7124_state *st, struct ad7124_channel *ch) -{ - ch->cfg.live = true; - return ad_sd_write_reg(&st->sd, AD7124_CHANNEL(ch->nr), 2, ch->ain | - FIELD_PREP(AD7124_CHANNEL_SETUP, ch->cfg.cfg_slot) | - AD7124_CHANNEL_ENABLE); -} - static int ad7124_prepare_read(struct ad7124_state *st, int address) { struct ad7124_channel_config *cfg = &st->channels[address].cfg; @@ -658,7 +650,11 @@ static int ad7124_prepare_read(struct ad7124_state *st, int address) } /* point channel to the config slot and enable */ - return ad7124_enable_channel(st, &st->channels[address]); + cfg->live = true; + return ad_sd_write_reg(&st->sd, AD7124_CHANNEL(address), 2, + st->channels[address].ain | + FIELD_PREP(AD7124_CHANNEL_SETUP, cfg->cfg_slot) | + AD7124_CHANNEL_ENABLE); } static int __ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int channel) @@ -1559,7 +1555,7 @@ static int __ad7124_calibrate_all(struct ad7124_state *st, struct iio_dev *indio * after full-scale calibration because the next * ad_sd_calibrate() call overwrites this via * ad_sigma_delta_set_channel() -> ad7124_set_channel() - * ... -> ad7124_enable_channel(). + * -> ad7124_prepare_read(). */ ret = ad_sd_read_reg(&st->sd, AD7124_GAIN(st->channels[i].cfg.cfg_slot), 3, &st->channels[i].cfg.calibration_gain); -- 2.47.3