From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org,
Mathias Nyman <mathias.nyman@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Anton Sviridenko <anton@corp.bluecherry.net>,
Andrey Utkin <andrey.utkin@corp.bluecherry.net>,
Ismael Luceno <ismael@iodev.co.uk>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Jussi Kivilinna <jussi.kivilinna@iki.fi>,
Kalle Valo <kvalo@codeaurora.org>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Sylwia Wnuczko <sylwia.wnuczko@intel.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>
Subject: [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array()
Date: Mon, 17 Aug 2020 21:46:52 +0300 [thread overview]
Message-ID: <20200817184659.58419-1-andriy.shevchenko@linux.intel.com> (raw)
Introduce cpu_to_le16_array() and le16_to_cpu_array() for existing and
future users.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Anton Sviridenko <anton@corp.bluecherry.net>
Cc: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Cc: Ismael Luceno <ismael@iodev.co.uk>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Sylwia Wnuczko <sylwia.wnuczko@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
v2: split out of the USB patch
The idea, how I see it, is to push entire series via USB tree as a main
target of it. The immutable branch can be used for others to pick up.
Of course maintainers can propose better approach.
include/linux/byteorder/generic.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 4b13e0a3e15b..24904ad79df0 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -156,6 +156,22 @@ static inline void le64_add_cpu(__le64 *var, u64 val)
*var = cpu_to_le64(le64_to_cpu(*var) + val);
}
+static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ dst[i] = cpu_to_le16(src[i]);
+}
+
+static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ dst[i] = le16_to_cpu(src[i]);
+}
+
/* XXX: this stuff can be optimized */
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
{
--
2.28.0
next reply other threads:[~2020-08-17 18:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 18:46 Andy Shevchenko [this message]
2020-08-17 18:46 ` [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array() Andy Shevchenko
2020-08-17 22:18 ` Ismael Luceno
2020-08-17 18:46 ` [PATCH v2 3/8] rndis_wlan: " Andy Shevchenko
2020-08-17 22:02 ` kernel test robot
2020-08-18 5:36 ` Kalle Valo
2020-08-18 5:36 ` Jussi Kivilinna
2020-08-17 18:46 ` [PATCH v2 4/8] i40e: Make use of le16_to_cpu_array() Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 5/8] ice: " Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 6/8] usb: early: xhci-dbc: use readl_poll_timeout() to simplify code Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 7/8] usb: early: xhci-dbc: Make use of cpu_to_le16_array() Andy Shevchenko
2020-08-17 21:23 ` kernel test robot
2020-08-17 18:46 ` [PATCH v2 8/8] usb: early: xhci-dbc: Move asm/* headers after linux/* Andy Shevchenko
2020-08-18 8:01 ` [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
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=20200817184659.58419-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrey.utkin@corp.bluecherry.net \
--cc=anton@corp.bluecherry.net \
--cc=gregkh@linuxfoundation.org \
--cc=ismael@iodev.co.uk \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=jussi.kivilinna@iki.fi \
--cc=kvalo@codeaurora.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mchehab@kernel.org \
--cc=sylwia.wnuczko@intel.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;
as well as URLs for NNTP newsgroup(s).