/* * uvc_gadget.h -- USB Video Class Gadget driver * * Copyright (C) 2009-2010 * Laurent Pinchart (laurent.pinchart@ideasonboard.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _UVC_GADGET_H_ #define _UVC_GADGET_H_ #include #include #include #define UVC_EVENT_FIRST (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_CONNECT (V4L2_EVENT_PRIVATE_START + 0) #define UVC_EVENT_DISCONNECT (V4L2_EVENT_PRIVATE_START + 1) #define UVC_EVENT_STREAMON (V4L2_EVENT_PRIVATE_START + 2) #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) #define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) struct uvc_request_data { __s32 length; __u8 data[60]; }; struct uvc_event { union { enum usb_device_speed speed; struct usb_ctrlrequest req; struct uvc_request_data data; }; }; #define UVCIOC_SEND_RESPONSE _IOW('U', 1, struct uvc_request_data) #define UVC_INTF_CONTROL 0 #define UVC_INTF_STREAMING 1 /* ------------------------------------------------------------------------ * Debugging, printing and logging */ #ifdef __KERNEL__ #include /* For usb_endpoint_* */ #include #include #include #include #include #include "uvc_queue.h" #define UVC_TRACE_PROBE (1 << 0) #define UVC_TRACE_DESCR (1 << 1) #define UVC_TRACE_CONTROL (1 << 2) #define UVC_TRACE_FORMAT (1 << 3) #define UVC_TRACE_CAPTURE (1 << 4) #define UVC_TRACE_CALLS (1 << 5) #define UVC_TRACE_IOCTL (1 << 6) #define UVC_TRACE_FRAME (1 << 7) #define UVC_TRACE_SUSPEND (1 << 8) #define UVC_TRACE_STATUS (1 << 9) #define UVC_WARN_MINMAX 0 #define UVC_WARN_PROBE_DEF 1 extern unsigned int uvc_gadget_trace_param; #define uvc_trace(flag, msg...) \ do { \ if (uvc_gadget_trace_param & flag) \ printk(KERN_DEBUG "uvcvideo: " msg); \ } while (0) #define uvc_warn_once(dev, warn, msg...) \ do { \ if (!test_and_set_bit(warn, &dev->warnings)) \ printk(KERN_INFO "uvcvideo: " msg); \ } while (0) #define uvc_printk(level, msg...) \ printk(level "uvcvideo: " msg) /* ------------------------------------------------------------------------ * Driver specific constants */ #define UVC_NUM_REQUESTS 4 #define UVC_MAX_REQUEST_SIZE 64 #define UVC_MAX_EVENTS 4 /* ------------------------------------------------------------------------ * Structures */ struct uvc_video { struct usb_ep *ep; /* Frame parameters */ u8 bpp; u32 fcc; unsigned int width; unsigned int height; unsigned int imagesize; struct mutex mutex; /* protects frame parameters */ /* Requests */ unsigned int req_size; struct usb_request *req[UVC_NUM_REQUESTS]; __u8 *req_buffer[UVC_NUM_REQUESTS]; struct list_head req_free; spinlock_t req_lock; void (*encode) (struct usb_request *req, struct uvc_video *video, struct uvc_buffer *buf); /* Context data used by the completion handler */ __u32 payload_size; __u32 max_payload_size; struct uvc_video_queue queue; unsigned int fid; }; enum uvc_state { UVC_STATE_DISCONNECTED, UVC_STATE_CONNECTED, UVC_STATE_STREAMING, }; struct uvc_device { struct video_device vdev; struct v4l2_device v4l2_dev; enum uvc_state state; struct usb_function func; struct uvc_video video; /* Descriptors */ struct { const struct uvc_descriptor_header * const *fs_control; const struct uvc_descriptor_header * const *ss_control; const struct uvc_descriptor_header * const *fs_streaming; const struct uvc_descriptor_header * const *hs_streaming; const struct uvc_descriptor_header * const *ss_streaming; } desc; unsigned int control_intf; struct usb_ep *control_ep; struct usb_request *control_req; void *control_buf; unsigned int streaming_intf; /* Events */ unsigned int event_length; unsigned int event_setup_out : 1; }; static inline struct uvc_device *to_uvc(struct usb_function *f) { return container_of(f, struct uvc_device, func); } struct uvc_file_handle { struct v4l2_fh vfh; struct uvc_video *device; }; #define to_uvc_file_handle(handle) \ container_of(handle, struct uvc_file_handle, vfh) /* ------------------------------------------------------------------------ * Functions */ extern void uvc_function_setup_continue(struct uvc_device *uvc); extern void uvc_endpoint_stream(struct uvc_device *dev); extern void uvc_function_connect(struct uvc_device *uvc); extern void uvc_function_disconnect(struct uvc_device *uvc); #endif /* __KERNEL__ */ #endif /* _UVC_GADGET_H_ */ summary='commit info' class='commit-info'> authorPeter Zijlstra <peterz@infradead.org>2017-01-26 23:15:08 +0100 committerIngo Molnar <mingo@kernel.org>2017-01-30 11:41:26 +0100 commit0b3589be9b98994ce3d5aeca52445d1f5627c4ba (patch) tree85d0d9b3ac902af2c938b19a566884caf8d00323 /drivers/usb/gadget/function/u_gether.h parenta76a82a3e38c8d3fb6499e3dfaeb0949241ab588 (diff)
perf/core: Fix PERF_RECORD_MMAP2 prot/flags for anonymous memory
Andres reported that MMAP2 records for anonymous memory always have their protection field 0. Turns out, someone daft put the prot/flags generation code in the file branch, leaving them unset for anonymous memory. Reported-by: Andres Freund <andres@anarazel.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Don Zickus <dzickus@redhat.com Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: acme@kernel.org Cc: anton@ozlabs.org Cc: namhyung@kernel.org Cc: stable@vger.kernel.org # v3.16+ Fixes: f972eb63b100 ("perf: Pass protection and flags bits through mmap2 interface") Link: http://lkml.kernel.org/r/20170126221508.GF6536@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/usb/gadget/function/u_gether.h')