Re: [PATCH v3 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 balbi-usb/next]
[also build test WARNING on v4.15-rc9 next-20180119]
[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/20180124-065635
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
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:14:
   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:14:
   drivers/usb/gadget/udc/aspeed-vhub/core.c: In function 'ast_vhub_irq':
>> drivers/usb/gadget/udc/aspeed-vhub/core.c:127: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:405: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:127: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:127: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:405: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:127: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:14:
   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:14:
   drivers/usb/gadget/udc/aspeed-vhub/epn.c: In function 'ast_vhub_epn_kick_desc':
>> drivers/usb/gadget/udc/aspeed-vhub/vhub.h:409: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:408:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(&(ep)->vhub->pdev->dev,   \
     ^~~~~~~
   drivers/usb/gadget/udc/aspeed-vhub/epn.c:233: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:233:44: note: format string is defined here
     EPVDBG(ep, "HW kicked, d_next=%d dstat=%08x\n",
                                            ~~~^
                                            %08lx

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

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

---
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