Re: [PATCH] usb: gadget: functions: add ftrace export over USB

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

 



Hi Felipe,

[auto build test ERROR on balbi-usb/next]
[also build test ERROR on v4.12-rc4 next-20170609]
[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/Felipe-Balbi/usb-gadget-functions-add-ftrace-export-over-USB/20170610-060059
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
reproduce:
        wget https://raw.githubusercontent.com/01org/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=alpha 

All error/warnings (new ones prefixed by >>):

>> drivers/usb/gadget/function/f-trace.c:25:22: error: field 'ftrace' has incomplete type
     struct trace_export ftrace;
                         ^~~~~~
   In file included from include/linux/list.h:8:0,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from drivers/usb/gadget/function/f-trace.c:12:
   drivers/usb/gadget/function/f-trace.c: In function 'ftrace_write':
   include/linux/kernel.h:854:48: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
>> drivers/usb/gadget/function/f-trace.c:38:29: note: in expansion of macro 'container_of'
    #define ftrace_to_trace(f) (container_of((f), struct usb_ftrace, ftrace))
                                ^~~~~~~~~~~~
>> drivers/usb/gadget/function/f-trace.c:174:30: note: in expansion of macro 'ftrace_to_trace'
     struct usb_ftrace  *trace = ftrace_to_trace(ftrace);
                                 ^~~~~~~~~~~~~~~
   include/linux/kernel.h:854:48: note: (near initialization for 'trace')
     const typeof( ((type *)0)->member ) *__mptr = (ptr); \
                                                   ^
>> drivers/usb/gadget/function/f-trace.c:38:29: note: in expansion of macro 'container_of'
    #define ftrace_to_trace(f) (container_of((f), struct usb_ftrace, ftrace))
                                ^~~~~~~~~~~~
>> drivers/usb/gadget/function/f-trace.c:174:30: note: in expansion of macro 'ftrace_to_trace'
     struct usb_ftrace  *trace = ftrace_to_trace(ftrace);
                                 ^~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f-trace.c: In function 'ftrace_bind':
>> drivers/usb/gadget/function/f-trace.c:294:8: error: implicit declaration of function 'register_ftrace_export' [-Werror=implicit-function-declaration]
     ret = register_ftrace_export(&trace->ftrace);
           ^~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f-trace.c: In function 'ftrace_unbind':
>> drivers/usb/gadget/function/f-trace.c:322:2: error: implicit declaration of function 'unregister_ftrace_export' [-Werror=implicit-function-declaration]
     unregister_ftrace_export(&trace->ftrace);
     ^~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/ftrace +25 drivers/usb/gadget/function/f-trace.c

     6	 *
     7	 * This program is free software; you can redistribute it and/or
     8	 * modify it under the terms of the GNU General Public License v2 as
     9	 * published by the Free Software Foundation.
    10	 */
    11	
  > 12	#include <linux/device.h>
    13	#include <linux/kernel.h>
    14	#include <linux/list.h>
    15	#include <linux/module.h>
    16	#include <linux/slab.h>
    17	#include <linux/spinlock.h>
    18	#include <linux/trace.h>
    19	#include <linux/usb.h>
    20	#include <linux/usb/composite.h>
    21	#include <linux/usb/gadget.h>
    22	#include <linux/workqueue.h>
    23	
    24	struct usb_ftrace {
  > 25		struct trace_export ftrace;
    26		struct usb_function function;
    27		struct work_struct queue_work;
    28		spinlock_t lock;
    29	
    30		struct list_head list;
    31		struct list_head pending;
    32		struct list_head queued;
    33	
    34		struct usb_ep *in;
    35	
    36		u8 intf_id;
    37	};
  > 38	#define ftrace_to_trace(f)	(container_of((f), struct usb_ftrace, ftrace))
    39	#define work_to_trace(w)	(container_of((w), struct usb_ftrace, queue_work))
    40	#define to_trace(f)		(container_of((f), struct usb_ftrace, function))
    41	
    42	#define FTRACE_REQUEST_QUEUE_LENGTH	250
    43	
    44	static inline struct usb_request *next_request(struct list_head *list)
    45	{
    46		return list_first_entry_or_null(list, struct usb_request, list);
    47	}
    48	
    49	struct usb_ftrace_opts {
    50		struct usb_function_instance func_inst;
    51	};
    52	#define to_opts(fi)	(container_of((fi), struct usb_ftrace_opts, func_inst))
    53	
    54	static struct usb_interface_descriptor ftrace_intf_desc = {
    55		.bLength		= USB_DT_INTERFACE_SIZE,
    56		.bDescriptorType	= USB_DT_INTERFACE,
    57	
    58		.bAlternateSetting	= 0,
    59		.bNumEndpoints		= 1,
    60		.bInterfaceClass	= USB_CLASS_VENDOR_SPEC,
    61		.bInterfaceSubClass	= USB_SUBCLASS_VENDOR_SPEC,
    62	};
    63	
    64	/* Super-Speed Support */
    65	static struct usb_endpoint_descriptor ftrace_ss_in_desc = {
    66		.bLength		= USB_DT_ENDPOINT_SIZE,
    67		.bDescriptorType	= USB_DT_ENDPOINT,
    68	
    69		.bEndpointAddress	= USB_DIR_IN,
    70		.bmAttributes		= USB_ENDPOINT_XFER_BULK,
    71		.wMaxPacketSize		= cpu_to_le16(1024),
    72	};
    73	
    74	static struct usb_ss_ep_comp_descriptor ftrace_ss_in_comp_desc = {
    75		.bLength		= USB_DT_SS_EP_COMP_SIZE,
    76		.bDescriptorType	= USB_DT_SS_ENDPOINT_COMP,
    77	
    78		.bMaxBurst		= 15,
    79	};
    80	
    81	static struct usb_descriptor_header *ftrace_ss_function[] = {
    82		(struct usb_descriptor_header *) &ftrace_intf_desc,
    83		(struct usb_descriptor_header *) &ftrace_ss_in_desc,
    84		(struct usb_descriptor_header *) &ftrace_ss_in_comp_desc,
    85		NULL,
    86	};
    87	
    88	/* High-Speed Support */
    89	static struct usb_endpoint_descriptor ftrace_hs_in_desc = {
    90		.bLength		= USB_DT_ENDPOINT_SIZE,
    91		.bDescriptorType	= USB_DT_ENDPOINT,
    92	
    93		.bEndpointAddress	= USB_DIR_IN,
    94		.bmAttributes		= USB_ENDPOINT_XFER_BULK,
    95		.wMaxPacketSize		= cpu_to_le16(512),
    96	};
    97	
    98	static struct usb_descriptor_header *ftrace_hs_function[] = {
    99		(struct usb_descriptor_header *) &ftrace_intf_desc,
   100		(struct usb_descriptor_header *) &ftrace_hs_in_desc,
   101		NULL,
   102	};
   103	
   104	/* Full-Speed Support */
   105	static struct usb_endpoint_descriptor ftrace_fs_in_desc = {
   106		.bLength		= USB_DT_ENDPOINT_SIZE,
   107		.bDescriptorType	= USB_DT_ENDPOINT,
   108	
   109		.bEndpointAddress	= USB_DIR_IN,
   110		.bmAttributes		= USB_ENDPOINT_XFER_BULK,
   111		.wMaxPacketSize		= cpu_to_le16(64),
   112	};
   113	
   114	static struct usb_descriptor_header *ftrace_fs_function[] = {
   115		(struct usb_descriptor_header *) &ftrace_intf_desc,
   116		(struct usb_descriptor_header *) &ftrace_fs_in_desc,
   117		NULL,
   118	};
   119	
   120	static struct usb_string ftrace_string_defs[] = {
   121		[0].s = "Linux Ftrace Export",
   122		{ },
   123	};
   124	
   125	static struct usb_gadget_strings ftrace_string_table = {
   126		.language		= 0x0409, /* en-US */
   127		.strings		= ftrace_string_defs,
   128	};
   129	
   130	static struct usb_gadget_strings *ftrace_strings[] = {
   131		&ftrace_string_table,
   132		NULL,
   133	};
   134	
   135	/* ------------------------------------------------------------------------ */
   136	
   137	static void ftrace_complete(struct usb_ep *ep, struct usb_request *req)
   138	{
   139		struct usb_ftrace		*trace = req->context;
   140	
   141		kfree(req->buf);
   142		list_move_tail(&req->list, &trace->list);
   143	}
   144	
   145	static void ftrace_queue_work(struct work_struct *work)
   146	{
   147		struct usb_ftrace		*trace = work_to_trace(work);
   148		struct usb_request		*req;
   149		struct usb_request		*tmp;
   150		struct list_head		local_list;
   151	
   152		spin_lock_irq(&trace->lock);
   153	restart:
   154		list_replace_init(&trace->pending, &local_list);
   155		spin_unlock_irq(&trace->lock);
   156	
   157		list_for_each_entry_safe(req, tmp, &local_list, list) {
   158			int			ret;
   159	
   160			ret = usb_ep_queue(trace->in, req, GFP_KERNEL);
   161			if (!ret)
   162				list_move_tail(&req->list, &trace->queued);
   163		}
   164	
   165		spin_lock_irq(&trace->lock);
   166		if (!list_empty(&trace->pending))
   167			goto restart;
   168		spin_unlock_irq(&trace->lock);
   169	}
   170	
   171	static void notrace ftrace_write(struct trace_export *ftrace, const void *buf,
   172					 unsigned int len)
   173	{
 > 174		struct usb_ftrace		*trace = ftrace_to_trace(ftrace);
   175		struct usb_request		*req = next_request(&trace->list);
   176	
   177		if (!req)

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