diff mbox series

[v1,3/3] usb: early: xhci-dbc: Sort headers alphabetically

Message ID 20200817164226.49119-3-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,1/3] usb: early: xhci-dbc: use readl_poll_timeout() to simplify code | expand

Commit Message

Andy Shevchenko Aug. 17, 2020, 4:42 p.m. UTC
For better maintenance sort headers alphabetically.
While at it, move asm/*.h to be included after linux/*.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/early/xhci-dbc.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Greg KH Aug. 17, 2020, 4:50 p.m. UTC | #1
On Mon, Aug 17, 2020 at 07:42:26PM +0300, Andy Shevchenko wrote:
> For better maintenance sort headers alphabetically.

Maintenance of what?  That's pointless churn.

> 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
Andy Shevchenko Aug. 17, 2020, 6:26 p.m. UTC | #2
On Mon, Aug 17, 2020 at 06:50:20PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Aug 17, 2020 at 07:42:26PM +0300, Andy Shevchenko wrote:
> > 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.

> > 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.
kernel test robot Aug. 18, 2020, 12:10 a.m. UTC | #3
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
Reported-by: kernel test robot <lkp@intel.com>

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@lists.01.org
diff mbox series

Patch

diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index c5761ea9394d..2ae9b28de424 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -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"