* [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array()
@ 2020-08-17 18:46 Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array() Andy Shevchenko
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Andy Shevchenko, Anton Sviridenko, Andrey Utkin, Ismael Luceno,
Mauro Carvalho Chehab, Jussi Kivilinna, Kalle Valo, Jeff Kirsher,
Sylwia Wnuczko, Jesse Brandeburg
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
@ 2020-08-17 18:46 ` Andy Shevchenko
2020-08-17 22:18 ` Ismael Luceno
2020-08-17 18:46 ` [PATCH v2 3/8] rndis_wlan: " Andy Shevchenko
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Andy Shevchenko, Anton Sviridenko, Andrey Utkin, Ismael Luceno,
Mauro Carvalho Chehab
Since we have a new helper, let's replace open coded variant by it.
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>
---
v2: new patch
drivers/media/pci/solo6x10/solo6x10-disp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c
index ad98ca7fb98b..09c0cf8a5fcb 100644
--- a/drivers/media/pci/solo6x10/solo6x10-disp.c
+++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
@@ -202,16 +202,15 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
{
const unsigned size = sizeof(u16) * 64;
u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2;
+ unsigned int y;
__le16 *buf;
- int x, y;
int ret = 0;
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
for (y = 0; y < SOLO_MOTION_SZ; y++) {
- for (x = 0; x < SOLO_MOTION_SZ; x++)
- buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]);
+ cpu_to_le16_array(buf, &thresholds[y * SOLO_MOTION_SZ], SOLO_MOTION_SZ);
ret |= solo_p2m_dma(solo_dev, 1, buf,
SOLO_MOTION_EXT_ADDR(solo_dev) + off + y * size,
size, 0, 0);
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array() Andy Shevchenko
@ 2020-08-17 18:46 ` Andy Shevchenko
2020-08-17 22:02 ` kernel test robot
` (2 more replies)
2020-08-17 18:46 ` [PATCH v2 4/8] i40e: Make use of le16_to_cpu_array() Andy Shevchenko
` (5 subsequent siblings)
7 siblings, 3 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Andy Shevchenko, Jussi Kivilinna, Kalle Valo
Since we have a new helper, let's replace open coded variant by it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Cc: Kalle Valo <kvalo@codeaurora.org>
---
v2: new patch
drivers/net/wireless/rndis_wlan.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 8852a1832951..06850ee6d6dc 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -859,9 +859,12 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
int value_type, void *value)
{
struct ndis_config_param *infobuf;
- int value_len, info_len, param_len, ret, i;
+ int value_len, info_len, param_len, ret;
__le16 *unibuf;
__le32 *dst_value;
+#ifdef DEBUG
+ int i;
+#endif
if (value_type == 0)
value_len = sizeof(__le32);
@@ -901,13 +904,11 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
/* simple string to unicode string conversion */
unibuf = (void *)infobuf + sizeof(*infobuf);
- for (i = 0; i < param_len / sizeof(__le16); i++)
- unibuf[i] = cpu_to_le16(param[i]);
+ cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
if (value_type == 2) {
unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
- for (i = 0; i < value_len / sizeof(__le16); i++)
- unibuf[i] = cpu_to_le16(((u8 *)value)[i]);
+ cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
} else {
dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
*dst_value = cpu_to_le32(*(u32 *)value);
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 4/8] i40e: Make use of le16_to_cpu_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array() Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 3/8] rndis_wlan: " Andy Shevchenko
@ 2020-08-17 18:46 ` Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 5/8] ice: " Andy Shevchenko
` (4 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Andy Shevchenko, Jeff Kirsher, Sylwia Wnuczko
Since we have a new helper, let's replace open coded variant by it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Sylwia Wnuczko <sylwia.wnuczko@intel.com>
---
v2: new patch
drivers/net/ethernet/intel/i40e/i40e_nvm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 7164f4ad8120..154505f352bc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -444,7 +444,6 @@ static i40e_status i40e_read_nvm_buffer_aq(struct i40e_hw *hw, u16 offset,
u16 read_size;
bool last_cmd = false;
u16 words_read = 0;
- u16 i = 0;
do {
/* Calculate number of bytes we should read in this step.
@@ -475,8 +474,7 @@ static i40e_status i40e_read_nvm_buffer_aq(struct i40e_hw *hw, u16 offset,
offset += read_size;
} while (words_read < *words);
- for (i = 0; i < *words; i++)
- data[i] = le16_to_cpu(((__le16 *)data)[i]);
+ le16_to_cpu_array(data, data, *words);
read_nvm_buffer_aq_exit:
*words = words_read;
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 5/8] ice: Make use of le16_to_cpu_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
` (2 preceding siblings ...)
2020-08-17 18:46 ` [PATCH v2 4/8] i40e: Make use of le16_to_cpu_array() Andy Shevchenko
@ 2020-08-17 18:46 ` Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 6/8] usb: early: xhci-dbc: use readl_poll_timeout() to simplify code Andy Shevchenko
` (3 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Andy Shevchenko, Jeff Kirsher, Jesse Brandeburg
Since we have a new helper, let's replace open coded variant by it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
v2: new patch
drivers/net/ethernet/intel/ice/ice_nvm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c
index 5903a36763de..3c376cb49e61 100644
--- a/drivers/net/ethernet/intel/ice/ice_nvm.c
+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c
@@ -448,8 +448,8 @@ static enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw)
enum ice_status ret;
u32 id_blk_start;
__le16 raw_data;
- u16 data, i;
u16 *buff;
+ u16 data;
ret = ice_acquire_nvm(hw, ICE_RES_READ);
if (ret)
@@ -494,8 +494,7 @@ static enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw)
if (ret)
goto exit_error;
- for (i = 0; i < ICE_AQC_NVM_NETLIST_ID_BLK_LEN; i++)
- buff[i] = le16_to_cpu(((__force __le16 *)buff)[i]);
+ le16_to_cpu_array(buff, buff, ICE_AQC_NVM_NETLIST_ID_BLK_LEN);
ver->major = (buff[ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_HIGH] << 16) |
buff[ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_LOW];
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 6/8] usb: early: xhci-dbc: use readl_poll_timeout() to simplify code
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
` (3 preceding siblings ...)
2020-08-17 18:46 ` [PATCH v2 5/8] ice: " Andy Shevchenko
@ 2020-08-17 18:46 ` Andy Shevchenko
2020-08-17 18:46 ` [PATCH v2 7/8] usb: early: xhci-dbc: Make use of cpu_to_le16_array() Andy Shevchenko
` (2 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman; +Cc: Andy Shevchenko
Use readl_poll_timeout() to poll the status of the registers.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no change
drivers/usb/early/xhci-dbc.c | 56 +++++++++++++++++-------------------
1 file changed, 27 insertions(+), 29 deletions(-)
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index c0507767a8e3..77c2e8301971 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -14,6 +14,7 @@
#include <linux/pci_ids.h>
#include <linux/memblock.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <asm/pci-direct.h>
#include <asm/fixmap.h>
#include <linux/bcd.h>
@@ -131,38 +132,23 @@ static u32 __init xdbc_find_dbgp(int xdbc_num, u32 *b, u32 *d, u32 *f)
return -1;
}
-static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait, int delay)
-{
- u32 result;
-
- do {
- result = readl(ptr);
- result &= mask;
- if (result == done)
- return 0;
- udelay(delay);
- wait -= delay;
- } while (wait > 0);
-
- return -ETIMEDOUT;
-}
-
static void __init xdbc_bios_handoff(void)
{
int offset, timeout;
u32 val;
offset = xhci_find_next_ext_cap(xdbc.xhci_base, 0, XHCI_EXT_CAPS_LEGACY);
- val = readl(xdbc.xhci_base + offset);
- if (val & XHCI_HC_BIOS_OWNED) {
+ val = readl(xdbc.xhci_base + offset);
+ if (val & XHCI_HC_BIOS_OWNED)
writel(val | XHCI_HC_OS_OWNED, xdbc.xhci_base + offset);
- timeout = handshake(xdbc.xhci_base + offset, XHCI_HC_BIOS_OWNED, 0, 5000, 10);
- if (timeout) {
- pr_notice("failed to hand over xHCI control from BIOS\n");
- writel(val & ~XHCI_HC_BIOS_OWNED, xdbc.xhci_base + offset);
- }
+ timeout = readl_poll_timeout_atomic(xdbc.xhci_base + offset, val,
+ !(val & XHCI_HC_BIOS_OWNED),
+ 10, 5000);
+ if (timeout) {
+ pr_notice("failed to hand over xHCI control from BIOS\n");
+ writel(val & ~XHCI_HC_BIOS_OWNED, xdbc.xhci_base + offset);
}
/* Disable BIOS SMIs and clear all SMI events: */
@@ -421,7 +407,9 @@ static int xdbc_start(void)
ctrl = readl(&xdbc.xdbc_reg->control);
writel(ctrl | CTRL_DBC_ENABLE | CTRL_PORT_ENABLE, &xdbc.xdbc_reg->control);
- ret = handshake(&xdbc.xdbc_reg->control, CTRL_DBC_ENABLE, CTRL_DBC_ENABLE, 100000, 100);
+ ret = readl_poll_timeout_atomic(&xdbc.xdbc_reg->control, ctrl,
+ (ctrl & CTRL_DBC_ENABLE) == CTRL_DBC_ENABLE,
+ 100, 100000);
if (ret) {
xdbc_trace("failed to initialize hardware\n");
return ret;
@@ -432,14 +420,18 @@ static int xdbc_start(void)
xdbc_reset_debug_port();
/* Wait for port connection: */
- ret = handshake(&xdbc.xdbc_reg->portsc, PORTSC_CONN_STATUS, PORTSC_CONN_STATUS, 5000000, 100);
+ ret = readl_poll_timeout_atomic(&xdbc.xdbc_reg->portsc, status,
+ (status & PORTSC_CONN_STATUS) == PORTSC_CONN_STATUS,
+ 100, 5000000);
if (ret) {
xdbc_trace("waiting for connection timed out\n");
return ret;
}
/* Wait for debug device to be configured: */
- ret = handshake(&xdbc.xdbc_reg->control, CTRL_DBC_RUN, CTRL_DBC_RUN, 5000000, 100);
+ ret = readl_poll_timeout_atomic(&xdbc.xdbc_reg->control, status,
+ (status & CTRL_DBC_RUN) == CTRL_DBC_RUN,
+ 100, 5000000);
if (ret) {
xdbc_trace("waiting for device configuration timed out\n");
return ret;
@@ -523,11 +515,14 @@ static int xdbc_bulk_transfer(void *data, int size, bool read)
static int xdbc_handle_external_reset(void)
{
- int ret = 0;
+ u32 result;
+ int ret;
xdbc.flags = 0;
writel(0, &xdbc.xdbc_reg->control);
- ret = handshake(&xdbc.xdbc_reg->control, CTRL_DBC_ENABLE, 0, 100000, 10);
+ ret = readl_poll_timeout_atomic(&xdbc.xdbc_reg->control, result,
+ !(result & CTRL_DBC_ENABLE),
+ 10, 100000);
if (ret)
goto reset_out;
@@ -552,10 +547,13 @@ static int xdbc_handle_external_reset(void)
static int __init xdbc_early_setup(void)
{
+ u32 result;
int ret;
writel(0, &xdbc.xdbc_reg->control);
- ret = handshake(&xdbc.xdbc_reg->control, CTRL_DBC_ENABLE, 0, 100000, 100);
+ ret = readl_poll_timeout_atomic(&xdbc.xdbc_reg->control, result,
+ !(result & CTRL_DBC_ENABLE),
+ 100, 100000);
if (ret)
return ret;
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 7/8] usb: early: xhci-dbc: Make use of cpu_to_le16_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
` (4 preceding siblings ...)
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 ` 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
7 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman; +Cc: Andy Shevchenko
Since we have a new helper, let's replace open coded variant by it.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: updated commit message due to split (see patch 1)
drivers/usb/early/xhci-dbc.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index 77c2e8301971..c5761ea9394d 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+#include <linux/byteorder/generic.h>
#include <linux/console.h>
#include <linux/pci_regs.h>
#include <linux/pci_ids.h>
@@ -200,14 +201,6 @@ static void xdbc_reset_ring(struct xdbc_ring *ring)
}
}
-static inline void xdbc_put_utf16(u16 *s, const char *c, size_t size)
-{
- int i;
-
- for (i = 0; i < size; i++)
- s[i] = cpu_to_le16(c[i]);
-}
-
static void xdbc_mem_init(void)
{
struct xdbc_ep_context *ep_in, *ep_out;
@@ -263,7 +256,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_SERIAL) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;
- xdbc_put_utf16(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
+ cpu_to_le16_array(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
string_length = s_desc->bLength;
string_length <<= 8;
@@ -272,7 +265,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_PRODUCT) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;
- xdbc_put_utf16(s_desc->wData, XDBC_STRING_PRODUCT, strlen(XDBC_STRING_PRODUCT));
+ cpu_to_le16_array(s_desc->wData, XDBC_STRING_PRODUCT, strlen(XDBC_STRING_PRODUCT));
string_length += s_desc->bLength;
string_length <<= 8;
@@ -281,7 +274,7 @@ static void xdbc_mem_init(void)
s_desc->bLength = (strlen(XDBC_STRING_MANUFACTURER) + 1) * 2;
s_desc->bDescriptorType = USB_DT_STRING;
- xdbc_put_utf16(s_desc->wData, XDBC_STRING_MANUFACTURER, strlen(XDBC_STRING_MANUFACTURER));
+ cpu_to_le16_array(s_desc->wData, XDBC_STRING_MANUFACTURER, strlen(XDBC_STRING_MANUFACTURER));
string_length += s_desc->bLength;
string_length <<= 8;
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 8/8] usb: early: xhci-dbc: Move asm/* headers after linux/*
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
` (5 preceding siblings ...)
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 18:46 ` Andy Shevchenko
2020-08-18 8:01 ` [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
7 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-17 18:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman; +Cc: Andy Shevchenko
asm/* are less generic and should be included after linux/* ones.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: moved only asm/* and preserved ordering of the rest (Greg)
drivers/usb/early/xhci-dbc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index c5761ea9394d..104b932a9c93 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -16,8 +16,6 @@
#include <linux/memblock.h>
#include <linux/io.h>
#include <linux/iopoll.h>
-#include <asm/pci-direct.h>
-#include <asm/fixmap.h>
#include <linux/bcd.h>
#include <linux/export.h>
#include <linux/module.h>
@@ -25,6 +23,9 @@
#include <linux/kthread.h>
#include <linux/usb/xhci-dbgp.h>
+#include <asm/fixmap.h>
+#include <asm/pci-direct.h>
+
#include "../host/xhci.h"
#include "xhci-dbc.h"
--
2.28.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 7/8] usb: early: xhci-dbc: Make use of cpu_to_le16_array()
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
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-08-17 21:23 UTC (permalink / raw)
To: Andy Shevchenko, Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: kbuild-all, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 12517 bytes --]
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on jkirsher-next-queue/dev-queue linuxtv-media/master staging/staging-testing v5.9-rc1 next-20200817]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-a003-20200817 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/usb/early/xhci-dbc.c:12:
>> include/linux/byteorder/generic.h:144:33: error: unknown type name '__le16'
144 | static inline void le16_add_cpu(__le16 *var, u16 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:144:46: error: unknown type name 'u16'
144 | static inline void le16_add_cpu(__le16 *var, u16 val)
| ^~~
>> include/linux/byteorder/generic.h:149:33: error: unknown type name '__le32'
149 | static inline void le32_add_cpu(__le32 *var, u32 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:149:46: error: unknown type name 'u32'
149 | static inline void le32_add_cpu(__le32 *var, u32 val)
| ^~~
>> include/linux/byteorder/generic.h:154:33: error: unknown type name '__le64'
154 | static inline void le64_add_cpu(__le64 *var, u64 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:154:46: error: unknown type name 'u64'
154 | static inline void le64_add_cpu(__le64 *var, u64 val)
| ^~~
include/linux/byteorder/generic.h:159:38: error: unknown type name '__le16'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:159:57: error: unknown type name 'u16'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~
>> include/linux/byteorder/generic.h:159:67: error: unknown type name 'size_t'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
+++ |+#include <stddef.h>
1 | /* SPDX-License-Identifier: GPL-2.0 */
include/linux/byteorder/generic.h:167:38: error: unknown type name 'u16'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:167:54: error: unknown type name '__le16'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:167:67: error: unknown type name 'size_t'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:167:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
include/linux/byteorder/generic.h:176:38: error: unknown type name 'u32'
176 | static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
| ^~~
include/linux/byteorder/generic.h:184:38: error: unknown type name 'u32'
184 | static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
| ^~~
>> include/linux/byteorder/generic.h:192:33: error: unknown type name '__be16'
192 | static inline void be16_add_cpu(__be16 *var, u16 val)
| ^~~~~~
include/linux/byteorder/generic.h:192:46: error: unknown type name 'u16'
192 | static inline void be16_add_cpu(__be16 *var, u16 val)
| ^~~
>> include/linux/byteorder/generic.h:197:33: error: unknown type name '__be32'
197 | static inline void be32_add_cpu(__be32 *var, u32 val)
| ^~~~~~
include/linux/byteorder/generic.h:197:46: error: unknown type name 'u32'
197 | static inline void be32_add_cpu(__be32 *var, u32 val)
| ^~~
>> include/linux/byteorder/generic.h:202:33: error: unknown type name '__be64'
202 | static inline void be64_add_cpu(__be64 *var, u64 val)
| ^~~~~~
include/linux/byteorder/generic.h:202:46: error: unknown type name 'u64'
202 | static inline void be64_add_cpu(__be64 *var, u64 val)
| ^~~
include/linux/byteorder/generic.h:207:38: error: unknown type name '__be32'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:207:57: error: unknown type name 'u32'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:207:67: error: unknown type name 'size_t'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:207:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
include/linux/byteorder/generic.h:215:38: error: unknown type name 'u32'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:215:54: error: unknown type name '__be32'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:215:67: error: unknown type name 'size_t'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:215:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
drivers/usb/early/xhci-dbc.c: In function 'xdbc_mem_init':
>> drivers/usb/early/xhci-dbc.c:259:2: error: implicit declaration of function 'cpu_to_le16_array'; did you mean 'cpu_to_le16'? [-Werror=implicit-function-declaration]
259 | cpu_to_le16_array(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
| ^~~~~~~~~~~~~~~~~
| cpu_to_le16
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/05f0c7b5a2ca395d58f1ba7a8f84f4be3d504b56
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
git checkout 05f0c7b5a2ca395d58f1ba7a8f84f4be3d504b56
vim +/__le16 +144 include/linux/byteorder/generic.h
^1da177e4c3f41 Linus Torvalds 2005-04-16 143
8b5f6883683c91 Marcin Slusarz 2008-02-08 @144 static inline void le16_add_cpu(__le16 *var, u16 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 145 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 146 *var = cpu_to_le16(le16_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 147 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 148
8b5f6883683c91 Marcin Slusarz 2008-02-08 @149 static inline void le32_add_cpu(__le32 *var, u32 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 150 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 151 *var = cpu_to_le32(le32_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 152 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 153
8b5f6883683c91 Marcin Slusarz 2008-02-08 @154 static inline void le64_add_cpu(__le64 *var, u64 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 155 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 156 *var = cpu_to_le64(le64_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 157 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 158
47df9f29cc421e Andy Shevchenko 2020-08-17 @159 static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
47df9f29cc421e Andy Shevchenko 2020-08-17 160 {
47df9f29cc421e Andy Shevchenko 2020-08-17 161 int i;
47df9f29cc421e Andy Shevchenko 2020-08-17 162
47df9f29cc421e Andy Shevchenko 2020-08-17 163 for (i = 0; i < len; i++)
47df9f29cc421e Andy Shevchenko 2020-08-17 164 dst[i] = cpu_to_le16(src[i]);
47df9f29cc421e Andy Shevchenko 2020-08-17 165 }
47df9f29cc421e Andy Shevchenko 2020-08-17 166
47df9f29cc421e Andy Shevchenko 2020-08-17 167 static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
47df9f29cc421e Andy Shevchenko 2020-08-17 168 {
47df9f29cc421e Andy Shevchenko 2020-08-17 169 int i;
47df9f29cc421e Andy Shevchenko 2020-08-17 170
47df9f29cc421e Andy Shevchenko 2020-08-17 171 for (i = 0; i < len; i++)
47df9f29cc421e Andy Shevchenko 2020-08-17 172 dst[i] = le16_to_cpu(src[i]);
47df9f29cc421e Andy Shevchenko 2020-08-17 173 }
47df9f29cc421e Andy Shevchenko 2020-08-17 174
9def051018c08e Andy Shevchenko 2018-03-21 175 /* XXX: this stuff can be optimized */
9def051018c08e Andy Shevchenko 2018-03-21 176 static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
9def051018c08e Andy Shevchenko 2018-03-21 177 {
9def051018c08e Andy Shevchenko 2018-03-21 178 while (words--) {
9def051018c08e Andy Shevchenko 2018-03-21 179 __le32_to_cpus(buf);
9def051018c08e Andy Shevchenko 2018-03-21 180 buf++;
9def051018c08e Andy Shevchenko 2018-03-21 181 }
9def051018c08e Andy Shevchenko 2018-03-21 182 }
9def051018c08e Andy Shevchenko 2018-03-21 183
9def051018c08e Andy Shevchenko 2018-03-21 184 static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
9def051018c08e Andy Shevchenko 2018-03-21 185 {
9def051018c08e Andy Shevchenko 2018-03-21 186 while (words--) {
9def051018c08e Andy Shevchenko 2018-03-21 187 __cpu_to_le32s(buf);
9def051018c08e Andy Shevchenko 2018-03-21 188 buf++;
9def051018c08e Andy Shevchenko 2018-03-21 189 }
9def051018c08e Andy Shevchenko 2018-03-21 190 }
9def051018c08e Andy Shevchenko 2018-03-21 191
8b5f6883683c91 Marcin Slusarz 2008-02-08 @192 static inline void be16_add_cpu(__be16 *var, u16 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 193 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 194 *var = cpu_to_be16(be16_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 195 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 196
8b5f6883683c91 Marcin Slusarz 2008-02-08 @197 static inline void be32_add_cpu(__be32 *var, u32 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 198 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 199 *var = cpu_to_be32(be32_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 200 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 201
8b5f6883683c91 Marcin Slusarz 2008-02-08 @202 static inline void be64_add_cpu(__be64 *var, u64 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 203 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 204 *var = cpu_to_be64(be64_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 205 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 206
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34758 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 7/8] usb: early: xhci-dbc: Make use of cpu_to_le16_array()
@ 2020-08-17 21:23 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-08-17 21:23 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 12706 bytes --]
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on jkirsher-next-queue/dev-queue linuxtv-media/master staging/staging-testing v5.9-rc1 next-20200817]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-a003-20200817 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/usb/early/xhci-dbc.c:12:
>> include/linux/byteorder/generic.h:144:33: error: unknown type name '__le16'
144 | static inline void le16_add_cpu(__le16 *var, u16 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:144:46: error: unknown type name 'u16'
144 | static inline void le16_add_cpu(__le16 *var, u16 val)
| ^~~
>> include/linux/byteorder/generic.h:149:33: error: unknown type name '__le32'
149 | static inline void le32_add_cpu(__le32 *var, u32 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:149:46: error: unknown type name 'u32'
149 | static inline void le32_add_cpu(__le32 *var, u32 val)
| ^~~
>> include/linux/byteorder/generic.h:154:33: error: unknown type name '__le64'
154 | static inline void le64_add_cpu(__le64 *var, u64 val)
| ^~~~~~
>> include/linux/byteorder/generic.h:154:46: error: unknown type name 'u64'
154 | static inline void le64_add_cpu(__le64 *var, u64 val)
| ^~~
include/linux/byteorder/generic.h:159:38: error: unknown type name '__le16'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:159:57: error: unknown type name 'u16'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~
>> include/linux/byteorder/generic.h:159:67: error: unknown type name 'size_t'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
+++ |+#include <stddef.h>
1 | /* SPDX-License-Identifier: GPL-2.0 */
include/linux/byteorder/generic.h:167:38: error: unknown type name 'u16'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:167:54: error: unknown type name '__le16'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:167:67: error: unknown type name 'size_t'
167 | static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:167:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
include/linux/byteorder/generic.h:176:38: error: unknown type name 'u32'
176 | static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
| ^~~
include/linux/byteorder/generic.h:184:38: error: unknown type name 'u32'
184 | static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
| ^~~
>> include/linux/byteorder/generic.h:192:33: error: unknown type name '__be16'
192 | static inline void be16_add_cpu(__be16 *var, u16 val)
| ^~~~~~
include/linux/byteorder/generic.h:192:46: error: unknown type name 'u16'
192 | static inline void be16_add_cpu(__be16 *var, u16 val)
| ^~~
>> include/linux/byteorder/generic.h:197:33: error: unknown type name '__be32'
197 | static inline void be32_add_cpu(__be32 *var, u32 val)
| ^~~~~~
include/linux/byteorder/generic.h:197:46: error: unknown type name 'u32'
197 | static inline void be32_add_cpu(__be32 *var, u32 val)
| ^~~
>> include/linux/byteorder/generic.h:202:33: error: unknown type name '__be64'
202 | static inline void be64_add_cpu(__be64 *var, u64 val)
| ^~~~~~
include/linux/byteorder/generic.h:202:46: error: unknown type name 'u64'
202 | static inline void be64_add_cpu(__be64 *var, u64 val)
| ^~~
include/linux/byteorder/generic.h:207:38: error: unknown type name '__be32'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:207:57: error: unknown type name 'u32'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:207:67: error: unknown type name 'size_t'
207 | static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:207:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
include/linux/byteorder/generic.h:215:38: error: unknown type name 'u32'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~
include/linux/byteorder/generic.h:215:54: error: unknown type name '__be32'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:215:67: error: unknown type name 'size_t'
215 | static inline void be32_to_cpu_array(u32 *dst, const __be32 *src, size_t len)
| ^~~~~~
include/linux/byteorder/generic.h:215:67: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
drivers/usb/early/xhci-dbc.c: In function 'xdbc_mem_init':
>> drivers/usb/early/xhci-dbc.c:259:2: error: implicit declaration of function 'cpu_to_le16_array'; did you mean 'cpu_to_le16'? [-Werror=implicit-function-declaration]
259 | cpu_to_le16_array(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
| ^~~~~~~~~~~~~~~~~
| cpu_to_le16
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/05f0c7b5a2ca395d58f1ba7a8f84f4be3d504b56
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
git checkout 05f0c7b5a2ca395d58f1ba7a8f84f4be3d504b56
vim +/__le16 +144 include/linux/byteorder/generic.h
^1da177e4c3f41 Linus Torvalds 2005-04-16 143
8b5f6883683c91 Marcin Slusarz 2008-02-08 @144 static inline void le16_add_cpu(__le16 *var, u16 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 145 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 146 *var = cpu_to_le16(le16_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 147 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 148
8b5f6883683c91 Marcin Slusarz 2008-02-08 @149 static inline void le32_add_cpu(__le32 *var, u32 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 150 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 151 *var = cpu_to_le32(le32_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 152 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 153
8b5f6883683c91 Marcin Slusarz 2008-02-08 @154 static inline void le64_add_cpu(__le64 *var, u64 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 155 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 156 *var = cpu_to_le64(le64_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 157 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 158
47df9f29cc421e Andy Shevchenko 2020-08-17 @159 static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
47df9f29cc421e Andy Shevchenko 2020-08-17 160 {
47df9f29cc421e Andy Shevchenko 2020-08-17 161 int i;
47df9f29cc421e Andy Shevchenko 2020-08-17 162
47df9f29cc421e Andy Shevchenko 2020-08-17 163 for (i = 0; i < len; i++)
47df9f29cc421e Andy Shevchenko 2020-08-17 164 dst[i] = cpu_to_le16(src[i]);
47df9f29cc421e Andy Shevchenko 2020-08-17 165 }
47df9f29cc421e Andy Shevchenko 2020-08-17 166
47df9f29cc421e Andy Shevchenko 2020-08-17 167 static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
47df9f29cc421e Andy Shevchenko 2020-08-17 168 {
47df9f29cc421e Andy Shevchenko 2020-08-17 169 int i;
47df9f29cc421e Andy Shevchenko 2020-08-17 170
47df9f29cc421e Andy Shevchenko 2020-08-17 171 for (i = 0; i < len; i++)
47df9f29cc421e Andy Shevchenko 2020-08-17 172 dst[i] = le16_to_cpu(src[i]);
47df9f29cc421e Andy Shevchenko 2020-08-17 173 }
47df9f29cc421e Andy Shevchenko 2020-08-17 174
9def051018c08e Andy Shevchenko 2018-03-21 175 /* XXX: this stuff can be optimized */
9def051018c08e Andy Shevchenko 2018-03-21 176 static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
9def051018c08e Andy Shevchenko 2018-03-21 177 {
9def051018c08e Andy Shevchenko 2018-03-21 178 while (words--) {
9def051018c08e Andy Shevchenko 2018-03-21 179 __le32_to_cpus(buf);
9def051018c08e Andy Shevchenko 2018-03-21 180 buf++;
9def051018c08e Andy Shevchenko 2018-03-21 181 }
9def051018c08e Andy Shevchenko 2018-03-21 182 }
9def051018c08e Andy Shevchenko 2018-03-21 183
9def051018c08e Andy Shevchenko 2018-03-21 184 static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
9def051018c08e Andy Shevchenko 2018-03-21 185 {
9def051018c08e Andy Shevchenko 2018-03-21 186 while (words--) {
9def051018c08e Andy Shevchenko 2018-03-21 187 __cpu_to_le32s(buf);
9def051018c08e Andy Shevchenko 2018-03-21 188 buf++;
9def051018c08e Andy Shevchenko 2018-03-21 189 }
9def051018c08e Andy Shevchenko 2018-03-21 190 }
9def051018c08e Andy Shevchenko 2018-03-21 191
8b5f6883683c91 Marcin Slusarz 2008-02-08 @192 static inline void be16_add_cpu(__be16 *var, u16 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 193 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 194 *var = cpu_to_be16(be16_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 195 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 196
8b5f6883683c91 Marcin Slusarz 2008-02-08 @197 static inline void be32_add_cpu(__be32 *var, u32 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 198 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 199 *var = cpu_to_be32(be32_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 200 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 201
8b5f6883683c91 Marcin Slusarz 2008-02-08 @202 static inline void be64_add_cpu(__be64 *var, u64 val)
8b5f6883683c91 Marcin Slusarz 2008-02-08 203 {
8b5f6883683c91 Marcin Slusarz 2008-02-08 204 *var = cpu_to_be64(be64_to_cpu(*var) + val);
8b5f6883683c91 Marcin Slusarz 2008-02-08 205 }
8b5f6883683c91 Marcin Slusarz 2008-02-08 206
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34758 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()
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
2 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-08-17 22:02 UTC (permalink / raw)
To: Andy Shevchenko, Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: kbuild-all, Andy Shevchenko, Jussi Kivilinna, Kalle Valo
[-- Attachment #1: Type: text/plain, Size: 4169 bytes --]
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on jkirsher-next-queue/dev-queue linuxtv-media/master staging/staging-testing v5.9-rc1 next-20200817]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/net/wireless/rndis_wlan.c: In function 'rndis_set_config_parameter':
>> drivers/net/wireless/rndis_wlan.c:907:28: error: passing argument 2 of 'cpu_to_le16_array' from incompatible pointer type [-Werror=incompatible-pointer-types]
907 | cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
| ^~~~~
| |
| char *
In file included from include/linux/byteorder/little_endian.h:11,
from arch/nios2/include/uapi/asm/byteorder.h:21,
from include/asm-generic/bitops/le.h:6,
from include/asm-generic/bitops.h:36,
from ./arch/nios2/include/generated/asm/bitops.h:1,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/net/wireless/rndis_wlan.c:16:
include/linux/byteorder/generic.h:159:62: note: expected 'const u16 *' {aka 'const short unsigned int *'} but argument is of type 'char *'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ~~~~~~~~~~~^~~
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/9ad6b9bbb11c203d62f21fbf7101b8c04aaea958
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
git checkout 9ad6b9bbb11c203d62f21fbf7101b8c04aaea958
vim +/cpu_to_le16_array +907 drivers/net/wireless/rndis_wlan.c
891
892 if (value_type == 2)
893 netdev_dbg(dev->net, "setting config parameter: %s, value: %s\n",
894 param, (u8 *)value);
895 else
896 netdev_dbg(dev->net, "setting config parameter: %s, value: %d\n",
897 param, *(u32 *)value);
898
899 infobuf->name_offs = cpu_to_le32(sizeof(*infobuf));
900 infobuf->name_length = cpu_to_le32(param_len);
901 infobuf->type = cpu_to_le32(value_type);
902 infobuf->value_offs = cpu_to_le32(sizeof(*infobuf) + param_len);
903 infobuf->value_length = cpu_to_le32(value_len);
904
905 /* simple string to unicode string conversion */
906 unibuf = (void *)infobuf + sizeof(*infobuf);
> 907 cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
908
909 if (value_type == 2) {
910 unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
911 cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
912 } else {
913 dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
914 *dst_value = cpu_to_le32(*(u32 *)value);
915 }
916
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 56578 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()
@ 2020-08-17 22:02 ` kernel test robot
0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2020-08-17 22:02 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 4253 bytes --]
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on jkirsher-next-queue/dev-queue linuxtv-media/master staging/staging-testing v5.9-rc1 next-20200817]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/net/wireless/rndis_wlan.c: In function 'rndis_set_config_parameter':
>> drivers/net/wireless/rndis_wlan.c:907:28: error: passing argument 2 of 'cpu_to_le16_array' from incompatible pointer type [-Werror=incompatible-pointer-types]
907 | cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
| ^~~~~
| |
| char *
In file included from include/linux/byteorder/little_endian.h:11,
from arch/nios2/include/uapi/asm/byteorder.h:21,
from include/asm-generic/bitops/le.h:6,
from include/asm-generic/bitops.h:36,
from ./arch/nios2/include/generated/asm/bitops.h:1,
from include/linux/bitops.h:29,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/net/wireless/rndis_wlan.c:16:
include/linux/byteorder/generic.h:159:62: note: expected 'const u16 *' {aka 'const short unsigned int *'} but argument is of type 'char *'
159 | static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
| ~~~~~~~~~~~^~~
cc1: some warnings being treated as errors
# https://github.com/0day-ci/linux/commit/9ad6b9bbb11c203d62f21fbf7101b8c04aaea958
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/byteorder-Introduce-cpu_to_le16_array-and-le16_to_cpu_array/20200818-024849
git checkout 9ad6b9bbb11c203d62f21fbf7101b8c04aaea958
vim +/cpu_to_le16_array +907 drivers/net/wireless/rndis_wlan.c
891
892 if (value_type == 2)
893 netdev_dbg(dev->net, "setting config parameter: %s, value: %s\n",
894 param, (u8 *)value);
895 else
896 netdev_dbg(dev->net, "setting config parameter: %s, value: %d\n",
897 param, *(u32 *)value);
898
899 infobuf->name_offs = cpu_to_le32(sizeof(*infobuf));
900 infobuf->name_length = cpu_to_le32(param_len);
901 infobuf->type = cpu_to_le32(value_type);
902 infobuf->value_offs = cpu_to_le32(sizeof(*infobuf) + param_len);
903 infobuf->value_length = cpu_to_le32(value_len);
904
905 /* simple string to unicode string conversion */
906 unibuf = (void *)infobuf + sizeof(*infobuf);
> 907 cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
908
909 if (value_type == 2) {
910 unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
911 cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
912 } else {
913 dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
914 *dst_value = cpu_to_le32(*(u32 *)value);
915 }
916
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 56578 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/8] media: solo6x10: Make use of cpu_to_le16_array()
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
0 siblings, 0 replies; 16+ messages in thread
From: Ismael Luceno @ 2020-08-17 22:18 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Greg Kroah-Hartman, linux-usb, Mathias Nyman, Anton Sviridenko,
Andrey Utkin, Mauro Carvalho Chehab
On 17/Aug/2020 21:46, Andy Shevchenko wrote:
> Since we have a new helper, let's replace open coded variant by it.
>
> 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>
> ---
> v2: new patch
> drivers/media/pci/solo6x10/solo6x10-disp.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c
> index ad98ca7fb98b..09c0cf8a5fcb 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-disp.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
> @@ -202,16 +202,15 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
> {
> const unsigned size = sizeof(u16) * 64;
> u32 off = SOLO_MOT_FLAG_AREA + ch * SOLO_MOT_THRESH_SIZE * 2;
> + unsigned int y;
> __le16 *buf;
> - int x, y;
> int ret = 0;
>
> buf = kzalloc(size, GFP_KERNEL);
> if (buf == NULL)
> return -ENOMEM;
> for (y = 0; y < SOLO_MOTION_SZ; y++) {
> - for (x = 0; x < SOLO_MOTION_SZ; x++)
> - buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]);
> + cpu_to_le16_array(buf, &thresholds[y * SOLO_MOTION_SZ], SOLO_MOTION_SZ);
> ret |= solo_p2m_dma(solo_dev, 1, buf,
> SOLO_MOTION_EXT_ADDR(solo_dev) + off + y * size,
> size, 0, 0);
> --
> 2.28.0
>
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()
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
2 siblings, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2020-08-18 5:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Greg Kroah-Hartman, linux-usb, Mathias Nyman, Jussi Kivilinna,
linux-wireless
+ linux-wireless
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> Since we have a new helper, let's replace open coded variant by it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
> Cc: Kalle Valo <kvalo@codeaurora.org>
> ---
> v2: new patch
> drivers/net/wireless/rndis_wlan.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
> index 8852a1832951..06850ee6d6dc 100644
> --- a/drivers/net/wireless/rndis_wlan.c
> +++ b/drivers/net/wireless/rndis_wlan.c
> @@ -859,9 +859,12 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
> int value_type, void *value)
> {
> struct ndis_config_param *infobuf;
> - int value_len, info_len, param_len, ret, i;
> + int value_len, info_len, param_len, ret;
> __le16 *unibuf;
> __le32 *dst_value;
> +#ifdef DEBUG
> + int i;
> +#endif
>
> if (value_type == 0)
> value_len = sizeof(__le32);
> @@ -901,13 +904,11 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
>
> /* simple string to unicode string conversion */
> unibuf = (void *)infobuf + sizeof(*infobuf);
> - for (i = 0; i < param_len / sizeof(__le16); i++)
> - unibuf[i] = cpu_to_le16(param[i]);
> + cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
>
> if (value_type == 2) {
> unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
> - for (i = 0; i < value_len / sizeof(__le16); i++)
> - unibuf[i] = cpu_to_le16(((u8 *)value)[i]);
> + cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
> } else {
> dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
> *dst_value = cpu_to_le32(*(u32 *)value);
I assume this goes via usb tree:
Acked-by: Kalle Valo <kvalo@codeaurora.org>
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/8] rndis_wlan: Make use of cpu_to_le16_array()
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
2 siblings, 0 replies; 16+ messages in thread
From: Jussi Kivilinna @ 2020-08-18 5:36 UTC (permalink / raw)
To: Andy Shevchenko, Greg Kroah-Hartman, linux-usb, Mathias Nyman; +Cc: Kalle Valo
Hello,
On 17.8.2020 21.46, Andy Shevchenko wrote:
> Since we have a new helper, let's replace open coded variant by it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>
> Cc: Kalle Valo <kvalo@codeaurora.org>
> ---
> v2: new patch
> drivers/net/wireless/rndis_wlan.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
> index 8852a1832951..06850ee6d6dc 100644
> --- a/drivers/net/wireless/rndis_wlan.c
> +++ b/drivers/net/wireless/rndis_wlan.c
> @@ -859,9 +859,12 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
> int value_type, void *value)
> {
> struct ndis_config_param *infobuf;
> - int value_len, info_len, param_len, ret, i;
> + int value_len, info_len, param_len, ret;
> __le16 *unibuf;
> __le32 *dst_value;
> +#ifdef DEBUG
> + int i;
> +#endif
>
> if (value_type == 0)
> value_len = sizeof(__le32);
> @@ -901,13 +904,11 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param,
>
> /* simple string to unicode string conversion */
> unibuf = (void *)infobuf + sizeof(*infobuf);
> - for (i = 0; i < param_len / sizeof(__le16); i++)
> - unibuf[i] = cpu_to_le16(param[i]);
> + cpu_to_le16_array(unibuf, param, param_len / sizeof(__le16));
This does not look correct, as kernel test robot noticed. 'param' is ASCII string and 'unibuf' wide character string and loop is making simple 8-bit char to 16-bit char conversion.
>
> if (value_type == 2) {
> unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
> - for (i = 0; i < value_len / sizeof(__le16); i++)
> - unibuf[i] = cpu_to_le16(((u8 *)value)[i]);
> + cpu_to_le16_array(unibuf, value, value_len / sizeof(__le16));
Same here.
-Jussi
> } else {
> dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
> *dst_value = cpu_to_le32(*(u32 *)value);
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array()
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
` (6 preceding siblings ...)
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 ` Andy Shevchenko
7 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2020-08-18 8:01 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-usb, Mathias Nyman
Cc: Anton Sviridenko, Andrey Utkin, Ismael Luceno,
Mauro Carvalho Chehab, Jussi Kivilinna, Kalle Valo, Jeff Kirsher,
Sylwia Wnuczko, Jesse Brandeburg
On Mon, Aug 17, 2020 at 09:46:52PM +0300, Andy Shevchenko wrote:
> Introduce cpu_to_le16_array() and le16_to_cpu_array() for existing and
> future users.
It appears that the series needs more work. Please, discard this and at some
point I'll send v3.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2020-08-18 8:14 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 18:46 [PATCH v2 1/8] byteorder: Introduce cpu_to_le16_array() and le16_to_cpu_array() Andy Shevchenko
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-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 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.