mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] iio: gts-helpers: fix integration time units
Date: Mon, 1 May 2023 16:48:43 +0100	[thread overview]
Message-ID: <20230501164843.18d9ec6f@jic23-huawei> (raw)
In-Reply-To: <ec06f796-24f7-c3a4-c22e-f568bcc08522@fi.rohmeurope.com>

On Mon, 24 Apr 2023 05:09:36 +0000
"Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com> wrote:

> On 4/23/23 14:18, Jonathan Cameron wrote:
> > On Mon, 17 Apr 2023 12:20:18 +0300
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >   
> >> The IIO ABI mandates expressing integration times in seconds. The GTS
> >> helper errorneously uses micro seconds in integration_times_available.
> >> Fix this by converting the lists to IIO_VAL_INT_PLUS_MICRO.
> >>
> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> >> ---
> >>   drivers/iio/industrialio-gts-helper.c | 43 ++++++++++++++++++++-------
> >>   1 file changed, 33 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/drivers/iio/industrialio-gts-helper.c b/drivers/iio/industrialio-gts-helper.c
> >> index 8bb68975b259..2ab8d2dce019 100644
> >> --- a/drivers/iio/industrialio-gts-helper.c
> >> +++ b/drivers/iio/industrialio-gts-helper.c
> >> @@ -337,6 +337,17 @@ static int iio_gts_build_avail_scale_table(struct iio_gts *gts)
> >>   	return ret;
> >>   }
> >>   
> >> +static void iio_gts_us_to_int_micro(int *time_us, int *int_micro_times,
> >> +				    int num_times)
> >> +{
> >> +	int i;
> >> +
> >> +	for (i = 0; i < num_times; i++) {
> >> +		int_micro_times[i * 2] = time_us[i] / 1000000;
> >> +		int_micro_times[i * 2 + 1] = time_us[i] % 1000000;
> >> +	}
> >> +}
> >> +
> >>   /**
> >>    * iio_gts_build_avail_time_table - build table of available integration times
> >>    * @gts:	Gain time scale descriptor
> >> @@ -351,7 +362,7 @@ static int iio_gts_build_avail_scale_table(struct iio_gts *gts)
> >>    */
> >>   static int iio_gts_build_avail_time_table(struct iio_gts *gts)
> >>   {
> >> -	int *times, i, j, idx = 0;
> >> +	int *times, i, j, idx = 0, *int_micro_times;
> >>   
> >>   	if (!gts->num_itime)
> >>   		return 0;
> >> @@ -360,6 +371,7 @@ static int iio_gts_build_avail_time_table(struct iio_gts *gts)
> >>   	if (!times)
> >>   		return -ENOMEM;
> >>   
> >> +  
> > 
> > Grumble.  
> 
> Oh. I wonder how things like this tend to slip-in. Maybe I should change 
> my password, it must be someone else has cracked my it and is typing 
> these in at night while I am sleeping ^_^;
> 
> > If nothing else comes up I'll tidy that stray line up when applying.  
> 
> Thanks!
> 
> > Note that these will need to wait for after rc1 now so my fixes branch
> > has moved on to include the code being fixed.  
> 
> Well, that's Ok. Please, let me know if you want me to rebase to rc1 and 
> respin the series.
No need as not much changed around these (not I'm not at rc1 yet, but
char-misc-linus now includes these so I rebased on that)

Applied to the fixes-togreg branch of iio.git with fixes tags added now
the commits are upstream.

Thanks,

Jonathan

> 
> --Matti
> 


      reply	other threads:[~2023-05-01 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  9:19 [PATCH 0/2] iio: Fix integration time unit Matti Vaittinen
2023-04-17  9:19 ` [PATCH 1/2] iio: bu27034: Fix integration time Matti Vaittinen
2023-04-17  9:20 ` [PATCH 2/2] iio: gts-helpers: fix integration time units Matti Vaittinen
2023-04-23 11:18   ` Jonathan Cameron
2023-04-24  5:09     ` Vaittinen, Matti
2023-05-01 15:48       ` Jonathan Cameron [this message]

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=20230501164843.18d9ec6f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Matti.Vaittinen@fi.rohmeurope.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@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

all inboxes | Powered by JetHome®