From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: davidcomponentone@gmail.com, Lars-Peter Clausen <lars@metafoo.de>,
linux-iio <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Yang Guang <yang.guang5@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] tools: iio: use swap() to make code cleaner
Date: Sun, 14 Nov 2021 16:05:11 +0000 [thread overview]
Message-ID: <20211114160511.404fcb4f@jic23-huawei> (raw)
In-Reply-To: <CAHp75VeUfRQ279iY3tZs298h7Vpnca_Lso=N2THEKuqc=hW1_A@mail.gmail.com>
On Thu, 4 Nov 2021 12:36:52 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Nov 4, 2021 at 12:33 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Thu, Nov 4, 2021 at 8:21 AM <davidcomponentone@gmail.com> wrote:
>
> > > Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> > > opencoding it.
> >
> > Same as per other patches. Don't be a dump addon to the robot, think
> > about the code a little bit more.
> >
> > > void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt)
> > > {
> > > - struct iio_channel_info temp;
> > > int x, y;
> > >
> > > for (x = 0; x < cnt; x++)
> > > for (y = 0; y < (cnt - 1); y++)
> > > if (ci_array[y].index > ci_array[y + 1].index) {
> > > - temp = ci_array[y + 1];
> > > - ci_array[y + 1] = ci_array[y];
> > > - ci_array[y] = temp;
> > > + swap(ci_array[y + 1], ci_array[y]);
> > > }
> >
> > Name of the function suggests it's a sort, we have the sort_r() API,
> > use it instead.
>
> Ah, it's the tools folder...
> Anyway, the first part of the comment stays valid for all your contribution.
>
Also check this builds as it doesn't for me precisely because this is in tools and
hence should be using uapi includes only. Maybe there is one going in for this
during the merge window but it's not in my tree yet at least.
Jonathan
prev parent reply other threads:[~2021-11-14 16:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 6:20 [PATCH] tools: iio: use swap() to make code cleaner davidcomponentone
2021-11-04 10:33 ` Andy Shevchenko
2021-11-04 10:36 ` Andy Shevchenko
2021-11-14 16:05 ` 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=20211114160511.404fcb4f@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=davidcomponentone@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yang.guang5@zte.com.cn \
--cc=zealci@zte.com.cn \
/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