usb: early: xhci-dbc: use readl_poll_timeout() to simplify code
PATCH 1/3 usb: early: xhci-dbc: use readl_poll_timeout() to simplify code
Use readl_poll_timeout() to poll the status of the registers.
--- drivers/usb/early/xhci-dbc.c | 56 +++++++++++++++++------------------- 1 file changed, 27 insertions(+), 29 deletions(-)
drivers/usb/early/xhci-dbc.c +27 -29
@@ -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;
Signature · 1 line
2.28.0
PATCH 2/3 usb: early: xhci-dbc: Move cpu_to_le16_array() to core
It's used in USB but it might be useful for other drivers as well. While at it, introduce a counterpart helper, i.e. le16_to_cpu_array().
Make them available through byteorder/generic.h.
--- drivers/usb/early/xhci-dbc.c | 15 ++++----------- include/linux/byteorder/generic.h | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 11 deletions(-)
drivers/usb/early/xhci-dbc.c +4 -11
@@ -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 ;
include/linux/byteorder/generic.h +16 -0
@@ -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) {
Signature · 1 line
2.28.0
Greg Kroah-Hartman
maintainerRe: [PATCH v1 2/3] usb: early: xhci-dbc: Move cpu_to_le16_array() to core
Quoted 1 line · Andy Shevchenko
It's used in USB but it might be useful for other drivers as well.
Don't move it unless someone actually needs it.
Quoted 1 line
While at it, introduce a counterpart helper, i.e.
le16_to_cpu_array().
Don't add something that no one uses, otherwise it will just be removed.
thanks,
greg k-h
Re: [PATCH v1 2/3] usb: early: xhci-dbc: Move cpu_to_le16_array() to core
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Andy Shevchenko
It's used in USB but it might be useful for other drivers as well.
Don't move it unless someone actually needs it.
Quoted 1 line
While at it, introduce a counterpart helper, i.e.
le16_to_cpu_array().Don't add something that no one uses, otherwise it will just be removed.
I will address both by converting real users of them besides this driver.
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v1 2/3] usb: early: xhci-dbc: Move cpu_to_le16_array() to core
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter.chen-usb/ci-for-usb-next balbi-usb/testing/next linus/master 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/usb-early-xhci-dbc-use-readl_poll_timeout-to-simplify-code/20200818-004710 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: x86_64-randconfig-r014-20200817 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
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' static inline void le16_add_cpu(__le16 *var, u16 val)
^
include/linux/byteorder/generic.h:144:46: error: unknown type name 'u16'
static inline void le16_add_cpu(__le16 *var, u16 val)
^
>> include/linux/byteorder/generic.h:146:9: error: implicit declaration of function '__cpu_to_le16' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le16(le16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:90:21: note: expanded from macro 'cpu_to_le16'
#define cpu_to_le16 __cpu_to_le16
^
>> include/linux/byteorder/generic.h:146:21: error: implicit declaration of function '__le16_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le16(le16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
#define le16_to_cpu __le16_to_cpu
^
include/linux/byteorder/generic.h:149:33: error: unknown type name '__le32'
static inline void le32_add_cpu(__le32 *var, u32 val)
^
include/linux/byteorder/generic.h:149:46: error: unknown type name 'u32'
static inline void le32_add_cpu(__le32 *var, u32 val)
^
>> include/linux/byteorder/generic.h:151:9: error: implicit declaration of function '__cpu_to_le32' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le32(le32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
#define cpu_to_le32 __cpu_to_le32
^
>> include/linux/byteorder/generic.h:151:21: error: implicit declaration of function '__le32_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le32(le32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^
include/linux/byteorder/generic.h:154:33: error: unknown type name '__le64'
static inline void le64_add_cpu(__le64 *var, u64 val)
^
include/linux/byteorder/generic.h:154:46: error: unknown type name 'u64'
static inline void le64_add_cpu(__le64 *var, u64 val)
^
>> include/linux/byteorder/generic.h:156:9: error: implicit declaration of function '__cpu_to_le64' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le64(le64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:86:21: note: expanded from macro 'cpu_to_le64'
#define cpu_to_le64 __cpu_to_le64
^
>> include/linux/byteorder/generic.h:156:21: error: implicit declaration of function '__le64_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le64(le64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:87:21: note: expanded from macro 'le64_to_cpu'
#define le64_to_cpu __le64_to_cpu
^
include/linux/byteorder/generic.h:159:38: error: unknown type name '__le16'
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'
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'
static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
^
include/linux/byteorder/generic.h:164:12: error: implicit declaration of function '__cpu_to_le16' [-Werror,-Wimplicit-function-declaration]
dst[i] = cpu_to_le16(src[i]);
^
include/linux/byteorder/generic.h:90:21: note: expanded from macro 'cpu_to_le16'
#define cpu_to_le16 __cpu_to_le16
^
include/linux/byteorder/generic.h:167:38: error: unknown type name 'u16'
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'
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'
static inline void le16_to_cpu_array(u16 *dst, const __le16 *src, size_t len)
^fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
# https://github.com/0day-ci/linux/commit/379f669600c31fef2fa3b729ebb9ecf706d69621
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/usb-early-xhci-dbc-use-readl_poll_timeout-to-simplify-code/20200818-004710 git checkout 379f669600c31fef2fa3b729ebb9ecf706d69621
vim +/__cpu_to_le16 +146 include/linux/byteorder/generic.h
^1da177e4c3f415 Linus Torvalds 2005-04-16 143
8b5f6883683c91a Marcin Slusarz 2008-02-08 144 static inline void le16_add_cpu(__le16 *var, u16 val)
8b5f6883683c91a Marcin Slusarz 2008-02-08 145 {
8b5f6883683c91a Marcin Slusarz 2008-02-08 @146 *var = cpu_to_le16(le16_to_cpu(*var) + val);
8b5f6883683c91a Marcin Slusarz 2008-02-08 147 }
8b5f6883683c91a Marcin Slusarz 2008-02-08 148
8b5f6883683c91a Marcin Slusarz 2008-02-08 149 static inline void le32_add_cpu(__le32 *var, u32 val)
8b5f6883683c91a Marcin Slusarz 2008-02-08 150 {
8b5f6883683c91a Marcin Slusarz 2008-02-08 @151 *var = cpu_to_le32(le32_to_cpu(*var) + val);
8b5f6883683c91a Marcin Slusarz 2008-02-08 152 }
8b5f6883683c91a Marcin Slusarz 2008-02-08 153
8b5f6883683c91a Marcin Slusarz 2008-02-08 154 static inline void le64_add_cpu(__le64 *var, u64 val)
8b5f6883683c91a Marcin Slusarz 2008-02-08 155 {8b5f6883683c91a Marcin Slusarz 2008-02-08 @156 *var = cpu_to_le64(le64_to_cpu(*var) + val);8b5f6883683c91a Marcin Slusarz 2008-02-08 157 }8b5f6883683c91a Marcin Slusarz 2008-02-08 158
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 3/3 usb: early: xhci-dbc: Sort headers alphabetically
In reply to Andy ShevchenkoFor better maintenance sort headers alphabetically. While at it, move asm/*.h to be included after linux/*.h.
--- drivers/usb/early/xhci-dbc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/usb/early/xhci-dbc.c +10 -9
@@ -9,22 +9,23 @@#define pr_fmt (fmt) KBUILD_MODNAME ":%s: " fmt, __func__ +#include <linux/bcd.h> #include <linux/byteorder/generic.h> #include <linux/console.h> -#include <linux/pci_regs.h> -#include <linux/pci_ids.h> -#include <linux/memblock.h> +#include <linux/delay.h> +#include <linux/export.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> -#include <linux/delay.h> #include <linux/kthread.h> +#include <linux/memblock.h> +#include <linux/module.h> +#include <linux/pci_ids.h> +#include <linux/pci_regs.h> #include <linux/usb/xhci-dbgp.h> +#include <asm/fixmap.h> +#include <asm/pci-direct.h> +#include "../host/xhci.h" #include "xhci-dbc.h"
Signature · 1 line
2.28.0
Greg Kroah-Hartman
maintainerRe: [PATCH v1 3/3] usb: early: xhci-dbc: Sort headers alphabetically
Quoted 1 line · Andy Shevchenko
For better maintenance sort headers alphabetically.
Maintenance of what? That's pointless churn.
Quoted 1 line
While at it, move asm/*.h to be included after linux/*.h.
That's the only valid type of change, but why is a driver having asm/*.h files included in the first place? Shouldn't that be fixed?
thanks,
greg k-h
Re: [PATCH v1 3/3] usb: early: xhci-dbc: Sort headers alphabetically
Quoted 4 lines · Greg Kroah-Hartman
Quoted 1 line · Andy Shevchenko
For better maintenance sort headers alphabetically.
Maintenance of what? That's pointless churn.
Of this driver. When adding a new header may bring a duplication.
Quoted 4 lines
Quoted 1 line
While at it, move asm/*.h to be included after linux/*.h.
That's the only valid type of change, but why is a driver having asm/*.h files included in the first place? Shouldn't that be fixed?
I can't see how. fixmap.h is special header for early boot stage and there is no linux/* part to cover it (no need).
The pci-direct.h is a specific arch-dependent way to access PCI configuration space without PCI core to be involved (also as above, to be used on early boot stages).
That said, I simply move them and will preserve ordering as it's now.
Signature · 2 lines
With Best Regards, Andy Shevchenko
kernel test robot
build botRe: [PATCH v1 3/3] usb: early: xhci-dbc: Sort headers alphabetically
In reply to Andy ShevchenkoI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on linus/master v5.9-rc1 next-20200817] [cannot apply to peter.chen-usb/ci-for-usb-next]
[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/usb-early-xhci-dbc-use-readl_poll_timeout-to-simplify-code/20200818-004710 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: x86_64-randconfig-r014-20200817 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project de71b46a519db014ce906a39f8a0e1b235ef1568)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
In file included from drivers/usb/early/xhci-dbc.c:13:
include/linux/byteorder/generic.h:146:9: error: implicit declaration of function '__cpu_to_le16' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le16(le16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:90:21: note: expanded from macro 'cpu_to_le16'
#define cpu_to_le16 __cpu_to_le16
^
include/linux/byteorder/generic.h:146:21: error: implicit declaration of function '__le16_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le16(le16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
#define le16_to_cpu __le16_to_cpu
^
include/linux/byteorder/generic.h:151:9: error: implicit declaration of function '__cpu_to_le32' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le32(le32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:88:21: note: expanded from macro 'cpu_to_le32'
#define cpu_to_le32 __cpu_to_le32
^
include/linux/byteorder/generic.h:151:21: error: implicit declaration of function '__le32_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le32(le32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^
include/linux/byteorder/generic.h:156:9: error: implicit declaration of function '__cpu_to_le64' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le64(le64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:86:21: note: expanded from macro 'cpu_to_le64'
#define cpu_to_le64 __cpu_to_le64
^
include/linux/byteorder/generic.h:156:21: error: implicit declaration of function '__le64_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le64(le64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:87:21: note: expanded from macro 'le64_to_cpu'
#define le64_to_cpu __le64_to_cpu
^
include/linux/byteorder/generic.h:164:12: error: implicit declaration of function '__cpu_to_le16' [-Werror,-Wimplicit-function-declaration]
dst[i] = cpu_to_le16(src[i]);
^
include/linux/byteorder/generic.h:90:21: note: expanded from macro 'cpu_to_le16'
#define cpu_to_le16 __cpu_to_le16
^
include/linux/byteorder/generic.h:172:12: error: implicit declaration of function '__le16_to_cpu' [-Werror,-Wimplicit-function-declaration]
dst[i] = le16_to_cpu(src[i]);
^
include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
#define le16_to_cpu __le16_to_cpu
^
>> include/linux/byteorder/generic.h:179:3: error: implicit declaration of function '__le32_to_cpus' [-Werror,-Wimplicit-function-declaration]
__le32_to_cpus(buf);
^
>> include/linux/byteorder/generic.h:187:3: error: implicit declaration of function '__cpu_to_le32s' [-Werror,-Wimplicit-function-declaration]
__cpu_to_le32s(buf);
^
>> include/linux/byteorder/generic.h:194:9: error: implicit declaration of function '__cpu_to_be16' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be16(be16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:96:21: note: expanded from macro 'cpu_to_be16'
#define cpu_to_be16 __cpu_to_be16
^
>> include/linux/byteorder/generic.h:194:21: error: implicit declaration of function '__be16_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be16(be16_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:97:21: note: expanded from macro 'be16_to_cpu'
#define be16_to_cpu __be16_to_cpu
^
>> include/linux/byteorder/generic.h:199:9: error: implicit declaration of function '__cpu_to_be32' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be32(be32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:94:21: note: expanded from macro 'cpu_to_be32'
#define cpu_to_be32 __cpu_to_be32
^
>> include/linux/byteorder/generic.h:199:21: error: implicit declaration of function '__be32_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be32(be32_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu'
#define be32_to_cpu __be32_to_cpu
^
>> include/linux/byteorder/generic.h:204:9: error: implicit declaration of function '__cpu_to_be64' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be64(be64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:92:21: note: expanded from macro 'cpu_to_be64'
#define cpu_to_be64 __cpu_to_be64
^
>> include/linux/byteorder/generic.h:204:21: error: implicit declaration of function '__be64_to_cpu' [-Werror,-Wimplicit-function-declaration]
*var = cpu_to_be64(be64_to_cpu(*var) + val);
^
include/linux/byteorder/generic.h:93:21: note: expanded from macro 'be64_to_cpu'
#define be64_to_cpu __be64_to_cpu
^
include/linux/byteorder/generic.h:212:12: error: implicit declaration of function '__cpu_to_be32' [-Werror,-Wimplicit-function-declaration]
dst[i] = cpu_to_be32(src[i]);
^
include/linux/byteorder/generic.h:94:21: note: expanded from macro 'cpu_to_be32'
#define cpu_to_be32 __cpu_to_be32
^
include/linux/byteorder/generic.h:220:12: error: implicit declaration of function '__be32_to_cpu' [-Werror,-Wimplicit-function-declaration]
dst[i] = be32_to_cpu(src[i]);
^
include/linux/byteorder/generic.h:95:21: note: expanded from macro 'be32_to_cpu'
#define be32_to_cpu __be32_to_cpu
^
>> drivers/usb/early/xhci-dbc.c:260:35: error: incompatible pointer types passing 'char [5]' to parameter of type 'const u16 *' (aka 'const unsigned short *') [-Werror,-Wincompatible-pointer-types]
cpu_to_le16_array(s_desc->wData, XDBC_STRING_SERIAL, strlen(XDBC_STRING_SERIAL));
^~~~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.h:92:29: note: expanded from macro 'XDBC_STRING_SERIAL'
#define XDBC_STRING_SERIAL "0001"
^~~~~~
include/linux/byteorder/generic.h:159:62: note: passing argument to parameter 'src' here
static inline void cpu_to_le16_array(__le16 *dst, const u16 *src, size_t len)
^fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
# https://github.com/0day-ci/linux/commit/cea598a970d1425a2efd9d4e15b984bd015561c9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/usb-early-xhci-dbc-use-readl_poll_timeout-to-simplify-code/20200818-004710 git checkout cea598a970d1425a2efd9d4e15b984bd015561c9
vim +/__le32_to_cpus +179 include/linux/byteorder/generic.h
379f669600c31f 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(a)lists.01.org