[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9724f90c-111f-40e7-9787-c62787cef96e@gmail.com>
Date: Wed, 13 Mar 2024 10:08:50 +0200
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Chenyuan Yang <chenyuan0y@...il.com>
Cc: jic23@...nel.org, lars@...afoo.de, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijie Zhao <zzjas98@...il.com>
Subject: Re: [drivers/iio] Question about `iio_gts_build_avail_time_table`
Hi Chenyuan,
On 3/12/24 18:53, Chenyuan Yang wrote:
> Hi Matti,
>
> I have a question about the "The idea of the check which has been
> removed was to assign the value in
> the array in first free spot if it is bigger than the last value".
Can you please avoid top-posting when discussing on the Linux lists. You
can find more information from:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html
part of which may be crucial in order to get your changes applied if you
haven't already familiarized yourself with the kernel development processes.
>
> - if (times[idx] < new) {
> - times[idx++] = new;
> - continue;
> - }
> + times[idx] = new;
>
> It appears that the comparison should perhaps be made with `idx-1`
> rather than `idx`, given that `idx` represents the current number of
> copied values in times, whereas `idx-1` points to the last value.
> Could I have your thoughts on this?
Yes. I implemented the old code wrong as you pointed out.
You may want to take the GTS Kunit test cases:
https://lore.kernel.org/all/6b839dd533fd93b75c2e6f6a8f2286233d4901fb.1704881096.git.mazziesaccount@gmail.com/
which, I think, are already merged in IIO testing branch.
You can test the sorting when you change the order of the times in the
test case:
+static const struct iio_itime_sel_mul gts_test_itimes[] = {
+ GAIN_SCALE_ITIME_US(400 * 1000, TEST_TSEL_400, 8),
+ GAIN_SCALE_ITIME_US(200 * 1000, TEST_TSEL_200, 4),
+ GAIN_SCALE_ITIME_US(100 * 1000, TEST_TSEL_100, 2),
+ GAIN_SCALE_ITIME_US(50 * 1000, TEST_TSEL_50, 1),
+#define TIMEGAIN_MAX 8
+};
for example to
+static const struct iio_itime_sel_mul gts_test_itimes[] = {
+ GAIN_SCALE_ITIME_US(400 * 1000, TEST_TSEL_400, 8),
+ GAIN_SCALE_ITIME_US(50 * 1000, TEST_TSEL_50, 1),
+ GAIN_SCALE_ITIME_US(200 * 1000, TEST_TSEL_200, 4),
+ GAIN_SCALE_ITIME_US(100 * 1000, TEST_TSEL_100, 2),
+#define TIMEGAIN_MAX 8
+};
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
Powered by blists - more mailing lists