Hi Felipe,

I love your patch! Yet something to improve:

[auto build test ERROR on balbi-usb/next]
[also build test ERROR on v5.1-rc1 next-20190321]
[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/20190322-081552
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 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
        GCC_VERSION=7.2.0 make.cross ARCH=m68k 

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

>> drivers/usb/gadget/function/f-trace.c:26:22: error: field 'ftrace' has 
>> incomplete type
     struct trace_export ftrace;
                         ^~~~~~
   In file included from include/linux/ioport.h:13:0,
                    from include/linux/device.h:15,
                    from drivers/usb/gadget/function/f-trace.c:13:
   drivers/usb/gadget/function/f-trace.c: In function 'ftrace_write':
>> include/linux/kernel.h:998:32: error: dereferencing pointer to incomplete 
>> type 'struct trace_export'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                   ^~~~~~
   include/linux/compiler.h:324:9: note: in definition of macro 
'__compiletime_assert'
      if (!(condition))     \
            ^~~~~~~~~
   include/linux/compiler.h:344:2: note: in expansion of macro 
'_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:998:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:998:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
>> drivers/usb/gadget/function/f-trace.c:39: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:175: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:295:8: error: implicit declaration of 
>> function 'register_ftrace_export'; did you mean 'register_chrdev_region'? 
>> [-Werror=implicit-function-declaration]
     ret = register_ftrace_export(&trace->ftrace);
           ^~~~~~~~~~~~~~~~~~~~~~
           register_chrdev_region
   drivers/usb/gadget/function/f-trace.c: In function 'ftrace_unbind':
>> drivers/usb/gadget/function/f-trace.c:323:2: error: implicit declaration of 
>> function 'unregister_ftrace_export'; did you mean 
>> 'unregister_chrdev_region'? [-Werror=implicit-function-declaration]
     unregister_ftrace_export(&trace->ftrace);
     ^~~~~~~~~~~~~~~~~~~~~~~~
     unregister_chrdev_region
   cc1: some warnings being treated as errors
--
   drivers/usb//gadget/function/f-trace.c:26:22: error: field 'ftrace' has 
incomplete type
     struct trace_export ftrace;
                         ^~~~~~
   In file included from include/linux/ioport.h:13:0,
                    from include/linux/device.h:15,
                    from drivers/usb//gadget/function/f-trace.c:13:
   drivers/usb//gadget/function/f-trace.c: In function 'ftrace_write':
>> include/linux/kernel.h:998:32: error: dereferencing pointer to incomplete 
>> type 'struct trace_export'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                   ^~~~~~
   include/linux/compiler.h:324:9: note: in definition of macro 
'__compiletime_assert'
      if (!(condition))     \
            ^~~~~~~~~
   include/linux/compiler.h:344:2: note: in expansion of macro 
'_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:998:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:998:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
   drivers/usb//gadget/function/f-trace.c:39: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:175: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:295:8: error: implicit declaration of 
function 'register_ftrace_export'; did you mean 'register_chrdev_region'? 
[-Werror=implicit-function-declaration]
     ret = register_ftrace_export(&trace->ftrace);
           ^~~~~~~~~~~~~~~~~~~~~~
           register_chrdev_region
   drivers/usb//gadget/function/f-trace.c: In function 'ftrace_unbind':
   drivers/usb//gadget/function/f-trace.c:323:2: error: implicit declaration of 
function 'unregister_ftrace_export'; did you mean 'unregister_chrdev_region'? 
[-Werror=implicit-function-declaration]
     unregister_ftrace_export(&trace->ftrace);
     ^~~~~~~~~~~~~~~~~~~~~~~~
     unregister_chrdev_region
   cc1: some warnings being treated as errors

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

    24  
    25  struct usb_ftrace {
  > 26          struct trace_export ftrace;
    27          struct usb_function function;
    28          struct work_struct queue_work;
    29          spinlock_t lock;
    30  
    31          struct list_head list;
    32          struct list_head pending;
    33          struct list_head queued;
    34  
    35          struct usb_ep *in;
    36  
    37          u8 intf_id;
    38  };
  > 39  #define ftrace_to_trace(f)      (container_of((f), struct usb_ftrace, 
ftrace))
    40  #define work_to_trace(w)        (container_of((w), struct usb_ftrace, 
queue_work))
    41  #define to_trace(f)             (container_of((f), struct usb_ftrace, 
function))
    42  
    43  #define FTRACE_REQUEST_QUEUE_LENGTH     250
    44  
    45  static inline struct usb_request *next_request(struct list_head *list)
    46  {
    47          return list_first_entry_or_null(list, struct usb_request, list);
    48  }
    49  
    50  struct usb_ftrace_opts {
    51          struct usb_function_instance func_inst;
    52  };
    53  #define to_opts(fi)     (container_of((fi), struct usb_ftrace_opts, 
