[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2acb30fb3c9a86ac8cc882fb787cd04e5864224b.camel@perches.com>
Date: Sun, 20 Oct 2019 12:02:52 -0700
From: Joe Perches <joe@...ches.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: byteorder: cpu_to_le32_array vs cpu_to_be32_array function API
differences
There's an argument inconsistency between these 4 functions
in include/linux/byteorder/generic.h
It'd be more a consistent API with one form and not two.
static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
{
while (words--) {
__le32_to_cpus(buf);
buf++;
}
}
static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
{
while (words--) {
__cpu_to_le32s(buf);
buf++;
}
}
vs
static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
{
int i;
for (i = 0; i < len; i++)
dst[i] = cpu_to_be32(src[i]);
}
static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
{
int i;
for (i = 0; i < len; i++)
dst[i] = be32_to_cpu(src[i]);
}
Added via 2 different commits:
commit f2f2efb807d339513199b1bb771806c90cce83ae
Author: Mika Westerberg <mika.westerberg@...ux.intel.com>
Date: Mon Oct 2 13:38:28 2017 +0300
byteorder: Move {cpu_to_be32, be32_to_cpu}_array() from Thunderbolt to core
We will be using these when communicating XDomain discovery protocol
over Thunderbolt link but they might be useful for other drivers as
well.
Make them available through byteorder/generic.h.
Suggested-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
and
commit 9def051018c08e65c532822749e857eb4b2e12e7
Author: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Date: Wed Mar 21 19:01:40 2018 +0200
crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
Deduplicate le32_to_cpu_array() and cpu_to_le32_array() by moving them
to the generic header.
No functional change implied.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>
Powered by blists - more mailing lists