The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "David Lechner" <dlechner@baylibre.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: iio: adc: ad7124: remove __ad7124_set_channel()
Date: Wed, 17 Sep 2025 08:05:57 +0100	[thread overview]
Message-ID: <ce724693ffd6bc8f3f10cb8d753fd69191a19d8d.camel@gmail.com> (raw)
In-Reply-To: <20250916-iio-adc-ad7124-remove-__ad7124_set_channel-v1-1-aa7a2cbec8a0@baylibre.com>

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@baylibre.com>
> ---
> Just a small cleanup while I continue to work on this driver.
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.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,

  reply	other threads:[~2025-09-17  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 21:39 [PATCH] drivers: iio: adc: ad7124: remove __ad7124_set_channel() David Lechner
2025-09-17  7:05 ` Nuno Sá [this message]
2025-09-17 21:52 ` David Lechner
2025-09-20 11:08   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce724693ffd6bc8f3f10cb8d753fd69191a19d8d.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox