Re: [PATCH v5 2/2] usb/gadget: Add driver for Aspeed SoC virtual hub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Benjamin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on v4.16-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Herrenschmidt/usb-gadget-Add-an-EP-dispose-callback-for-EP-lifetime-tracking/20180317-004216
config: m32r-allyesconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 7.2.0
reproduce:
        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
        make.cross ARCH=m32r 

All warnings (new ones prefixed by >>):

   In file included from arch/m32r/include/uapi/asm/byteorder.h:8:0,
                    from arch/m32r/include/asm/bitops.h:22,
                    from include/linux/bitops.h:38,
                    from include/linux/kernel.h:11,
                    from drivers/usb/gadget/udc/aspeed-vhub/core.c:15:
   include/linux/byteorder/big_endian.h:8:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
    #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     ^~~~~~~
   In file included from include/linux/printk.h:329:0,
                    from include/linux/kernel.h:14,
                    from drivers/usb/gadget/udc/aspeed-vhub/core.c:15:
   drivers/usb/gadget/udc/aspeed-vhub/core.c: In function 'ast_vhub_irq':
>> drivers/usb/gadget/udc/aspeed-vhub/core.c:115:16: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Wformat=]
     UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
                   ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
>> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:423:28: note: in expansion of macro 'dev_dbg'
    #define UDCVDBG(u, fmt...) dev_dbg(&(u)->pdev->dev, fmt)
                               ^~~~~~~
>> drivers/usb/gadget/udc/aspeed-vhub/core.c:115:2: note: in expansion of macro 'UDCVDBG'
     UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
     ^~~~~~~
   drivers/usb/gadget/udc/aspeed-vhub/core.c:115:16: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Wformat=]
     UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
                   ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
>> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:423:28: note: in expansion of macro 'dev_dbg'
    #define UDCVDBG(u, fmt...) dev_dbg(&(u)->pdev->dev, fmt)
                               ^~~~~~~
>> drivers/usb/gadget/udc/aspeed-vhub/core.c:115:2: note: in expansion of macro 'UDCVDBG'
     UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
     ^~~~~~~
--
   In file included from arch/m32r/include/uapi/asm/byteorder.h:8:0,
                    from arch/m32r/include/asm/bitops.h:22,
                    from include/linux/bitops.h:38,
                    from include/linux/kernel.h:11,
                    from drivers/usb/gadget/udc/aspeed-vhub/epn.c:15:
   include/linux/byteorder/big_endian.h:8:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp]
    #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
     ^~~~~~~
   In file included from include/linux/printk.h:329:0,
                    from include/linux/kernel.h:14,
                    from drivers/usb/gadget/udc/aspeed-vhub/epn.c:15:
   drivers/usb/gadget/udc/aspeed-vhub/epn.c: In function 'ast_vhub_epn_kick_desc':
>> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:427:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'long unsigned int' [-Wformat=]
      "%s:EP%d " fmt,    \
      ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
   drivers/usb/gadget/udc/aspeed-vhub/vhub.h:426:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(&(ep)->vhub->pdev->dev,   \
     ^~~~~~~
>> drivers/usb/gadget/udc/aspeed-vhub/epn.c:234:2: note: in expansion of macro 'EPVDBG'
     EPVDBG(ep, "HW kicked, d_next=%d dstat=%08x\n",
     ^~~~~~
   drivers/usb/gadget/udc/aspeed-vhub/epn.c:234:44: note: format string is defined here
     EPVDBG(ep, "HW kicked, d_next=%d dstat=%08x\n",
                                            ~~~^
                                            %08lx

vim +115 drivers/usb/gadget/udc/aspeed-vhub/core.c

  > 15	#include <linux/kernel.h>
    16	#include <linux/module.h>
    17	#include <linux/platform_device.h>
    18	#include <linux/delay.h>
    19	#include <linux/ioport.h>
    20	#include <linux/slab.h>
    21	#include <linux/errno.h>
    22	#include <linux/list.h>
    23	#include <linux/interrupt.h>
    24	#include <linux/proc_fs.h>
    25	#include <linux/prefetch.h>
    26	#include <linux/clk.h>
    27	#include <linux/usb/gadget.h>
    28	#include <linux/of.h>
    29	#include <linux/of_gpio.h>
    30	#include <linux/regmap.h>
    31	#include <linux/dma-mapping.h>
    32	
    33	#include "vhub.h"
    34	
    35	void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,
    36			   int status)
    37	{
    38		bool internal = req->internal;
    39	
    40		EPVDBG(ep, "completing request @%p, status %d\n", req, status);
    41	
    42		list_del_init(&req->queue);
    43	
    44		if (req->req.status == -EINPROGRESS)
    45			req->req.status = status;
    46	
    47		if (req->req.dma) {
    48			if (!WARN_ON(!ep->dev))
    49				usb_gadget_unmap_request(&ep->dev->gadget,
    50							 &req->req, ep->epn.is_in);
    51			req->req.dma = 0;
    52		}
    53	
    54		/*
    55		 * If this isn't an internal EP0 request, call the core
    56		 * to call the gadget completion.
    57		 */
    58		if (!internal) {
    59			spin_unlock(&ep->vhub->lock);
    60			usb_gadget_giveback_request(&ep->ep, &req->req);
    61			spin_lock(&ep->vhub->lock);
    62		}
    63	}
    64	
    65	void ast_vhub_nuke(struct ast_vhub_ep *ep, int status)
    66	{
    67		struct ast_vhub_req *req;
    68	
    69		EPDBG(ep, "Nuking\n");
    70	
    71		/* Beware, lock will be dropped & req-acquired by done() */
    72		while (!list_empty(&ep->queue)) {
    73			req = list_first_entry(&ep->queue, struct ast_vhub_req, queue);
    74			ast_vhub_done(ep, req, status);
    75		}
    76	}
    77	
    78	struct usb_request *ast_vhub_alloc_request(struct usb_ep *u_ep,
    79						   gfp_t gfp_flags)
    80	{
    81		struct ast_vhub_req *req;
    82	
    83		req = kzalloc(sizeof(*req), gfp_flags);
    84		if (!req)
    85			return NULL;
    86		return &req->req;
    87	}
    88	
    89	void ast_vhub_free_request(struct usb_ep *u_ep, struct usb_request *u_req)
    90	{
    91		struct ast_vhub_req *req = to_ast_req(u_req);
    92	
    93		kfree(req);
    94	}
    95	
    96	static irqreturn_t ast_vhub_irq(int irq, void *data)
    97	{
    98		struct ast_vhub *vhub = data;
    99		irqreturn_t iret = IRQ_NONE;
   100		u32 istat;
   101	
   102		/* Stale interrupt while tearing down */
   103		if (!vhub->ep0_bufs)
   104			return IRQ_NONE;
   105	
   106		spin_lock(&vhub->lock);
   107	
   108		/* Read and ACK interrupts */
   109		istat = readl(vhub->regs + AST_VHUB_ISR);
   110		if (!istat)
   111			goto bail;
   112		writel(istat, vhub->regs + AST_VHUB_ISR);
   113		iret = IRQ_HANDLED;
   114	
 > 115		UDCVDBG(vhub, "irq status=%08x, ep_acks=%08x ep_nacks=%08x\n",
   116		       istat,
   117		       readl(vhub->regs + AST_VHUB_EP_ACK_ISR),
   118		       readl(vhub->regs + AST_VHUB_EP_NACK_ISR));
   119	
   120		/* Handle generic EPs first */
   121		if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) {
   122			u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
   123			writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR);
   124	
   125			for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) {
   126				u32 mask = VHUB_EP_IRQ(i);
   127				if (ep_acks & mask) {
   128					ast_vhub_epn_ack_irq(&vhub->epns[i]);
   129					ep_acks &= ~mask;
   130				}
   131			}
   132		}
   133	
   134		/* Handle device interrupts */
   135		if (istat & (VHUB_IRQ_DEVICE1 |
   136			     VHUB_IRQ_DEVICE2 |
   137			     VHUB_IRQ_DEVICE3 |
   138			     VHUB_IRQ_DEVICE4 |
   139			     VHUB_IRQ_DEVICE5)) {
   140			if (istat & VHUB_IRQ_DEVICE1)
   141				ast_vhub_dev_irq(&vhub->ports[0].dev);
   142			if (istat & VHUB_IRQ_DEVICE2)
   143				ast_vhub_dev_irq(&vhub->ports[1].dev);
   144			if (istat & VHUB_IRQ_DEVICE3)
   145				ast_vhub_dev_irq(&vhub->ports[2].dev);
   146			if (istat & VHUB_IRQ_DEVICE4)
   147				ast_vhub_dev_irq(&vhub->ports[3].dev);
   148			if (istat & VHUB_IRQ_DEVICE5)
   149				ast_vhub_dev_irq(&vhub->ports[4].dev);
   150		}
   151	
   152		/* Handle top-level vHub EP0 interrupts */
   153		if (istat & (VHUB_IRQ_HUB_EP0_OUT_ACK_STALL |
   154			     VHUB_IRQ_HUB_EP0_IN_ACK_STALL |
   155			     VHUB_IRQ_HUB_EP0_SETUP)) {
   156			if (istat & VHUB_IRQ_HUB_EP0_IN_ACK_STALL)
   157				ast_vhub_ep0_handle_ack(&vhub->ep0, true);
   158			if (istat & VHUB_IRQ_HUB_EP0_OUT_ACK_STALL)
   159				ast_vhub_ep0_handle_ack(&vhub->ep0, false);
   160			if (istat & VHUB_IRQ_HUB_EP0_SETUP)
   161				ast_vhub_ep0_handle_setup(&vhub->ep0);
   162		}
   163	
   164		/* Various top level bus events */
   165		if (istat & (VHUB_IRQ_BUS_RESUME |
   166			     VHUB_IRQ_BUS_SUSPEND |
   167			     VHUB_IRQ_BUS_RESET)) {
   168			if (istat & VHUB_IRQ_BUS_RESUME)
   169				ast_vhub_hub_resume(vhub);
   170			if (istat & VHUB_IRQ_BUS_SUSPEND)
   171				ast_vhub_hub_suspend(vhub);
   172			if (istat & VHUB_IRQ_BUS_RESET)
   173				ast_vhub_hub_reset(vhub);
   174		}
   175	
   176	 bail:
   177		spin_unlock(&vhub->lock);
   178		return iret;
   179	}
   180	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux