Re: [PATCH RFC 3/6] iio: adc: dln2-adc: make use of iio_is_soft_ts_enabled()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 30, 2024 at 02:02:55PM +0000, Jonathan Cameron wrote:
> On Sat, 30 Nov 2024 01:27:07 +0100
> Vasileios Amoiridis <vassilisamir@xxxxxxxxx> 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@xxxxxxxxx>
> 
> 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
> 
> 

Hi Jonathan,

Thanks for the review once again! It looks like it should be fairly
straightforward to drop the zeroing of the ts_pad_{offset/length} so
indeed, if Jack doesn't have anything strong against it I could move
forward and send a v2.

Cheers,
Vasilis

> > ---
> >  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;
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux