From: davidcomponentone@gmail.com
To: jic23@kernel.org
Cc: davidcomponentone@gmail.com, lars@metafoo.de,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Yang Guang <yang.guang5@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH] tools: iio: use swap() to make code cleaner
Date: Thu, 4 Nov 2021 14:20:32 +0800 [thread overview]
Message-ID: <20211104062032.1505899-1-yang.guang5@zte.com.cn> (raw)
From: Yang Guang <yang.guang5@zte.com.cn>
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
tools/iio/iio_utils.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index aadee6d34c74..7a56c41fbded 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -290,15 +290,12 @@ int iioutils_get_param_float(float *output, const char *param_name,
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]);
}
}
--
2.30.2
next reply other threads:[~2021-11-04 6:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 6:20 davidcomponentone [this message]
2021-11-04 10:33 ` [PATCH] tools: iio: use swap() to make code cleaner Andy Shevchenko
2021-11-04 10:36 ` Andy Shevchenko
2021-11-14 16:05 ` Jonathan Cameron
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=20211104062032.1505899-1-yang.guang5@zte.com.cn \
--to=davidcomponentone@gmail.com \
--cc=jic23@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).