Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7124: inline ad7124_enable_channel()

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 <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
0b02af93 5f31df50

+6 -10
+6 -10
drivers/iio/adc/ad7124.c
··· 631 631 return ad7124_write_config(st, cfg, free_cfg_slot); 632 632 } 633 633 634 - static int ad7124_enable_channel(struct ad7124_state *st, struct ad7124_channel *ch) 635 - { 636 - ch->cfg.live = true; 637 - return ad_sd_write_reg(&st->sd, AD7124_CHANNEL(ch->nr), 2, ch->ain | 638 - FIELD_PREP(AD7124_CHANNEL_SETUP, ch->cfg.cfg_slot) | 639 - AD7124_CHANNEL_ENABLE); 640 - } 641 - 642 634 static int ad7124_prepare_read(struct ad7124_state *st, int address) 643 635 { 644 636 struct ad7124_channel_config *cfg = &st->channels[address].cfg; ··· 650 658 } 651 659 652 660 /* point channel to the config slot and enable */ 653 - return ad7124_enable_channel(st, &st->channels[address]); 661 + cfg->live = true; 662 + return ad_sd_write_reg(&st->sd, AD7124_CHANNEL(address), 2, 663 + st->channels[address].ain | 664 + FIELD_PREP(AD7124_CHANNEL_SETUP, cfg->cfg_slot) | 665 + AD7124_CHANNEL_ENABLE); 654 666 } 655 667 656 668 static int __ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int channel) ··· 1555 1559 * after full-scale calibration because the next 1556 1560 * ad_sd_calibrate() call overwrites this via 1557 1561 * ad_sigma_delta_set_channel() -> ad7124_set_channel() 1558 - * ... -> ad7124_enable_channel(). 1562 + * -> ad7124_prepare_read(). 1559 1563 */ 1560 1564 ret = ad_sd_read_reg(&st->sd, AD7124_GAIN(st->channels[i].cfg.cfg_slot), 3, 1561 1565 &st->channels[i].cfg.calibration_gain);