[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce724693ffd6bc8f3f10cb8d753fd69191a19d8d.camel@gmail.com>
Date: Wed, 17 Sep 2025 08:05:57 +0100
From: Nuno Sá <noname.nuno@...il.com>
To: David Lechner <dlechner@...libre.com>, Michael Hennerich
<Michael.Hennerich@...log.com>, Jonathan Cameron <jic23@...nel.org>, Nuno
Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: iio: adc: ad7124: remove __ad7124_set_channel()
On Tue, 2025-09-16 at 16:39 -0500, David Lechner wrote:
> Remove __ad7124_set_channel() wrapper function. This just added an
> unnecessary layer of indirection with an extra call to container_of().
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
> ---
> Just a small cleanup while I continue to work on this driver.
> ---
Reviewed-by: Nuno Sá <nuno.sa@...log.com>
> drivers/iio/adc/ad7124.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c
> index
> 910b40393f77de84afc77d406c17c6e5051a02cd..c24f3d5127cb83eeab0cf37882446fc99417
> 3274 100644
> --- a/drivers/iio/adc/ad7124.c
> +++ b/drivers/iio/adc/ad7124.c
> @@ -657,20 +657,13 @@ static int ad7124_prepare_read(struct ad7124_state *st,
> int address)
> return ad7124_enable_channel(st, &st->channels[address]);
> }
>
> -static int __ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int
> channel)
> -{
> - struct ad7124_state *st = container_of(sd, struct ad7124_state, sd);
> -
> - return ad7124_prepare_read(st, channel);
> -}
> -
> static int ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int
> channel)
> {
> struct ad7124_state *st = container_of(sd, struct ad7124_state, sd);
> int ret;
>
> mutex_lock(&st->cfgs_lock);
> - ret = __ad7124_set_channel(sd, channel);
> + ret = ad7124_prepare_read(st, channel);
> mutex_unlock(&st->cfgs_lock);
>
> return ret;
> @@ -965,7 +958,7 @@ static int ad7124_update_scan_mode(struct iio_dev
> *indio_dev,
> for (i = 0; i < st->num_channels; i++) {
> bit_set = test_bit(i, scan_mask);
> if (bit_set)
> - ret = __ad7124_set_channel(&st->sd, i);
> + ret = ad7124_prepare_read(st, i);
> else
> ret = ad7124_spi_write_mask(st, AD7124_CHANNEL(i),
> AD7124_CHANNEL_ENABLE,
> 0, 2);
>
> ---
> base-commit: df76e03e8127f756f314418d683bad24b460c61f
> change-id: 20250916-iio-adc-ad7124-remove-__ad7124_set_channel-d8e5c30ec7c6
>
> Best regards,
Powered by blists - more mailing lists