public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: lars@metafoo.de, krzysztof.kozlowski@linaro.org,
	nuno.sa@analog.com, u.kleine-koenig@baylibre.com,
	abhashkumarjha123@gmail.com, jstephan@baylibre.com,
	dlechner@baylibre.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jack Andersen <jackoalan@gmail.com>
Subject: Re: [PATCH RFC 3/6] iio: adc: dln2-adc: make use of iio_is_soft_ts_enabled()
Date: Sat, 30 Nov 2024 14:02:55 +0000	[thread overview]
Message-ID: <20241130140255.70b4b68b@jic23-huawei> (raw)
In-Reply-To: <20241130002710.18615-4-vassilisamir@gmail.com>

On Sat, 30 Nov 2024 01:27:07 +0100
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:

> Use the iio_is_soft_ts_enabled() accessor to access the value of the
> scan_timestamp. This way, it can be marked as __private when there
> are no direct accessors of it.
> 
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>

The original code looks to me like a micro optimization that we should
consider dropping to reduce complexity.  It is only used to zero a hole
in a structure conditionally if the timestamp is enabled.

Better I think to just drop all the ts_pad_offset etc stuff in favour of
just zeroing the whole of the data structure in dln2_adc_trigger_h()
whether or not the timestamp is enabled.

My guess is that on a reasonably performance CPU the occasional cost
of a branch miss prediction will outweigh zeroing a fairly small structure
anyway.

+CC Jack who wrote this driver.

Jonathan


> ---
>  drivers/iio/adc/dln2-adc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/dln2-adc.c b/drivers/iio/adc/dln2-adc.c
> index 30328626d9be..f9cf132c41e6 100644
> --- a/drivers/iio/adc/dln2-adc.c
> +++ b/drivers/iio/adc/dln2-adc.c
> @@ -128,7 +128,7 @@ static void dln2_adc_update_demux(struct dln2_adc *dln2)
>  		in_loc += 2;
>  	}
>  
> -	if (indio_dev->scan_timestamp) {
> +	if (iio_is_soft_ts_enabled(indio_dev)) {
>  		size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
>  
>  		dln2->ts_pad_offset = out_loc;


  reply	other threads:[~2024-11-30 14:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30  0:27 [PATCH RFC 0/6] iio: mark scan_timestamp __private Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 1/6] iio: create accessor for iio_dev->scan_timestamp Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 2/6] iio: make use of iio_is_soft_ts_enabled() Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 3/6] iio: adc: dln2-adc: " Vasileios Amoiridis
2024-11-30 14:02   ` Jonathan Cameron [this message]
2024-12-03 21:38     ` Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 4/6] iio: adc: max1363: " Vasileios Amoiridis
2024-11-30 14:09   ` Jonathan Cameron
2024-12-03 22:08     ` Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 5/6] iio: common: ssp_sensors: " Vasileios Amoiridis
2024-11-30 14:17   ` Jonathan Cameron
2024-12-03 22:10     ` Vasileios Amoiridis
2024-11-30  0:27 ` [PATCH RFC 6/6] iio: core: mark scan_timestamp as __private Vasileios Amoiridis
2024-11-30 14:19   ` Jonathan Cameron
2024-12-03 22:14     ` Vasileios Amoiridis

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=20241130140255.70b4b68b@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=abhashkumarjha123@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jackoalan@gmail.com \
    --cc=jstephan@baylibre.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vassilisamir@gmail.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