func_inst))
    54  
    55  static struct usb_interface_descriptor ftrace_intf_desc = {
    56          .bLength                = USB_DT_INTERFACE_SIZE,
    57          .bDescriptorType        = USB_DT_INTERFACE,
    58  
    59          .bAlternateSetting      = 0,
    60          .bNumEndpoints          = 1,
    61          .bInterfaceClass        = USB_CLASS_VENDOR_SPEC,
    62          .bInterfaceSubClass     = USB_SUBCLASS_VENDOR_SPEC,
    63  };
    64  
    65  /* Super-Speed Support */
    66  static struct usb_endpoint_descriptor ftrace_ss_in_desc = {
    67          .bLength                = USB_DT_ENDPOINT_SIZE,
    68          .bDescriptorType        = USB_DT_ENDPOINT,
    69  
    70          .bEndpointAddress       = USB_DIR_IN,
    71          .bmAttributes           = USB_ENDPOINT_XFER_BULK,
    72          .wMaxPacketSize         = cpu_to_le16(1024),
    73  };
    74  
    75  static struct usb_ss_ep_comp_descriptor ftrace_ss_in_comp_desc = {
    76          .bLength                = USB_DT_SS_EP_COMP_SIZE,
    77          .bDescriptorType        = USB_DT_SS_ENDPOINT_COMP,
    78  
    79          .bMaxBurst              = 15,
    80  };
    81  
    82  static struct usb_descriptor_header *ftrace_ss_function[] = {
    83          (struct usb_descriptor_header *) &ftrace_intf_desc,
    84          (struct usb_descriptor_header *) &ftrace_ss_in_desc,
    85          (struct usb_descriptor_header *) &ftrace_ss_in_comp_desc,
    86          NULL,
    87  };
    88  
    89  /* High-Speed Support */
    90  static struct usb_endpoint_descriptor ftrace_hs_in_desc = {
    91          .bLength                = USB_DT_ENDPOINT_SIZE,
    92          .bDescriptorType        = USB_DT_ENDPOINT,
    93  
    94          .bEndpointAddress       = USB_DIR_IN,
    95          .bmAttributes           = USB_ENDPOINT_XFER_BULK,
    96          .wMaxPacketSize         = cpu_to_le16(512),
    97  };
    98  
    99  static struct usb_descriptor_header *ftrace_hs_function[] = {
   100          (struct usb_descriptor_header *) &ftrace_intf_desc,
   101          (struct usb_descriptor_header *) &ftrace_hs_in_desc,
   102          NULL,
   103  };
   104  
   105  /* Full-Speed Support */
   106  static struct usb_endpoint_descriptor ftrace_fs_in_desc = {
   107          .bLength                = USB_DT_ENDPOINT_SIZE,
   108          .bDescriptorType        = USB_DT_ENDPOINT,
   109  
   110          .bEndpointAddress       = USB_DIR_IN,
   111          .bmAttributes           = USB_ENDPOINT_XFER_BULK,
   112          .wMaxPacketSize         = cpu_to_le16(64),
   113  };
   114  
   115  static struct usb_descriptor_header *ftrace_fs_function[] = {
   116          (struct usb_descriptor_header *) &ftrace_intf_desc,
   117          (struct usb_descriptor_header *) &ftrace_fs_in_desc,
   118          NULL,
   119  };
   120  
   121  static struct usb_string ftrace_string_defs[] = {
   122          [0].s = "Linux Ftrace Export",
   123          { },
   124  };
   125  
   126  static struct usb_gadget_strings ftrace_string_table = {
   127          .language               = 0x0409, /* en-US */
   128          .strings                = ftrace_string_defs,
   129  };
   130  
   131  static struct usb_gadget_strings *ftrace_strings[] = {
   132          &ftrace_string_table,
   133          NULL,
   134  };
   135  
   136  /* 
------------------------------------------------------------------------ */
   137  
   138  static void ftrace_complete(struct usb_ep *ep, struct usb_request *req)
   139  {
   140          struct usb_ftrace               *trace = req->context;
   141  
   142          kfree(req->buf);
   143          list_move_tail(&req->list, &trace->list);
   144  }
   145  
   146  static void ftrace_queue_work(struct work_struct *work)
   147  {
   148          struct usb_ftrace               *trace = work_to_trace(work);
   149          struct usb_request              *req;
   150          struct usb_request              *tmp;
   151          struct list_head                local_list;
   152  
   153          spin_lock_irq(&trace->lock);
   154  restart:
   155          list_replace_init(&trace->pending, &local_list);
   156          spin_unlock_irq(&trace->lock);
   157  
   158          list_for_each_entry_safe(req, tmp, &local_list, list) {
   159                  int                     ret;
   160  
   161                  ret = usb_ep_queue(trace->in, req, GFP_KERNEL);
   162                  if (!ret)
   163                          list_move_tail(&req->list, &trace->queued);
   164          }
   165  
   166          spin_lock_irq(&trace->lock);
   167          if (!list_empty(&trace->pending))
   168                  goto restart;
   169          spin_unlock_irq(&trace->lock);
   170  }
   171  
   172  static void notrace ftrace_write(struct trace_export *ftrace, const 
void *buf,
   173                  unsigned int len)
   174  {
 > 175          struct usb_ftrace               *trace = 
 > ftrace_to_trace(ftrace);
   176          struct usb_request              *req = 
next_request(&trace->list);
   177  
   178          if (!req)
   179                  return;
   180  
   181          if (!trace->in->enabled)
   182                  return;
   183  
   184          req->buf = kmemdup(buf, len, GFP_ATOMIC);
   185          req->length = len;
   186          req->context = trace;
   187          req->complete = ftrace_complete;
   188          list_move_tail(&req->list, &trace->pending);
   189  
   190          schedule_work(&trace->queue_work);
   191  }
   192  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to