Bug

[В начало]

Ошибка # 49

Показать/спрятать трассу ошибок
Error trace
Function bodies
Blocks
  • Others...
    Function bodies without model function calls
    Initialization function calls
    Initialization function bodies
    Entry point
    Entry point body
    Function calls
    Skipped function calls
    Formal parameter names
    Declarations
    Assumes
    Assume conditions
    Returns
    Return values
    DEG initialization
    DEG function calls
    Model function calls
    Model function bodies
    Model asserts
    Model state changes
    Model function function calls
    Model function function bodies
    Model returns
    Model others
    Identation
    Line numbers
    Expand signs
-__CPAchecker_initialize()
{
95 struct kernel_symbol { unsigned long value; const char *name; } ;
33 struct module ;
19 typedef signed char __s8;
20 typedef unsigned char __u8;
22 typedef short __s16;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
29 typedef long long __s64;
30 typedef unsigned long long __u64;
16 typedef unsigned char u8;
18 typedef short s16;
19 typedef unsigned short u16;
21 typedef int s32;
22 typedef unsigned int u32;
24 typedef long long s64;
25 typedef unsigned long long u64;
14 typedef long __kernel_long_t;
15 typedef unsigned long __kernel_ulong_t;
27 typedef int __kernel_pid_t;
40 typedef __kernel_long_t __kernel_suseconds_t;
48 typedef unsigned int __kernel_uid32_t;
49 typedef unsigned int __kernel_gid32_t;
71 typedef __kernel_ulong_t __kernel_size_t;
72 typedef __kernel_long_t __kernel_ssize_t;
87 typedef long long __kernel_loff_t;
88 typedef __kernel_long_t __kernel_time_t;
89 typedef __kernel_long_t __kernel_clock_t;
90 typedef int __kernel_timer_t;
91 typedef int __kernel_clockid_t;
32 typedef __u16 __le16;
34 typedef __u32 __le32;
12 typedef __u32 __kernel_dev_t;
15 typedef __kernel_dev_t dev_t;
18 typedef unsigned short umode_t;
21 typedef __kernel_pid_t pid_t;
26 typedef __kernel_clockid_t clockid_t;
29 typedef _Bool bool;
31 typedef __kernel_uid32_t uid_t;
32 typedef __kernel_gid32_t gid_t;
45 typedef __kernel_loff_t loff_t;
54 typedef __kernel_size_t size_t;
59 typedef __kernel_ssize_t ssize_t;
69 typedef __kernel_time_t time_t;
102 typedef __s32 int32_t;
106 typedef __u8 uint8_t;
107 typedef __u16 uint16_t;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
147 typedef u64 dma_addr_t;
158 typedef unsigned int gfp_t;
159 typedef unsigned int fmode_t;
160 typedef unsigned int oom_flags_t;
178 struct __anonstruct_atomic_t_6 { int counter; } ;
178 typedef struct __anonstruct_atomic_t_6 atomic_t;
183 struct __anonstruct_atomic64_t_7 { long counter; } ;
183 typedef struct __anonstruct_atomic64_t_7 atomic64_t;
184 struct list_head { struct list_head *next; struct list_head *prev; } ;
189 struct hlist_node ;
189 struct hlist_head { struct hlist_node *first; } ;
193 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ;
204 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ;
65 struct pt_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long bp; unsigned long bx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long ax; unsigned long cx; unsigned long dx; unsigned long si; unsigned long di; unsigned long orig_ax; unsigned long ip; unsigned long cs; unsigned long flags; unsigned long sp; unsigned long ss; } ;
59 struct __anonstruct_ldv_1016_9 { unsigned int a; unsigned int b; } ;
59 struct __anonstruct_ldv_1031_10 { u16 limit0; u16 base0; unsigned char base1; unsigned char type; unsigned char s; unsigned char dpl; unsigned char p; unsigned char limit; unsigned char avl; unsigned char l; unsigned char d; unsigned char g; unsigned char base2; } ;
59 union __anonunion_ldv_1032_8 { struct __anonstruct_ldv_1016_9 ldv_1016; struct __anonstruct_ldv_1031_10 ldv_1031; } ;
59 struct desc_struct { union __anonunion_ldv_1032_8 ldv_1032; } ;
12 typedef unsigned long pteval_t;
15 typedef unsigned long pgdval_t;
16 typedef unsigned long pgprotval_t;
18 struct __anonstruct_pte_t_11 { pteval_t pte; } ;
18 typedef struct __anonstruct_pte_t_11 pte_t;
20 struct pgprot { pgprotval_t pgprot; } ;
242 typedef struct pgprot pgprot_t;
244 struct __anonstruct_pgd_t_12 { pgdval_t pgd; } ;
244 typedef struct __anonstruct_pgd_t_12 pgd_t;
332 struct page ;
332 typedef struct page *pgtable_t;
340 struct file ;
353 struct seq_file ;
390 struct thread_struct ;
392 struct mm_struct ;
393 struct task_struct ;
394 struct cpumask ;
327 struct arch_spinlock ;
18 typedef u16 __ticket_t;
19 typedef u32 __ticketpair_t;
20 struct __raw_tickets { __ticket_t head; __ticket_t tail; } ;
32 union __anonunion_ldv_1452_15 { __ticketpair_t head_tail; struct __raw_tickets tickets; } ;
32 struct arch_spinlock { union __anonunion_ldv_1452_15 ldv_1452; } ;
33 typedef struct arch_spinlock arch_spinlock_t;
34 struct qrwlock { atomic_t cnts; arch_spinlock_t lock; } ;
14 typedef struct qrwlock arch_rwlock_t;
142 typedef void (*ctor_fn_t)();
48 struct device ;
400 struct file_operations ;
412 struct completion ;
416 struct pid ;
527 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
102 struct timespec ;
127 struct kernel_vm86_regs { struct pt_regs pt; unsigned short es; unsigned short __esh; unsigned short ds; unsigned short __dsh; unsigned short fs; unsigned short __fsh; unsigned short gs; unsigned short __gsh; } ;
79 union __anonunion_ldv_3000_20 { struct pt_regs *regs; struct kernel_vm86_regs *vm86; } ;
79 struct math_emu_info { long ___orig_eip; union __anonunion_ldv_3000_20 ldv_3000; } ;
306 struct cpumask { unsigned long bits[128U]; } ;
14 typedef struct cpumask cpumask_t;
671 typedef struct cpumask *cpumask_var_t;
162 struct seq_operations ;
294 struct i387_fsave_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u32 status; } ;
312 struct __anonstruct_ldv_5307_25 { u64 rip; u64 rdp; } ;
312 struct __anonstruct_ldv_5313_26 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
312 union __anonunion_ldv_5314_24 { struct __anonstruct_ldv_5307_25 ldv_5307; struct __anonstruct_ldv_5313_26 ldv_5313; } ;
312 union __anonunion_ldv_5323_27 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
312 struct i387_fxsave_struct { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion_ldv_5314_24 ldv_5314; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion_ldv_5323_27 ldv_5323; } ;
346 struct i387_soft_struct { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u8 ftop; u8 changed; u8 lookahead; u8 no_update; u8 rm; u8 alimit; struct math_emu_info *info; u32 entry_eip; } ;
367 struct ymmh_struct { u32 ymmh_space[64U]; } ;
372 struct lwp_struct { u8 reserved[128U]; } ;
377 struct bndregs_struct { u64 bndregs[8U]; } ;
381 struct bndcsr_struct { u64 cfg_reg_u; u64 status_reg; } ;
386 struct xsave_hdr_struct { u64 xstate_bv; u64 reserved1[2U]; u64 reserved2[5U]; } ;
392 struct xsave_struct { struct i387_fxsave_struct i387; struct xsave_hdr_struct xsave_hdr; struct ymmh_struct ymmh; struct lwp_struct lwp; struct bndregs_struct bndregs; struct bndcsr_struct bndcsr; } ;
401 union thread_xstate { struct i387_fsave_struct fsave; struct i387_fxsave_struct fxsave; struct i387_soft_struct soft; struct xsave_struct xsave; } ;
409 struct fpu { unsigned int last_cpu; unsigned int has_fpu; union thread_xstate *state; } ;
465 struct kmem_cache ;
466 struct perf_event ;
467 struct thread_struct { struct desc_struct tls_array[3U]; unsigned long sp0; unsigned long sp; unsigned long usersp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; unsigned long fs; unsigned long gs; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; struct fpu fpu; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; unsigned char fpu_counter; } ;
23 typedef atomic64_t atomic_long_t;
35 struct lockdep_map ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
26 struct lockdep_subclass_key { char __one_byte; } ;
53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ;
59 struct lock_class { struct list_head hash_entry; struct list_head lock_entry; struct lockdep_subclass_key *key; unsigned int subclass; unsigned int dep_gen_id; unsigned long usage_mask; struct stack_trace usage_traces[13U]; struct list_head locks_after; struct list_head locks_before; unsigned int version; unsigned long ops; const char *name; int name_version; unsigned long contention_point[4U]; unsigned long contending_point[4U]; } ;
144 struct lockdep_map { struct lock_class_key *key; struct lock_class *class_cache[2U]; const char *name; int cpu; unsigned long ip; } ;
205 struct held_lock { u64 prev_chain_key; unsigned long acquire_ip; struct lockdep_map *instance; struct lockdep_map *nest_lock; u64 waittime_stamp; u64 holdtime_stamp; unsigned short class_idx; unsigned char irq_context; unsigned char trylock; unsigned char read; unsigned char check; unsigned char hardirqs_off; unsigned short references; } ;
530 struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
32 typedef struct raw_spinlock raw_spinlock_t;
33 struct __anonstruct_ldv_6364_31 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion_ldv_6365_30 { struct raw_spinlock rlock; struct __anonstruct_ldv_6364_31 ldv_6364; } ;
33 struct spinlock { union __anonunion_ldv_6365_30 ldv_6365; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_32 { arch_rwlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ;
23 typedef struct __anonstruct_rwlock_t_32 rwlock_t;
412 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
51 typedef struct seqcount seqcount_t;
433 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
13 struct timeval { __kernel_time_t tv_sec; __kernel_suseconds_t tv_usec; } ;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_34 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_34 kuid_t;
27 struct __anonstruct_kgid_t_35 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_35 kgid_t;
127 struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; kuid_t uid; kgid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; } ;
34 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
39 typedef struct __wait_queue_head wait_queue_head_t;
98 struct __anonstruct_nodemask_t_36 { unsigned long bits[16U]; } ;
98 typedef struct __anonstruct_nodemask_t_36 nodemask_t;
814 struct optimistic_spin_queue ;
815 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; const char *name; void *magic; struct lockdep_map dep_map; } ;
68 struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; } ;
178 struct rw_semaphore ;
179 struct rw_semaphore { long count; raw_spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; struct optimistic_spin_queue *osq; struct lockdep_map dep_map; } ;
174 struct completion { unsigned int done; wait_queue_head_t wait; } ;
105 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
323 union ktime { s64 tv64; } ;
59 typedef union ktime ktime_t;
412 struct tvec_base ;
413 struct timer_list { struct list_head entry; unsigned long expires; struct tvec_base *base; void (*function)(unsigned long); unsigned long data; int slack; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
254 struct hrtimer ;
255 enum hrtimer_restart ;
266 struct workqueue_struct ;
267 struct work_struct ;
53 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ;
106 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ;
58 struct pm_message { int event; } ;
64 typedef struct pm_message pm_message_t;
65 struct dev_pm_ops { int (*prepare)(struct device *); void (*complete)(struct device *); int (*suspend)(struct device *); int (*resume)(struct device *); int (*freeze)(struct device *); int (*thaw)(struct device *); int (*poweroff)(struct device *); int (*restore)(struct device *); int (*suspend_late)(struct device *); int (*resume_early)(struct device *); int (*freeze_late)(struct device *); int (*thaw_early)(struct device *); int (*poweroff_late)(struct device *); int (*restore_early)(struct device *); int (*suspend_noirq)(struct device *); int (*resume_noirq)(struct device *); int (*freeze_noirq)(struct device *); int (*thaw_noirq)(struct device *); int (*poweroff_noirq)(struct device *); int (*restore_noirq)(struct device *); int (*runtime_suspend)(struct device *); int (*runtime_resume)(struct device *); int (*runtime_idle)(struct device *); } ;
320 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
327 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
335 struct wakeup_source ;
546 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; } ;
553 struct dev_pm_qos ;
553 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool is_prepared; bool is_suspended; bool is_noirq_suspended; bool is_late_suspended; bool ignore_children; bool early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; atomic_t usage_count; atomic_t child_count; unsigned char disable_depth; unsigned char idle_notification; unsigned char request_pending; unsigned char deferred_resume; unsigned char run_wake; unsigned char runtime_auto; unsigned char no_callbacks; unsigned char irq_safe; unsigned char use_autosuspend; unsigned char timer_autosuspends; unsigned char memalloc_noio; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; void (*set_latency_tolerance)(struct device *, s32 ); struct dev_pm_qos *qos; } ;
614 struct dev_pm_domain { struct dev_pm_ops ops; } ;
22 struct __anonstruct_mm_context_t_101 { void *ldt; int size; unsigned short ia32_compat; struct mutex lock; void *vdso; } ;
22 typedef struct __anonstruct_mm_context_t_101 mm_context_t;
18 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ;
40 struct rb_root { struct rb_node *rb_node; } ;
87 struct vm_area_struct ;
835 struct nsproxy ;
37 struct cred ;
24 struct inode ;
58 struct arch_uprobe_task { unsigned long saved_scratch_register; unsigned int saved_trap_nr; unsigned int saved_tf; } ;
66 enum uprobe_task_state { UTASK_RUNNING = 0, UTASK_SSTEP = 1, UTASK_SSTEP_ACK = 2, UTASK_SSTEP_TRAPPED = 3 } ;
73 struct __anonstruct_ldv_13972_136 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct_ldv_13976_137 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion_ldv_13977_135 { struct __anonstruct_ldv_13972_136 ldv_13972; struct __anonstruct_ldv_13976_137 ldv_13976; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion_ldv_13977_135 ldv_13977; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
94 struct xol_area ;
95 struct uprobes_state { struct xol_area *xol_area; } ;
133 struct address_space ;
134 union __anonunion_ldv_14086_138 { struct address_space *mapping; void *s_mem; } ;
134 union __anonunion_ldv_14092_140 { unsigned long index; void *freelist; bool pfmemalloc; } ;
134 struct __anonstruct_ldv_14102_144 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
134 union __anonunion_ldv_14104_143 { atomic_t _mapcount; struct __anonstruct_ldv_14102_144 ldv_14102; int units; } ;
134 struct __anonstruct_ldv_14106_142 { union __anonunion_ldv_14104_143 ldv_14104; atomic_t _count; } ;
134 union __anonunion_ldv_14108_141 { unsigned long counters; struct __anonstruct_ldv_14106_142 ldv_14106; unsigned int active; } ;
134 struct __anonstruct_ldv_14109_139 { union __anonunion_ldv_14092_140 ldv_14092; union __anonunion_ldv_14108_141 ldv_14108; } ;
134 struct __anonstruct_ldv_14116_146 { struct page *next; int pages; int pobjects; } ;
134 struct slab ;
134 union __anonunion_ldv_14121_145 { struct list_head lru; struct __anonstruct_ldv_14116_146 ldv_14116; struct slab *slab_page; struct callback_head callback_head; pgtable_t pmd_huge_pte; } ;
134 union __anonunion_ldv_14127_147 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; struct page *first_page; } ;
134 struct page { unsigned long flags; union __anonunion_ldv_14086_138 ldv_14086; struct __anonstruct_ldv_14109_139 ldv_14109; union __anonunion_ldv_14121_145 ldv_14121; union __anonunion_ldv_14127_147 ldv_14127; unsigned long debug_flags; } ;
187 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
239 struct __anonstruct_linear_149 { struct rb_node rb; unsigned long rb_subtree_last; } ;
239 union __anonunion_shared_148 { struct __anonstruct_linear_149 linear; struct list_head nonlinear; } ;
239 struct anon_vma ;
239 struct vm_operations_struct ;
239 struct mempolicy ;
239 struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; struct vm_area_struct *vm_prev; struct rb_node vm_rb; unsigned long rb_subtree_gap; struct mm_struct *vm_mm; pgprot_t vm_page_prot; unsigned long vm_flags; union __anonunion_shared_148 shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file *vm_file; void *vm_private_data; struct mempolicy *vm_policy; } ;
311 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
317 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
330 struct task_rss_stat { int events; int count[3U]; } ;
338 struct mm_rss_stat { atomic_long_t count[3U]; } ;
343 struct kioctx_table ;
344 struct linux_binfmt ;
344 struct mmu_notifier_mm ;
344 struct mm_struct { struct vm_area_struct *mmap; struct rb_root mm_rb; u32 vmacache_seqnum; unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); unsigned long mmap_base; unsigned long mmap_legacy_base; unsigned long task_size; unsigned long highest_vm_end; pgd_t *pgd; atomic_t mm_users; atomic_t mm_count; atomic_long_t nr_ptes; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long shared_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long def_flags; unsigned long start_code; unsigned long end_code; unsigned long start_data; unsigned long end_data; unsigned long start_brk; unsigned long brk; unsigned long start_stack; unsigned long arg_start; unsigned long arg_end; unsigned long env_start; unsigned long env_end; unsigned long saved_auxv[46U]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct kioctx_table *ioctx_table; struct task_struct *owner; struct file *exe_file; struct mmu_notifier_mm *mmu_notifier_mm; struct cpumask cpumask_allocation; unsigned long numa_next_scan; unsigned long numa_scan_offset; int numa_scan_seq; bool tlb_flush_pending; struct uprobes_state uprobes_state; } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
20 typedef __u32 Elf64_Word;
21 typedef __u64 Elf64_Xword;
190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ;
198 typedef struct elf64_sym Elf64_Sym;
48 union __anonunion_ldv_14490_153 { unsigned long bitmap[4U]; struct callback_head callback_head; } ;
48 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion_ldv_14490_153 ldv_14490; } ;
41 struct idr { struct idr_layer *hint; struct idr_layer *top; int layers; int cur; spinlock_t lock; int id_free_cnt; struct idr_layer *id_free; } ;
124 struct ida_bitmap { long nr_busy; unsigned long bitmap[15U]; } ;
153 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ;
185 struct dentry ;
186 struct iattr ;
187 struct super_block ;
188 struct file_system_type ;
189 struct kernfs_open_node ;
190 struct kernfs_iattrs ;
213 struct kernfs_root ;
213 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
85 struct kernfs_node ;
85 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
89 struct kernfs_ops ;
89 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; } ;
95 union __anonunion_ldv_14634_154 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
95 struct kernfs_node { atomic_t count; atomic_t active; struct lockdep_map dep_map; struct kernfs_node *parent; const char *name; struct rb_node rb; const void *ns; unsigned int hash; union __anonunion_ldv_14634_154 ldv_14634; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
137 struct kernfs_syscall_ops { int (*remount_fs)(struct kernfs_root *, int *, char *); int (*show_options)(struct seq_file *, struct kernfs_root *); int (*mkdir)(struct kernfs_node *, const char *, umode_t ); int (*rmdir)(struct kernfs_node *); int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); } ;
154 struct kernfs_root { struct kernfs_node *kn; unsigned int flags; struct ida ino_ida; struct kernfs_syscall_ops *syscall_ops; struct list_head supers; wait_queue_head_t deactivate_waitq; } ;
170 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; void *priv; struct mutex mutex; int event; struct list_head list; size_t atomic_write_len; bool mmapped; const struct vm_operations_struct *vm_ops; } ;
186 struct kernfs_ops { int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); ssize_t (*read)(struct kernfs_open_file *, char *, size_t , loff_t ); size_t atomic_write_len; ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); struct lock_class_key lockdep_key; } ;
462 struct sock ;
463 struct kobject ;
464 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
470 struct kobj_ns_type_operations { enum kobj_ns_type type; bool (*current_may_mount)(); void * (*grab_current_ns)(); const void * (*netlink_ns)(struct sock *); const void * (*initial_ns)(); void (*drop_ns)(void *); } ;
59 struct bin_attribute ;
60 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ;
37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
67 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ;
131 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
470 struct kref { atomic_t refcount; } ;
52 struct kset ;
52 struct kobj_type ;
52 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ;
114 struct kobj_type { void (*release)(struct kobject *); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); const void * (*namespace)(struct kobject *); } ;
122 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
130 struct kset_uevent_ops { const int (*filter)(struct kset *, struct kobject *); const const char * (*name)(struct kset *, struct kobject *); const int (*uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); } ;
147 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
222 struct kernel_param ;
227 struct kernel_param_ops { unsigned int flags; int (*set)(const char *, const struct kernel_param *); int (*get)(char *, const struct kernel_param *); void (*free)(void *); } ;
58 struct kparam_string ;
58 struct kparam_array ;
58 union __anonunion_ldv_15312_155 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
58 struct kernel_param { const char *name; const struct kernel_param_ops *ops; u16 perm; s16 level; union __anonunion_ldv_15312_155 ldv_15312; } ;
70 struct kparam_string { unsigned int maxlen; char *string; } ;
76 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
461 struct mod_arch_specific { } ;
36 struct module_param_attrs ;
36 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
46 struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t ); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); } ;
72 struct exception_table_entry ;
205 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
212 struct module_ref { unsigned long incs; unsigned long decs; } ;
226 struct module_sect_attrs ;
226 struct module_notes_attrs ;
226 struct tracepoint ;
226 struct ftrace_event_call ;
226 struct module { enum module_state state; struct list_head list; char name[56U]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const unsigned long *crcs; unsigned int num_syms; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; bool sig_ok; const struct kernel_symbol *gpl_future_syms; const unsigned long *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(); void *module_init; void *module_core; unsigned int init_size; unsigned int core_size; unsigned int init_text_size; unsigned int core_text_size; unsigned int init_ro_size; unsigned int core_ro_size; struct mod_arch_specific arch; unsigned int taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; Elf64_Sym *symtab; Elf64_Sym *core_symtab; unsigned int num_symtab; unsigned int core_num_syms; char *strtab; char *core_strtab; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; const struct tracepoint **tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct ftrace_event_call **trace_events; unsigned int num_trace_events; struct list_head source_list; struct list_head target_list; void (*exit)(); struct module_ref *refptr; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ;
13 typedef unsigned long kernel_ulong_t;
186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; } ;
219 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
253 struct usb_device_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 iManufacturer; __u8 iProduct; __u8 iSerialNumber; __u8 bNumConfigurations; } ;
275 struct usb_config_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumInterfaces; __u8 bConfigurationValue; __u8 iConfiguration; __u8 bmAttributes; __u8 bMaxPower; } ;
343 struct usb_interface_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bInterfaceNumber; __u8 bAlternateSetting; __u8 bNumEndpoints; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 iInterface; } ;
363 struct usb_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; __u8 bRefresh; __u8 bSynchAddress; } ;
613 struct usb_ss_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bmAttributes; __le16 wBytesPerInterval; } ;
692 struct usb_interface_assoc_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bFirstInterface; __u8 bInterfaceCount; __u8 bFunctionClass; __u8 bFunctionSubClass; __u8 bFunctionProtocol; __u8 iFunction; } ;
751 struct usb_bos_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumDeviceCaps; } ;
801 struct usb_ext_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __le32 bmAttributes; } ;
811 struct usb_ss_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; __le16 wSpeedSupported; __u8 bFunctionalitySupport; __u8 bU1devExitLat; __le16 bU2DevExitLat; } ;
840 struct usb_ss_container_id_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bReserved; __u8 ContainerID[16U]; } ;
905 enum usb_device_speed { USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW = 1, USB_SPEED_FULL = 2, USB_SPEED_HIGH = 3, USB_SPEED_WIRELESS = 4, USB_SPEED_SUPER = 5 } ;
914 enum usb_device_state { USB_STATE_NOTATTACHED = 0, USB_STATE_ATTACHED = 1, USB_STATE_POWERED = 2, USB_STATE_RECONNECTING = 3, USB_STATE_UNAUTHENTICATED = 4, USB_STATE_DEFAULT = 5, USB_STATE_ADDRESS = 6, USB_STATE_CONFIGURED = 7, USB_STATE_SUSPENDED = 8 } ;
62 struct exception_table_entry { int insn; int fixup; } ;
61 struct timerqueue_node { struct rb_node node; ktime_t expires; } ;
12 struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; } ;
50 struct hrtimer_clock_base ;
51 struct hrtimer_cpu_base ;
60 enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ;
65 struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; unsigned long state; int start_pid; void *start_site; char start_comm[16U]; } ;
132 struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t resolution; ktime_t (*get_time)(); ktime_t softirq_time; ktime_t offset; } ;
163 struct hrtimer_cpu_base { raw_spinlock_t lock; unsigned int active_bases; unsigned int clock_was_set; ktime_t expires_next; int hres_active; int hang_detected; unsigned long nr_events; unsigned long nr_retries; unsigned long nr_hangs; ktime_t max_hang_time; struct hrtimer_clock_base clock_base[4U]; } ;
663 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
67 struct path ;
68 struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; struct user_namespace *user_ns; void *private; } ;
35 struct seq_operations { void * (*start)(struct seq_file *, loff_t *); void (*stop)(struct seq_file *, void *); void * (*next)(struct seq_file *, void *, loff_t *); int (*show)(struct seq_file *, void *); } ;
196 struct pinctrl ;
197 struct pinctrl_state ;
194 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ;
42 struct dma_map_ops ;
42 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ;
14 struct device_private ;
15 struct device_driver ;
16 struct driver_private ;
17 struct class ;
18 struct subsys_private ;
19 struct bus_type ;
20 struct device_node ;
21 struct iommu_ops ;
22 struct iommu_group ;
60 struct device_attribute ;
60 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; const struct attribute_group **bus_groups; const struct attribute_group **dev_groups; const struct attribute_group **drv_groups; int (*match)(struct device *, struct device_driver *); int (*uevent)(struct device *, struct kobj_uevent_env *); int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*online)(struct device *); int (*offline)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct dev_pm_ops *pm; struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
138 struct device_type ;
195 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; } ;
321 struct class_attribute ;
321 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; const struct attribute_group **dev_groups; struct kobject *dev_kobj; int (*dev_uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *); void (*class_release)(struct class *); void (*dev_release)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ;
414 struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, struct class_attribute *, char *); ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t ); } ;
482 struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); void (*release)(struct device *); const struct dev_pm_ops *pm; } ;
510 struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *, struct device_attribute *, char *); ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t ); } ;
640 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
649 struct acpi_device ;
650 struct acpi_dev_node { struct acpi_device *companion; } ;
656 struct dma_coherent_mem ;
656 struct cma ;
656 struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; void *driver_data; struct dev_pm_info power; struct dev_pm_domain *pm_domain; struct dev_pin_info *pins; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct cma *cma_area; struct dev_archdata archdata; struct device_node *of_node; struct acpi_dev_node acpi_node; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *); struct iommu_group *iommu_group; bool offline_disabled; bool offline; } ;
803 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ;
93 struct hlist_bl_node ;
93 struct hlist_bl_head { struct hlist_bl_node *first; } ;
36 struct hlist_bl_node { struct hlist_bl_node *next; struct hlist_bl_node **pprev; } ;
114 struct __anonstruct_ldv_19539_162 { spinlock_t lock; unsigned int count; } ;
114 union __anonunion_ldv_19540_161 { struct __anonstruct_ldv_19539_162 ldv_19539; } ;
114 struct lockref { union __anonunion_ldv_19540_161 ldv_19540; } ;
49 struct nameidata ;
50 struct vfsmount ;
51 struct __anonstruct_ldv_19563_164 { u32 hash; u32 len; } ;
51 union __anonunion_ldv_19565_163 { struct __anonstruct_ldv_19563_164 ldv_19563; u64 hash_len; } ;
51 struct qstr { union __anonunion_ldv_19565_163 ldv_19565; const unsigned char *name; } ;
90 struct dentry_operations ;
90 union __anonunion_d_u_165 { struct list_head d_child; struct callback_head d_rcu; } ;
90 struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32U]; struct lockref d_lockref; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; struct list_head d_lru; union __anonunion_d_u_165 d_u; struct list_head d_subdirs; struct hlist_node d_alias; } ;
142 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool ); } ;
477 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
27 struct list_lru_node { spinlock_t lock; struct list_head list; long nr_items; } ;
30 struct list_lru { struct list_lru_node *node; nodemask_t active_nodes; } ;
58 struct __anonstruct_ldv_19926_167 { struct radix_tree_node *parent; void *private_data; } ;
58 union __anonunion_ldv_19928_166 { struct __anonstruct_ldv_19926_167 ldv_19926; struct callback_head callback_head; } ;
58 struct radix_tree_node { unsigned int path; unsigned int count; union __anonunion_ldv_19928_166 ldv_19928; struct list_head private_list; void *slots[64U]; unsigned long tags[3U][1U]; } ;
105 struct radix_tree_root { unsigned int height; gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
428 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
435 struct pid_namespace ;
435 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ;
56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ;
68 struct pid_link { struct hlist_node node; struct pid *pid; } ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
45 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ;
38 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; nodemask_t nodes_to_scan; int nid; } ;
26 struct shrinker { unsigned long int (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long int (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; long batch; unsigned long flags; struct list_head list; atomic_long_t *nr_deferred; } ;
70 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
30 struct block_device ;
31 struct io_context ;
59 struct export_operations ;
61 struct iovec ;
62 struct kiocb ;
63 struct pipe_inode_info ;
64 struct poll_table_struct ;
65 struct kstatfs ;
66 struct swap_info_struct ;
67 struct iov_iter ;
69 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ;
253 struct percpu_counter { raw_spinlock_t lock; s64 count; struct list_head list; s32 *counters; } ;
176 struct fs_disk_quota { __s8 d_version; __s8 d_flags; __u16 d_fieldmask; __u32 d_id; __u64 d_blk_hardlimit; __u64 d_blk_softlimit; __u64 d_ino_hardlimit; __u64 d_ino_softlimit; __u64 d_bcount; __u64 d_icount; __s32 d_itimer; __s32 d_btimer; __u16 d_iwarns; __u16 d_bwarns; __s32 d_padding2; __u64 d_rtb_hardlimit; __u64 d_rtb_softlimit; __u64 d_rtbcount; __s32 d_rtbtimer; __u16 d_rtbwarns; __s16 d_padding3; char d_padding4[8U]; } ;
76 struct fs_qfilestat { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; } ;
151 typedef struct fs_qfilestat fs_qfilestat_t;
152 struct fs_quota_stat { __s8 qs_version; __u16 qs_flags; __s8 qs_pad; fs_qfilestat_t qs_uquota; fs_qfilestat_t qs_gquota; __u32 qs_incoredqs; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; } ;
166 struct fs_qfilestatv { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; __u32 qfs_pad; } ;
196 struct fs_quota_statv { __s8 qs_version; __u8 qs_pad1; __u16 qs_flags; __u32 qs_incoredqs; struct fs_qfilestatv qs_uquota; struct fs_qfilestatv qs_gquota; struct fs_qfilestatv qs_pquota; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; __u64 qs_pad2[8U]; } ;
212 struct dquot ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_169 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_169 kprojid_t;
119 struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; __u32 dqi_valid; } ;
152 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
60 typedef long long qsize_t;
61 union __anonunion_ldv_20748_170 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
61 struct kqid { union __anonunion_ldv_20748_170 ldv_20748; enum quota_type type; } ;
178 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; } ;
200 struct quota_format_type ;
201 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_maxblimit; qsize_t dqi_maxilimit; void *dqi_priv; } ;
264 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ;
291 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); } ;
302 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); } ;
316 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_on_meta)(struct super_block *, int, int); int (*quota_off)(struct super_block *, int); int (*quota_sync)(struct super_block *, int); int (*get_info)(struct super_block *, int, struct if_dqinfo *); int (*set_info)(struct super_block *, int, struct if_dqinfo *); int (*get_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*set_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*get_xstate)(struct super_block *, struct fs_quota_stat *); int (*set_xstate)(struct super_block *, unsigned int, int); int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); int (*rm_xquota)(struct super_block *, unsigned int); } ;
334 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ;
380 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct rw_semaphore dqptr_sem; struct inode *files[2U]; struct mem_dqinfo info[2U]; const struct quota_format_ops *ops[2U]; } ;
411 struct writeback_control ;
323 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *, loff_t ); int (*get_xip_mem)(struct address_space *, unsigned long, int, void **, unsigned long *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ;
382 struct backing_dev_info ;
383 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; unsigned int i_mmap_writable; struct rb_root i_mmap; struct list_head i_mmap_nonlinear; struct mutex i_mmap_mutex; unsigned long nrpages; unsigned long nrshadows; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; struct backing_dev_info *backing_dev_info; spinlock_t private_lock; struct list_head private_list; void *private_data; } ;
405 struct request_queue ;
406 struct hd_struct ;
406 struct gendisk ;
406 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
478 struct posix_acl ;
479 struct inode_operations ;
479 union __anonunion_ldv_21164_173 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
479 union __anonunion_ldv_21184_174 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
479 struct file_lock ;
479 struct cdev ;
479 union __anonunion_ldv_21201_175 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; } ;
479 struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union __anonunion_ldv_21164_173 ldv_21164; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks; unsigned long i_state; struct mutex i_mutex; unsigned long dirtied_when; struct hlist_node i_hash; struct list_head i_wb_list; struct list_head i_lru; struct list_head i_sb_list; union __anonunion_ldv_21184_174 ldv_21184; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; atomic_t i_readcount; const struct file_operations *i_fop; struct file_lock *i_flock; struct address_space i_data; struct dquot *i_dquot[2U]; struct list_head i_devices; union __anonunion_ldv_21201_175 ldv_21201; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; void *i_private; } ;
715 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
723 struct file_ra_state { unsigned long start; unsigned int size; unsigned int async_size; unsigned int ra_pages; unsigned int mmap_miss; loff_t prev_pos; } ;
746 union __anonunion_f_u_176 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
746 struct file { union __anonunion_f_u_176 f_u; struct path f_path; struct inode *f_inode; const struct file_operations *f_op; spinlock_t f_lock; atomic_long_t f_count; unsigned int f_flags; fmode_t f_mode; struct mutex f_pos_lock; loff_t f_pos; struct fown_struct f_owner; const struct cred *f_cred; struct file_ra_state f_ra; u64 f_version; void *f_security; void *private_data; struct list_head f_ep_links; struct list_head f_tfile_llink; struct address_space *f_mapping; } ;
836 struct files_struct ;
836 typedef struct files_struct *fl_owner_t;
837 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
842 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, struct file_lock *, int); void (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock **, int); } ;
860 struct nlm_lockowner ;
861 struct nfs_lock_info { u32 state; struct nlm_lockowner *owner; struct list_head list; } ;
14 struct nfs4_lock_state ;
15 struct nfs4_lock_info { struct nfs4_lock_state *owner; } ;
19 struct fasync_struct ;
19 struct __anonstruct_afs_178 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_177 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_178 afs; } ;
19 struct file_lock { struct file_lock *fl_next; struct hlist_node fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; int fl_link_cpu; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct *fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union __anonunion_fl_u_177 fl_u; } ;
963 struct fasync_struct { spinlock_t fa_lock; int magic; int fa_fd; struct fasync_struct *fa_next; struct file *fa_file; struct callback_head fa_rcu; } ;
1157 struct sb_writers { struct percpu_counter counter[3U]; wait_queue_head_t wait; int frozen; wait_queue_head_t wait_unfrozen; struct lockdep_map lock_map[3U]; } ;
1173 struct super_operations ;
1173 struct xattr_handler ;
1173 struct mtd_info ;
1173 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; struct list_head s_inodes; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; u8 s_uuid[16U]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; } ;
1403 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1441 struct dir_context { int (*actor)(void *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1446 struct file_operations { struct module *owner; loff_t (*llseek)(struct file *, loff_t , int); ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); ssize_t (*aio_read)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t (*aio_write)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); int (*iterate)(struct file *, struct dir_context *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct inode *, struct file *); int (*flush)(struct file *, fl_owner_t ); int (*release)(struct inode *, struct file *); int (*fsync)(struct file *, loff_t , loff_t , int); int (*aio_fsync)(struct kiocb *, int); int (*fasync)(int, struct file *, int); int (*lock)(struct file *, int, struct file_lock *); ssize_t (*sendpage)(struct file *, struct page *, int, size_t , loff_t *, int); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock)(struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t , unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*setlease)(struct file *, long, struct file_lock **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); int (*show_fdinfo)(struct seq_file *, struct file *); } ;
1488 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); void * (*follow_link)(struct dentry *, struct nameidata *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); void (*put_link)(struct dentry *, struct nameidata *, void *); int (*create)(struct inode *, struct dentry *, umode_t , bool ); int (*link)(struct dentry *, struct inode *, struct dentry *); int (*unlink)(struct inode *, struct dentry *); int (*symlink)(struct inode *, struct dentry *, const char *); int (*mkdir)(struct inode *, struct dentry *, umode_t ); int (*rmdir)(struct inode *, struct dentry *); int (*mknod)(struct inode *, struct dentry *, umode_t , dev_t ); int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *); int (*rename2)(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(struct vfsmount *, struct dentry *, struct kstat *); int (*setxattr)(struct dentry *, const char *, const void *, size_t , int); ssize_t (*getxattr)(struct dentry *, const char *, void *, size_t ); ssize_t (*listxattr)(struct dentry *, char *, size_t ); int (*removexattr)(struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 , u64 ); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t , int *); int (*tmpfile)(struct inode *, struct dentry *, umode_t ); int (*set_acl)(struct inode *, struct posix_acl *, int); } ;
1535 struct super_operations { struct inode * (*alloc_inode)(struct super_block *); void (*destroy_inode)(struct inode *); void (*dirty_inode)(struct inode *, int); int (*write_inode)(struct inode *, struct writeback_control *); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_fs)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*remount_fs)(struct super_block *, int *, char *); void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t , loff_t ); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t , loff_t ); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, int); long int (*free_cached_objects)(struct super_block *, long, int); } ;
1749 struct file_system_type { const char *name; int fs_flags; struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); void (*kill_sb)(struct super_block *); struct module *owner; struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key s_writers_key[3U]; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
4 typedef unsigned long cputime_t;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
24 struct __anonstruct_sigset_t_179 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_179 sigset_t;
25 struct siginfo ;
17 typedef void __signalfn_t(int);
18 typedef __signalfn_t *__sighandler_t;
20 typedef void __restorefn_t();
21 typedef __restorefn_t *__sigrestore_t;
34 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_181 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_182 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_183 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_184 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__sigfault_185 { void *_addr; short _addr_lsb; } ;
11 struct __anonstruct__sigpoll_186 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_187 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_180 { int _pad[28U]; struct __anonstruct__kill_181 _kill; struct __anonstruct__timer_182 _timer; struct __anonstruct__rt_183 _rt; struct __anonstruct__sigchld_184 _sigchld; struct __anonstruct__sigfault_185 _sigfault; struct __anonstruct__sigpoll_186 _sigpoll; struct __anonstruct__sigsys_187 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_180 _sifields; } ;
109 typedef struct siginfo siginfo_t;
11 struct user_struct ;
21 struct sigpending { struct list_head list; sigset_t signal; } ;
246 struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; } ;
260 struct k_sigaction { struct sigaction sa; } ;
46 struct seccomp_filter ;
47 struct seccomp { int mode; struct seccomp_filter *filter; } ;
40 struct rt_mutex_waiter ;
41 struct rlimit { __kernel_ulong_t rlim_cur; __kernel_ulong_t rlim_max; } ;
11 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
39 struct assoc_array_ptr ;
39 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
31 typedef int32_t key_serial_t;
34 typedef uint32_t key_perm_t;
35 struct key ;
36 struct signal_struct ;
37 struct key_type ;
41 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
123 union __anonunion_ldv_24022_190 { struct list_head graveyard_link; struct rb_node serial_node; } ;
123 struct key_user ;
123 union __anonunion_ldv_24030_191 { time_t expiry; time_t revoked_at; } ;
123 struct __anonstruct_ldv_24043_193 { struct key_type *type; char *description; } ;
123 union __anonunion_ldv_24044_192 { struct keyring_index_key index_key; struct __anonstruct_ldv_24043_193 ldv_24043; } ;
123 union __anonunion_type_data_194 { struct list_head link; unsigned long x[2U]; void *p[2U]; int reject_error; } ;
123 union __anonunion_payload_196 { unsigned long value; void *rcudata; void *data; void *data2[2U]; } ;
123 union __anonunion_ldv_24059_195 { union __anonunion_payload_196 payload; struct assoc_array keys; } ;
123 struct key { atomic_t usage; key_serial_t serial; union __anonunion_ldv_24022_190 ldv_24022; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion_ldv_24030_191 ldv_24030; time_t last_used_at; kuid_t uid; kgid_t gid; key_perm_t perm; unsigned short quotalen; unsigned short datalen; unsigned long flags; union __anonunion_ldv_24044_192 ldv_24044; union __anonunion_type_data_194 type_data; union __anonunion_ldv_24059_195 ldv_24059; } ;
356 struct audit_context ;
27 struct group_info { atomic_t usage; int ngroups; int nblocks; kgid_t small_block[32U]; kgid_t *blocks[0U]; } ;
78 struct cred { atomic_t usage; atomic_t subscribers; void *put_addr; unsigned int magic; kuid_t uid; kgid_t gid; kuid_t suid; kgid_t sgid; kuid_t euid; kgid_t egid; kuid_t fsuid; kgid_t fsgid; unsigned int securebits; kernel_cap_t cap_inheritable; kernel_cap_t cap_permitted; kernel_cap_t cap_effective; kernel_cap_t cap_bset; unsigned char jit_keyring; struct key *session_keyring; struct key *process_keyring; struct key *thread_keyring; struct key *request_key_auth; void *security; struct user_struct *user; struct user_namespace *user_ns; struct group_info *group_info; struct callback_head rcu; } ;
125 struct futex_pi_state ;
126 struct robust_list_head ;
127 struct bio_list ;
128 struct fs_struct ;
129 struct perf_event_context ;
130 struct blk_plug ;
180 struct cfs_rq ;
181 struct task_group ;
426 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
465 struct pacct_struct { int ac_flag; long ac_exitcode; unsigned long ac_mem; cputime_t ac_utime; cputime_t ac_stime; unsigned long ac_minflt; unsigned long ac_majflt; } ;
473 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
480 struct cputime { cputime_t utime; cputime_t stime; } ;
492 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
512 struct thread_group_cputimer { struct task_cputime cputime; int running; raw_spinlock_t lock; } ;
554 struct autogroup ;
555 struct tty_struct ;
555 struct taskstats ;
555 struct tty_audit_buf ;
555 struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; struct list_head thread_head; wait_queue_head_t wait_chldexit; struct task_struct *curr_target; struct sigpending shared_pending; int group_exit_code; int notify_count; struct task_struct *group_exit_task; int group_stop_count; unsigned int flags; unsigned char is_child_subreaper; unsigned char has_child_subreaper; int posix_timer_id; struct list_head posix_timers; struct hrtimer real_timer; struct pid *leader_pid; ktime_t it_real_incr; struct cpu_itimer it[2U]; struct thread_group_cputimer cputimer; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; struct pid *tty_old_pgrp; int leader; struct tty_struct *tty; struct autogroup *autogroup; cputime_t utime; cputime_t stime; cputime_t cutime; cputime_t cstime; cputime_t gtime; cputime_t cgtime; struct cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; unsigned long cnvcsw; unsigned long cnivcsw; unsigned long min_flt; unsigned long maj_flt; unsigned long cmin_flt; unsigned long cmaj_flt; unsigned long inblock; unsigned long oublock; unsigned long cinblock; unsigned long coublock; unsigned long maxrss; unsigned long cmaxrss; struct task_io_accounting ioac; unsigned long long sum_sched_runtime; struct rlimit rlim[16U]; struct pacct_struct pacct; struct taskstats *stats; unsigned int audit_tty; unsigned int audit_tty_log_passwd; struct tty_audit_buf *tty_audit_buf; struct rw_semaphore group_rwsem; oom_flags_t oom_flags; short oom_score_adj; short oom_score_adj_min; struct mutex cred_guard_mutex; } ;
735 struct user_struct { atomic_t __count; atomic_t processes; atomic_t sigpending; atomic_t inotify_watches; atomic_t inotify_devs; atomic_t fanotify_listeners; atomic_long_t epoll_watches; unsigned long mq_bytes; unsigned long locked_shm; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; kuid_t uid; atomic_long_t locked_vm; } ;
778 struct reclaim_state ;
779 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
794 struct task_delay_info { spinlock_t lock; unsigned int flags; struct timespec blkio_start; struct timespec blkio_end; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; struct timespec freepages_start; struct timespec freepages_end; u64 freepages_delay; u32 freepages_count; } ;
1061 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1069 struct sched_avg { u32 runnable_avg_sum; u32 runnable_avg_period; u64 last_runnable_update; s64 decay_count; unsigned long load_avg_contrib; } ;
1081 struct sched_statistics { u64 wait_start; u64 wait_max; u64 wait_count; u64 wait_sum; u64 iowait_count; u64 iowait_sum; u64 sleep_start; u64 sleep_max; s64 sum_sleep_runtime; u64 block_start; u64 block_max; u64 exec_max; u64 slice_max; u64 nr_migrations_cold; u64 nr_failed_migrations_affine; u64 nr_failed_migrations_running; u64 nr_failed_migrations_hot; u64 nr_forced_migrations; u64 nr_wakeups; u64 nr_wakeups_sync; u64 nr_wakeups_migrate; u64 nr_wakeups_local; u64 nr_wakeups_remote; u64 nr_wakeups_affine; u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; } ;
1116 struct sched_entity { struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; struct sched_statistics statistics; int depth; struct sched_entity *parent; struct cfs_rq *cfs_rq; struct cfs_rq *my_q; struct sched_avg avg; } ;
1148 struct rt_rq ;
1148 struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; } ;
1164 struct sched_dl_entity { struct rb_node rb_node; u64 dl_runtime; u64 dl_deadline; u64 dl_period; u64 dl_bw; s64 runtime; u64 deadline; unsigned int flags; int dl_throttled; int dl_new; int dl_boosted; int dl_yielded; struct hrtimer dl_timer; } ;
1222 struct mem_cgroup ;
1222 struct memcg_batch_info { int do_batch; struct mem_cgroup *memcg; unsigned long nr_pages; unsigned long memsw_nr_pages; } ;
1643 struct memcg_oom_info { struct mem_cgroup *memcg; gfp_t gfp_mask; int order; unsigned char may_oom; } ;
1650 struct sched_class ;
1650 struct css_set ;
1650 struct compat_robust_list_head ;
1650 struct numa_group ;
1650 struct task_struct { volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; struct task_struct *last_wakee; unsigned long wakee_flips; unsigned long wakee_flip_decay_ts; int wake_cpu; int on_rq; int prio; int static_prio; int normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; struct task_group *sched_task_group; struct sched_dl_entity dl; struct hlist_head preempt_notifiers; unsigned int policy; int nr_cpus_allowed; cpumask_t cpus_allowed; struct sched_info sched_info; struct list_head tasks; struct plist_node pushable_tasks; struct rb_node pushable_dl_tasks; struct mm_struct *mm; struct mm_struct *active_mm; unsigned char brk_randomized; u32 vmacache_seqnum; struct vm_area_struct *vmacache[4U]; struct task_rss_stat rss_stat; int exit_state; int exit_code; int exit_signal; int pdeath_signal; unsigned int jobctl; unsigned int personality; unsigned char in_execve; unsigned char in_iowait; unsigned char no_new_privs; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; pid_t pid; pid_t tgid; struct task_struct *real_parent; struct task_struct *parent; struct list_head children; struct list_head sibling; struct task_struct *group_leader; struct list_head ptraced; struct list_head ptrace_entry; struct pid_link pids[3U]; struct list_head thread_group; struct list_head thread_node; struct completion *vfork_done; int *set_child_tid; int *clear_child_tid; cputime_t utime; cputime_t stime; cputime_t utimescaled; cputime_t stimescaled; cputime_t gtime; struct cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; struct timespec start_time; struct timespec real_start_time; unsigned long min_flt; unsigned long maj_flt; struct task_cputime cputime_expires; struct list_head cpu_timers[3U]; const struct cred *real_cred; const struct cred *cred; char comm[16U]; int link_count; int total_link_count; struct sysv_sem sysvsem; unsigned long last_switch_count; struct thread_struct thread; struct fs_struct *fs; struct files_struct *files; struct nsproxy *nsproxy; struct signal_struct *signal; struct sighand_struct *sighand; sigset_t blocked; sigset_t real_blocked; sigset_t saved_sigmask; struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; int (*notifier)(void *); void *notifier_data; sigset_t *notifier_mask; struct callback_head *task_works; struct audit_context *audit_context; kuid_t loginuid; unsigned int sessionid; struct seccomp seccomp; u32 parent_exec_id; u32 self_exec_id; spinlock_t alloc_lock; raw_spinlock_t pi_lock; struct rb_root pi_waiters; struct rb_node *pi_waiters_leftmost; struct rt_mutex_waiter *pi_blocked_on; struct task_struct *pi_top_task; struct mutex_waiter *blocked_on; unsigned int irq_events; unsigned long hardirq_enable_ip; unsigned long hardirq_disable_ip; unsigned int hardirq_enable_event; unsigned int hardirq_disable_event; int hardirqs_enabled; int hardirq_context; unsigned long softirq_disable_ip; unsigned long softirq_enable_ip; unsigned int softirq_disable_event; unsigned int softirq_enable_event; int softirqs_enabled; int softirq_context; u64 curr_chain_key; int lockdep_depth; unsigned int lockdep_recursion; struct held_lock held_locks[48U]; gfp_t lockdep_reclaim_gfp; void *journal_info; struct bio_list *bio_list; struct blk_plug *plug; struct reclaim_state *reclaim_state; struct backing_dev_info *backing_dev_info; struct io_context *io_context; unsigned long ptrace_message; siginfo_t *last_siginfo; struct task_io_accounting ioac; u64 acct_rss_mem1; u64 acct_vm_mem1; cputime_t acct_timexpd; nodemask_t mems_allowed; seqcount_t mems_allowed_seq; int cpuset_mem_spread_rotor; int cpuset_slab_spread_rotor; struct css_set *cgroups; struct list_head cg_list; struct robust_list_head *robust_list; struct compat_robust_list_head *compat_robust_list; struct list_head pi_state_list; struct futex_pi_state *pi_state_cache; struct perf_event_context *perf_event_ctxp[2U]; struct mutex perf_event_mutex; struct list_head perf_event_list; struct mempolicy *mempolicy; short il_next; short pref_node_fork; int numa_scan_seq; unsigned int numa_scan_period; unsigned int numa_scan_period_max; int numa_preferred_nid; unsigned long numa_migrate_retry; u64 node_stamp; u64 last_task_numa_placement; u64 last_sum_exec_runtime; struct callback_head numa_work; struct list_head numa_entry; struct numa_group *numa_group; unsigned long *numa_faults_memory; unsigned long total_numa_faults; unsigned long *numa_faults_buffer_memory; unsigned long *numa_faults_cpu; unsigned long *numa_faults_buffer_cpu; unsigned long numa_faults_locality[2U]; unsigned long numa_pages_migrated; struct callback_head rcu; struct pipe_inode_info *splice_pipe; struct page_frag task_frag; struct task_delay_info *delays; int make_it_fail; int nr_dirtied; int nr_dirtied_pause; unsigned long dirty_paused_when; int latency_record_count; struct latency_record latency_record[32U]; unsigned long timer_slack_ns; unsigned long default_timer_slack_ns; unsigned long trace; unsigned long trace_recursion; struct memcg_batch_info memcg_batch; unsigned int memcg_kmem_skip_account; struct memcg_oom_info memcg_oom; struct uprobe_task *utask; unsigned int sequential_io; unsigned int sequential_io_avg; } ;
272 struct usb_device ;
274 struct wusb_dev ;
275 struct ep_device ;
276 struct usb_host_endpoint { struct usb_endpoint_descriptor desc; struct usb_ss_ep_comp_descriptor ss_ep_comp; struct list_head urb_list; void *hcpriv; struct ep_device *ep_dev; unsigned char *extra; int extralen; int enabled; int streams; } ;
77 struct usb_host_interface { struct usb_interface_descriptor desc; int extralen; unsigned char *extra; struct usb_host_endpoint *endpoint; char *string; } ;
92 enum usb_interface_condition { USB_INTERFACE_UNBOUND = 0, USB_INTERFACE_BINDING = 1, USB_INTERFACE_BOUND = 2, USB_INTERFACE_UNBINDING = 3 } ;
99 struct usb_interface { struct usb_host_interface *altsetting; struct usb_host_interface *cur_altsetting; unsigned int num_altsetting; struct usb_interface_assoc_descriptor *intf_assoc; int minor; enum usb_interface_condition condition; unsigned char sysfs_files_created; unsigned char ep_devs_created; unsigned char unregistering; unsigned char needs_remote_wakeup; unsigned char needs_altsetting0; unsigned char needs_binding; unsigned char reset_running; unsigned char resetting_device; struct device dev; struct device *usb_dev; atomic_t pm_usage_cnt; struct work_struct reset_ws; } ;
206 struct usb_interface_cache { unsigned int num_altsetting; struct kref ref; struct usb_host_interface altsetting[0U]; } ;
235 struct usb_host_config { struct usb_config_descriptor desc; char *string; struct usb_interface_assoc_descriptor *intf_assoc[16U]; struct usb_interface *interface[32U]; struct usb_interface_cache *intf_cache[32U]; unsigned char *extra; int extralen; } ;
299 struct usb_host_bos { struct usb_bos_descriptor *desc; struct usb_ext_cap_descriptor *ext_cap; struct usb_ss_cap_descriptor *ss_cap; struct usb_ss_container_id_descriptor *ss_id; } ;
311 struct usb_devmap { unsigned long devicemap[2U]; } ;
323 struct mon_bus ;
323 struct usb_bus { struct device *controller; int busnum; const char *bus_name; u8 uses_dma; u8 uses_pio_for_control; u8 otg_port; unsigned char is_b_host; unsigned char b_hnp_enable; unsigned char no_stop_on_short; unsigned char no_sg_constraint; unsigned int sg_tablesize; int devnum_next; struct usb_devmap devmap; struct usb_device *root_hub; struct usb_bus *hs_companion; struct list_head bus_list; struct mutex usb_address0_mutex; int bandwidth_allocated; int bandwidth_int_reqs; int bandwidth_isoc_reqs; unsigned int resuming_ports; struct mon_bus *mon_bus; int monitored; } ;
374 struct usb_tt ;
375 enum usb_device_removable { USB_DEVICE_REMOVABLE_UNKNOWN = 0, USB_DEVICE_REMOVABLE = 1, USB_DEVICE_FIXED = 2 } ;
388 struct usb2_lpm_parameters { unsigned int besl; int timeout; } ;
409 struct usb3_lpm_parameters { unsigned int mel; unsigned int pel; unsigned int sel; int timeout; } ;
448 struct usb_device { int devnum; char devpath[16U]; u32 route; enum usb_device_state state; enum usb_device_speed speed; struct usb_tt *tt; int ttport; unsigned int toggle[2U]; struct usb_device *parent; struct usb_bus *bus; struct usb_host_endpoint ep0; struct device dev; struct usb_device_descriptor descriptor; struct usb_host_bos *bos; struct usb_host_config *config; struct usb_host_config *actconfig; struct usb_host_endpoint *ep_in[16U]; struct usb_host_endpoint *ep_out[16U]; char **rawdescriptors; unsigned short bus_mA; u8 portnum; u8 level; unsigned char can_submit; unsigned char persist_enabled; unsigned char have_langid; unsigned char authorized; unsigned char authenticated; unsigned char wusb; unsigned char lpm_capable; unsigned char usb2_hw_lpm_capable; unsigned char usb2_hw_lpm_besl_capable; unsigned char usb2_hw_lpm_enabled; unsigned char usb2_hw_lpm_allowed; unsigned char usb3_lpm_enabled; int string_langid; char *product; char *manufacturer; char *serial; struct list_head filelist; int maxchild; u32 quirks; atomic_t urbnum; unsigned long active_duration; unsigned long connect_time; unsigned char do_remote_wakeup; unsigned char reset_resume; unsigned char port_is_suspended; struct wusb_dev *wusb_dev; int slot_id; enum usb_device_removable removable; struct usb2_lpm_parameters l1_params; struct usb3_lpm_parameters u1_params; struct usb3_lpm_parameters u2_params; unsigned int lpm_disable_count; } ;
1179 struct usb_iso_packet_descriptor { unsigned int offset; unsigned int length; unsigned int actual_length; int status; } ;
1221 struct urb ;
1222 struct usb_anchor { struct list_head urb_list; wait_queue_head_t wait; spinlock_t lock; atomic_t suspend_wakeups; unsigned char poisoned; } ;
1241 struct scatterlist ;
1241 struct urb { struct kref kref; void *hcpriv; atomic_t use_count; atomic_t reject; int unlinked; struct list_head urb_list; struct list_head anchor_list; struct usb_anchor *anchor; struct usb_device *dev; struct usb_host_endpoint *ep; unsigned int pipe; unsigned int stream_id; int status; unsigned int transfer_flags; void *transfer_buffer; dma_addr_t transfer_dma; struct scatterlist *sg; int num_mapped_sgs; int num_sgs; u32 transfer_buffer_length; u32 actual_length; unsigned char *setup_packet; dma_addr_t setup_dma; int start_frame; int number_of_packets; int interval; int error_count; void *context; void (*complete)(struct urb *); struct usb_iso_packet_descriptor iso_frame_desc[0U]; } ;
17 struct v4l2_edid { __u32 pad; __u32 start_block; __u32 blocks; __u32 reserved[5U]; __u8 *edid; } ;
549 enum v4l2_field { V4L2_FIELD_ANY = 0, V4L2_FIELD_NONE = 1, V4L2_FIELD_TOP = 2, V4L2_FIELD_BOTTOM = 3, V4L2_FIELD_INTERLACED = 4, V4L2_FIELD_SEQ_TB = 5, V4L2_FIELD_SEQ_BT = 6, V4L2_FIELD_ALTERNATE = 7, V4L2_FIELD_INTERLACED_TB = 8, V4L2_FIELD_INTERLACED_BT = 9 } ;
562 enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, V4L2_BUF_TYPE_SDR_CAPTURE = 11, V4L2_BUF_TYPE_PRIVATE = 128 } ;
585 enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, V4L2_MEMORY_DMABUF = 4 } ;
603 enum v4l2_priority { V4L2_PRIORITY_UNSET = 0, V4L2_PRIORITY_BACKGROUND = 1, V4L2_PRIORITY_INTERACTIVE = 2, V4L2_PRIORITY_RECORD = 3, V4L2_PRIORITY_DEFAULT = 2 } ;
611 struct v4l2_rect { __s32 left; __s32 top; __u32 width; __u32 height; } ;
216 struct v4l2_fract { __u32 numerator; __u32 denominator; } ;
221 struct v4l2_capability { __u8 driver[16U]; __u8 card[32U]; __u8 bus_info[32U]; __u32 version; __u32 capabilities; __u32 device_caps; __u32 reserved[3U]; } ;
242 struct v4l2_pix_format { __u32 width; __u32 height; __u32 pixelformat; __u32 field; __u32 bytesperline; __u32 sizeimage; __u32 colorspace; __u32 priv; } ;
291 struct v4l2_fmtdesc { __u32 index; __u32 type; __u32 flags; __u8 description[32U]; __u32 pixelformat; __u32 reserved[4U]; } ;
460 struct v4l2_frmsize_discrete { __u32 width; __u32 height; } ;
473 struct v4l2_frmsize_stepwise { __u32 min_width; __u32 max_width; __u32 step_width; __u32 min_height; __u32 max_height; __u32 step_height; } ;
482 union __anonunion_ldv_26983_198 { struct v4l2_frmsize_discrete discrete; struct v4l2_frmsize_stepwise stepwise; } ;
482 struct v4l2_frmsizeenum { __u32 index; __u32 pixel_format; __u32 type; union __anonunion_ldv_26983_198 ldv_26983; __u32 reserved[2U]; } ;
501 struct v4l2_frmival_stepwise { struct v4l2_fract min; struct v4l2_fract max; struct v4l2_fract step; } ;
510 union __anonunion_ldv_27002_199 { struct v4l2_fract discrete; struct v4l2_frmival_stepwise stepwise; } ;
510 struct v4l2_frmivalenum { __u32 index; __u32 pixel_format; __u32 width; __u32 height; __u32 type; union __anonunion_ldv_27002_199 ldv_27002; __u32 reserved[2U]; } ;
525 struct v4l2_timecode { __u32 type; __u32 flags; __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4U]; } ;
539 struct v4l2_jpegcompression { int quality; int APPn; int APP_len; char APP_data[60U]; int COM_len; char COM_data[60U]; __u32 jpeg_markers; } ;
568 struct v4l2_requestbuffers { __u32 count; __u32 type; __u32 memory; __u32 reserved[2U]; } ;
593 union __anonunion_m_200 { __u32 mem_offset; unsigned long userptr; __s32 fd; } ;
593 struct v4l2_plane { __u32 bytesused; __u32 length; union __anonunion_m_200 m; __u32 data_offset; __u32 reserved[11U]; } ;
625 union __anonunion_m_201 { __u32 offset; unsigned long userptr; struct v4l2_plane *planes; __s32 fd; } ;
625 struct v4l2_buffer { __u32 index; __u32 type; __u32 bytesused; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; __u32 memory; union __anonunion_m_201 m; __u32 length; __u32 reserved2; __u32 reserved; } ;
678 struct v4l2_exportbuffer { __u32 type; __u32 index; __u32 plane; __u32 flags; __s32 fd; __u32 reserved[11U]; } ;
737 struct v4l2_framebuffer { __u32 capability; __u32 flags; void *base; struct v4l2_pix_format fmt; } ;
749 struct v4l2_clip { struct v4l2_rect c; struct v4l2_clip *next; } ;
771 struct v4l2_window { struct v4l2_rect w; __u32 field; __u32 chromakey; struct v4l2_clip *clips; __u32 clipcount; void *bitmap; __u8 global_alpha; } ;
781 struct v4l2_captureparm { __u32 capability; __u32 capturemode; struct v4l2_fract timeperframe; __u32 extendedmode; __u32 readbuffers; __u32 reserved[4U]; } ;
793 struct v4l2_outputparm { __u32 capability; __u32 outputmode; struct v4l2_fract timeperframe; __u32 extendedmode; __u32 writebuffers; __u32 reserved[4U]; } ;
806 struct v4l2_cropcap { __u32 type; struct v4l2_rect bounds; struct v4l2_rect defrect; struct v4l2_fract pixelaspect; } ;
816 struct v4l2_crop { __u32 type; struct v4l2_rect c; } ;
821 struct v4l2_selection { __u32 type; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[9U]; } ;
848 typedef __u64 v4l2_std_id;
984 struct v4l2_bt_timings { __u32 width; __u32 height; __u32 interlaced; __u32 polarities; __u64 pixelclock; __u32 hfrontporch; __u32 hsync; __u32 hbackporch; __u32 vfrontporch; __u32 vsync; __u32 vbackporch; __u32 il_vfrontporch; __u32 il_vsync; __u32 il_vbackporch; __u32 standards; __u32 flags; __u32 reserved[14U]; } ;
1040 union __anonunion_ldv_27136_202 { struct v4l2_bt_timings bt; __u32 reserved[32U]; } ;
1040 struct v4l2_dv_timings { __u32 type; union __anonunion_ldv_27136_202 ldv_27136; } ;
1102 struct v4l2_enum_dv_timings { __u32 index; __u32 pad; __u32 reserved[2U]; struct v4l2_dv_timings timings; } ;
1120 struct v4l2_bt_timings_cap { __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u64 min_pixelclock; __u64 max_pixelclock; __u32 standards; __u32 capabilities; __u32 reserved[16U]; } ;
1143 union __anonunion_ldv_27159_203 { struct v4l2_bt_timings_cap bt; __u32 raw_data[32U]; } ;
1143 struct v4l2_dv_timings_cap { __u32 type; __u32 pad; __u32 reserved[2U]; union __anonunion_ldv_27159_203 ldv_27159; } ;
1168 struct v4l2_input { __u32 index; __u8 name[32U]; __u32 type; __u32 audioset; __u32 tuner; v4l2_std_id std; __u32 status; __u32 capabilities; __u32 reserved[3U]; } ;
1184 struct v4l2_output { __u32 index; __u8 name[32U]; __u32 type; __u32 audioset; __u32 modulator; v4l2_std_id std; __u32 capabilities; __u32 reserved[3U]; } ;
1231 struct v4l2_control { __u32 id; __s32 value; } ;
1248 union __anonunion_ldv_27190_204 { __s32 value; __s64 value64; char *string; } ;
1248 struct v4l2_ext_control { __u32 id; __u32 size; __u32 reserved2[1U]; union __anonunion_ldv_27190_204 ldv_27190; } ;
1259 struct v4l2_ext_controls { __u32 ctrl_class; __u32 count; __u32 error_idx; __u32 reserved[2U]; struct v4l2_ext_control *controls; } ;
1267 enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER = 1, V4L2_CTRL_TYPE_BOOLEAN = 2, V4L2_CTRL_TYPE_MENU = 3, V4L2_CTRL_TYPE_BUTTON = 4, V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, V4L2_CTRL_TYPE_BITMASK = 8, V4L2_CTRL_TYPE_INTEGER_MENU = 9 } ;
1279 struct v4l2_queryctrl { __u32 id; __u32 type; __u8 name[32U]; __s32 minimum; __s32 maximum; __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2U]; } ;
1296 union __anonunion_ldv_27223_205 { __u8 name[32U]; __s64 value; } ;
1296 struct v4l2_querymenu { __u32 id; __u32 index; union __anonunion_ldv_27223_205 ldv_27223; __u32 reserved; } ;
1307 struct v4l2_tuner { __u32 index; __u8 name[32U]; __u32 type; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 rxsubchans; __u32 audmode; __s32 signal; __s32 afc; __u32 reserved[4U]; } ;
1343 struct v4l2_modulator { __u32 index; __u8 name[32U]; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 txsubchans; __u32 reserved[4U]; } ;
1353 struct v4l2_frequency { __u32 tuner; __u32 type; __u32 frequency; __u32 reserved[8U]; } ;
1392 struct v4l2_frequency_band { __u32 tuner; __u32 type; __u32 index; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 modulation; __u32 reserved[9U]; } ;
1407 struct v4l2_hw_freq_seek { __u32 tuner; __u32 type; __u32 seek_upward; __u32 wrap_around; __u32 spacing; __u32 rangelow; __u32 rangehigh; __u32 reserved[5U]; } ;
1428 struct v4l2_audio { __u32 index; __u8 name[32U]; __u32 capability; __u32 mode; __u32 reserved[2U]; } ;
1450 struct v4l2_audioout { __u32 index; __u8 name[32U]; __u32 capability; __u32 mode; __u32 reserved[2U]; } ;
1465 struct v4l2_enc_idx_entry { __u64 offset; __u64 pts; __u32 length; __u32 flags; __u32 reserved[2U]; } ;
1484 struct v4l2_enc_idx { __u32 entries; __u32 entries_cap; __u32 reserved[4U]; struct v4l2_enc_idx_entry entry[64U]; } ;
1492 struct __anonstruct_raw_207 { __u32 data[8U]; } ;
1492 union __anonunion_ldv_27302_206 { struct __anonstruct_raw_207 raw; } ;
1492 struct v4l2_encoder_cmd { __u32 cmd; __u32 flags; union __anonunion_ldv_27302_206 ldv_27302; } ;
1511 struct __anonstruct_stop_209 { __u64 pts; } ;
1511 struct __anonstruct_start_210 { __s32 speed; __u32 format; } ;
1511 struct __anonstruct_raw_211 { __u32 data[16U]; } ;
1511 union __anonunion_ldv_27317_208 { struct __anonstruct_stop_209 stop; struct __anonstruct_start_210 start; struct __anonstruct_raw_211 raw; } ;
1511 struct v4l2_decoder_cmd { __u32 cmd; __u32 flags; union __anonunion_ldv_27317_208 ldv_27317; } ;
1560 struct v4l2_vbi_format { __u32 sampling_rate; __u32 offset; __u32 samples_per_line; __u32 sample_format; __s32 start[2U]; __u32 count[2U]; __u32 flags; __u32 reserved[2U]; } ;
1580 struct v4l2_sliced_vbi_format { __u16 service_set; __u16 service_lines[2U][24U]; __u32 io_size; __u32 reserved[2U]; } ;
1602 struct v4l2_sliced_vbi_cap { __u16 service_set; __u16 service_lines[2U][24U]; __u32 type; __u32 reserved[3U]; } ;
1626 struct v4l2_sliced_vbi_data { __u32 id; __u32 field; __u32 line; __u32 reserved; __u8 data[48U]; } ;
1681 struct v4l2_plane_pix_format { __u32 sizeimage; __u16 bytesperline; __u16 reserved[7U]; } ;
1698 struct v4l2_pix_format_mplane { __u32 width; __u32 height; __u32 pixelformat; __u32 field; __u32 colorspace; struct v4l2_plane_pix_format plane_fmt[8U]; __u8 num_planes; __u8 reserved[11U]; } ;
1720 struct v4l2_sdr_format { __u32 pixelformat; __u8 reserved[28U]; } ;
1729 union __anonunion_fmt_213 { struct v4l2_pix_format pix; struct v4l2_pix_format_mplane pix_mp; struct v4l2_window win; struct v4l2_vbi_format vbi; struct v4l2_sliced_vbi_format sliced; struct v4l2_sdr_format sdr; __u8 raw_data[200U]; } ;
1729 struct v4l2_format { __u32 type; union __anonunion_fmt_213 fmt; } ;
1752 union __anonunion_parm_214 { struct v4l2_captureparm capture; struct v4l2_outputparm output; __u8 raw_data[200U]; } ;
1752 struct v4l2_streamparm { __u32 type; union __anonunion_parm_214 parm; } ;
1826 struct v4l2_event_subscription { __u32 type; __u32 id; __u32 flags; __u32 reserved[5U]; } ;
1836 union __anonunion_ldv_27433_217 { __u32 addr; char name[32U]; } ;
1836 struct v4l2_dbg_match { __u32 type; union __anonunion_ldv_27433_217 ldv_27433; } ;
1862 struct v4l2_dbg_register { struct v4l2_dbg_match match; __u32 size; __u64 reg; __u64 val; } ;
1869 struct v4l2_dbg_chip_info { struct v4l2_dbg_match match; char name[32U]; __u32 flags; __u32 reserved[32U]; } ;
1880 struct v4l2_create_buffers { __u32 index; __u32 count; __u32 memory; struct v4l2_format format; __u32 reserved[8U]; } ;
188 struct vm_fault { unsigned int flags; unsigned long pgoff; void *virtual_address; struct page *page; unsigned long max_pgoff; pte_t *pte; } ;
221 struct vm_operations_struct { void (*open)(struct vm_area_struct *); void (*close)(struct vm_area_struct *); int (*fault)(struct vm_area_struct *, struct vm_fault *); void (*map_pages)(struct vm_area_struct *, struct vm_fault *); int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*access)(struct vm_area_struct *, unsigned long, void *, int, int); const char * (*name)(struct vm_area_struct *); int (*set_policy)(struct vm_area_struct *, struct mempolicy *); struct mempolicy * (*get_policy)(struct vm_area_struct *, unsigned long); int (*migrate)(struct vm_area_struct *, const nodemask_t *, const nodemask_t *, unsigned long); int (*remap_pages)(struct vm_area_struct *, unsigned long, unsigned long, unsigned long); } ;
368 struct kmem_cache_cpu { void **freelist; unsigned long tid; struct page *page; struct page *partial; unsigned int stat[26U]; } ;
48 struct kmem_cache_order_objects { unsigned long x; } ;
58 struct memcg_cache_params ;
58 struct kmem_cache_node ;
58 struct kmem_cache { struct kmem_cache_cpu *cpu_slab; unsigned long flags; unsigned long min_partial; int size; int object_size; int offset; int cpu_partial; struct kmem_cache_order_objects oo; struct kmem_cache_order_objects max; struct kmem_cache_order_objects min; gfp_t allocflags; int refcount; void (*ctor)(void *); int inuse; int align; int reserved; const char *name; struct list_head list; struct kobject kobj; struct memcg_cache_params *memcg_params; int max_attr_size; struct kset *memcg_kset; int remote_node_defrag_ratio; struct kmem_cache_node *node[1024U]; } ;
501 struct __anonstruct_ldv_30441_219 { struct callback_head callback_head; struct kmem_cache *memcg_caches[0U]; } ;
501 struct __anonstruct_ldv_30447_220 { struct mem_cgroup *memcg; struct list_head list; struct kmem_cache *root_cache; atomic_t nr_pages; } ;
501 union __anonunion_ldv_30448_218 { struct __anonstruct_ldv_30441_219 ldv_30441; struct __anonstruct_ldv_30447_220 ldv_30447; } ;
501 struct memcg_cache_params { bool is_root_cache; union __anonunion_ldv_30448_218 ldv_30448; } ;
32 struct poll_table_struct { void (*_qproc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); unsigned long _key; } ;
40 typedef struct poll_table_struct poll_table;
163 struct v4l2_fh ;
164 struct v4l2_ioctl_ops { int (*vidioc_querycap)(struct file *, void *, struct v4l2_capability *); int (*vidioc_g_priority)(struct file *, void *, enum v4l2_priority *); int (*vidioc_s_priority)(struct file *, void *, enum v4l2_priority ); int (*vidioc_enum_fmt_vid_cap)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_enum_fmt_vid_overlay)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_enum_fmt_vid_out)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_enum_fmt_vid_out_mplane)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_enum_fmt_sdr_cap)(struct file *, void *, struct v4l2_fmtdesc *); int (*vidioc_g_fmt_vid_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vid_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vid_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vid_out_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_sliced_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vid_cap_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_vid_out_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_g_fmt_sdr_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_out_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_sliced_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_cap_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_vid_out_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_s_fmt_sdr_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_out_overlay)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_sliced_vbi_out)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_cap_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_vid_out_mplane)(struct file *, void *, struct v4l2_format *); int (*vidioc_try_fmt_sdr_cap)(struct file *, void *, struct v4l2_format *); int (*vidioc_reqbufs)(struct file *, void *, struct v4l2_requestbuffers *); int (*vidioc_querybuf)(struct file *, void *, struct v4l2_buffer *); int (*vidioc_qbuf)(struct file *, void *, struct v4l2_buffer *); int (*vidioc_expbuf)(struct file *, void *, struct v4l2_exportbuffer *); int (*vidioc_dqbuf)(struct file *, void *, struct v4l2_buffer *); int (*vidioc_create_bufs)(struct file *, void *, struct v4l2_create_buffers *); int (*vidioc_prepare_buf)(struct file *, void *, struct v4l2_buffer *); int (*vidioc_overlay)(struct file *, void *, unsigned int); int (*vidioc_g_fbuf)(struct file *, void *, struct v4l2_framebuffer *); int (*vidioc_s_fbuf)(struct file *, void *, const struct v4l2_framebuffer *); int (*vidioc_streamon)(struct file *, void *, enum v4l2_buf_type ); int (*vidioc_streamoff)(struct file *, void *, enum v4l2_buf_type ); int (*vidioc_g_std)(struct file *, void *, v4l2_std_id *); int (*vidioc_s_std)(struct file *, void *, v4l2_std_id ); int (*vidioc_querystd)(struct file *, void *, v4l2_std_id *); int (*vidioc_enum_input)(struct file *, void *, struct v4l2_input *); int (*vidioc_g_input)(struct file *, void *, unsigned int *); int (*vidioc_s_input)(struct file *, void *, unsigned int); int (*vidioc_enum_output)(struct file *, void *, struct v4l2_output *); int (*vidioc_g_output)(struct file *, void *, unsigned int *); int (*vidioc_s_output)(struct file *, void *, unsigned int); int (*vidioc_queryctrl)(struct file *, void *, struct v4l2_queryctrl *); int (*vidioc_g_ctrl)(struct file *, void *, struct v4l2_control *); int (*vidioc_s_ctrl)(struct file *, void *, struct v4l2_control *); int (*vidioc_g_ext_ctrls)(struct file *, void *, struct v4l2_ext_controls *); int (*vidioc_s_ext_ctrls)(struct file *, void *, struct v4l2_ext_controls *); int (*vidioc_try_ext_ctrls)(struct file *, void *, struct v4l2_ext_controls *); int (*vidioc_querymenu)(struct file *, void *, struct v4l2_querymenu *); int (*vidioc_enumaudio)(struct file *, void *, struct v4l2_audio *); int (*vidioc_g_audio)(struct file *, void *, struct v4l2_audio *); int (*vidioc_s_audio)(struct file *, void *, const struct v4l2_audio *); int (*vidioc_enumaudout)(struct file *, void *, struct v4l2_audioout *); int (*vidioc_g_audout)(struct file *, void *, struct v4l2_audioout *); int (*vidioc_s_audout)(struct file *, void *, const struct v4l2_audioout *); int (*vidioc_g_modulator)(struct file *, void *, struct v4l2_modulator *); int (*vidioc_s_modulator)(struct file *, void *, const struct v4l2_modulator *); int (*vidioc_cropcap)(struct file *, void *, struct v4l2_cropcap *); int (*vidioc_g_crop)(struct file *, void *, struct v4l2_crop *); int (*vidioc_s_crop)(struct file *, void *, const struct v4l2_crop *); int (*vidioc_g_selection)(struct file *, void *, struct v4l2_selection *); int (*vidioc_s_selection)(struct file *, void *, struct v4l2_selection *); int (*vidioc_g_jpegcomp)(struct file *, void *, struct v4l2_jpegcompression *); int (*vidioc_s_jpegcomp)(struct file *, void *, const struct v4l2_jpegcompression *); int (*vidioc_g_enc_index)(struct file *, void *, struct v4l2_enc_idx *); int (*vidioc_encoder_cmd)(struct file *, void *, struct v4l2_encoder_cmd *); int (*vidioc_try_encoder_cmd)(struct file *, void *, struct v4l2_encoder_cmd *); int (*vidioc_decoder_cmd)(struct file *, void *, struct v4l2_decoder_cmd *); int (*vidioc_try_decoder_cmd)(struct file *, void *, struct v4l2_decoder_cmd *); int (*vidioc_g_parm)(struct file *, void *, struct v4l2_streamparm *); int (*vidioc_s_parm)(struct file *, void *, struct v4l2_streamparm *); int (*vidioc_g_tuner)(struct file *, void *, struct v4l2_tuner *); int (*vidioc_s_tuner)(struct file *, void *, const struct v4l2_tuner *); int (*vidioc_g_frequency)(struct file *, void *, struct v4l2_frequency *); int (*vidioc_s_frequency)(struct file *, void *, const struct v4l2_frequency *); int (*vidioc_enum_freq_bands)(struct file *, void *, struct v4l2_frequency_band *); int (*vidioc_g_sliced_vbi_cap)(struct file *, void *, struct v4l2_sliced_vbi_cap *); int (*vidioc_log_status)(struct file *, void *); int (*vidioc_s_hw_freq_seek)(struct file *, void *, const struct v4l2_hw_freq_seek *); int (*vidioc_g_register)(struct file *, void *, struct v4l2_dbg_register *); int (*vidioc_s_register)(struct file *, void *, const struct v4l2_dbg_register *); int (*vidioc_g_chip_info)(struct file *, void *, struct v4l2_dbg_chip_info *); int (*vidioc_enum_framesizes)(struct file *, void *, struct v4l2_frmsizeenum *); int (*vidioc_enum_frameintervals)(struct file *, void *, struct v4l2_frmivalenum *); int (*vidioc_s_dv_timings)(struct file *, void *, struct v4l2_dv_timings *); int (*vidioc_g_dv_timings)(struct file *, void *, struct v4l2_dv_timings *); int (*vidioc_query_dv_timings)(struct file *, void *, struct v4l2_dv_timings *); int (*vidioc_enum_dv_timings)(struct file *, void *, struct v4l2_enum_dv_timings *); int (*vidioc_dv_timings_cap)(struct file *, void *, struct v4l2_dv_timings_cap *); int (*vidioc_g_edid)(struct file *, void *, struct v4l2_edid *); int (*vidioc_s_edid)(struct file *, void *, struct v4l2_edid *); int (*vidioc_subscribe_event)(struct v4l2_fh *, const struct v4l2_event_subscription *); int (*vidioc_unsubscribe_event)(struct v4l2_fh *, const struct v4l2_event_subscription *); long int (*vidioc_default)(struct file *, void *, bool , unsigned int, void *); } ;
304 struct video_device ;
329 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count; } ;
129 struct media_pipeline { } ;
132 struct media_pad ;
132 struct media_link { struct media_pad *source; struct media_pad *sink; struct media_link *reverse; unsigned long flags; } ;
40 struct media_entity ;
40 struct media_pad { struct media_entity *entity; u16 index; unsigned long flags; } ;
46 struct media_entity_operations { int (*link_setup)(struct media_entity *, const struct media_pad *, const struct media_pad *, u32 ); int (*link_validate)(struct media_link *); } ;
53 struct media_device ;
53 struct __anonstruct_v4l_227 { u32 major; u32 minor; } ;
53 struct __anonstruct_fb_228 { u32 major; u32 minor; } ;
53 struct __anonstruct_alsa_229 { u32 card; u32 device; u32 subdevice; } ;
53 union __anonunion_info_226 { struct __anonstruct_v4l_227 v4l; struct __anonstruct_fb_228 fb; struct __anonstruct_alsa_229 alsa; int dvb; } ;
53 struct media_entity { struct list_head list; struct media_device *parent; u32 id; const char *name; u32 type; u32 revision; unsigned long flags; u32 group_id; u16 num_pads; u16 num_links; u16 num_backlinks; u16 max_links; struct media_pad *pads; struct media_link *links; const struct media_entity_operations *ops; int stream_count; int use_count; struct media_pipeline *pipe; union __anonunion_info_226 info; } ;
156 struct v4l2_device ;
157 struct v4l2_ctrl_handler ;
158 struct v4l2_prio_state { atomic_t prios[4U]; } ;
63 struct v4l2_file_operations { struct module *owner; ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*ioctl)(struct file *, unsigned int, unsigned long); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl32)(struct file *, unsigned int, unsigned long); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct file *); int (*release)(struct file *); } ;
81 struct vb2_queue ;
81 struct video_device { struct media_entity entity; const struct v4l2_file_operations *fops; struct device dev; struct cdev *cdev; struct v4l2_device *v4l2_dev; struct device *dev_parent; struct v4l2_ctrl_handler *ctrl_handler; struct vb2_queue *queue; struct v4l2_prio_state *prio; char name[32U]; int vfl_type; int vfl_dir; int minor; u16 num; unsigned long flags; int index; spinlock_t fh_lock; struct list_head fh_list; int debug; v4l2_std_id tvnorms; void (*release)(struct video_device *); const struct v4l2_ioctl_ops *ioctl_ops; unsigned long valid_ioctls[3U]; unsigned long disable_locking[3U]; struct mutex *lock; } ;
237 struct v4l2_ctrl_helper ;
238 struct v4l2_ctrl ;
239 struct v4l2_subdev ;
241 struct v4l2_ctrl_ops { int (*g_volatile_ctrl)(struct v4l2_ctrl *); int (*try_ctrl)(struct v4l2_ctrl *); int (*s_ctrl)(struct v4l2_ctrl *); } ;
58 union __anonunion_ldv_31443_231 { u32 step; u32 menu_skip_mask; } ;
58 union __anonunion_ldv_31447_232 { const const char **qmenu; const s64 *qmenu_int; } ;
58 union __anonunion_cur_233 { s32 val; s64 val64; char *string; } ;
58 union __anonunion_ldv_31458_234 { s32 val; s64 val64; char *string; } ;
58 struct v4l2_ctrl { struct list_head node; struct list_head ev_subs; struct v4l2_ctrl_handler *handler; struct v4l2_ctrl **cluster; unsigned int ncontrols; unsigned char done; unsigned char is_new; unsigned char is_private; unsigned char is_auto; unsigned char has_volatiles; unsigned char call_notify; unsigned char manual_mode_value; const struct v4l2_ctrl_ops *ops; u32 id; const char *name; enum v4l2_ctrl_type type; s32 minimum; s32 maximum; s32 default_value; union __anonunion_ldv_31443_231 ldv_31443; union __anonunion_ldv_31447_232 ldv_31447; unsigned long flags; union __anonunion_cur_233 cur; union __anonunion_ldv_31458_234 ldv_31458; void *priv; } ;
156 struct v4l2_ctrl_ref { struct list_head node; struct v4l2_ctrl_ref *next; struct v4l2_ctrl *ctrl; struct v4l2_ctrl_helper *helper; } ;
173 struct v4l2_ctrl_handler { struct mutex _lock; struct mutex *lock; struct list_head ctrls; struct list_head ctrl_refs; struct v4l2_ctrl_ref *cached; struct v4l2_ctrl_ref **buckets; void (*notify)(struct v4l2_ctrl *, void *); void *notify_priv; u16 nr_of_buckets; int error; } ;
688 struct videobuf_buffer ;
689 struct videobuf_queue ;
690 struct videobuf_mapping { unsigned int count; struct videobuf_queue *q; } ;
55 enum videobuf_state { VIDEOBUF_NEEDS_INIT = 0, VIDEOBUF_PREPARED = 1, VIDEOBUF_QUEUED = 2, VIDEOBUF_ACTIVE = 3, VIDEOBUF_DONE = 4, VIDEOBUF_ERROR = 5, VIDEOBUF_IDLE = 6 } ;
65 struct videobuf_buffer { unsigned int i; u32 magic; unsigned int width; unsigned int height; unsigned int bytesperline; unsigned long size; enum v4l2_field field; enum videobuf_state state; struct list_head stream; struct list_head queue; wait_queue_head_t done; unsigned int field_count; struct timeval ts; enum v4l2_memory memory; size_t bsize; size_t boff; unsigned long baddr; struct videobuf_mapping *map; int privsize; void *priv; } ;
104 struct videobuf_queue_ops { int (*buf_setup)(struct videobuf_queue *, unsigned int *, unsigned int *); int (*buf_prepare)(struct videobuf_queue *, struct videobuf_buffer *, enum v4l2_field ); void (*buf_queue)(struct videobuf_queue *, struct videobuf_buffer *); void (*buf_release)(struct videobuf_queue *, struct videobuf_buffer *); } ;
115 struct videobuf_qtype_ops { u32 magic; struct videobuf_buffer * (*alloc_vb)(size_t ); void * (*vaddr)(struct videobuf_buffer *); int (*iolock)(struct videobuf_queue *, struct videobuf_buffer *, struct v4l2_framebuffer *); int (*sync)(struct videobuf_queue *, struct videobuf_buffer *); int (*mmap_mapper)(struct videobuf_queue *, struct videobuf_buffer *, struct vm_area_struct *); } ;
132 struct videobuf_queue { struct mutex vb_lock; struct mutex *ext_lock; spinlock_t *irqlock; struct device *dev; wait_queue_head_t wait; enum v4l2_buf_type type; unsigned int msize; enum v4l2_field field; enum v4l2_field last; struct videobuf_buffer *bufs[32U]; const struct videobuf_queue_ops *ops; struct videobuf_qtype_ops *int_ops; unsigned char streaming; unsigned char reading; struct list_head stream; unsigned int read_off; struct videobuf_buffer *read_buf; void *priv_data; } ;
45 struct media_file_operations { struct module *owner; ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*open)(struct file *); int (*release)(struct file *); } ;
53 struct media_devnode { const struct media_file_operations *fops; struct device dev; struct cdev cdev; struct device *parent; int minor; unsigned long flags; void (*release)(struct media_devnode *); } ;
98 struct media_device { struct device *dev; struct media_devnode devnode; char model[32U]; char serial[40U]; char bus_info[32U]; u32 hw_revision; u32 driver_version; u32 entity_id; struct list_head entities; spinlock_t lock; struct mutex graph_mutex; int (*link_notify)(struct media_link *, u32 , unsigned int); } ;
98 enum v4l2_mbus_pixelcode { V4L2_MBUS_FMT_FIXED = 1, V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 4097, V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 4098, V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 4099, V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 4100, V4L2_MBUS_FMT_BGR565_2X8_BE = 4101, V4L2_MBUS_FMT_BGR565_2X8_LE = 4102, V4L2_MBUS_FMT_RGB565_2X8_BE = 4103, V4L2_MBUS_FMT_RGB565_2X8_LE = 4104, V4L2_MBUS_FMT_RGB666_1X18 = 4105, V4L2_MBUS_FMT_RGB888_1X24 = 4106, V4L2_MBUS_FMT_RGB888_2X12_BE = 4107, V4L2_MBUS_FMT_RGB888_2X12_LE = 4108, V4L2_MBUS_FMT_ARGB8888_1X32 = 4109, V4L2_MBUS_FMT_Y8_1X8 = 8193, V4L2_MBUS_FMT_UV8_1X8 = 8213, V4L2_MBUS_FMT_UYVY8_1_5X8 = 8194, V4L2_MBUS_FMT_VYUY8_1_5X8 = 8195, V4L2_MBUS_FMT_YUYV8_1_5X8 = 8196, V4L2_MBUS_FMT_YVYU8_1_5X8 = 8197, V4L2_MBUS_FMT_UYVY8_2X8 = 8198, V4L2_MBUS_FMT_VYUY8_2X8 = 8199, V4L2_MBUS_FMT_YUYV8_2X8 = 8200, V4L2_MBUS_FMT_YVYU8_2X8 = 8201, V4L2_MBUS_FMT_Y10_1X10 = 8202, V4L2_MBUS_FMT_UYVY10_2X10 = 8216, V4L2_MBUS_FMT_VYUY10_2X10 = 8217, V4L2_MBUS_FMT_YUYV10_2X10 = 8203, V4L2_MBUS_FMT_YVYU10_2X10 = 8204, V4L2_MBUS_FMT_Y12_1X12 = 8211, V4L2_MBUS_FMT_UYVY8_1X16 = 8207, V4L2_MBUS_FMT_VYUY8_1X16 = 8208, V4L2_MBUS_FMT_YUYV8_1X16 = 8209, V4L2_MBUS_FMT_YVYU8_1X16 = 8210, V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 8212, V4L2_MBUS_FMT_UYVY10_1X20 = 8218, V4L2_MBUS_FMT_VYUY10_1X20 = 8219, V4L2_MBUS_FMT_YUYV10_1X20 = 8205, V4L2_MBUS_FMT_YVYU10_1X20 = 8206, V4L2_MBUS_FMT_YUV10_1X30 = 8214, V4L2_MBUS_FMT_AYUV8_1X32 = 8215, V4L2_MBUS_FMT_UYVY12_2X12 = 8220, V4L2_MBUS_FMT_VYUY12_2X12 = 8221, V4L2_MBUS_FMT_YUYV12_2X12 = 8222, V4L2_MBUS_FMT_YVYU12_2X12 = 8223, V4L2_MBUS_FMT_UYVY12_1X24 = 8224, V4L2_MBUS_FMT_VYUY12_1X24 = 8225, V4L2_MBUS_FMT_YUYV12_1X24 = 8226, V4L2_MBUS_FMT_YVYU12_1X24 = 8227, V4L2_MBUS_FMT_SBGGR8_1X8 = 12289, V4L2_MBUS_FMT_SGBRG8_1X8 = 12307, V4L2_MBUS_FMT_SGRBG8_1X8 = 12290, V4L2_MBUS_FMT_SRGGB8_1X8 = 12308, V4L2_MBUS_FMT_SBGGR10_ALAW8_1X8 = 12309, V4L2_MBUS_FMT_SGBRG10_ALAW8_1X8 = 12310, V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8 = 12311, V4L2_MBUS_FMT_SRGGB10_ALAW8_1X8 = 12312, V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 12299, V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 12300, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 12297, V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 12301, V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 12291, V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 12292, V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 12293, V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 12294, V4L2_MBUS_FMT_SBGGR10_1X10 = 12295, V4L2_MBUS_FMT_SGBRG10_1X10 = 12302, V4L2_MBUS_FMT_SGRBG10_1X10 = 12298, V4L2_MBUS_FMT_SRGGB10_1X10 = 12303, V4L2_MBUS_FMT_SBGGR12_1X12 = 12296, V4L2_MBUS_FMT_SGBRG12_1X12 = 12304, V4L2_MBUS_FMT_SGRBG12_1X12 = 12305, V4L2_MBUS_FMT_SRGGB12_1X12 = 12306, V4L2_MBUS_FMT_JPEG_1X8 = 16385, V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 20481, V4L2_MBUS_FMT_AHSV8888_1X32 = 24577 } ;
177 struct v4l2_mbus_framefmt { __u32 width; __u32 height; __u32 code; __u32 field; __u32 colorspace; __u32 reserved[7U]; } ;
151 struct v4l2_subdev_format { __u32 which; __u32 pad; struct v4l2_mbus_framefmt format; __u32 reserved[8U]; } ;
53 struct v4l2_subdev_crop { __u32 which; __u32 pad; struct v4l2_rect rect; __u32 reserved[8U]; } ;
66 struct v4l2_subdev_mbus_code_enum { __u32 pad; __u32 index; __u32 code; __u32 reserved[9U]; } ;
79 struct v4l2_subdev_frame_size_enum { __u32 index; __u32 pad; __u32 code; __u32 min_width; __u32 max_width; __u32 min_height; __u32 max_height; __u32 reserved[9U]; } ;
96 struct v4l2_subdev_frame_interval { __u32 pad; struct v4l2_fract interval; __u32 reserved[9U]; } ;
107 struct v4l2_subdev_frame_interval_enum { __u32 index; __u32 pad; __u32 code; __u32 width; __u32 height; struct v4l2_fract interval; __u32 reserved[9U]; } ;
126 struct v4l2_subdev_selection { __u32 which; __u32 pad; __u32 target; __u32 flags; struct v4l2_rect r; __u32 reserved[8U]; } ;
150 struct v4l2_async_notifier ;
151 enum v4l2_async_match_type { V4L2_ASYNC_MATCH_CUSTOM = 0, V4L2_ASYNC_MATCH_DEVNAME = 1, V4L2_ASYNC_MATCH_I2C = 2, V4L2_ASYNC_MATCH_OF = 3 } ;
158 struct __anonstruct_of_236 { const struct device_node *node; } ;
158 struct __anonstruct_device_name_237 { const char *name; } ;
158 struct __anonstruct_i2c_238 { int adapter_id; unsigned short address; } ;
158 struct __anonstruct_custom_239 { bool (*match)(struct device *, struct v4l2_async_subdev *); void *priv; } ;
158 union __anonunion_match_235 { struct __anonstruct_of_236 of; struct __anonstruct_device_name_237 device_name; struct __anonstruct_i2c_238 i2c; struct __anonstruct_custom_239 custom; } ;
158 struct v4l2_async_subdev { enum v4l2_async_match_type match_type; union __anonunion_match_235 match; struct list_head list; } ;
63 struct v4l2_async_notifier { unsigned int num_subdevs; struct v4l2_async_subdev **subdevs; struct v4l2_device *v4l2_dev; struct list_head waiting; struct list_head done; struct list_head list; int (*bound)(struct v4l2_async_notifier *, struct v4l2_subdev *, struct v4l2_async_subdev *); int (*complete)(struct v4l2_async_notifier *); void (*unbind)(struct v4l2_async_notifier *, struct v4l2_subdev *, struct v4l2_async_subdev *); } ;
104 struct v4l2_subdev_ops ;
139 struct scatterlist { unsigned long sg_magic; unsigned long page_link; unsigned int offset; unsigned int length; dma_addr_t dma_address; unsigned int dma_length; } ;
162 struct v4l2_priv_tun_config { int tuner; void *priv; } ;
206 struct v4l2_m2m_ctx ;
206 struct v4l2_fh { struct list_head list; struct video_device *vdev; struct v4l2_ctrl_handler *ctrl_handler; enum v4l2_priority prio; wait_queue_head_t wait; struct list_head subscribed; struct list_head available; unsigned int navailable; u32 sequence; struct v4l2_m2m_ctx *m2m_ctx; } ;
106 enum v4l2_mbus_type { V4L2_MBUS_PARALLEL = 0, V4L2_MBUS_BT656 = 1, V4L2_MBUS_CSI2 = 2 } ;
112 struct v4l2_mbus_config { enum v4l2_mbus_type type; unsigned int flags; } ;
109 struct v4l2_subdev_fh ;
110 struct tuner_setup ;
111 struct v4l2_mbus_frame_desc ;
112 struct v4l2_decode_vbi_line { u32 is_second_field; u8 *p; u32 line; u32 type; } ;
61 struct v4l2_subdev_io_pin_config { u32 flags; u8 pin; u8 function; u8 value; u8 strength; } ;
117 struct v4l2_subdev_core_ops { int (*log_status)(struct v4l2_subdev *); int (*s_io_pin_config)(struct v4l2_subdev *, size_t , struct v4l2_subdev_io_pin_config *); int (*init)(struct v4l2_subdev *, u32 ); int (*load_fw)(struct v4l2_subdev *); int (*reset)(struct v4l2_subdev *, u32 ); int (*s_gpio)(struct v4l2_subdev *, u32 ); int (*queryctrl)(struct v4l2_subdev *, struct v4l2_queryctrl *); int (*g_ctrl)(struct v4l2_subdev *, struct v4l2_control *); int (*s_ctrl)(struct v4l2_subdev *, struct v4l2_control *); int (*g_ext_ctrls)(struct v4l2_subdev *, struct v4l2_ext_controls *); int (*s_ext_ctrls)(struct v4l2_subdev *, struct v4l2_ext_controls *); int (*try_ext_ctrls)(struct v4l2_subdev *, struct v4l2_ext_controls *); int (*querymenu)(struct v4l2_subdev *, struct v4l2_querymenu *); long int (*ioctl)(struct v4l2_subdev *, unsigned int, void *); long int (*compat_ioctl32)(struct v4l2_subdev *, unsigned int, unsigned long); int (*g_register)(struct v4l2_subdev *, struct v4l2_dbg_register *); int (*s_register)(struct v4l2_subdev *, const struct v4l2_dbg_register *); int (*s_power)(struct v4l2_subdev *, int); int (*interrupt_service_routine)(struct v4l2_subdev *, u32 , bool *); int (*subscribe_event)(struct v4l2_subdev *, struct v4l2_fh *, struct v4l2_event_subscription *); int (*unsubscribe_event)(struct v4l2_subdev *, struct v4l2_fh *, struct v4l2_event_subscription *); } ;
178 struct v4l2_subdev_tuner_ops { int (*s_radio)(struct v4l2_subdev *); int (*s_frequency)(struct v4l2_subdev *, const struct v4l2_frequency *); int (*g_frequency)(struct v4l2_subdev *, struct v4l2_frequency *); int (*enum_freq_bands)(struct v4l2_subdev *, struct v4l2_frequency_band *); int (*g_tuner)(struct v4l2_subdev *, struct v4l2_tuner *); int (*s_tuner)(struct v4l2_subdev *, const struct v4l2_tuner *); int (*g_modulator)(struct v4l2_subdev *, struct v4l2_modulator *); int (*s_modulator)(struct v4l2_subdev *, const struct v4l2_modulator *); int (*s_type_addr)(struct v4l2_subdev *, struct tuner_setup *); int (*s_config)(struct v4l2_subdev *, const struct v4l2_priv_tun_config *); } ;
205 struct v4l2_subdev_audio_ops { int (*s_clock_freq)(struct v4l2_subdev *, u32 ); int (*s_i2s_clock_freq)(struct v4l2_subdev *, u32 ); int (*s_routing)(struct v4l2_subdev *, u32 , u32 , u32 ); int (*s_stream)(struct v4l2_subdev *, int); } ;
232 struct v4l2_mbus_frame_desc_entry { u16 flags; u32 pixelcode; u32 length; } ;
253 struct v4l2_mbus_frame_desc { struct v4l2_mbus_frame_desc_entry entry[4U]; unsigned short num_entries; } ;
265 struct v4l2_subdev_video_ops { int (*s_routing)(struct v4l2_subdev *, u32 , u32 , u32 ); int (*s_crystal_freq)(struct v4l2_subdev *, u32 , u32 ); int (*g_std)(struct v4l2_subdev *, v4l2_std_id *); int (*s_std)(struct v4l2_subdev *, v4l2_std_id ); int (*s_std_output)(struct v4l2_subdev *, v4l2_std_id ); int (*g_std_output)(struct v4l2_subdev *, v4l2_std_id *); int (*querystd)(struct v4l2_subdev *, v4l2_std_id *); int (*g_tvnorms)(struct v4l2_subdev *, v4l2_std_id *); int (*g_tvnorms_output)(struct v4l2_subdev *, v4l2_std_id *); int (*g_input_status)(struct v4l2_subdev *, u32 *); int (*s_stream)(struct v4l2_subdev *, int); int (*cropcap)(struct v4l2_subdev *, struct v4l2_cropcap *); int (*g_crop)(struct v4l2_subdev *, struct v4l2_crop *); int (*s_crop)(struct v4l2_subdev *, const struct v4l2_crop *); int (*g_parm)(struct v4l2_subdev *, struct v4l2_streamparm *); int (*s_parm)(struct v4l2_subdev *, struct v4l2_streamparm *); int (*g_frame_interval)(struct v4l2_subdev *, struct v4l2_subdev_frame_interval *); int (*s_frame_interval)(struct v4l2_subdev *, struct v4l2_subdev_frame_interval *); int (*enum_framesizes)(struct v4l2_subdev *, struct v4l2_frmsizeenum *); int (*enum_frameintervals)(struct v4l2_subdev *, struct v4l2_frmivalenum *); int (*s_dv_timings)(struct v4l2_subdev *, struct v4l2_dv_timings *); int (*g_dv_timings)(struct v4l2_subdev *, struct v4l2_dv_timings *); int (*query_dv_timings)(struct v4l2_subdev *, struct v4l2_dv_timings *); int (*enum_mbus_fmt)(struct v4l2_subdev *, unsigned int, enum v4l2_mbus_pixelcode *); int (*enum_mbus_fsizes)(struct v4l2_subdev *, struct v4l2_frmsizeenum *); int (*g_mbus_fmt)(struct v4l2_subdev *, struct v4l2_mbus_framefmt *); int (*try_mbus_fmt)(struct v4l2_subdev *, struct v4l2_mbus_framefmt *); int (*s_mbus_fmt)(struct v4l2_subdev *, struct v4l2_mbus_framefmt *); int (*g_mbus_config)(struct v4l2_subdev *, struct v4l2_mbus_config *); int (*s_mbus_config)(struct v4l2_subdev *, const struct v4l2_mbus_config *); int (*s_rx_buffer)(struct v4l2_subdev *, void *, unsigned int *); } ;
359 struct v4l2_subdev_vbi_ops { int (*decode_vbi_line)(struct v4l2_subdev *, struct v4l2_decode_vbi_line *); int (*s_vbi_data)(struct v4l2_subdev *, const struct v4l2_sliced_vbi_data *); int (*g_vbi_data)(struct v4l2_subdev *, struct v4l2_sliced_vbi_data *); int (*g_sliced_vbi_cap)(struct v4l2_subdev *, struct v4l2_sliced_vbi_cap *); int (*s_raw_fmt)(struct v4l2_subdev *, struct v4l2_vbi_format *); int (*g_sliced_fmt)(struct v4l2_subdev *, struct v4l2_sliced_vbi_format *); int (*s_sliced_fmt)(struct v4l2_subdev *, struct v4l2_sliced_vbi_format *); } ;
399 struct v4l2_subdev_sensor_ops { int (*g_skip_top_lines)(struct v4l2_subdev *, u32 *); int (*g_skip_frames)(struct v4l2_subdev *, u32 *); } ;
414 enum v4l2_subdev_ir_mode { V4L2_SUBDEV_IR_MODE_PULSE_WIDTH = 0 } ;
418 struct v4l2_subdev_ir_parameters { unsigned int bytes_per_data_element; enum v4l2_subdev_ir_mode mode; bool enable; bool interrupt_enable; bool shutdown; bool modulation; u32 max_pulse_width; unsigned int carrier_freq; unsigned int duty_cycle; bool invert_level; bool invert_carrier_sense; u32 noise_filter_min_width; unsigned int carrier_range_lower; unsigned int carrier_range_upper; u32 resolution; } ;
466 struct v4l2_subdev_ir_ops { int (*rx_read)(struct v4l2_subdev *, u8 *, size_t , ssize_t *); int (*rx_g_parameters)(struct v4l2_subdev *, struct v4l2_subdev_ir_parameters *); int (*rx_s_parameters)(struct v4l2_subdev *, struct v4l2_subdev_ir_parameters *); int (*tx_write)(struct v4l2_subdev *, u8 *, size_t , ssize_t *); int (*tx_g_parameters)(struct v4l2_subdev *, struct v4l2_subdev_ir_parameters *); int (*tx_s_parameters)(struct v4l2_subdev *, struct v4l2_subdev_ir_parameters *); } ;
485 struct v4l2_subdev_pad_ops { int (*enum_mbus_code)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_mbus_code_enum *); int (*enum_frame_size)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_frame_size_enum *); int (*enum_frame_interval)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_frame_interval_enum *); int (*get_fmt)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_format *); int (*set_fmt)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_format *); int (*set_crop)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_crop *); int (*get_crop)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_crop *); int (*get_selection)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_selection *); int (*set_selection)(struct v4l2_subdev *, struct v4l2_subdev_fh *, struct v4l2_subdev_selection *); int (*get_edid)(struct v4l2_subdev *, struct v4l2_edid *); int (*set_edid)(struct v4l2_subdev *, struct v4l2_edid *); int (*dv_timings_cap)(struct v4l2_subdev *, struct v4l2_dv_timings_cap *); int (*enum_dv_timings)(struct v4l2_subdev *, struct v4l2_enum_dv_timings *); int (*link_validate)(struct v4l2_subdev *, struct media_link *, struct v4l2_subdev_format *, struct v4l2_subdev_format *); int (*get_frame_desc)(struct v4l2_subdev *, unsigned int, struct v4l2_mbus_frame_desc *); int (*set_frame_desc)(struct v4l2_subdev *, unsigned int, struct v4l2_mbus_frame_desc *); } ;
529 struct v4l2_subdev_ops { const struct v4l2_subdev_core_ops *core; const struct v4l2_subdev_tuner_ops *tuner; const struct v4l2_subdev_audio_ops *audio; const struct v4l2_subdev_video_ops *video; const struct v4l2_subdev_vbi_ops *vbi; const struct v4l2_subdev_ir_ops *ir; const struct v4l2_subdev_sensor_ops *sensor; const struct v4l2_subdev_pad_ops *pad; } ;
541 struct v4l2_subdev_internal_ops { int (*registered)(struct v4l2_subdev *); void (*unregistered)(struct v4l2_subdev *); int (*open)(struct v4l2_subdev *, struct v4l2_subdev_fh *); int (*close)(struct v4l2_subdev *, struct v4l2_subdev_fh *); } ;
562 struct regulator_bulk_data ;
563 struct v4l2_subdev_platform_data { struct regulator_bulk_data *regulators; int num_regulators; void *host_priv; } ;
584 struct v4l2_subdev { struct media_entity entity; struct list_head list; struct module *owner; bool owner_v4l2_dev; u32 flags; struct v4l2_device *v4l2_dev; const struct v4l2_subdev_ops *ops; const struct v4l2_subdev_internal_ops *internal_ops; struct v4l2_ctrl_handler *ctrl_handler; char name[32U]; u32 grp_id; void *dev_priv; void *host_priv; struct video_device *devnode; struct device *dev; struct list_head async_list; struct v4l2_async_subdev *asd; struct v4l2_async_notifier *notifier; struct v4l2_subdev_platform_data *pdata; } ;
622 struct __anonstruct_pad_240 { struct v4l2_mbus_framefmt try_fmt; struct v4l2_rect try_crop; struct v4l2_rect try_compose; } ;
622 struct v4l2_subdev_fh { struct v4l2_fh vfh; struct __anonstruct_pad_240 *pad; } ;
691 struct v4l2_device { struct device *dev; struct media_device *mdev; struct list_head subdevs; spinlock_t lock; char name[36U]; void (*notify)(struct v4l2_subdev *, unsigned int, void *); struct v4l2_ctrl_handler *ctrl_handler; struct v4l2_prio_state prio; struct mutex ioctl_lock; struct kref ref; void (*release)(struct v4l2_device *); } ;
30 typedef u32 phandle;
32 struct property { char *name; int length; void *value; struct property *next; unsigned long _flags; unsigned int unique_id; struct bin_attribute attr; } ;
42 struct device_node { const char *name; const char *type; phandle phandle; const char *full_name; struct property *properties; struct property *deadprops; struct device_node *parent; struct device_node *child; struct device_node *sibling; struct device_node *next; struct device_node *allnext; struct kobject kobj; unsigned long _flags; void *data; } ;
578 enum fe_type { FE_QPSK = 0, FE_QAM = 1, FE_OFDM = 2, FE_ATSC = 3 } ;
36 typedef enum fe_type fe_type_t;
37 enum fe_caps { FE_IS_STUPID = 0, FE_CAN_INVERSION_AUTO = 1, FE_CAN_FEC_1_2 = 2, FE_CAN_FEC_2_3 = 4, FE_CAN_FEC_3_4 = 8, FE_CAN_FEC_4_5 = 16, FE_CAN_FEC_5_6 = 32, FE_CAN_FEC_6_7 = 64, FE_CAN_FEC_7_8 = 128, FE_CAN_FEC_8_9 = 256, FE_CAN_FEC_AUTO = 512, FE_CAN_QPSK = 1024, FE_CAN_QAM_16 = 2048, FE_CAN_QAM_32 = 4096, FE_CAN_QAM_64 = 8192, FE_CAN_QAM_128 = 16384, FE_CAN_QAM_256 = 32768, FE_CAN_QAM_AUTO = 65536, FE_CAN_TRANSMISSION_MODE_AUTO = 131072, FE_CAN_BANDWIDTH_AUTO = 262144, FE_CAN_GUARD_INTERVAL_AUTO = 524288, FE_CAN_HIERARCHY_AUTO = 1048576, FE_CAN_8VSB = 2097152, FE_CAN_16VSB = 4194304, FE_HAS_EXTENDED_CAPS = 8388608, FE_CAN_MULTISTREAM = 67108864, FE_CAN_TURBO_FEC = 134217728, FE_CAN_2G_MODULATION = 268435456, FE_NEEDS_BENDING = 536870912, FE_CAN_RECOVER = 1073741824, FE_CAN_MUTE_TS = 2147483648 } ;
71 typedef enum fe_caps fe_caps_t;
72 struct dvb_frontend_info { char name[128U]; fe_type_t type; __u32 frequency_min; __u32 frequency_max; __u32 frequency_stepsize; __u32 frequency_tolerance; __u32 symbol_rate_min; __u32 symbol_rate_max; __u32 symbol_rate_tolerance; __u32 notifier_delay; fe_caps_t caps; } ;
87 struct dvb_diseqc_master_cmd { __u8 msg[6U]; __u8 msg_len; } ;
97 struct dvb_diseqc_slave_reply { __u8 msg[4U]; __u8 msg_len; int timeout; } ;
104 enum fe_sec_voltage { SEC_VOLTAGE_13 = 0, SEC_VOLTAGE_18 = 1, SEC_VOLTAGE_OFF = 2 } ;
110 typedef enum fe_sec_voltage fe_sec_voltage_t;
111 enum fe_sec_tone_mode { SEC_TONE_ON = 0, SEC_TONE_OFF = 1 } ;
116 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
117 enum fe_sec_mini_cmd { SEC_MINI_A = 0, SEC_MINI_B = 1 } ;
122 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
123 enum fe_status { FE_HAS_SIGNAL = 1, FE_HAS_CARRIER = 2, FE_HAS_VITERBI = 4, FE_HAS_SYNC = 8, FE_HAS_LOCK = 16, FE_TIMEDOUT = 32, FE_REINIT = 64 } ;
145 typedef enum fe_status fe_status_t;
146 enum fe_spectral_inversion { INVERSION_OFF = 0, INVERSION_ON = 1, INVERSION_AUTO = 2 } ;
151 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
152 enum fe_code_rate { FEC_NONE = 0, FEC_1_2 = 1, FEC_2_3 = 2, FEC_3_4 = 3, FEC_4_5 = 4, FEC_5_6 = 5, FEC_6_7 = 6, FEC_7_8 = 7, FEC_8_9 = 8, FEC_AUTO = 9, FEC_3_5 = 10, FEC_9_10 = 11, FEC_2_5 = 12 } ;
168 typedef enum fe_code_rate fe_code_rate_t;
169 enum fe_modulation { QPSK = 0, QAM_16 = 1, QAM_32 = 2, QAM_64 = 3, QAM_128 = 4, QAM_256 = 5, QAM_AUTO = 6, VSB_8 = 7, VSB_16 = 8, PSK_8 = 9, APSK_16 = 10, APSK_32 = 11, DQPSK = 12, QAM_4_NR = 13 } ;
186 typedef enum fe_modulation fe_modulation_t;
187 enum fe_transmit_mode { TRANSMISSION_MODE_2K = 0, TRANSMISSION_MODE_8K = 1, TRANSMISSION_MODE_AUTO = 2, TRANSMISSION_MODE_4K = 3, TRANSMISSION_MODE_1K = 4, TRANSMISSION_MODE_16K = 5, TRANSMISSION_MODE_32K = 6, TRANSMISSION_MODE_C1 = 7, TRANSMISSION_MODE_C3780 = 8 } ;
198 typedef enum fe_transmit_mode fe_transmit_mode_t;
199 enum fe_guard_interval { GUARD_INTERVAL_1_32 = 0, GUARD_INTERVAL_1_16 = 1, GUARD_INTERVAL_1_8 = 2, GUARD_INTERVAL_1_4 = 3, GUARD_INTERVAL_AUTO = 4, GUARD_INTERVAL_1_128 = 5, GUARD_INTERVAL_19_128 = 6, GUARD_INTERVAL_19_256 = 7, GUARD_INTERVAL_PN420 = 8, GUARD_INTERVAL_PN595 = 9, GUARD_INTERVAL_PN945 = 10 } ;
224 typedef enum fe_guard_interval fe_guard_interval_t;
225 enum fe_hierarchy { HIERARCHY_NONE = 0, HIERARCHY_1 = 1, HIERARCHY_2 = 2, HIERARCHY_4 = 3, HIERARCHY_AUTO = 4 } ;
233 typedef enum fe_hierarchy fe_hierarchy_t;
234 enum fe_interleaving { INTERLEAVING_NONE = 0, INTERLEAVING_AUTO = 1, INTERLEAVING_240 = 2, INTERLEAVING_720 = 3 } ;
241 enum fe_pilot { PILOT_ON = 0, PILOT_OFF = 1, PILOT_AUTO = 2 } ;
384 typedef enum fe_pilot fe_pilot_t;
385 enum fe_rolloff { ROLLOFF_35 = 0, ROLLOFF_20 = 1, ROLLOFF_25 = 2, ROLLOFF_AUTO = 3 } ;
391 typedef enum fe_rolloff fe_rolloff_t;
392 enum fe_delivery_system { SYS_UNDEFINED = 0, SYS_DVBC_ANNEX_A = 1, SYS_DVBC_ANNEX_B = 2, SYS_DVBT = 3, SYS_DSS = 4, SYS_DVBS = 5, SYS_DVBS2 = 6, SYS_DVBH = 7, SYS_ISDBT = 8, SYS_ISDBS = 9, SYS_ISDBC = 10, SYS_ATSC = 11, SYS_ATSCMH = 12, SYS_DTMB = 13, SYS_CMMB = 14, SYS_DAB = 15, SYS_DVBT2 = 16, SYS_TURBO = 17, SYS_DVBC_ANNEX_C = 18 } ;
413 typedef enum fe_delivery_system fe_delivery_system_t;
471 union __anonunion_ldv_34044_241 { __u64 uvalue; __s64 svalue; } ;
471 struct dtv_stats { __u8 scale; union __anonunion_ldv_34044_241 ldv_34044; } ;
522 struct dtv_fe_stats { __u8 len; struct dtv_stats stat[4U]; } ;
530 struct __anonstruct_buffer_243 { __u8 data[32U]; __u32 len; __u32 reserved1[3U]; void *reserved2; } ;
530 union __anonunion_u_242 { __u32 data; struct dtv_fe_stats st; struct __anonstruct_buffer_243 buffer; } ;
530 struct dtv_property { __u32 cmd; __u32 reserved[3U]; union __anonunion_u_242 u; int result; } ;
554 struct dvb_frontend ;
555 struct dvb_device ;
555 struct dvb_adapter { int num; struct list_head list_head; struct list_head device_list; const char *name; u8 proposed_mac[6U]; void *priv; struct device *device; struct module *module; int mfe_shared; struct dvb_device *mfe_dvbdev; struct mutex mfe_lock; } ;
75 struct dvb_device { struct list_head list_head; const struct file_operations *fops; struct dvb_adapter *adapter; int type; int minor; u32 id; int readers; int writers; int users; wait_queue_head_t wait_queue; int (*kernel_ioctl)(struct file *, unsigned int, void *); void *priv; } ;
122 struct dvb_frontend_tune_settings { int min_delay_ms; int step_size; int max_drift; } ;
56 struct dvb_tuner_info { char name[128U]; u32 frequency_min; u32 frequency_max; u32 frequency_step; u32 bandwidth_min; u32 bandwidth_max; u32 bandwidth_step; } ;
70 struct analog_parameters { unsigned int frequency; unsigned int mode; unsigned int audmode; u64 std; } ;
113 enum tuner_param { DVBFE_TUNER_FREQUENCY = 1, DVBFE_TUNER_TUNERSTEP = 2, DVBFE_TUNER_IFFREQ = 4, DVBFE_TUNER_BANDWIDTH = 8, DVBFE_TUNER_REFCLOCK = 16, DVBFE_TUNER_IQSENSE = 32, DVBFE_TUNER_DUMMY = -2147483648 } ;
123 enum dvbfe_algo { DVBFE_ALGO_HW = 1, DVBFE_ALGO_SW = 2, DVBFE_ALGO_CUSTOM = 4, DVBFE_ALGO_RECOVERY = -2147483648 } ;
130 struct tuner_state { u32 frequency; u32 tunerstep; u32 ifreq; u32 bandwidth; u32 iqsense; u32 refclock; } ;
164 enum dvbfe_search { DVBFE_ALGO_SEARCH_SUCCESS = 1, DVBFE_ALGO_SEARCH_ASLEEP = 2, DVBFE_ALGO_SEARCH_FAILED = 4, DVBFE_ALGO_SEARCH_INVALID = 8, DVBFE_ALGO_SEARCH_AGAIN = 16, DVBFE_ALGO_SEARCH_ERROR = -2147483648 } ;
173 struct dvb_tuner_ops { struct dvb_tuner_info info; int (*release)(struct dvb_frontend *); int (*init)(struct dvb_frontend *); int (*sleep)(struct dvb_frontend *); int (*set_params)(struct dvb_frontend *); int (*set_analog_params)(struct dvb_frontend *, struct analog_parameters *); int (*calc_regs)(struct dvb_frontend *, u8 *, int); int (*set_config)(struct dvb_frontend *, void *); int (*get_frequency)(struct dvb_frontend *, u32 *); int (*get_bandwidth)(struct dvb_frontend *, u32 *); int (*get_if_frequency)(struct dvb_frontend *, u32 *); int (*get_status)(struct dvb_frontend *, u32 *); int (*get_rf_strength)(struct dvb_frontend *, u16 *); int (*get_afc)(struct dvb_frontend *, s32 *); int (*set_frequency)(struct dvb_frontend *, u32 ); int (*set_bandwidth)(struct dvb_frontend *, u32 ); int (*set_state)(struct dvb_frontend *, enum tuner_param , struct tuner_state *); int (*get_state)(struct dvb_frontend *, enum tuner_param , struct tuner_state *); } ;
237 struct analog_demod_info { char *name; } ;
241 struct analog_demod_ops { struct analog_demod_info info; void (*set_params)(struct dvb_frontend *, struct analog_parameters *); int (*has_signal)(struct dvb_frontend *, u16 *); int (*get_afc)(struct dvb_frontend *, s32 *); void (*tuner_status)(struct dvb_frontend *); void (*standby)(struct dvb_frontend *); void (*release)(struct dvb_frontend *); int (*i2c_gate_ctrl)(struct dvb_frontend *, int); int (*set_config)(struct dvb_frontend *, void *); } ;
258 struct dtv_frontend_properties ;
259 struct dvb_frontend_ops { struct dvb_frontend_info info; u8 delsys[8U]; void (*release)(struct dvb_frontend *); void (*release_sec)(struct dvb_frontend *); int (*init)(struct dvb_frontend *); int (*sleep)(struct dvb_frontend *); int (*write)(struct dvb_frontend *, const u8 *, int); int (*tune)(struct dvb_frontend *, bool , unsigned int, unsigned int *, fe_status_t *); enum dvbfe_algo (*get_frontend_algo)(struct dvb_frontend *); int (*set_frontend)(struct dvb_frontend *); int (*get_tune_settings)(struct dvb_frontend *, struct dvb_frontend_tune_settings *); int (*get_frontend)(struct dvb_frontend *); int (*read_status)(struct dvb_frontend *, fe_status_t *); int (*read_ber)(struct dvb_frontend *, u32 *); int (*read_signal_strength)(struct dvb_frontend *, u16 *); int (*read_snr)(struct dvb_frontend *, u16 *); int (*read_ucblocks)(struct dvb_frontend *, u32 *); int (*diseqc_reset_overload)(struct dvb_frontend *); int (*diseqc_send_master_cmd)(struct dvb_frontend *, struct dvb_diseqc_master_cmd *); int (*diseqc_recv_slave_reply)(struct dvb_frontend *, struct dvb_diseqc_slave_reply *); int (*diseqc_send_burst)(struct dvb_frontend *, fe_sec_mini_cmd_t ); int (*set_tone)(struct dvb_frontend *, fe_sec_tone_mode_t ); int (*set_voltage)(struct dvb_frontend *, fe_sec_voltage_t ); int (*enable_high_lnb_voltage)(struct dvb_frontend *, long); int (*dishnetwork_send_legacy_command)(struct dvb_frontend *, unsigned long); int (*i2c_gate_ctrl)(struct dvb_frontend *, int); int (*ts_bus_ctrl)(struct dvb_frontend *, int); int (*set_lna)(struct dvb_frontend *); enum dvbfe_search (*search)(struct dvb_frontend *); struct dvb_tuner_ops tuner_ops; struct analog_demod_ops analog_ops; int (*set_property)(struct dvb_frontend *, struct dtv_property *); int (*get_property)(struct dvb_frontend *, struct dtv_property *); } ;
319 struct __anonstruct_layer_244 { u8 segment_count; fe_code_rate_t fec; fe_modulation_t modulation; u8 interleaving; } ;
319 struct dtv_frontend_properties { u32 state; u32 frequency; fe_modulation_t modulation; fe_sec_voltage_t voltage; fe_sec_tone_mode_t sectone; fe_spectral_inversion_t inversion; fe_code_rate_t fec_inner; fe_transmit_mode_t transmission_mode; u32 bandwidth_hz; fe_guard_interval_t guard_interval; fe_hierarchy_t hierarchy; u32 symbol_rate; fe_code_rate_t code_rate_HP; fe_code_rate_t code_rate_LP; fe_pilot_t pilot; fe_rolloff_t rolloff; fe_delivery_system_t delivery_system; enum fe_interleaving interleaving; u8 isdbt_partial_reception; u8 isdbt_sb_mode; u8 isdbt_sb_subchannel; u32 isdbt_sb_segment_idx; u32 isdbt_sb_segment_count; u8 isdbt_layer_enabled; struct __anonstruct_layer_244 layer[3U]; u32 stream_id; u8 atscmh_fic_ver; u8 atscmh_parade_id; u8 atscmh_nog; u8 atscmh_tnog; u8 atscmh_sgn; u8 atscmh_prc; u8 atscmh_rs_frame_mode; u8 atscmh_rs_frame_ensemble; u8 atscmh_rs_code_mode_pri; u8 atscmh_rs_code_mode_sec; u8 atscmh_sccc_block_mode; u8 atscmh_sccc_code_mode_a; u8 atscmh_sccc_code_mode_b; u8 atscmh_sccc_code_mode_c; u8 atscmh_sccc_code_mode_d; u32 lna; struct dtv_fe_stats strength; struct dtv_fe_stats cnr; struct dtv_fe_stats pre_bit_error; struct dtv_fe_stats pre_bit_count; struct dtv_fe_stats post_bit_error; struct dtv_fe_stats post_bit_count; struct dtv_fe_stats block_error; struct dtv_fe_stats block_count; } ;
407 struct dvb_frontend { struct dvb_frontend_ops ops; struct dvb_adapter *dvb; void *demodulator_priv; void *tuner_priv; void *frontend_priv; void *sec_priv; void *analog_demod_priv; struct dtv_frontend_properties dtv_property_cache; int (*callback)(void *, int, int, int); int id; } ;
436 enum ldv_25367 { DMX_OUT_DECODER = 0, DMX_OUT_TAP = 1, DMX_OUT_TS_TAP = 2, DMX_OUT_TSDEMUX_TAP = 3 } ;
44 typedef enum ldv_25367 dmx_output_t;
45 enum ldv_25369 { DMX_IN_FRONTEND = 0, DMX_IN_DVR = 1 } ;
51 typedef enum ldv_25369 dmx_input_t;
52 enum dmx_ts_pes { DMX_PES_AUDIO0 = 0, DMX_PES_VIDEO0 = 1, DMX_PES_TELETEXT0 = 2, DMX_PES_SUBTITLE0 = 3, DMX_PES_PCR0 = 4, DMX_PES_AUDIO1 = 5, DMX_PES_VIDEO1 = 6, DMX_PES_TELETEXT1 = 7, DMX_PES_SUBTITLE1 = 8, DMX_PES_PCR1 = 9, DMX_PES_AUDIO2 = 10, DMX_PES_VIDEO2 = 11, DMX_PES_TELETEXT2 = 12, DMX_PES_SUBTITLE2 = 13, DMX_PES_PCR2 = 14, DMX_PES_AUDIO3 = 15, DMX_PES_VIDEO3 = 16, DMX_PES_TELETEXT3 = 17, DMX_PES_SUBTITLE3 = 18, DMX_PES_PCR3 = 19, DMX_PES_OTHER = 20 } ;
81 typedef enum dmx_ts_pes dmx_pes_type_t;
82 struct dmx_filter { __u8 filter[16U]; __u8 mask[16U]; __u8 mode[16U]; } ;
95 typedef struct dmx_filter dmx_filter_t;
96 struct dmx_sct_filter_params { __u16 pid; dmx_filter_t filter; __u32 timeout; __u32 flags; } ;
105 struct dmx_pes_filter_params { __u16 pid; dmx_input_t input; dmx_output_t output; dmx_pes_type_t pes_type; __u32 flags; } ;
119 struct dmx_caps { __u32 caps; int num_decoders; } ;
124 enum ldv_25385 { DMX_SOURCE_FRONT0 = 0, DMX_SOURCE_FRONT1 = 1, DMX_SOURCE_FRONT2 = 2, DMX_SOURCE_FRONT3 = 3, DMX_SOURCE_DVR0 = 16, DMX_SOURCE_DVR1 = 17, DMX_SOURCE_DVR2 = 18, DMX_SOURCE_DVR3 = 19 } ;
134 typedef enum ldv_25385 dmx_source_t;
141 enum dmx_success { DMX_OK = 0, DMX_LENGTH_ERROR = 1, DMX_OVERRUN_ERROR = 2, DMX_CRC_ERROR = 3, DMX_FRAME_ERROR = 4, DMX_FIFO_ERROR = 5, DMX_MISSED_ERROR = 6 } ;
151 struct dmx_demux ;
151 struct dmx_ts_feed { int is_filtering; struct dmx_demux *parent; void *priv; int (*set)(struct dmx_ts_feed *, u16 , int, enum dmx_ts_pes , size_t , struct timespec ); int (*start_filtering)(struct dmx_ts_feed *); int (*stop_filtering)(struct dmx_ts_feed *); } ;
99 struct dmx_section_feed ;
99 struct dmx_section_filter { u8 filter_value[18U]; u8 filter_mask[18U]; u8 filter_mode[18U]; struct dmx_section_feed *parent; void *priv; } ;
111 struct dmx_section_feed { int is_filtering; struct dmx_demux *parent; void *priv; int check_crc; u32 crc_val; u8 *secbuf; u8 secbuf_base[4284U]; u16 secbufp; u16 seclen; u16 tsfeedp; int (*set)(struct dmx_section_feed *, u16 , size_t , int); int (*allocate_filter)(struct dmx_section_feed *, struct dmx_section_filter **); int (*release_filter)(struct dmx_section_feed *, struct dmx_section_filter *); int (*start_filtering)(struct dmx_section_feed *); int (*stop_filtering)(struct dmx_section_feed *); } ;
148 enum dmx_frontend_source { DMX_MEMORY_FE = 0, DMX_FRONTEND_0 = 1, DMX_FRONTEND_1 = 2, DMX_FRONTEND_2 = 3, DMX_FRONTEND_3 = 4, DMX_STREAM_0 = 5, DMX_STREAM_1 = 6, DMX_STREAM_2 = 7, DMX_STREAM_3 = 8 } ;
160 struct dmx_frontend { struct list_head connectivity_list; enum dmx_frontend_source source; } ;
176 struct dmx_demux { u32 capabilities; struct dmx_frontend *frontend; void *priv; int (*open)(struct dmx_demux *); int (*close)(struct dmx_demux *); int (*write)(struct dmx_demux *, const char *, size_t ); int (*allocate_ts_feed)(struct dmx_demux *, struct dmx_ts_feed **, int (*)(const u8 *, size_t , const u8 *, size_t , struct dmx_ts_feed *, enum dmx_success )); int (*release_ts_feed)(struct dmx_demux *, struct dmx_ts_feed *); int (*allocate_section_feed)(struct dmx_demux *, struct dmx_section_feed **, int (*)(const u8 *, size_t , const u8 *, size_t , struct dmx_section_filter *, enum dmx_success )); int (*release_section_feed)(struct dmx_demux *, struct dmx_section_feed *); int (*add_frontend)(struct dmx_demux *, struct dmx_frontend *); int (*remove_frontend)(struct dmx_demux *, struct dmx_frontend *); struct list_head * (*get_frontends)(struct dmx_demux *); int (*connect_frontend)(struct dmx_demux *, struct dmx_frontend *); int (*disconnect_frontend)(struct dmx_demux *); int (*get_pes_pids)(struct dmx_demux *, u16 *); int (*get_caps)(struct dmx_demux *, struct dmx_caps *); int (*set_source)(struct dmx_demux *, const dmx_source_t *); int (*get_stc)(struct dmx_demux *, unsigned int, u64 *, unsigned int *); } ;
239 struct dvb_demux_feed ;
239 struct dvb_demux_filter { struct dmx_section_filter filter; u8 maskandmode[18U]; u8 maskandnotmode[18U]; int doneq; struct dvb_demux_filter *next; struct dvb_demux_feed *feed; int index; int state; int type; u16 hw_handle; struct timer_list timer; } ;
64 union __anonunion_feed_245 { struct dmx_ts_feed ts; struct dmx_section_feed sec; } ;
64 union __anonunion_cb_246 { int (*ts)(const u8 *, size_t , const u8 *, size_t , struct dmx_ts_feed *, enum dmx_success ); int (*sec)(const u8 *, size_t , const u8 *, size_t , struct dmx_section_filter *, enum dmx_success ); } ;
64 struct dvb_demux ;
64 struct dvb_demux_feed { union __anonunion_feed_245 feed; union __anonunion_cb_246 cb; struct dvb_demux *demux; void *priv; int type; int state; u16 pid; u8 *buffer; int buffer_size; struct timespec timeout; struct dvb_demux_filter *filter; int ts_type; enum dmx_ts_pes pes_type; int cc; int pusi_seen; u16 peslen; struct list_head list_head; unsigned int index; } ;
100 struct dvb_demux { struct dmx_demux dmx; void *priv; int filternum; int feednum; int (*start_feed)(struct dvb_demux_feed *); int (*stop_feed)(struct dvb_demux_feed *); int (*write_to_decoder)(struct dvb_demux_feed *, const u8 *, size_t ); u32 (*check_crc32)(struct dvb_demux_feed *, const u8 *, size_t ); void (*memcopy)(struct dvb_demux_feed *, u8 *, const u8 *, size_t ); int users; struct dvb_demux_filter *filter; struct dvb_demux_feed *feed; struct list_head frontend_list; struct dvb_demux_feed *pesfilter[20U]; u16 pids[20U]; int playing; int recording; struct list_head feed_list; u8 tsbuf[204U]; int tsbufp; struct mutex mutex; spinlock_t lock; uint8_t *cnt_storage; struct timespec speed_last_time; uint32_t speed_pkts_cnt; } ;
149 struct dvb_ringbuffer { u8 *data; ssize_t size; ssize_t pread; ssize_t pwrite; int error; wait_queue_head_t queue; spinlock_t lock; } ;
184 enum dmxdev_type { DMXDEV_TYPE_NONE = 0, DMXDEV_TYPE_SEC = 1, DMXDEV_TYPE_PES = 2 } ;
190 enum dmxdev_state { DMXDEV_STATE_FREE = 0, DMXDEV_STATE_ALLOCATED = 1, DMXDEV_STATE_SET = 2, DMXDEV_STATE_GO = 3, DMXDEV_STATE_DONE = 4, DMXDEV_STATE_TIMEDOUT = 5 } ;
63 union __anonunion_filter_247 { struct dmx_section_filter *sec; } ;
63 union __anonunion_feed_248 { struct list_head ts; struct dmx_section_feed *sec; } ;
63 union __anonunion_params_249 { struct dmx_sct_filter_params sec; struct dmx_pes_filter_params pes; } ;
63 struct dmxdev ;
63 struct dmxdev_filter { union __anonunion_filter_247 filter; union __anonunion_feed_248 feed; union __anonunion_params_249 params; enum dmxdev_type type; enum dmxdev_state state; struct dmxdev *dev; struct dvb_ringbuffer buffer; struct mutex mutex; struct timer_list timer; int todo; u8 secheader[3U]; } ;
92 struct dmxdev { struct dvb_device *dvbdev; struct dvb_device *dvr_dvbdev; struct dmxdev_filter *filter; struct dmx_demux *demux; int filternum; int capabilities; unsigned char exit; struct dmx_frontend *dvr_orig_fe; struct dvb_ringbuffer dvr_buffer; struct mutex mutex; spinlock_t lock; } ;
118 struct video_data ;
118 struct front_face ;
118 struct vbi_data { struct video_device v_dev; struct video_data *video; struct front_face *front; unsigned int copied; unsigned int vbi_size; int users; } ;
50 struct running_context { u32 freq; int audio_idx; v4l2_std_id tvnormid; int sig_index; struct v4l2_pix_format pix; } ;
62 struct poseidon ;
62 struct video_data { struct video_device v_dev; struct v4l2_ctrl_handler ctrl_handler; struct running_context context; int field_count; char *dst; int lines_copied; int prev_left; int lines_per_field; int lines_size; u8 endpoint_addr; struct urb *urb_array[8U]; struct vbi_data *vbi; struct poseidon *pd; struct front_face *front; int is_streaming; int users; struct work_struct bubble_work; } ;
94 enum pcm_stream_state { STREAM_OFF = 0, STREAM_ON = 1, STREAM_SUSPEND = 2 } ;
100 struct snd_pcm_substream ;
100 struct snd_card ;
100 struct poseidon_audio { struct urb *urb_array[3U]; unsigned int copied_position; struct snd_pcm_substream *capture_pcm_substream; unsigned int rcv_position; struct snd_card *card; int card_close; int users; int pm_state; enum pcm_stream_state capture_stream; } ;
116 struct radio_data { __u32 fm_freq; unsigned int is_radio_streaming; int pre_emphasis; struct video_device fm_dev; struct v4l2_ctrl_handler ctrl_handler; } ;
124 struct pd_dvb_adapter { struct dvb_adapter dvb_adap; struct dvb_frontend dvb_fe; struct dmxdev dmxdev; struct dvb_demux demux; atomic_t users; atomic_t active_feed; s32 is_streaming; struct urb *urb_array[4U]; struct poseidon *pd_device; u8 ep_addr; u8 reserved[3U]; struct dtv_frontend_properties fe_param; int prev_freq; int bandwidth; unsigned long last_jiffies; } ;
151 struct front_face { enum v4l2_buf_type type; struct videobuf_queue q; struct videobuf_buffer *curr_frame; spinlock_t queue_lock; struct list_head active; struct poseidon *pd; } ;
167 struct poseidon { struct list_head device_list; struct mutex lock; struct kref kref; struct v4l2_device v4l2_dev; struct usb_device *udev; struct usb_interface *interface; int cur_transfer_mode; struct video_data video_data; struct vbi_data vbi_data; struct poseidon_audio audio; struct radio_data radio_data; struct pd_dvb_adapter dvb_data; u32 state; struct file *file_for_stream; int (*pm_suspend)(struct poseidon *); int (*pm_resume)(struct poseidon *); pm_message_t msg; struct work_struct pm_work; u8 portnum; } ;
199 struct poseidon_format { char *name; int fourcc; int depth; int flags; } ;
207 struct poseidon_tvnorm { v4l2_std_id v4l2_id; char name[12U]; u32 tlg_tvnorm; } ;
276 struct tuner_custom_parameter_s { uint16_t param_id; uint16_t param_value; } ;
43 struct tuner_atv_sig_stat_s { uint32_t sig_present; uint32_t sig_locked; uint32_t sig_lock_busy; uint32_t sig_strength; uint32_t tv_audio_chan; uint32_t mvision_stat; } ;
69 struct pd_audio_mode { u32 tlg_audio_mode; u32 v4l2_audio_sub; u32 v4l2_audio_mode; } ;
89 struct pd_input { char *name; uint32_t tlg_src; } ;
102 struct video_std_to_audio_std { v4l2_std_id video_std; int audio_std; } ;
167 struct notifier_block ;
51 struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; } ;
63 struct blocking_notifier_head { struct rw_semaphore rwsem; struct notifier_block *head; } ;
359 struct proc_dir_entry ;
12 struct plist_head { struct list_head node_list; } ;
89 struct snd_info_entry ;
89 struct snd_shutdown_f_ops ;
89 struct snd_mixer_oss ;
89 struct snd_card { int number; char id[16U]; char driver[16U]; char shortname[32U]; char longname[80U]; char mixername[80U]; char components[128U]; struct module *module; void *private_data; void (*private_free)(struct snd_card *); struct list_head devices; unsigned int last_numid; struct rw_semaphore controls_rwsem; rwlock_t ctl_files_rwlock; int controls_count; int user_ctl_count; struct list_head controls; struct list_head ctl_files; struct snd_info_entry *proc_root; struct snd_info_entry *proc_id; struct proc_dir_entry *proc_root_link; struct list_head files_list; struct snd_shutdown_f_ops *s_f_ops; spinlock_t files_lock; int shutdown; struct completion *release_completion; struct device *dev; struct device card_dev; bool registered; unsigned int power_state; struct mutex power_lock; wait_queue_head_t power_sleep; struct snd_mixer_oss *mixer_oss; int mixer_oss_change_count; } ;
470 struct snd_aes_iec958 { unsigned char status[24U]; unsigned char subcode[147U]; unsigned char pad; unsigned char dig_subframe[4U]; } ;
144 typedef unsigned long snd_pcm_uframes_t;
145 typedef long snd_pcm_sframes_t;
169 typedef int snd_pcm_access_t;
177 typedef int snd_pcm_format_t;
247 typedef int snd_pcm_subformat_t;
269 typedef int snd_pcm_state_t;
276 union snd_pcm_sync_id { unsigned char id[16U]; unsigned short id16[8U]; unsigned int id32[4U]; } ;
309 typedef int snd_pcm_hw_param_t;
310 struct snd_interval { unsigned int min; unsigned int max; unsigned char openmin; unsigned char openmax; unsigned char integer; unsigned char empty; } ;
352 struct snd_mask { __u32 bits[8U]; } ;
358 struct snd_pcm_hw_params { unsigned int flags; struct snd_mask masks[3U]; struct snd_mask mres[5U]; struct snd_interval intervals[12U]; struct snd_interval ires[9U]; unsigned int rmask; unsigned int cmask; unsigned int info; unsigned int msbits; unsigned int rate_num; unsigned int rate_den; snd_pcm_uframes_t fifo_size; unsigned char reserved[64U]; } ;
419 struct snd_pcm_mmap_status { snd_pcm_state_t state; int pad1; snd_pcm_uframes_t hw_ptr; struct timespec tstamp; snd_pcm_state_t suspended_state; struct timespec audio_tstamp; } ;
428 struct snd_pcm_mmap_control { snd_pcm_uframes_t appl_ptr; snd_pcm_uframes_t avail_min; } ;
779 typedef int snd_ctl_elem_type_t;
789 typedef int snd_ctl_elem_iface_t;
790 struct snd_ctl_elem_id { unsigned int numid; snd_ctl_elem_iface_t iface; unsigned int device; unsigned int subdevice; unsigned char name[44U]; unsigned int index; } ;
842 struct __anonstruct_integer_202 { long min; long max; long step; } ;
842 struct __anonstruct_integer64_203 { long long min; long long max; long long step; } ;
842 struct __anonstruct_enumerated_204 { unsigned int items; unsigned int item; char name[64U]; __u64 names_ptr; unsigned int names_length; } ;
842 union __anonunion_value_201 { struct __anonstruct_integer_202 integer; struct __anonstruct_integer64_203 integer64; struct __anonstruct_enumerated_204 enumerated; unsigned char reserved[128U]; } ;
842 union __anonunion_dimen_205 { unsigned short d[4U]; unsigned short *d_ptr; } ;
842 struct snd_ctl_elem_info { struct snd_ctl_elem_id id; snd_ctl_elem_type_t type; unsigned int access; unsigned int count; __kernel_pid_t owner; union __anonunion_value_201 value; union __anonunion_dimen_205 dimen; unsigned char reserved[56U]; } ;
875 union __anonunion_integer_207 { long value[128U]; long *value_ptr; } ;
875 union __anonunion_integer64_208 { long long value[64U]; long long *value_ptr; } ;
875 union __anonunion_enumerated_209 { unsigned int item[128U]; unsigned int *item_ptr; } ;
875 union __anonunion_bytes_210 { unsigned char data[512U]; unsigned char *data_ptr; } ;
875 union __anonunion_value_206 { union __anonunion_integer_207 integer; union __anonunion_integer64_208 integer64; union __anonunion_enumerated_209 enumerated; union __anonunion_bytes_210 bytes; struct snd_aes_iec958 iec958; } ;
875 struct snd_ctl_elem_value { struct snd_ctl_elem_id id; unsigned char indirect; union __anonunion_value_206 value; struct timespec tstamp; unsigned char reserved[112U]; } ;
959 struct snd_dma_device { int type; struct device *dev; } ;
36 struct snd_dma_buffer { struct snd_dma_device dev; unsigned char *area; dma_addr_t addr; size_t bytes; void *private_data; } ;
84 struct pm_qos_request { struct plist_node node; int pm_qos_class; struct delayed_work work; } ;
48 struct pm_qos_flags_request { struct list_head node; s32 flags; } ;
53 enum dev_pm_qos_req_type { DEV_PM_QOS_RESUME_LATENCY = 1, DEV_PM_QOS_LATENCY_TOLERANCE = 2, DEV_PM_QOS_FLAGS = 3 } ;
59 union __anonunion_data_214 { struct plist_node pnode; struct pm_qos_flags_request flr; } ;
59 struct dev_pm_qos_request { enum dev_pm_qos_req_type type; union __anonunion_data_214 data; struct device *dev; } ;
68 enum pm_qos_type { PM_QOS_UNITIALIZED = 0, PM_QOS_MAX = 1, PM_QOS_MIN = 2 } ;
74 struct pm_qos_constraints { struct plist_head list; s32 target_value; s32 default_value; s32 no_constraint_value; enum pm_qos_type type; struct blocking_notifier_head *notifiers; } ;
88 struct pm_qos_flags { struct list_head list; s32 effective_flags; } ;
93 struct dev_pm_qos { struct pm_qos_constraints resume_latency; struct pm_qos_constraints latency_tolerance; struct pm_qos_flags flags; struct dev_pm_qos_request *resume_latency_req; struct dev_pm_qos_request *latency_tolerance_req; struct dev_pm_qos_request *flags_req; } ;
220 struct snd_pcm_oss_setup { char *task_name; unsigned char disable; unsigned char direct; unsigned char block; unsigned char nonblock; unsigned char partialfrag; unsigned char nosilence; unsigned char buggyptr; unsigned int periods; unsigned int period_size; struct snd_pcm_oss_setup *next; } ;
38 struct snd_pcm_plugin ;
38 struct snd_pcm_oss_runtime { unsigned char params; unsigned char prepare; unsigned char trigger; unsigned char sync_trigger; int rate; int format; unsigned int channels; unsigned int fragshift; unsigned int maxfrags; unsigned int subdivision; size_t period_bytes; size_t period_frames; size_t period_ptr; unsigned int periods; size_t buffer_bytes; size_t bytes; size_t mmap_bytes; char *buffer; size_t buffer_used; struct mutex params_lock; struct snd_pcm_plugin *plugin_first; struct snd_pcm_plugin *plugin_last; unsigned int prev_hw_ptr_period; } ;
70 struct snd_pcm_oss_substream { unsigned char oss; struct snd_pcm_oss_setup setup; } ;
75 struct snd_pcm_oss_stream { struct snd_pcm_oss_setup *setup_list; struct mutex setup_mutex; struct snd_info_entry *proc_entry; } ;
82 struct snd_pcm_oss { int reg; unsigned int reg_mask; } ;
88 struct snd_pcm_hardware { unsigned int info; u64 formats; unsigned int rates; unsigned int rate_min; unsigned int rate_max; unsigned int channels_min; unsigned int channels_max; size_t buffer_bytes_max; size_t period_bytes_min; size_t period_bytes_max; unsigned int periods_min; unsigned int periods_max; size_t fifo_size; } ;
60 struct snd_pcm_ops { int (*open)(struct snd_pcm_substream *); int (*close)(struct snd_pcm_substream *); int (*ioctl)(struct snd_pcm_substream *, unsigned int, void *); int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); int (*hw_free)(struct snd_pcm_substream *); int (*prepare)(struct snd_pcm_substream *); int (*trigger)(struct snd_pcm_substream *, int); snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); int (*wall_clock)(struct snd_pcm_substream *, struct timespec *); int (*copy)(struct snd_pcm_substream *, int, snd_pcm_uframes_t , void *, snd_pcm_uframes_t ); int (*silence)(struct snd_pcm_substream *, int, snd_pcm_uframes_t , snd_pcm_uframes_t ); struct page * (*page)(struct snd_pcm_substream *, unsigned long); int (*mmap)(struct snd_pcm_substream *, struct vm_area_struct *); int (*ack)(struct snd_pcm_substream *); } ;
214 struct snd_pcm_hw_rule ;
217 struct snd_pcm_hw_rule { unsigned int cond; int (*func)(struct snd_pcm_hw_params *, struct snd_pcm_hw_rule *); int var; int deps[4U]; void *private; } ;
226 struct snd_pcm_hw_constraints { struct snd_mask masks[3U]; struct snd_interval intervals[12U]; unsigned int rules_num; unsigned int rules_all; struct snd_pcm_hw_rule *rules; } ;
274 struct snd_pcm_hwptr_log ;
275 struct snd_pcm_runtime { struct snd_pcm_substream *trigger_master; struct timespec trigger_tstamp; int overrange; snd_pcm_uframes_t avail_max; snd_pcm_uframes_t hw_ptr_base; snd_pcm_uframes_t hw_ptr_interrupt; unsigned long hw_ptr_jiffies; unsigned long hw_ptr_buffer_jiffies; snd_pcm_sframes_t delay; u64 hw_ptr_wrap; snd_pcm_access_t access; snd_pcm_format_t format; snd_pcm_subformat_t subformat; unsigned int rate; unsigned int channels; snd_pcm_uframes_t period_size; unsigned int periods; snd_pcm_uframes_t buffer_size; snd_pcm_uframes_t min_align; size_t byte_align; unsigned int frame_bits; unsigned int sample_bits; unsigned int info; unsigned int rate_num; unsigned int rate_den; unsigned char no_period_wakeup; int tstamp_mode; unsigned int period_step; snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; snd_pcm_uframes_t silence_size; snd_pcm_uframes_t boundary; snd_pcm_uframes_t silence_start; snd_pcm_uframes_t silence_filled; union snd_pcm_sync_id sync; struct snd_pcm_mmap_status *status; struct snd_pcm_mmap_control *control; snd_pcm_uframes_t twake; wait_queue_head_t sleep; wait_queue_head_t tsleep; struct fasync_struct *fasync; void *private_data; void (*private_free)(struct snd_pcm_runtime *); struct snd_pcm_hardware hw; struct snd_pcm_hw_constraints hw_constraints; void (*transfer_ack_begin)(struct snd_pcm_substream *); void (*transfer_ack_end)(struct snd_pcm_substream *); unsigned int timer_resolution; int tstamp_type; unsigned char *dma_area; dma_addr_t dma_addr; size_t dma_bytes; struct snd_dma_buffer *dma_buffer_p; struct snd_pcm_oss_runtime oss; struct snd_pcm_hwptr_log *hwptr_log; } ;
364 struct snd_pcm_group { spinlock_t lock; struct list_head substreams; int count; } ;
371 struct snd_pcm ;
371 struct snd_pcm_str ;
371 struct snd_timer ;
371 struct snd_pcm_substream { struct snd_pcm *pcm; struct snd_pcm_str *pstr; void *private_data; int number; char name[32U]; int stream; struct pm_qos_request latency_pm_qos_req; size_t buffer_bytes_max; struct snd_dma_buffer dma_buffer; size_t dma_max; const struct snd_pcm_ops *ops; struct snd_pcm_runtime *runtime; struct snd_timer *timer; unsigned char timer_running; struct snd_pcm_substream *next; struct list_head link_list; struct snd_pcm_group self_group; struct snd_pcm_group *group; void *file; int ref_count; atomic_t mmap_count; unsigned int f_flags; void (*pcm_release)(struct snd_pcm_substream *); struct pid *pid; struct snd_pcm_oss_substream oss; struct snd_info_entry *proc_root; struct snd_info_entry *proc_info_entry; struct snd_info_entry *proc_hw_params_entry; struct snd_info_entry *proc_sw_params_entry; struct snd_info_entry *proc_status_entry; struct snd_info_entry *proc_prealloc_entry; struct snd_info_entry *proc_prealloc_max_entry; unsigned char hw_opened; } ;
421 struct snd_kcontrol ;
421 struct snd_pcm_str { int stream; struct snd_pcm *pcm; unsigned int substream_count; unsigned int substream_opened; struct snd_pcm_substream *substream; struct snd_pcm_oss_stream oss; struct snd_info_entry *proc_root; struct snd_info_entry *proc_info_entry; unsigned int xrun_debug; struct snd_info_entry *proc_xrun_debug_entry; struct snd_kcontrol *chmap_kctl; } ;
446 struct snd_pcm { struct snd_card *card; struct list_head list; int device; unsigned int info_flags; unsigned short dev_class; unsigned short dev_subclass; char id[64U]; char name[80U]; struct snd_pcm_str streams[2U]; struct mutex open_mutex; wait_queue_head_t open_wait; void *private_data; void (*private_free)(struct snd_pcm *); struct device *dev; bool internal; struct snd_pcm_oss oss; } ;
368 struct snd_info_buffer { char *buffer; unsigned int curr; unsigned int size; unsigned int len; int stop; int error; } ;
36 struct snd_info_entry_text { void (*read)(struct snd_info_entry *, struct snd_info_buffer *); void (*write)(struct snd_info_entry *, struct snd_info_buffer *); } ;
47 struct snd_info_entry_ops { int (*open)(struct snd_info_entry *, unsigned short, void **); int (*release)(struct snd_info_entry *, unsigned short, void *); ssize_t (*read)(struct snd_info_entry *, void *, struct file *, char *, size_t , loff_t ); ssize_t (*write)(struct snd_info_entry *, void *, struct file *, const char *, size_t , loff_t ); loff_t (*llseek)(struct snd_info_entry *, void *, struct file *, loff_t , int); unsigned int (*poll)(struct snd_info_entry *, void *, struct file *, poll_table *); int (*ioctl)(struct snd_info_entry *, void *, struct file *, unsigned int, unsigned long); int (*mmap)(struct snd_info_entry *, void *, struct inode *, struct file *, struct vm_area_struct *); } ;
70 union __anonunion_c_215 { struct snd_info_entry_text text; struct snd_info_entry_ops *ops; } ;
70 struct snd_info_entry { const char *name; umode_t mode; long size; unsigned short content; union __anonunion_c_215 c; struct snd_info_entry *parent; struct snd_card *card; struct module *module; void *private_data; void (*private_free)(struct snd_info_entry *); struct proc_dir_entry *p; struct mutex access; struct list_head children; struct list_head list; } ;
30 typedef int snd_kcontrol_info_t(struct snd_kcontrol *, struct snd_ctl_elem_info *);
31 typedef int snd_kcontrol_get_t(struct snd_kcontrol *, struct snd_ctl_elem_value *);
32 typedef int snd_kcontrol_put_t(struct snd_kcontrol *, struct snd_ctl_elem_value *);
33 typedef int snd_kcontrol_tlv_rw_t(struct snd_kcontrol *, int, unsigned int, unsigned int *);
56 struct snd_ctl_file ;
56 struct snd_kcontrol_volatile { struct snd_ctl_file *owner; unsigned int access; } ;
61 union __anonunion_tlv_217 { snd_kcontrol_tlv_rw_t *c; const unsigned int *p; } ;
61 struct snd_kcontrol { struct list_head list; struct snd_ctl_elem_id id; unsigned int count; snd_kcontrol_info_t *info; snd_kcontrol_get_t *get; snd_kcontrol_put_t *put; union __anonunion_tlv_217 tlv; unsigned long private_value; void *private_data; void (*private_free)(struct snd_kcontrol *); struct snd_kcontrol_volatile vd[0U]; } ;
86 struct snd_ctl_file { struct list_head list; struct snd_card *card; struct pid *pid; int prefer_pcm_subdevice; int prefer_rawmidi_subdevice; wait_queue_head_t change_sleep; spinlock_t read_lock; struct fasync_struct *fasync; int subscribed; struct list_head events; } ;
39 struct tuner_ber_rate_s { uint32_t ber_rate; } ;
52 struct tuner_dtv_sig_stat_s { uint32_t sig_present; uint32_t sig_locked; uint32_t sig_lock_busy; uint32_t sig_strength; } ;
59 struct tuner_fm_sig_stat_s { uint32_t sig_present; uint32_t sig_locked; uint32_t sig_lock_busy; uint32_t sig_stereo_mono; uint32_t sig_strength; } ;
15 typedef signed char s8;
39 struct usb_device_id { __u16 match_flags; __u16 idVendor; __u16 idProduct; __u16 bcdDevice_lo; __u16 bcdDevice_hi; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 bInterfaceNumber; kernel_ulong_t driver_info; } ;
32 struct cgroup_subsys_state ;
273 struct usb_driver ;
798 struct usb_dynids { spinlock_t lock; struct list_head list; } ;
986 struct usbdrv_wrap { struct device_driver driver; int for_devices; } ;
996 struct usb_driver { const char *name; int (*probe)(struct usb_interface *, const struct usb_device_id *); void (*disconnect)(struct usb_interface *); int (*unlocked_ioctl)(struct usb_interface *, unsigned int, void *); int (*suspend)(struct usb_interface *, pm_message_t ); int (*resume)(struct usb_interface *); int (*reset_resume)(struct usb_interface *); int (*pre_reset)(struct usb_interface *); int (*post_reset)(struct usb_interface *); const struct usb_device_id *id_table; struct usb_dynids dynids; struct usbdrv_wrap drvwrap; unsigned char no_dynamic_id; unsigned char supports_autosuspend; unsigned char disable_hub_initiated_lpm; unsigned char soft_unbind; } ;
662 struct taskstats { __u16 version; __u32 ac_exitcode; __u8 ac_flag; __u8 ac_nice; __u64 cpu_count; __u64 cpu_delay_total; __u64 blkio_count; __u64 blkio_delay_total; __u64 swapin_count; __u64 swapin_delay_total; __u64 cpu_run_real_total; __u64 cpu_run_virtual_total; char ac_comm[32U]; __u8 ac_sched; __u8 ac_pad[3U]; __u32 ac_uid; __u32 ac_gid; __u32 ac_pid; __u32 ac_ppid; __u32 ac_btime; __u64 ac_etime; __u64 ac_utime; __u64 ac_stime; __u64 ac_minflt; __u64 ac_majflt; __u64 coremem; __u64 virtmem; __u64 hiwater_rss; __u64 hiwater_vm; __u64 read_char; __u64 write_char; __u64 read_syscalls; __u64 write_syscalls; __u64 read_bytes; __u64 write_bytes; __u64 cancelled_write_bytes; __u64 nvcsw; __u64 nivcsw; __u64 ac_utimescaled; __u64 ac_stimescaled; __u64 cpu_scaled_run_real_total; __u64 freepages_count; __u64 freepages_delay_total; } ;
58 struct percpu_ref ;
54 typedef void percpu_ref_func_t(struct percpu_ref *);
55 struct percpu_ref { atomic_t count; unsigned int *pcpu_count; percpu_ref_func_t *release; percpu_ref_func_t *confirm_kill; struct callback_head rcu; } ;
205 struct cgroup_root ;
206 struct cgroup_subsys ;
207 struct cgroup ;
58 struct cgroup_subsys_state { struct cgroup *cgroup; struct cgroup_subsys *ss; struct percpu_ref refcnt; struct cgroup_subsys_state *parent; struct list_head sibling; struct list_head children; int id; unsigned int flags; u64 serial_nr; struct callback_head callback_head; struct work_struct destroy_work; } ;
167 struct cgroup { struct cgroup_subsys_state self; unsigned long flags; int id; int populated_cnt; struct kernfs_node *kn; struct kernfs_node *populated_kn; unsigned int child_subsys_mask; struct cgroup_subsys_state *subsys[12U]; struct cgroup_root *root; struct list_head cset_links; struct list_head e_csets[12U]; struct list_head release_list; struct list_head pidlists; struct mutex pidlist_mutex; wait_queue_head_t offline_waitq; } ;
253 struct cgroup_root { struct kernfs_root *kf_root; unsigned int subsys_mask; int hierarchy_id; struct cgroup cgrp; atomic_t nr_cgrps; struct list_head root_list; unsigned int flags; struct idr cgroup_idr; char release_agent_path[4096U]; char name[64U]; } ;
355 struct css_set { atomic_t refcount; struct hlist_node hlist; struct list_head tasks; struct list_head mg_tasks; struct list_head cgrp_links; struct cgroup *dfl_cgrp; struct cgroup_subsys_state *subsys[12U]; struct list_head mg_preload_node; struct list_head mg_node; struct cgroup *mg_src_cgrp; struct css_set *mg_dst_cset; struct list_head e_cset_node[12U]; struct callback_head callback_head; } ;
438 struct cftype { char name[64U]; int private; umode_t mode; size_t max_write_len; unsigned int flags; struct cgroup_subsys *ss; struct list_head node; struct kernfs_ops *kf_ops; u64 (*read_u64)(struct cgroup_subsys_state *, struct cftype *); s64 (*read_s64)(struct cgroup_subsys_state *, struct cftype *); int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); int (*write_u64)(struct cgroup_subsys_state *, struct cftype *, u64 ); int (*write_s64)(struct cgroup_subsys_state *, struct cftype *, s64 ); ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); struct lock_class_key lockdep_key; } ;
609 struct cgroup_taskset ;
617 struct cgroup_subsys { struct cgroup_subsys_state * (*css_alloc)(struct cgroup_subsys_state *); int (*css_online)(struct cgroup_subsys_state *); void (*css_offline)(struct cgroup_subsys_state *); void (*css_free)(struct cgroup_subsys_state *); int (*can_attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*cancel_attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*attach)(struct cgroup_subsys_state *, struct cgroup_taskset *); void (*fork)(struct task_struct *); void (*exit)(struct cgroup_subsys_state *, struct cgroup_subsys_state *, struct task_struct *); void (*bind)(struct cgroup_subsys_state *); int disabled; int early_init; bool broken_hierarchy; bool warned_broken_hierarchy; int id; const char *name; struct cgroup_root *root; struct idr css_idr; struct list_head cfts; struct cftype *base_cftypes; } ;
112 struct reclaim_state { unsigned long reclaimed_slab; } ;
120 struct swap_extent { struct list_head list; unsigned long start_page; unsigned long nr_pages; sector_t start_block; } ;
156 struct swap_cluster_info { unsigned int data; unsigned char flags; } ;
198 struct percpu_cluster { struct swap_cluster_info index; unsigned int next; } ;
210 struct swap_info_struct { unsigned long flags; short prio; struct plist_node list; struct plist_node avail_list; signed char type; unsigned int max; unsigned char *swap_map; struct swap_cluster_info *cluster_info; struct swap_cluster_info free_cluster_head; struct swap_cluster_info free_cluster_tail; unsigned int lowest_bit; unsigned int highest_bit; unsigned int pages; unsigned int inuse_pages; unsigned int cluster_next; unsigned int cluster_nr; struct percpu_cluster *percpu_cluster; struct swap_extent *curr_swap_extent; struct swap_extent first_swap_extent; struct block_device *bdev; struct file *swap_file; unsigned int old_block_size; unsigned long *frontswap_map; atomic_t frontswap_pages; spinlock_t lock; struct work_struct discard_work; struct swap_cluster_info discard_cluster_head; struct swap_cluster_info discard_cluster_tail; } ;
69 struct firmware { size_t size; const u8 *data; struct page **pages; void *priv; } ;
227 struct cmd_firmware_vers_s { uint8_t fw_rev_major; uint8_t fw_rev_minor; uint16_t fw_patch; } ;
961 typedef struct usb_device *ldv_func_ret_type;
988 typedef struct usb_device *ldv_func_ret_type___0;
1 void * __builtin_memcpy(void *, const void *, unsigned long);
1 long int __builtin_expect(long exp, long c);
33 extern struct module __this_module;
139 int printk(const char *, ...);
391 int snprintf(char *, size_t , const char *, ...);
24 void INIT_LIST_HEAD(struct list_head *list);
47 void __list_add(struct list_head *, struct list_head *, struct list_head *);
74 void list_add_tail(struct list_head *new, struct list_head *head);
111 void __list_del_entry(struct list_head *);
142 void list_del_init(struct list_head *entry);
186 int list_empty(const struct list_head *head);
88 void __bad_percpu_size();
71 void warn_slowpath_null(const char *, const int);
10 extern struct task_struct *current_task;
12 struct task_struct * get_current();
62 char * strcpy(char *, const char *);
41 int strncmp(const char *, const char *, __kernel_size_t );
11 void __xchg_wrong_size();
15 void __xadd_wrong_size();
79 int atomic_sub_and_test(int i, atomic_t *v);
155 int atomic_add_return(int i, atomic_t *v);
279 void lockdep_init_map(struct lockdep_map *, const char *, struct lock_class_key *, int);
93 void __raw_spin_lock_init(raw_spinlock_t *, const char *, struct lock_class_key *);
22 void _raw_spin_lock(raw_spinlock_t *);
39 void _raw_spin_unlock(raw_spinlock_t *);
290 raw_spinlock_t * spinlock_check(spinlock_t *lock);
301 void spin_lock(spinlock_t *lock);
341 void spin_unlock(spinlock_t *lock);
144 void __wake_up(wait_queue_head_t *, unsigned int, int, void *);
139 void mutex_lock_nested(struct mutex *, unsigned int);
175 void mutex_unlock(struct mutex *);
180 void __init_work(struct work_struct *, int);
355 extern struct workqueue_struct *system_wq;
431 bool queue_work_on(int, struct workqueue_struct *, struct work_struct *);
471 bool queue_work(struct workqueue_struct *wq, struct work_struct *work);
530 bool schedule_work(struct work_struct *work);
41 void kref_get(struct kref *kref);
68 int kref_sub(struct kref *kref, unsigned int count, void (*release)(struct kref *));
97 int kref_put(struct kref *kref, void (*release)(struct kref *));
46 void msleep(unsigned int);
837 void * dev_get_drvdata(const struct device *dev);
842 void dev_set_drvdata(struct device *dev, void *data);
377 long int schedule_timeout(long);
644 int usb_autopm_get_interface(struct usb_interface *);
645 void usb_autopm_put_interface(struct usb_interface *);
791 int usb_make_path(struct usb_device *dev, char *buf, size_t size);
1511 void usb_fill_bulk_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, void *transfer_buffer, int buffer_length, void (*complete_fn)(struct urb *), void *context);
1581 struct urb * usb_alloc_urb(int, gfp_t );
1582 void usb_free_urb(struct urb *);
1585 int usb_submit_urb(struct urb *, gfp_t );
1587 void usb_kill_urb(struct urb *);
1631 void * usb_alloc_coherent(struct usb_device *, size_t , gfp_t , dma_addr_t *);
1633 void usb_free_coherent(struct usb_device *, size_t , void *, dma_addr_t );
1676 int usb_set_interface(struct usb_device *, int, int);
1784 unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint);
144 void kfree(const void *);
315 void * __kmalloc(size_t , gfp_t );
445 void * kmalloc(size_t size, gfp_t flags);
637 void * kzalloc(size_t size, gfp_t flags);
328 long int video_ioctl2(struct file *, unsigned int, unsigned long);
151 int __video_register_device(struct video_device *, int, int, int, struct module *);
158 int video_register_device(struct video_device *vdev, int type, int nr);
174 void video_unregister_device(struct video_device *);
186 void video_device_release_empty(struct video_device *);
209 void * video_get_drvdata(struct video_device *vdev);
214 void video_set_drvdata(struct video_device *vdev, void *data);
219 struct video_device * video_devdata(struct file *);
281 int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *, unsigned int, struct lock_class_key *, const char *);
308 void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *);
363 struct v4l2_ctrl * v4l2_ctrl_new_std(struct v4l2_ctrl_handler *, const struct v4l2_ctrl_ops *, u32 , s32 , s32 , u32 , s32 );
179 int videobuf_iolock(struct videobuf_queue *, struct videobuf_buffer *, struct v4l2_framebuffer *);
202 int videobuf_reqbufs(struct videobuf_queue *, struct v4l2_requestbuffers *);
204 int videobuf_querybuf(struct videobuf_queue *, struct v4l2_buffer *);
205 int videobuf_qbuf(struct videobuf_queue *, struct v4l2_buffer *);
207 int videobuf_dqbuf(struct videobuf_queue *, struct v4l2_buffer *, int);
209 int videobuf_streamon(struct videobuf_queue *);
210 int videobuf_streamoff(struct videobuf_queue *);
212 void videobuf_stop(struct videobuf_queue *);
216 ssize_t videobuf_read_stream(struct videobuf_queue *, char *, size_t , loff_t *, int, int);
222 unsigned int videobuf_poll_stream(struct file *, struct videobuf_queue *, poll_table *);
232 int videobuf_mmap_free(struct videobuf_queue *);
233 int videobuf_mmap_mapper(struct videobuf_queue *, struct vm_area_struct *);
32 void videobuf_queue_vmalloc_init(struct videobuf_queue *, const struct videobuf_queue_ops *, struct device *, spinlock_t *, enum v4l2_buf_type , enum v4l2_field , unsigned int, void *, struct mutex *);
42 void * videobuf_to_vmalloc(struct videobuf_buffer *);
44 void videobuf_vmalloc_free(struct videobuf_buffer *);
205 void v4l2_get_timestamp(struct timeval *);
215 int pd_video_init(struct poseidon *pd);
216 void pd_video_exit(struct poseidon *pd);
217 int stop_all_video_stream(struct poseidon *pd);
223 int pm_alsa_suspend(struct poseidon *p);
224 int pm_alsa_resume(struct poseidon *p);
239 int send_set_req(struct poseidon *pd, u8 cmdid, s32 param, s32 *cmd_status);
240 int send_get_req(struct poseidon *pd, u8 cmdid, s32 param, void *buf, s32 *cmd_status, s32 datalen);
241 s32 set_tuner_mode(struct poseidon *pd, unsigned char mode);
244 int alloc_bulk_urbs_generic(struct urb **urb_array, int num, struct usb_device *udev, u8 ep_addr, int buf_size, gfp_t gfp_flags, void (*complete_fn)(struct urb *), void *context);
248 void free_all_urb_generic(struct urb **urb_array, int num);
251 void poseidon_delete(struct kref *kref);
252 int debug_mode = 0;
253 void set_debug_mode(struct video_device *vfd, int debug_mode___0);
34 int pm_video_suspend(struct poseidon *pd);
35 int pm_video_resume(struct poseidon *pd);
37 void iso_bubble_handler(struct work_struct *w);
39 int usb_transfer_mode = 0;
43 const struct poseidon_format poseidon_formats[2U] = { { (char *)"YUV 422", 1448695129, 16, 0 }, { (char *)"RGB565", 1346520914, 16, 0 } };
48 const struct poseidon_tvnorm poseidon_tvnorms[18U] = { { 32ULL, { 'P', 'A', 'L', '-', 'D', '\x0' }, 32U }, { 1ULL, { 'P', 'A', 'L', '-', 'B', '\x0' }, 16U }, { 4ULL, { 'P', 'A', 'L', '-', 'G', '\x0' }, 64U }, { 8ULL, { 'P', 'A', 'L', '-', 'H', '\x0' }, 128U }, { 16ULL, { 'P', 'A', 'L', '-', 'I', '\x0' }, 256U }, { 256ULL, { 'P', 'A', 'L', '-', 'M', '\x0' }, 512U }, { 512ULL, { 'P', 'A', 'L', '-', 'N', '\x0' }, 1048576U }, { 1024ULL, { 'P', 'A', 'L', '-', 'N', 'c', '\x0' }, 1048576U }, { 4096ULL, { 'N', 'T', 'S', 'C', '-', 'M', '\x0' }, 1U }, { 8192ULL, { 'N', 'T', 'S', 'C', '-', 'J', 'P', '\x0' }, 2U }, { 65536ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'B', '\x0' }, 4096U }, { 131072ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'D', '\x0' }, 8192U }, { 262144ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'G', '\x0' }, 16384U }, { 524288ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'H', '\x0' }, 32768U }, { 1048576ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'K', '\x0' }, 65536U }, { 2097152ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'K', '1', '\x0' }, 131072U }, { 4194304ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'L', '\x0' }, 262144U }, { 8388608ULL, { 'S', 'E', 'C', 'A', 'M', '-', 'L', 'C', '\x0' }, 524288U } };
68 const unsigned int POSEIDON_TVNORMS = 18U;
76 const struct pd_audio_mode pd_audio_modes[5U] = { { 1U, 1U, 0U }, { 2U, 2U, 1U }, { 16U, 8U, 3U }, { 32U, 4U, 2U }, { 64U, 8U, 4U } };
88 const unsigned int POSEIDON_AUDIOMODS = 5U;
95 const struct pd_input pd_inputs[4U] = { { (char *)"TV Antenna", 1U }, { (char *)"TV Cable", 2U }, { (char *)"TV SVideo", 4U }, { (char *)"TV Composite", 8U } };
101 const unsigned int POSEIDON_INPUTS = 4U;
108 const struct video_std_to_audio_std video_to_audio_map[3U] = { { 4325425ULL, 2 }, { 4864ULL, 8 }, { 8192ULL, 4 } };
122 const unsigned int map_size = 3U;
124 int get_audio_std(v4l2_std_id v4l2_std);
135 int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap);
156 void init_copy(struct video_data *video, bool index);
168 bool get_frame(struct front_face *front, int *need_init);
190 bool get_video_frame(struct front_face *front, struct video_data *video);
201 void submit_frame(struct front_face *front);
220 void end_field(struct video_data *video);
228 void copy_video_data(struct video_data *video, char *src, unsigned int count);
261 void check_trailer(struct video_data *video, char *src, int count);
292 void copy_vbi_data(struct vbi_data *vbi, char *src, unsigned int count);
311 void copy_vbi_video_data(struct video_data *video, char *src, unsigned int count);
331 void urb_complete_bulk(struct urb *urb);
363 int get_chunk(int start, struct urb *urb, int *head, int *tail, int *bubble_err);
417 void urb_complete_iso(struct urb *urb);
457 int prepare_iso_urb(struct video_data *video);
550 int prepare_bulk_urb(struct video_data *video);
563 void free_all_urb(struct video_data *video);
568 void pd_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb);
574 void pd_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb);
581 int pd_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field);
617 int fire_all_urb(struct video_data *video);
631 int start_video_stream(struct poseidon *pd);
650 int pd_buf_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size);
692 struct videobuf_queue_ops pd_video_qops = { &pd_buf_setup, &pd_buf_prepare, &pd_buf_queue, &pd_buf_release };
699 int vidioc_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f);
711 int vidioc_g_fmt(struct file *file, void *fh, struct v4l2_format *f);
724 int pd_vidioc_s_fmt(struct poseidon *pd, struct v4l2_pix_format *pix);
773 int vidioc_s_fmt(struct file *file, void *fh, struct v4l2_format *f);
795 int vidioc_g_fmt_vbi(struct file *file, void *fh, struct v4l2_format *v4l2_f);
821 int set_std(struct poseidon *pd, v4l2_std_id norm);
866 int vidioc_s_std(struct file *file, void *fh, v4l2_std_id norm);
873 int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm);
881 int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *in);
899 int vidioc_g_input(struct file *file, void *fh, unsigned int *i);
910 int vidioc_s_input(struct file *file, void *fh, unsigned int i);
927 int tlg_s_ctrl(struct v4l2_ctrl *c);
962 int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a);
973 int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a);
982 int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *a);
988 int vidioc_g_tuner(struct file *file, void *fh, struct v4l2_tuner *tuner);
1035 int pd_vidioc_s_tuner(struct poseidon *pd, int index);
1051 int vidioc_s_tuner(struct file *file, void *fh, const struct v4l2_tuner *a);
1065 int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency *freq);
1079 int set_frequency(struct poseidon *pd, u32 *frequency);
1098 int vidioc_s_frequency(struct file *file, void *fh, const struct v4l2_frequency *freq);
1114 int vidioc_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *b);
1121 int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *b);
1127 int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *b);
1133 int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b);
1140 int usb_transfer_stop(struct video_data *video);
1207 int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type type);
1217 int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type type);
1228 int pd_video_checkmode(struct poseidon *pd);
1283 int restore_v4l2_context(struct poseidon *pd, struct running_context *context);
1328 void init_video_context(struct running_context *context);
1345 int pd_video_open(struct file *file);
1413 int pd_video_release(struct file *file);
1450 int pd_video_mmap(struct file *file, struct vm_area_struct *vma);
1456 unsigned int pd_video_poll(struct file *file, poll_table *table);
1462 ssize_t pd_video_read(struct file *file, char *buffer, size_t count, loff_t *ppos);
1471 const struct v4l2_file_operations pd_video_fops = { &__this_module, &pd_video_read, 0, &pd_video_poll, &video_ioctl2, 0, 0, 0, &pd_video_mmap, &pd_video_open, &pd_video_release };
1481 const struct v4l2_ioctl_ops pd_video_ioctl_ops = { &vidioc_querycap, 0, 0, &vidioc_enum_fmt, 0, 0, 0, 0, 0, &vidioc_g_fmt, 0, 0, 0, &vidioc_g_fmt_vbi, 0, 0, 0, 0, 0, 0, &vidioc_s_fmt, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &vidioc_reqbufs, &vidioc_querybuf, &vidioc_qbuf, 0, &vidioc_dqbuf, 0, 0, 0, 0, 0, &vidioc_streamon, &vidioc_streamoff, &vidioc_g_std, &vidioc_s_std, 0, &vidioc_enum_input, &vidioc_g_input, &vidioc_s_input, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &vidioc_enumaudio, &vidioc_g_audio, &vidioc_s_audio, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &vidioc_g_tuner, &vidioc_s_tuner, &vidioc_g_frequency, &vidioc_s_frequency, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1519 struct video_device pd_video_template = { { { 0, 0 }, 0, 0U, 0, 0U, 0U, 0UL, 0U, 0U, 0U, 0U, 0U, 0, 0, 0, 0, 0, 0, { .alsa = { 0U, 0U, 0U } } }, &pd_video_fops, { 0, 0, { 0, { 0, 0 }, 0, 0, 0, 0, { { 0 } }, { { { 0L }, { 0, 0 }, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, { { 0, 0 }, 0UL, 0, 0, 0UL, 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, { 0, 0 }, 0, 0, 0UL } }, 0, 0 }, 0U, 0U, 0U, 0U, 0U }, 0, 0, { { 0 }, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, 0, 0, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, 0, 0, 0, 0, { { 0 }, 0U, 0U, 0, 0, 0, 0, 0, 0, 0, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, { 0U, { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } } }, 0, 0, 0, { { 0, 0 }, 0UL, 0, 0, 0UL, 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, { 0, 0 }, 0, 0, 0UL } }, 0UL, { { 0L }, { 0, 0 }, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } }, { 0 }, { 0 }, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0, 0, 0, 0, 0UL, 0UL, 0UL, 0UL, 0, 0, 0 }, 0, 0, 0, 0, 0ULL, 0UL, 0, { 0, 0 }, 0, 0, { 0, 0 }, 0, { 0 }, 0U, 0U, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, { 0, { 0, 0 }, { { 0 } } }, 0, 0, 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, { 'T', 'e', 'l', 'e', 'g', 'e', 'n', 't', '-', 'V', 'i', 'd', 'e', 'o', '\x0' }, 0, 0, -1, 0U, 0UL, 0, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, 0, 16777215ULL, &video_device_release_empty, &pd_video_ioctl_ops, { 0UL, 0UL, 0UL }, { 0UL, 0UL, 0UL }, 0 };
1528 const struct v4l2_ctrl_ops tlg_ctrl_ops = { 0, 0, &tlg_s_ctrl };
1606 void ldv_check_final_state();
1609 void ldv_check_return_value(int);
1615 void ldv_initialize();
1618 void ldv_handler_precall();
1621 int nondet_int();
1624 int LDV_IN_INTERRUPT = 0;
1627 void ldv_main0_sequence_infinite_withcheck_stateful();
18 void _raw_read_lock(rwlock_t *);
30 void _raw_read_unlock(rwlock_t *);
67 void * vmalloc(unsigned long);
79 void vfree(const void *);
281 int snd_card_new(struct device *, int, const char *, struct module *, int, struct snd_card **);
286 int snd_card_free(struct snd_card *);
289 int snd_card_register(struct snd_card *);
351 struct page * vmalloc_to_page(const void *);
481 int snd_pcm_new(struct snd_card *, const char *, int, int, int, struct snd_pcm **);
495 extern rwlock_t snd_pcm_link_rwlock;
540 void snd_pcm_stream_lock(struct snd_pcm_substream *substream);
546 void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
767 const struct snd_interval * hw_param_interval_c(const struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
814 int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *, snd_pcm_hw_param_t );
873 void snd_pcm_set_ops(struct snd_pcm *, int, const struct snd_pcm_ops *);
877 int snd_pcm_lib_ioctl(struct snd_pcm_substream *, unsigned int, void *);
887 void snd_pcm_period_elapsed(struct snd_pcm_substream *);
220 int poseidon_audio_init(struct poseidon *p);
221 int poseidon_audio_free(struct poseidon *p);
38 void complete_handler_audio(struct urb *urb);
45 struct snd_pcm_hardware snd_pd_hw_capture = { 65795U, 4ULL, 128U, 48000U, 48000U, 2U, 2U, 32768UL, 8192UL, 8192UL, 4U, 4U, 0UL };
72 int snd_pd_capture_open(struct snd_pcm_substream *substream);
92 int snd_pd_pcm_close(struct snd_pcm_substream *substream);
104 int snd_pd_hw_capture_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params);
124 int audio_buf_free(struct poseidon *p);
137 int snd_pd_hw_capture_free(struct snd_pcm_substream *substream);
146 int snd_pd_prepare(struct snd_pcm_substream *substream);
152 void handle_audio_data(struct urb *urb, int *period_elapsed);
218 int fire_audio_urb(struct poseidon *p);
237 int snd_pd_capture_trigger(struct snd_pcm_substream *substream, int cmd);
271 snd_pcm_uframes_t snd_pd_capture_pointer(struct snd_pcm_substream *substream);
278 struct page * snd_pcm_pd_get_page(struct snd_pcm_substream *subs, unsigned long offset);
285 struct snd_pcm_ops pcm_capture_ops = { &snd_pd_capture_open, &snd_pd_pcm_close, &snd_pcm_lib_ioctl, &snd_pd_hw_capture_params, &snd_pd_hw_capture_free, &snd_pd_prepare, &snd_pd_capture_trigger, &snd_pd_capture_pointer, 0, 0, 0, &snd_pcm_pd_get_page, 0, 0 };
393 void ldv_main1_sequence_infinite_withcheck_stateful();
34 void * __memcpy(void *, const void *, size_t );
55 void * memset(void *, int, size_t );
25 int atomic_read(const atomic_t *v);
37 void atomic_set(atomic_t *v, int i);
90 void atomic_inc(atomic_t *v);
116 int atomic_dec_and_test(atomic_t *v);
77 extern volatile unsigned long jiffies;
295 unsigned int jiffies_to_msecs(const unsigned long);
99 int dvb_register_adapter(struct dvb_adapter *, const char *, struct module *, struct device *, short *);
102 int dvb_unregister_adapter(struct dvb_adapter *);
423 int dvb_register_frontend(struct dvb_adapter *, struct dvb_frontend *);
426 int dvb_unregister_frontend(struct dvb_frontend *);
141 int dvb_dmx_init(struct dvb_demux *);
145 void dvb_dmx_swfilter(struct dvb_demux *, const u8 *, size_t );
116 int dvb_dmxdev_init(struct dmxdev *, struct dvb_adapter *);
117 void dvb_dmxdev_release(struct dmxdev *);
228 int pd_dvb_usb_device_init(struct poseidon *pd);
229 void pd_dvb_usb_device_exit(struct poseidon *pd);
230 void pd_dvb_usb_device_cleanup(struct poseidon *pd);
231 int pd_dvb_get_adapter_num(struct pd_dvb_adapter *pd_dvb);
232 void dvb_stop_streaming(struct pd_dvb_adapter *pd_dvb);
30 void dvb_urb_cleanup(struct pd_dvb_adapter *pd_dvb);
32 int dvb_bandwidth[3U][2U] = { { 8, 8000000 }, { 7, 7000000 }, { 6, 6000000 } };
37 int dvb_bandwidth_length = 3;
39 s32 dvb_start_streaming(struct pd_dvb_adapter *pd_dvb);
40 int poseidon_check_mode_dvbt(struct poseidon *pd);
67 int poseidon_ts_bus_ctrl(struct dvb_frontend *fe, int acquire);
119 void poseidon_fe_release(struct dvb_frontend *fe);
130 s32 poseidon_fe_sleep(struct dvb_frontend *fe);
138 bool check_scan_ok(__u32 freq, int bandwidth, struct pd_dvb_adapter *adapter);
158 int fw_delay_overflow(struct pd_dvb_adapter *adapter);
167 int poseidon_set_fe(struct dvb_frontend *fe);
216 int pm_dvb_suspend(struct poseidon *pd);
225 int pm_dvb_resume(struct poseidon *pd);
238 s32 poseidon_fe_init(struct dvb_frontend *fe);
252 int poseidon_get_fe(struct dvb_frontend *fe);
262 int poseidon_fe_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *tune);
269 int poseidon_read_status(struct dvb_frontend *fe, fe_status_t *stat);
304 int poseidon_read_ber(struct dvb_frontend *fe, u32 *ber);
321 s32 poseidon_read_signal_strength(struct dvb_frontend *fe, u16 *strength);
341 int poseidon_read_snr(struct dvb_frontend *fe, u16 *snr);
346 int poseidon_read_unc_blocks(struct dvb_frontend *fe, u32 *unc);
352 struct dvb_frontend_ops poseidon_frontend_ops = { { { 'P', 'o', 's', 'e', 'i', 'd', 'o', 'n', ' ', 'D', 'V', 'B', '-', 'T', '\x0' }, 0, 174000000U, 862000000U, 62500U, 0U, 0U, 0U, 0U, 0U, 1075523247 }, { 3U }, &poseidon_fe_release, 0, &poseidon_fe_init, &poseidon_fe_sleep, 0, 0, 0, &poseidon_set_fe, &poseidon_fe_get_tune_settings, &poseidon_get_fe, &poseidon_read_status, &poseidon_read_ber, &poseidon_read_signal_strength, &poseidon_read_snr, &poseidon_read_unc_blocks, 0, 0, 0, 0, 0, 0, 0, 0, 0, &poseidon_ts_bus_ctrl, 0, 0, { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0U, 0U, 0U, 0U, 0U, 0U }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { { 0 }, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 0 };
387 void dvb_urb_irq(struct urb *urb);
430 int dvb_urb_init(struct pd_dvb_adapter *pd_dvb);
508 int pd_start_feed(struct dvb_demux_feed *feed);
520 int pd_stop_feed(struct dvb_demux_feed *feed);
531 short adapter_nr[8U] = { -1, -1, -1, -1, -1, -1, -1, -1 };
653 void ldv_main2_sequence_infinite_withcheck_stateful();
72 void set_bit(long nr, volatile unsigned long *addr);
26 size_t strlcpy(char *, const char *, size_t );
223 void * video_drvdata(struct file *file);
130 int v4l2_event_unsubscribe(struct v4l2_fh *, const struct v4l2_event_subscription *);
71 int v4l2_fh_open(struct file *);
92 int v4l2_fh_release(struct file *);
97 int v4l2_fh_is_singular(struct v4l2_fh *);
102 int v4l2_fh_is_singular_file(struct file *filp);
385 struct v4l2_ctrl * v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *, const struct v4l2_ctrl_ops *, u32 , s32 , s32 , s32 );
654 int v4l2_ctrl_subscribe_event(struct v4l2_fh *, const struct v4l2_event_subscription *);
658 unsigned int v4l2_ctrl_poll(struct file *, struct poll_table_struct *);
235 int poseidon_fm_init(struct poseidon *p);
236 int poseidon_fm_exit(struct poseidon *p);
36 int set_frequency___0(struct poseidon *p, __u32 frequency);
37 int poseidon_fm_close(struct file *filp);
38 int poseidon_fm_open(struct file *filp);
44 int preemphasis[3U] = { 0, 32, 16 };
50 int poseidon_check_mode_radio(struct poseidon *p);
78 int pm_fm_suspend(struct poseidon *p);
87 int pm_fm_resume(struct poseidon *p);
159 int vidioc_querycap___0(struct file *file, void *priv, struct v4l2_capability *v);
176 const struct v4l2_file_operations poseidon_fm_fops = { &__this_module, 0, 0, &v4l2_ctrl_poll, 0, &video_ioctl2, 0, 0, 0, &poseidon_fm_open, &poseidon_fm_close };
184 int tlg_fm_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *vt);
228 int fm_get_freq(struct file *file, void *priv, struct v4l2_frequency *argp);
271 int fm_set_freq(struct file *file, void *priv, const struct v4l2_frequency *argp);
286 int tlg_fm_s_ctrl(struct v4l2_ctrl *ctrl);
303 int vidioc_s_tuner___0(struct file *file, void *priv, const struct v4l2_tuner *vt);
308 const struct v4l2_ctrl_ops tlg_fm_ctrl_ops = { 0, 0, &tlg_fm_s_ctrl };
312 const struct v4l2_ioctl_ops poseidon_fm_ioctl_ops = { &vidioc_querycap___0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &tlg_fm_vidioc_g_tuner, &vidioc_s_tuner___0, &fm_get_freq, &fm_set_freq, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &v4l2_ctrl_subscribe_event, &v4l2_event_unsubscribe, 0 };
322 struct video_device poseidon_fm_template = { { { 0, 0 }, 0, 0U, 0, 0U, 0U, 0UL, 0U, 0U, 0U, 0U, 0U, 0, 0, 0, 0, 0, 0, { .alsa = { 0U, 0U, 0U } } }, &poseidon_fm_fops, { 0, 0, { 0, { 0, 0 }, 0, 0, 0, 0, { { 0 } }, { { { 0L }, { 0, 0 }, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, { { 0, 0 }, 0UL, 0, 0, 0UL, 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, { 0, 0 }, 0, 0, 0UL } }, 0, 0 }, 0U, 0U, 0U, 0U, 0U }, 0, 0, { { 0 }, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, 0, 0, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, 0, 0, 0, 0, { { 0 }, 0U, 0U, 0, 0, 0, 0, 0, 0, 0, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, { 0U, { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } } }, 0, 0, 0, { { 0, 0 }, 0UL, 0, 0, 0UL, 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, { 0, 0 }, 0, 0, 0UL } }, 0UL, { { 0L }, { 0, 0 }, 0, { 0, { 0, 0 }, 0, 0, 0UL } }, { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } }, { 0 }, { 0 }, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0, 0, 0, 0, 0UL, 0UL, 0UL, 0UL, 0, 0, 0 }, 0, 0, 0, 0, 0ULL, 0UL, 0, { 0, 0 }, 0, 0, { 0, 0 }, 0, { 0 }, 0U, 0U, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, { 0, { 0, 0 }, { { 0 } } }, 0, 0, 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, { 'T', 'e', 'l', 'e', 'g', 'e', 'n', 't', '-', 'R', 'a', 'd', 'i', 'o', '\x0' }, 0, 0, -1, 0U, 0UL, 0, { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 }, 0, 0ULL, &video_device_release_empty, &poseidon_fm_ioctl_ops, { 0UL, 0UL, 0UL }, { 0UL, 0UL, 0UL }, 0 };
396 void ldv_main3_sequence_infinite_withcheck_stateful();
120 void * kmemdup(const void *, size_t , gfp_t );
120 void __mutex_init(struct mutex *, const char *, struct lock_class_key *);
32 void kref_init(struct kref *kref);
10 void __const_udelay(unsigned long);
94 int device_init_wakeup(struct device *, bool );
906 void device_unlock(struct device *dev);
55 void pm_runtime_set_autosuspend_delay(struct device *, int);
194 void * usb_get_intfdata(struct usb_interface *intf);
199 void usb_set_intfdata(struct usb_interface *intf, void *data);
204 struct usb_interface * usb_get_intf(struct usb_interface *);
205 void usb_put_intf(struct usb_interface *);
595 struct usb_device * ldv_interface_to_usbdev_25(struct usb_interface *intf);
595 struct usb_device * interface_to_usbdev(struct usb_interface *intf);
605 struct usb_device * usb_get_dev(struct usb_device *);
607 struct usb_device * ldv_usb_get_dev_28(struct usb_device *ldv_func_arg1);
609 void usb_put_dev(struct usb_device *);
612 void ldv_usb_put_dev_26(struct usb_device *ldv_func_arg1);
616 void ldv_usb_put_dev_27(struct usb_device *ldv_func_arg1);
621 int usb_lock_device_for_reset(struct usb_device *, const struct usb_interface *);
625 int usb_reset_device(struct usb_device *);
641 void usb_enable_autosuspend(struct usb_device *);
1148 int usb_register_driver(struct usb_driver *, struct module *, const char *);
1155 void usb_deregister(struct usb_driver *);
1656 int usb_control_msg(struct usb_device *, unsigned int, __u8 , __u8 , __u16 , __u16 , void *, __u16 , int);
1661 int usb_bulk_msg(struct usb_device *, unsigned int, void *, int, int *, int);
14 void ldv_interface_to_usbdev();
15 void ldv_usb_get_dev();
16 void ldv_usb_put_dev();
359 int register_pm_notifier(struct notifier_block *);
360 int unregister_pm_notifier(struct notifier_block *);
42 int request_firmware(const struct firmware **, const char *, struct device *);
49 void release_firmware(const struct firmware *);
79 int v4l2_device_register(struct device *, struct v4l2_device *);
106 void v4l2_device_unregister(struct v4l2_device *);
62 struct usb_device_id id_table[3U] = { { 899U, 6948U, 16385U, 0U, 0U, 0U, 0U, 0U, 255U, 1U, 0U, 0U, 0UL }, { 899U, 6948U, 16385U, 0U, 0U, 0U, 0U, 0U, 255U, 1U, 1U, 0U, 0UL } };
67 const struct usb_device_id __mod_usb__id_table_device_table = { };
74 const char *firmware_name = "tlg2300_firmware.bin";
75 struct list_head pd_device_list = { &pd_device_list, &pd_device_list };
158 int pm_notifier_block(struct notifier_block *nb, unsigned long event, void *dummy);
190 struct notifier_block pm_notifer = { &pm_notifier_block, 0, 0 };
230 int firmware_download(struct usb_device *udev);
272 struct poseidon * get_pd(struct usb_interface *intf);
279 void set_map_flags(struct poseidon *pd, struct usb_device *udev);
284 int get_autopm_ref(struct poseidon *pd);
292 struct poseidon * fixup(struct poseidon *pd);
309 struct poseidon * find_old_poseidon(struct usb_device *udev);
321 int is_working(struct poseidon *pd);
326 int poseidon_suspend(struct usb_interface *intf, pm_message_t msg);
345 int poseidon_resume(struct usb_interface *intf);
366 void hibernation_resume(struct work_struct *w);
395 int check_firmware(struct usb_device *udev);
420 int poseidon_probe(struct usb_interface *interface, const struct usb_device_id *id);
500 void poseidon_disconnect(struct usb_interface *interface);
531 struct usb_driver poseidon_driver = { "poseidon", &poseidon_probe, &poseidon_disconnect, 0, &poseidon_suspend, &poseidon_resume, 0, 0, 0, (const struct usb_device_id *)(&id_table), { { { { { { 0U } }, 0U, 0U, 0, { 0, { 0, 0 }, 0, 0, 0UL } } } }, { 0, 0 } }, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, 0U, 1U, 0U, 0U };
543 int poseidon_init();
554 void poseidon_exit();
592 void ldv_check_return_value_probe(int retval);
607 void ldv_main4_sequence_infinite_withcheck_stateful();
10 void ldv_error();
59 void __builtin_trap();
7 bool ldv_is_err(const void *ptr);
14 void * ldv_err_ptr(long error);
21 long int ldv_ptr_err(const void *ptr);
28 bool ldv_is_err_or_null(const void *ptr);
19 int ldv_usb_dev_state = 0;
return ;
}
-entry_point
{
609 struct notifier_block *var_group1;
610 unsigned long var_pm_notifier_block_2_p1;
611 void *var_pm_notifier_block_2_p2;
612 struct usb_interface *var_group2;
613 const struct usb_device_id *var_poseidon_probe_18_p1;
614 int res_poseidon_probe_18;
615 pm_message_t var_poseidon_suspend_12_p1;
616 int ldv_s_poseidon_driver_usb_driver;
617 int tmp;
618 int tmp___0;
619 int tmp___1;
741 ldv_s_poseidon_driver_usb_driver = 0;
710 LDV_IN_INTERRUPT = 1;
719 ldv_initialize() { /* Function call is skipped due to function is undefined */}
736 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
737 -poseidon_init()
{
545 int ret;
547 ret = usb_register_driver(&poseidon_driver, &__this_module, "poseidon") { /* Function call is skipped due to function is undefined */}
548 assume(!(ret != 0));
550 register_pm_notifier(&pm_notifer) { /* Function call is skipped due to function is undefined */}
551 return ret;;
}
737 assume(!(tmp != 0));
744 goto ldv_36483;
744 tmp___1 = nondet_int() { /* Function call is skipped due to function is undefined */}
744 assume(tmp___1 != 0);
747 goto ldv_36482;
745 ldv_36482:;
748 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
748 switch (tmp___0)
749 assume(!(tmp___0 == 0));
780 assume(tmp___0 == 1);
783 assume(ldv_s_poseidon_driver_usb_driver == 0);
795 -poseidon_probe(var_group2, var_poseidon_probe_18_p1)
{
422 struct usb_device *udev;
423 struct usb_device *tmp;
424 struct poseidon *pd;
425 int ret;
426 int new_one;
427 void *tmp___0;
428 struct lock_class_key __key;
429 struct lock_class_key __key___0;
430 atomic_long_t __constr_expr_0;
423 -interface_to_usbdev(interface)
{
961 ldv_func_ret_type ldv_func_res;
962 struct usb_device *tmp;
963 -ldv_interface_to_usbdev_25(intf)
{
597 const struct device *__mptr;
597 __mptr = (const struct device *)(intf->dev.parent);
597 return ((struct usb_device *)__mptr) + 18446744073709551472UL;;
}
963 ldv_func_res = tmp;
965 -ldv_interface_to_usbdev()
{
25 assume(ldv_usb_dev_state == 0);
27 ldv_usb_dev_state = 1;
28 return ;;
}
967 return ldv_func_res;;
}
423 udev = tmp;
424 pd = (struct poseidon *)0;
425 ret = 0;
426 new_one = 0;
429 -check_firmware(udev)
{
397 void *buf;
398 int ret;
399 unsigned int tmp;
400 int tmp___0;
401 -kzalloc(8UL, 208U)
{
639 void *tmp;
639 -kmalloc(size, flags | 32768U)
{
447 void *tmp___2;
462 tmp___2 = __kmalloc(size, flags) { /* Function call is skipped due to function is undefined */}
462 return tmp___2;;
}
639 return tmp;;
}
402 assume(!(((unsigned long)buf) == 0UL));
404 -__create_pipe(udev, 0U)
{
1787 return ((unsigned int)((dev->devnum) << 8)) | (endpoint << 15);;
}
404 ret = usb_control_msg(udev, tmp | 2147483776U, 130, 192, 0, 0, buf, 8, 5000) { /* Function call is skipped due to function is undefined */}
413 kfree((const void *)buf) { /* Function call is skipped due to function is undefined */}
415 assume(!(ret < 0));
417 return 0;;
}
430 assume(!(ret != 0));
434 -find_old_poseidon(udev)
{
311 struct poseidon *pd;
312 const struct list_head *__mptr;
313 struct poseidon *tmp;
314 const struct list_head *__mptr___0;
313 __mptr = (const struct list_head *)(pd_device_list.next);
313 pd = (struct poseidon *)__mptr;
313 goto ldv_36369;
313 assume(!(((unsigned long)(&(pd->device_list))) != ((unsigned long)(&pd_device_list))));
317 return (struct poseidon *)0;;
}
435 assume(((unsigned long)pd) == 0UL);
436 -kzalloc(10648UL, 208U)
{
639 void *tmp;
639 -kmalloc(size, flags | 32768U)
{
447 void *tmp___2;
462 tmp___2 = __kmalloc(size, flags) { /* Function call is skipped due to function is undefined */}
462 return tmp___2;;
}
639 return tmp;;
}
436 pd = (struct poseidon *)tmp___0;
437 assume(!(((unsigned long)pd) == 0UL));
439 -kref_init(&(pd->kref))
{
34 -atomic_set(&(kref->refcount), 1)
{
39 v->counter = i;
40 return ;;
}
35 return ;;
}
440 -set_map_flags(pd, udev)
{
281 pd->portnum = udev->portnum;
282 return ;;
}
441 new_one = 1;
444 -ldv_usb_get_dev_28(udev)
{
988 ldv_func_ret_type___0 ldv_func_res;
989 struct usb_device *tmp;
990 tmp = usb_get_dev(ldv_func_arg1) { /* Function call is skipped due to function is undefined */}
990 ldv_func_res = tmp;
992 -ldv_usb_get_dev()
{
34 assume(!(ldv_usb_dev_state < 1));
39 ldv_usb_dev_state = ldv_usb_dev_state + 1;
40 return ;;
}
994 return ldv_func_res;;
}
445 pd->interface = usb_get_intf(interface) { /* Function call is skipped due to function is undefined */}
446 -usb_set_intfdata(interface, (void *)pd)
{
201 -dev_set_drvdata(&(intf->dev), data)
{
844 dev->driver_data = data;
845 return ;;
}
202 return ;;
}
448 assume(new_one != 0);
449 assume((debug_mode & 16) != 0);
449 printk("\017\t[ %s : %.3d ] \n", "poseidon_probe", 449) { /* Function call is skipped due to function is undefined */}
450 __mutex_init(&(pd->lock), "&pd->lock", &__key) { /* Function call is skipped due to function is undefined */}
453 ret = v4l2_device_register(&(interface->dev), &(pd->v4l2_dev)) { /* Function call is skipped due to function is undefined */}
454 assume(ret != 0);
455 goto err_v4l2;
496 kfree((const void *)pd) { /* Function call is skipped due to function is undefined */}
497 return ret;;
}
796 ldv_check_return_value(res_poseidon_probe_18) { /* Function call is skipped due to function is undefined */}
797 -ldv_check_return_value_probe(res_poseidon_probe_18)
{
60 assume(!(retval == 0));
62 assume(!(ldv_usb_dev_state < 2));
62 -ldv_error()
{
15 LDV_ERROR:;
12 goto LDV_ERROR;
}
}
}
Source code
1 #ifndef _ASM_X86_ATOMIC_H 2 #define _ASM_X86_ATOMIC_H 3 4 #include <linux/compiler.h> 5 #include <linux/types.h> 6 #include <asm/processor.h> 7 #include <asm/alternative.h> 8 #include <asm/cmpxchg.h> 9 #include <asm/rmwcc.h> 10 #include <asm/barrier.h> 11 12 /* 13 * Atomic operations that C can't guarantee us. Useful for 14 * resource counting etc.. 15 */ 16 17 #define ATOMIC_INIT(i) { (i) } 18 19 /** 20 * atomic_read - read atomic variable 21 * @v: pointer of type atomic_t 22 * 23 * Atomically reads the value of @v. 24 */ 25 static inline int atomic_read(const atomic_t *v) 26 { 27 return (*(volatile int *)&(v)->counter); 28 } 29 30 /** 31 * atomic_set - set atomic variable 32 * @v: pointer of type atomic_t 33 * @i: required value 34 * 35 * Atomically sets the value of @v to @i. 36 */ 37 static inline void atomic_set(atomic_t *v, int i) 38 { 39 v->counter = i; 40 } 41 42 /** 43 * atomic_add - add integer to atomic variable 44 * @i: integer value to add 45 * @v: pointer of type atomic_t 46 * 47 * Atomically adds @i to @v. 48 */ 49 static inline void atomic_add(int i, atomic_t *v) 50 { 51 asm volatile(LOCK_PREFIX "addl %1,%0" 52 : "+m" (v->counter) 53 : "ir" (i)); 54 } 55 56 /** 57 * atomic_sub - subtract integer from atomic variable 58 * @i: integer value to subtract 59 * @v: pointer of type atomic_t 60 * 61 * Atomically subtracts @i from @v. 62 */ 63 static inline void atomic_sub(int i, atomic_t *v) 64 { 65 asm volatile(LOCK_PREFIX "subl %1,%0" 66 : "+m" (v->counter) 67 : "ir" (i)); 68 } 69 70 /** 71 * atomic_sub_and_test - subtract value from variable and test result 72 * @i: integer value to subtract 73 * @v: pointer of type atomic_t 74 * 75 * Atomically subtracts @i from @v and returns 76 * true if the result is zero, or false for all 77 * other cases. 78 */ 79 static inline int atomic_sub_and_test(int i, atomic_t *v) 80 { 81 GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, "er", i, "%0", "e"); 82 } 83 84 /** 85 * atomic_inc - increment atomic variable 86 * @v: pointer of type atomic_t 87 * 88 * Atomically increments @v by 1. 89 */ 90 static inline void atomic_inc(atomic_t *v) 91 { 92 asm volatile(LOCK_PREFIX "incl %0" 93 : "+m" (v->counter)); 94 } 95 96 /** 97 * atomic_dec - decrement atomic variable 98 * @v: pointer of type atomic_t 99 * 100 * Atomically decrements @v by 1. 101 */ 102 static inline void atomic_dec(atomic_t *v) 103 { 104 asm volatile(LOCK_PREFIX "decl %0" 105 : "+m" (v->counter)); 106 } 107 108 /** 109 * atomic_dec_and_test - decrement and test 110 * @v: pointer of type atomic_t 111 * 112 * Atomically decrements @v by 1 and 113 * returns true if the result is 0, or false for all other 114 * cases. 115 */ 116 static inline int atomic_dec_and_test(atomic_t *v) 117 { 118 GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, "%0", "e"); 119 } 120 121 /** 122 * atomic_inc_and_test - increment and test 123 * @v: pointer of type atomic_t 124 * 125 * Atomically increments @v by 1 126 * and returns true if the result is zero, or false for all 127 * other cases. 128 */ 129 static inline int atomic_inc_and_test(atomic_t *v) 130 { 131 GEN_UNARY_RMWcc(LOCK_PREFIX "incl", v->counter, "%0", "e"); 132 } 133 134 /** 135 * atomic_add_negative - add and test if negative 136 * @i: integer value to add 137 * @v: pointer of type atomic_t 138 * 139 * Atomically adds @i to @v and returns true 140 * if the result is negative, or false when 141 * result is greater than or equal to zero. 142 */ 143 static inline int atomic_add_negative(int i, atomic_t *v) 144 { 145 GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, "er", i, "%0", "s"); 146 } 147 148 /** 149 * atomic_add_return - add integer and return 150 * @i: integer value to add 151 * @v: pointer of type atomic_t 152 * 153 * Atomically adds @i to @v and returns @i + @v 154 */ 155 static inline int atomic_add_return(int i, atomic_t *v) 156 { 157 return i + xadd(&v->counter, i); 158 } 159 160 /** 161 * atomic_sub_return - subtract integer and return 162 * @v: pointer of type atomic_t 163 * @i: integer value to subtract 164 * 165 * Atomically subtracts @i from @v and returns @v - @i 166 */ 167 static inline int atomic_sub_return(int i, atomic_t *v) 168 { 169 return atomic_add_return(-i, v); 170 } 171 172 #define atomic_inc_return(v) (atomic_add_return(1, v)) 173 #define atomic_dec_return(v) (atomic_sub_return(1, v)) 174 175 static inline int atomic_cmpxchg(atomic_t *v, int old, int new) 176 { 177 return cmpxchg(&v->counter, old, new); 178 } 179 180 static inline int atomic_xchg(atomic_t *v, int new) 181 { 182 return xchg(&v->counter, new); 183 } 184 185 /** 186 * __atomic_add_unless - add unless the number is already a given value 187 * @v: pointer of type atomic_t 188 * @a: the amount to add to v... 189 * @u: ...unless v is equal to u. 190 * 191 * Atomically adds @a to @v, so long as @v was not already @u. 192 * Returns the old value of @v. 193 */ 194 static inline int __atomic_add_unless(atomic_t *v, int a, int u) 195 { 196 int c, old; 197 c = atomic_read(v); 198 for (;;) { 199 if (unlikely(c == (u))) 200 break; 201 old = atomic_cmpxchg((v), c, c + (a)); 202 if (likely(old == c)) 203 break; 204 c = old; 205 } 206 return c; 207 } 208 209 /** 210 * atomic_inc_short - increment of a short integer 211 * @v: pointer to type int 212 * 213 * Atomically adds 1 to @v 214 * Returns the new value of @u 215 */ 216 static inline short int atomic_inc_short(short int *v) 217 { 218 asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v)); 219 return *v; 220 } 221 222 #ifdef CONFIG_X86_64 223 /** 224 * atomic_or_long - OR of two long integers 225 * @v1: pointer to type unsigned long 226 * @v2: pointer to type unsigned long 227 * 228 * Atomically ORs @v1 and @v2 229 * Returns the result of the OR 230 */ 231 static inline void atomic_or_long(unsigned long *v1, unsigned long v2) 232 { 233 asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2)); 234 } 235 #endif 236 237 /* These are x86-specific, used by some header files */ 238 #define atomic_clear_mask(mask, addr) \ 239 asm volatile(LOCK_PREFIX "andl %0,%1" \ 240 : : "r" (~(mask)), "m" (*(addr)) : "memory") 241 242 #define atomic_set_mask(mask, addr) \ 243 asm volatile(LOCK_PREFIX "orl %0,%1" \ 244 : : "r" ((unsigned)(mask)), "m" (*(addr)) \ 245 : "memory") 246 247 #ifdef CONFIG_X86_32 248 # include <asm/atomic64_32.h> 249 #else 250 # include <asm/atomic64_64.h> 251 #endif 252 253 #endif /* _ASM_X86_ATOMIC_H */
1 2 #include <linux/kernel.h> 3 bool ldv_is_err(const void *ptr); 4 bool ldv_is_err_or_null(const void *ptr); 5 void* ldv_err_ptr(long error); 6 long ldv_ptr_err(const void *ptr); 7 8 #include <linux/kernel.h> 9 #include <linux/module.h> 10 11 #include <linux/usb.h> 12 13 // Provide model function prototypes before their usage. 14 void ldv_interface_to_usbdev(void); 15 void ldv_usb_get_dev(void); 16 void ldv_usb_put_dev(void); 17 18 /* 19 * device driver for Telegent tlg2300 based TV cards 20 * 21 * Author : 22 * Kang Yong <kangyong@telegent.com> 23 * Zhang Xiaobing <xbzhang@telegent.com> 24 * Huang Shijie <zyziii@telegent.com> or <shijie8@gmail.com> 25 * 26 * (c) 2009 Telegent Systems 27 * (c) 2010 Telegent Systems 28 * 29 * This program is free software; you can redistribute it and/or modify 30 * it under the terms of the GNU General Public License as published by 31 * the Free Software Foundation; either version 2 of the License, or 32 * (at your option) any later version. 33 * 34 * This program is distributed in the hope that it will be useful, 35 * but WITHOUT ANY WARRANTY; without even the implied warranty of 36 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 * GNU General Public License for more details. 38 * 39 * You should have received a copy of the GNU General Public License 40 * along with this program; if not, write to the Free Software 41 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 42 */ 43 44 #include <linux/kernel.h> 45 #include <linux/errno.h> 46 #include <linux/init.h> 47 #include <linux/slab.h> 48 #include <linux/module.h> 49 #include <linux/kref.h> 50 #include <linux/suspend.h> 51 #include <linux/usb/quirks.h> 52 #include <linux/ctype.h> 53 #include <linux/string.h> 54 #include <linux/types.h> 55 #include <linux/firmware.h> 56 57 #include "vendorcmds.h" 58 #include "pd-common.h" 59 60 #define VENDOR_ID 0x1B24 61 #define PRODUCT_ID 0x4001 62 static struct usb_device_id id_table[] = { 63 { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, PRODUCT_ID, 255, 1, 0) }, 64 { USB_DEVICE_AND_INTERFACE_INFO(VENDOR_ID, PRODUCT_ID, 255, 1, 1) }, 65 { }, 66 }; 67 MODULE_DEVICE_TABLE(usb, id_table); 68 69 int debug_mode; 70 module_param(debug_mode, int, 0644); 71 MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose"); 72 73 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 74 static const char *firmware_name = TLG2300_FIRMWARE; 75 static LIST_HEAD(pd_device_list); 76 77 /* 78 * send set request to USB firmware. 79 */ 80 s32 send_set_req(struct poseidon *pd, u8 cmdid, s32 param, s32 *cmd_status) 81 { 82 s32 ret; 83 s8 data[32] = {}; 84 u16 lower_16, upper_16; 85 86 if (pd->state & POSEIDON_STATE_DISCONNECT) 87 return -ENODEV; 88 89 mdelay(30); 90 91 if (param == 0) { 92 upper_16 = lower_16 = 0; 93 } else { 94 /* send 32 bit param as two 16 bit param,little endian */ 95 lower_16 = (unsigned short)(param & 0xffff); 96 upper_16 = (unsigned short)((param >> 16) & 0xffff); 97 } 98 ret = usb_control_msg(pd->udev, 99 usb_rcvctrlpipe(pd->udev, 0), 100 REQ_SET_CMD | cmdid, 101 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 102 lower_16, 103 upper_16, 104 &data, 105 sizeof(*cmd_status), 106 USB_CTRL_GET_TIMEOUT); 107 108 if (!ret) { 109 return -ENXIO; 110 } else { 111 /* 1st 4 bytes into cmd_status */ 112 memcpy((char *)cmd_status, &(data[0]), sizeof(*cmd_status)); 113 } 114 return 0; 115 } 116 117 /* 118 * send get request to Poseidon firmware. 119 */ 120 s32 send_get_req(struct poseidon *pd, u8 cmdid, s32 param, 121 void *buf, s32 *cmd_status, s32 datalen) 122 { 123 s32 ret; 124 s8 data[128] = {}; 125 u16 lower_16, upper_16; 126 127 if (pd->state & POSEIDON_STATE_DISCONNECT) 128 return -ENODEV; 129 130 mdelay(30); 131 if (param == 0) { 132 upper_16 = lower_16 = 0; 133 } else { 134 /*send 32 bit param as two 16 bit param, little endian */ 135 lower_16 = (unsigned short)(param & 0xffff); 136 upper_16 = (unsigned short)((param >> 16) & 0xffff); 137 } 138 ret = usb_control_msg(pd->udev, 139 usb_rcvctrlpipe(pd->udev, 0), 140 REQ_GET_CMD | cmdid, 141 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 142 lower_16, 143 upper_16, 144 &data, 145 (datalen + sizeof(*cmd_status)), 146 USB_CTRL_GET_TIMEOUT); 147 148 if (ret < 0) { 149 return -ENXIO; 150 } else { 151 /* 1st 4 bytes into cmd_status, remaining data into cmd_data */ 152 memcpy((char *)cmd_status, &data[0], sizeof(*cmd_status)); 153 memcpy((char *)buf, &data[sizeof(*cmd_status)], datalen); 154 } 155 return 0; 156 } 157 158 static int pm_notifier_block(struct notifier_block *nb, 159 unsigned long event, void *dummy) 160 { 161 struct poseidon *pd = NULL; 162 struct list_head *node, *next; 163 164 switch (event) { 165 case PM_POST_HIBERNATION: 166 list_for_each_safe(node, next, &pd_device_list) { 167 struct usb_device *udev; 168 struct usb_interface *iface; 169 int rc = 0; 170 171 pd = container_of(node, struct poseidon, device_list); 172 udev = pd->udev; 173 iface = pd->interface; 174 175 /* It will cause the system to reload the firmware */ 176 rc = usb_lock_device_for_reset(udev, iface); 177 if (rc >= 0) { 178 usb_reset_device(udev); 179 usb_unlock_device(udev); 180 } 181 } 182 break; 183 default: 184 break; 185 } 186 log("event :%ld\n", event); 187 return 0; 188 } 189 190 static struct notifier_block pm_notifer = { 191 .notifier_call = pm_notifier_block, 192 }; 193 194 int set_tuner_mode(struct poseidon *pd, unsigned char mode) 195 { 196 s32 ret, cmd_status; 197 198 if (pd->state & POSEIDON_STATE_DISCONNECT) 199 return -ENODEV; 200 201 ret = send_set_req(pd, TUNE_MODE_SELECT, mode, &cmd_status); 202 if (ret || cmd_status) 203 return -ENXIO; 204 return 0; 205 } 206 207 void poseidon_delete(struct kref *kref) 208 { 209 struct poseidon *pd = container_of(kref, struct poseidon, kref); 210 211 if (!pd) 212 return; 213 list_del_init(&pd->device_list); 214 215 pd_dvb_usb_device_cleanup(pd); 216 /* clean_audio_data(&pd->audio_data);*/ 217 218 if (pd->udev) { 219 usb_put_dev(pd->udev); 220 pd->udev = NULL; 221 } 222 if (pd->interface) { 223 usb_put_intf(pd->interface); 224 pd->interface = NULL; 225 } 226 kfree(pd); 227 log(); 228 } 229 230 static int firmware_download(struct usb_device *udev) 231 { 232 int ret = 0, actual_length; 233 const struct firmware *fw = NULL; 234 void *fwbuf = NULL; 235 size_t fwlength = 0, offset; 236 size_t max_packet_size; 237 238 ret = request_firmware(&fw, firmware_name, &udev->dev); 239 if (ret) { 240 log("download err : %d", ret); 241 return ret; 242 } 243 244 fwlength = fw->size; 245 246 fwbuf = kmemdup(fw->data, fwlength, GFP_KERNEL); 247 if (!fwbuf) { 248 ret = -ENOMEM; 249 goto out; 250 } 251 252 max_packet_size = le16_to_cpu(udev->ep_out[0x1]->desc.wMaxPacketSize); 253 log("\t\t download size : %d", (int)max_packet_size); 254 255 for (offset = 0; offset < fwlength; offset += max_packet_size) { 256 actual_length = 0; 257 ret = usb_bulk_msg(udev, 258 usb_sndbulkpipe(udev, 0x01), /* ep 1 */ 259 fwbuf + offset, 260 min(max_packet_size, fwlength - offset), 261 &actual_length, 262 HZ * 10); 263 if (ret) 264 break; 265 } 266 kfree(fwbuf); 267 out: 268 release_firmware(fw); 269 return ret; 270 } 271 272 static inline struct poseidon *get_pd(struct usb_interface *intf) 273 { 274 return usb_get_intfdata(intf); 275 } 276 277 #ifdef CONFIG_PM 278 /* one-to-one map : poseidon{} <----> usb_device{}'s port */ 279 static inline void set_map_flags(struct poseidon *pd, struct usb_device *udev) 280 { 281 pd->portnum = udev->portnum; 282 } 283 284 static inline int get_autopm_ref(struct poseidon *pd) 285 { 286 return pd->video_data.users + pd->vbi_data.users + pd->audio.users 287 + atomic_read(&pd->dvb_data.users) + 288 !list_empty(&pd->radio_data.fm_dev.fh_list); 289 } 290 291 /* fixup something for poseidon */ 292 static inline struct poseidon *fixup(struct poseidon *pd) 293 { 294 int count; 295 296 /* old udev and interface have gone, so put back reference . */ 297 count = get_autopm_ref(pd); 298 log("count : %d, ref count : %d", count, get_pm_count(pd)); 299 while (count--) 300 usb_autopm_put_interface(pd->interface); 301 /*usb_autopm_set_interface(pd->interface); */ 302 303 usb_put_dev(pd->udev); 304 usb_put_intf(pd->interface); 305 log("event : %d\n", pd->msg.event); 306 return pd; 307 } 308 309 static struct poseidon *find_old_poseidon(struct usb_device *udev) 310 { 311 struct poseidon *pd; 312 313 list_for_each_entry(pd, &pd_device_list, device_list) { 314 if (pd->portnum == udev->portnum && in_hibernation(pd)) 315 return fixup(pd); 316 } 317 return NULL; 318 } 319 320 /* Is the card working now ? */ 321 static inline int is_working(struct poseidon *pd) 322 { 323 return get_pm_count(pd) > 0; 324 } 325 326 static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg) 327 { 328 struct poseidon *pd = get_pd(intf); 329 330 if (!pd) 331 return 0; 332 if (!is_working(pd)) { 333 if (get_pm_count(pd) <= 0 && !in_hibernation(pd)) { 334 pd->msg.event = PM_EVENT_AUTO_SUSPEND; 335 pd->pm_resume = NULL; /* a good guard */ 336 printk(KERN_DEBUG "TLG2300 auto suspend\n"); 337 } 338 return 0; 339 } 340 pd->msg = msg; /* save it here */ 341 logpm(pd); 342 return pd->pm_suspend ? pd->pm_suspend(pd) : 0; 343 } 344 345 static int poseidon_resume(struct usb_interface *intf) 346 { 347 struct poseidon *pd = get_pd(intf); 348 349 if (!pd) 350 return 0; 351 printk(KERN_DEBUG "TLG2300 resume\n"); 352 353 if (!is_working(pd)) { 354 if (PM_EVENT_AUTO_SUSPEND == pd->msg.event) 355 pd->msg = PMSG_ON; 356 return 0; 357 } 358 if (in_hibernation(pd)) { 359 logpm(pd); 360 return 0; 361 } 362 logpm(pd); 363 return pd->pm_resume ? pd->pm_resume(pd) : 0; 364 } 365 366 static void hibernation_resume(struct work_struct *w) 367 { 368 struct poseidon *pd = container_of(w, struct poseidon, pm_work); 369 int count; 370 371 pd->msg.event = 0; /* clear it here */ 372 pd->state &= ~POSEIDON_STATE_DISCONNECT; 373 374 /* set the new interface's reference */ 375 count = get_autopm_ref(pd); 376 while (count--) 377 usb_autopm_get_interface(pd->interface); 378 379 /* resume the context */ 380 logpm(pd); 381 if (pd->pm_resume) 382 pd->pm_resume(pd); 383 } 384 #else /* CONFIG_PM is not enabled: */ 385 static inline struct poseidon *find_old_poseidon(struct usb_device *udev) 386 { 387 return NULL; 388 } 389 390 static inline void set_map_flags(struct poseidon *pd, struct usb_device *udev) 391 { 392 } 393 #endif 394 395 static int check_firmware(struct usb_device *udev) 396 { 397 void *buf; 398 int ret; 399 struct cmd_firmware_vers_s *cmd_firm; 400 401 buf = kzalloc(sizeof(*cmd_firm) + sizeof(u32), GFP_KERNEL); 402 if (!buf) 403 return -ENOMEM; 404 ret = usb_control_msg(udev, 405 usb_rcvctrlpipe(udev, 0), 406 REQ_GET_CMD | GET_FW_ID, 407 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 408 0, 409 0, 410 buf, 411 sizeof(*cmd_firm) + sizeof(u32), 412 USB_CTRL_GET_TIMEOUT); 413 kfree(buf); 414 415 if (ret < 0) 416 return firmware_download(udev); 417 return 0; 418 } 419 420 static int poseidon_probe(struct usb_interface *interface, 421 const struct usb_device_id *id) 422 { 423 struct usb_device *udev = interface_to_usbdev(interface); 424 struct poseidon *pd = NULL; 425 int ret = 0; 426 int new_one = 0; 427 428 /* download firmware */ 429 ret = check_firmware(udev); 430 if (ret) 431 return ret; 432 433 /* Do I recovery from the hibernate ? */ 434 pd = find_old_poseidon(udev); 435 if (!pd) { 436 pd = kzalloc(sizeof(*pd), GFP_KERNEL); 437 if (!pd) 438 return -ENOMEM; 439 kref_init(&pd->kref); 440 set_map_flags(pd, udev); 441 new_one = 1; 442 } 443 444 pd->udev = usb_get_dev(udev); 445 pd->interface = usb_get_intf(interface); 446 usb_set_intfdata(interface, pd); 447 448 if (new_one) { 449 logpm(pd); 450 mutex_init(&pd->lock); 451 452 /* register v4l2 device */ 453 ret = v4l2_device_register(&interface->dev, &pd->v4l2_dev); 454 if (ret) 455 goto err_v4l2; 456 457 /* register devices in directory /dev */ 458 ret = pd_video_init(pd); 459 if (ret) 460 goto err_video; 461 ret = poseidon_audio_init(pd); 462 if (ret) 463 goto err_audio; 464 ret = poseidon_fm_init(pd); 465 if (ret) 466 goto err_fm; 467 ret = pd_dvb_usb_device_init(pd); 468 if (ret) 469 goto err_dvb; 470 471 INIT_LIST_HEAD(&pd->device_list); 472 list_add_tail(&pd->device_list, &pd_device_list); 473 } 474 475 device_init_wakeup(&udev->dev, 1); 476 #ifdef CONFIG_PM 477 pm_runtime_set_autosuspend_delay(&pd->udev->dev, 478 1000 * PM_SUSPEND_DELAY); 479 usb_enable_autosuspend(pd->udev); 480 481 if (in_hibernation(pd)) { 482 INIT_WORK(&pd->pm_work, hibernation_resume); 483 schedule_work(&pd->pm_work); 484 } 485 #endif 486 return 0; 487 err_dvb: 488 poseidon_fm_exit(pd); 489 err_fm: 490 poseidon_audio_free(pd); 491 err_audio: 492 pd_video_exit(pd); 493 err_video: 494 v4l2_device_unregister(&pd->v4l2_dev); 495 err_v4l2: 496 kfree(pd); 497 return ret; 498 } 499 500 static void poseidon_disconnect(struct usb_interface *interface) 501 { 502 struct poseidon *pd = get_pd(interface); 503 504 if (!pd) 505 return; 506 logpm(pd); 507 if (in_hibernation(pd)) 508 return; 509 510 mutex_lock(&pd->lock); 511 pd->state |= POSEIDON_STATE_DISCONNECT; 512 mutex_unlock(&pd->lock); 513 514 /* stop urb transferring */ 515 stop_all_video_stream(pd); 516 dvb_stop_streaming(&pd->dvb_data); 517 518 /*unregister v4l2 device */ 519 v4l2_device_unregister(&pd->v4l2_dev); 520 521 pd_dvb_usb_device_exit(pd); 522 poseidon_fm_exit(pd); 523 524 poseidon_audio_free(pd); 525 pd_video_exit(pd); 526 527 usb_set_intfdata(interface, NULL); 528 kref_put(&pd->kref, poseidon_delete); 529 } 530 531 static struct usb_driver poseidon_driver = { 532 .name = "poseidon", 533 .probe = poseidon_probe, 534 .disconnect = poseidon_disconnect, 535 .id_table = id_table, 536 #ifdef CONFIG_PM 537 .suspend = poseidon_suspend, 538 .resume = poseidon_resume, 539 #endif 540 .supports_autosuspend = 1, 541 }; 542 543 static int __init poseidon_init(void) 544 { 545 int ret; 546 547 ret = usb_register(&poseidon_driver); 548 if (ret) 549 return ret; 550 register_pm_notifier(&pm_notifer); 551 return ret; 552 } 553 554 static void __exit poseidon_exit(void) 555 { 556 log(); 557 unregister_pm_notifier(&pm_notifer); 558 usb_deregister(&poseidon_driver); 559 } 560 561 module_init(poseidon_init); 562 module_exit(poseidon_exit); 563 564 MODULE_AUTHOR("Telegent Systems"); 565 MODULE_DESCRIPTION("For tlg2300-based USB device"); 566 MODULE_LICENSE("GPL"); 567 MODULE_VERSION("0.0.2"); 568 MODULE_FIRMWARE(TLG2300_FIRMWARE); 569 570 571 572 573 574 /* LDV_COMMENT_BEGIN_MAIN */ 575 #ifdef LDV_MAIN4_sequence_infinite_withcheck_stateful 576 577 /*###########################################################################*/ 578 579 /*############## Driver Environment Generator 0.2 output ####################*/ 580 581 /*###########################################################################*/ 582 583 584 585 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test if all kernel resources are correctly released by driver before driver will be unloaded. */ 586 void ldv_check_final_state(void); 587 588 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 589 void ldv_check_return_value(int res); 590 591 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 592 void ldv_check_return_value_probe(int res); 593 594 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 595 void ldv_initialize(void); 596 597 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 598 void ldv_handler_precall(void); 599 600 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 601 int nondet_int(void); 602 603 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 604 int LDV_IN_INTERRUPT; 605 606 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 607 void ldv_main4_sequence_infinite_withcheck_stateful(void) { 608 609 610 611 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 612 /*============================= VARIABLE DECLARATION PART =============================*/ 613 /** STRUCT: struct type: notifier_block, struct name: pm_notifer **/ 614 /* content: static int pm_notifier_block(struct notifier_block *nb, unsigned long event, void *dummy)*/ 615 /* LDV_COMMENT_BEGIN_PREP */ 616 #define VENDOR_ID 0x1B24 617 #define PRODUCT_ID 0x4001 618 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 619 /* LDV_COMMENT_END_PREP */ 620 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "pm_notifier_block" */ 621 struct notifier_block * var_group1; 622 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "pm_notifier_block" */ 623 unsigned long var_pm_notifier_block_2_p1; 624 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "pm_notifier_block" */ 625 void * var_pm_notifier_block_2_p2; 626 /* LDV_COMMENT_BEGIN_PREP */ 627 #ifdef CONFIG_PM 628 #else 629 #endif 630 #ifdef CONFIG_PM 631 #endif 632 #ifdef CONFIG_PM 633 #endif 634 /* LDV_COMMENT_END_PREP */ 635 636 /** STRUCT: struct type: usb_driver, struct name: poseidon_driver **/ 637 /* content: static int poseidon_probe(struct usb_interface *interface, const struct usb_device_id *id)*/ 638 /* LDV_COMMENT_BEGIN_PREP */ 639 #define VENDOR_ID 0x1B24 640 #define PRODUCT_ID 0x4001 641 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 642 #ifdef CONFIG_PM 643 #else 644 #endif 645 /* LDV_COMMENT_END_PREP */ 646 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "poseidon_probe" */ 647 struct usb_interface * var_group2; 648 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "poseidon_probe" */ 649 const struct usb_device_id * var_poseidon_probe_18_p1; 650 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "poseidon_probe" */ 651 static int res_poseidon_probe_18; 652 /* LDV_COMMENT_BEGIN_PREP */ 653 #ifdef CONFIG_PM 654 #endif 655 /* LDV_COMMENT_END_PREP */ 656 /* content: static void poseidon_disconnect(struct usb_interface *interface)*/ 657 /* LDV_COMMENT_BEGIN_PREP */ 658 #define VENDOR_ID 0x1B24 659 #define PRODUCT_ID 0x4001 660 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 661 #ifdef CONFIG_PM 662 #else 663 #endif 664 #ifdef CONFIG_PM 665 #endif 666 /* LDV_COMMENT_END_PREP */ 667 /* LDV_COMMENT_BEGIN_PREP */ 668 #ifdef CONFIG_PM 669 #endif 670 /* LDV_COMMENT_END_PREP */ 671 /* content: static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)*/ 672 /* LDV_COMMENT_BEGIN_PREP */ 673 #define VENDOR_ID 0x1B24 674 #define PRODUCT_ID 0x4001 675 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 676 #ifdef CONFIG_PM 677 /* LDV_COMMENT_END_PREP */ 678 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "poseidon_suspend" */ 679 pm_message_t var_poseidon_suspend_12_p1; 680 /* LDV_COMMENT_BEGIN_PREP */ 681 #else 682 #endif 683 #ifdef CONFIG_PM 684 #endif 685 #ifdef CONFIG_PM 686 #endif 687 /* LDV_COMMENT_END_PREP */ 688 /* content: static int poseidon_resume(struct usb_interface *intf)*/ 689 /* LDV_COMMENT_BEGIN_PREP */ 690 #define VENDOR_ID 0x1B24 691 #define PRODUCT_ID 0x4001 692 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 693 #ifdef CONFIG_PM 694 /* LDV_COMMENT_END_PREP */ 695 /* LDV_COMMENT_BEGIN_PREP */ 696 #else 697 #endif 698 #ifdef CONFIG_PM 699 #endif 700 #ifdef CONFIG_PM 701 #endif 702 /* LDV_COMMENT_END_PREP */ 703 704 705 706 707 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 708 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 709 /*============================= VARIABLE INITIALIZING PART =============================*/ 710 LDV_IN_INTERRUPT=1; 711 712 713 714 715 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 716 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 717 /*============================= FUNCTION CALL SECTION =============================*/ 718 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 719 ldv_initialize(); 720 721 /** INIT: init_type: ST_MODULE_INIT **/ 722 /* content: static int __init poseidon_init(void)*/ 723 /* LDV_COMMENT_BEGIN_PREP */ 724 #define VENDOR_ID 0x1B24 725 #define PRODUCT_ID 0x4001 726 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 727 #ifdef CONFIG_PM 728 #else 729 #endif 730 #ifdef CONFIG_PM 731 #endif 732 #ifdef CONFIG_PM 733 #endif 734 /* LDV_COMMENT_END_PREP */ 735 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 736 ldv_handler_precall(); 737 if(poseidon_init()) 738 goto ldv_final; 739 740 741 int ldv_s_poseidon_driver_usb_driver = 0; 742 743 744 while( nondet_int() 745 || !(ldv_s_poseidon_driver_usb_driver == 0) 746 ) { 747 748 switch(nondet_int()) { 749 750 case 0: { 751 752 /** STRUCT: struct type: notifier_block, struct name: pm_notifer **/ 753 754 755 /* content: static int pm_notifier_block(struct notifier_block *nb, unsigned long event, void *dummy)*/ 756 /* LDV_COMMENT_BEGIN_PREP */ 757 #define VENDOR_ID 0x1B24 758 #define PRODUCT_ID 0x4001 759 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 760 /* LDV_COMMENT_END_PREP */ 761 /* LDV_COMMENT_FUNCTION_CALL Function from field "notifier_call" from driver structure with callbacks "pm_notifer" */ 762 ldv_handler_precall(); 763 pm_notifier_block( var_group1, var_pm_notifier_block_2_p1, var_pm_notifier_block_2_p2); 764 /* LDV_COMMENT_BEGIN_PREP */ 765 #ifdef CONFIG_PM 766 #else 767 #endif 768 #ifdef CONFIG_PM 769 #endif 770 #ifdef CONFIG_PM 771 #endif 772 /* LDV_COMMENT_END_PREP */ 773 774 775 776 777 } 778 779 break; 780 case 1: { 781 782 /** STRUCT: struct type: usb_driver, struct name: poseidon_driver **/ 783 if(ldv_s_poseidon_driver_usb_driver==0) { 784 785 /* content: static int poseidon_probe(struct usb_interface *interface, const struct usb_device_id *id)*/ 786 /* LDV_COMMENT_BEGIN_PREP */ 787 #define VENDOR_ID 0x1B24 788 #define PRODUCT_ID 0x4001 789 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 790 #ifdef CONFIG_PM 791 #else 792 #endif 793 /* LDV_COMMENT_END_PREP */ 794 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "poseidon_driver". Standart function test for correct return result. */ 795 res_poseidon_probe_18 = poseidon_probe( var_group2, var_poseidon_probe_18_p1); 796 ldv_check_return_value(res_poseidon_probe_18); 797 ldv_check_return_value_probe(res_poseidon_probe_18); 798 if(res_poseidon_probe_18) 799 goto ldv_module_exit; 800 /* LDV_COMMENT_BEGIN_PREP */ 801 #ifdef CONFIG_PM 802 #endif 803 /* LDV_COMMENT_END_PREP */ 804 ldv_s_poseidon_driver_usb_driver++; 805 806 } 807 808 } 809 810 break; 811 case 2: { 812 813 /** STRUCT: struct type: usb_driver, struct name: poseidon_driver **/ 814 if(ldv_s_poseidon_driver_usb_driver==1) { 815 816 /* content: static int poseidon_suspend(struct usb_interface *intf, pm_message_t msg)*/ 817 /* LDV_COMMENT_BEGIN_PREP */ 818 #define VENDOR_ID 0x1B24 819 #define PRODUCT_ID 0x4001 820 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 821 #ifdef CONFIG_PM 822 /* LDV_COMMENT_END_PREP */ 823 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "poseidon_driver" */ 824 ldv_handler_precall(); 825 poseidon_suspend( var_group2, var_poseidon_suspend_12_p1); 826 /* LDV_COMMENT_BEGIN_PREP */ 827 #else 828 #endif 829 #ifdef CONFIG_PM 830 #endif 831 #ifdef CONFIG_PM 832 #endif 833 /* LDV_COMMENT_END_PREP */ 834 ldv_s_poseidon_driver_usb_driver++; 835 836 } 837 838 } 839 840 break; 841 case 3: { 842 843 /** STRUCT: struct type: usb_driver, struct name: poseidon_driver **/ 844 if(ldv_s_poseidon_driver_usb_driver==2) { 845 846 /* content: static int poseidon_resume(struct usb_interface *intf)*/ 847 /* LDV_COMMENT_BEGIN_PREP */ 848 #define VENDOR_ID 0x1B24 849 #define PRODUCT_ID 0x4001 850 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 851 #ifdef CONFIG_PM 852 /* LDV_COMMENT_END_PREP */ 853 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "poseidon_driver" */ 854 ldv_handler_precall(); 855 poseidon_resume( var_group2); 856 /* LDV_COMMENT_BEGIN_PREP */ 857 #else 858 #endif 859 #ifdef CONFIG_PM 860 #endif 861 #ifdef CONFIG_PM 862 #endif 863 /* LDV_COMMENT_END_PREP */ 864 ldv_s_poseidon_driver_usb_driver++; 865 866 } 867 868 } 869 870 break; 871 case 4: { 872 873 /** STRUCT: struct type: usb_driver, struct name: poseidon_driver **/ 874 if(ldv_s_poseidon_driver_usb_driver==3) { 875 876 /* content: static void poseidon_disconnect(struct usb_interface *interface)*/ 877 /* LDV_COMMENT_BEGIN_PREP */ 878 #define VENDOR_ID 0x1B24 879 #define PRODUCT_ID 0x4001 880 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 881 #ifdef CONFIG_PM 882 #else 883 #endif 884 #ifdef CONFIG_PM 885 #endif 886 /* LDV_COMMENT_END_PREP */ 887 /* LDV_COMMENT_FUNCTION_CALL Function from field "disconnect" from driver structure with callbacks "poseidon_driver" */ 888 ldv_handler_precall(); 889 poseidon_disconnect( var_group2); 890 /* LDV_COMMENT_BEGIN_PREP */ 891 #ifdef CONFIG_PM 892 #endif 893 /* LDV_COMMENT_END_PREP */ 894 ldv_s_poseidon_driver_usb_driver=0; 895 896 } 897 898 } 899 900 break; 901 default: break; 902 903 } 904 905 } 906 907 ldv_module_exit: 908 909 /** INIT: init_type: ST_MODULE_EXIT **/ 910 /* content: static void __exit poseidon_exit(void)*/ 911 /* LDV_COMMENT_BEGIN_PREP */ 912 #define VENDOR_ID 0x1B24 913 #define PRODUCT_ID 0x4001 914 #define TLG2300_FIRMWARE "tlg2300_firmware.bin" 915 #ifdef CONFIG_PM 916 #else 917 #endif 918 #ifdef CONFIG_PM 919 #endif 920 #ifdef CONFIG_PM 921 #endif 922 /* LDV_COMMENT_END_PREP */ 923 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 924 ldv_handler_precall(); 925 poseidon_exit(); 926 927 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 928 ldv_final: ldv_check_final_state(); 929 930 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 931 return; 932 933 } 934 #endif 935 936 /* LDV_COMMENT_END_MAIN */
1 2 #include <linux/kernel.h> 3 #include <linux/module.h> 4 5 #include <linux/usb.h> 6 7 #include <verifier/rcv.h> // For LDV auxiliary routines. 8 #include <kernel-model/ERR.inc> 9 10 // There are 3 possible states of usb device reference counter 11 enum 12 { 13 LDV_USB_DEV_ZERO_STATE = 0, // Usb device reference hasn't been acquired 14 LDV_USB_DEV_ACQUIRED = 1, // Usb device reference acquired 15 LDV_USB_DEV_INCREASED = 2 // Usb device reference counter increased 16 }; 17 18 /* LDV_COMMENT_OTHER The model automaton state (one of thee possible ones). */ 19 int ldv_usb_dev_state = LDV_USB_DEV_ZERO_STATE; 20 21 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_interface_to_usbdev') Change state state after acquiring a reference to usb_device. */ 22 void ldv_interface_to_usbdev(void) 23 { 24 /* LDV_COMMENT_OTHER Initially we suppose this function is used to acquire a reference to usb_device. */ 25 if (ldv_usb_dev_state == LDV_USB_DEV_ZERO_STATE) 26 /* LDV_COMMENT_CHANGE_STATE Usb device reference acquired. */ 27 ldv_usb_dev_state = LDV_USB_DEV_ACQUIRED; 28 } 29 30 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_get_dev') Change state after increasing the reference counter with usb_get_dev. */ 31 void ldv_usb_get_dev(void) 32 { 33 /* LDV_COMMENT_OTHER Here the reference has surely been acquired somewhere. */ 34 if (ldv_usb_dev_state < LDV_USB_DEV_ACQUIRED) { 35 /* LDV_COMMENT_CHANGE_STATE The reference has already been acquired. */ 36 ldv_usb_dev_state = LDV_USB_DEV_ACQUIRED; 37 } 38 /* LDV_COMMENT_CHANGE_STATE Increase reference counter. */ 39 ldv_usb_dev_state++; 40 } 41 42 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_put_dev') Change state after decreasing the reference counter with usb_put_dev. */ 43 void ldv_usb_put_dev(void) 44 { 45 /* LDV_COMMENT_ASSERT Check usb device reference counter has been increased. */ 46 ldv_assert(ldv_usb_dev_state >= LDV_USB_DEV_INCREASED); 47 /* LDV_COMMENT_CHANGE_STATE Decrease reference counter. */ 48 ldv_usb_dev_state--; 49 /* LDV_COMMENT_OTHER LDV_USB_DEV_ACQUIRED is special (for when the one has forgotten to increase the counter). Not intednded to be used here. */ 50 if (ldv_usb_dev_state == LDV_USB_DEV_ACQUIRED) { 51 /* LDV_COMMENT_CHANGE_STATE Re-zero the model variable. */ 52 ldv_usb_dev_state = LDV_USB_DEV_ZERO_STATE; 53 } 54 } 55 56 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_check_return_value_probe') Check the probe function leaved the model in the proper state. */ 57 void ldv_check_return_value_probe(int retval) 58 { 59 /* LDV_COMMENT_OTHER Probe finished unsuccessfully and returned an error. */ 60 if (retval) { 61 /* LDV_COMMENT_ASSERT Check usb device reference counter is not increased. */ 62 ldv_assert(ldv_usb_dev_state < LDV_USB_DEV_INCREASED); 63 /* LDV_COMMENT_OTHER LDV_USB_DEV_ACQUIRED is special (for when the one has forgotten to increase the counter). Not this case. */ 64 if (ldv_usb_dev_state == LDV_USB_DEV_ACQUIRED) 65 /* LDV_COMMENT_CHANGE_STATE Re-zero the model variable. */ 66 ldv_usb_dev_state = LDV_USB_DEV_ZERO_STATE; 67 } // else /* LDV_COMMENT_OTHER Probe finished successfully and returned 0. */ 68 // /* LDV_COMMENT_ASSERT Check usb device reference counter is not acquired or has been increased. */ 69 // ldv_assert(ldv_usb_dev_state != LDV_USB_DEV_ACQUIRED); 70 } 71 72 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_check_final_state') Check that usb device reference hasn't been acquired or the counter has been decreased. */ 73 void ldv_check_final_state(void) 74 { 75 /* LDV_COMMENT_ASSERT Check that usb device reference hasn't been acquired or the counter has been decreased. */ 76 ldv_assert(ldv_usb_dev_state < LDV_USB_DEV_INCREASED); 77 }
1 #ifndef _LDV_RCV_H_ 2 #define _LDV_RCV_H_ 3 4 /* If expr evaluates to zero, ldv_assert() causes a program to reach the error 5 label like the standard assert(). */ 6 #define ldv_assert(expr) ((expr) ? 0 : ldv_error()) 7 8 /* The error label wrapper. It is used because of some static verifiers (like 9 BLAST) don't accept multiple error labels through a program. */ 10 static inline void ldv_error(void) 11 { 12 LDV_ERROR: goto LDV_ERROR; 13 } 14 15 /* If expr evaluates to zero, ldv_assume() causes an infinite loop that is 16 avoided by verifiers. */ 17 #define ldv_assume(expr) ((expr) ? 0 : ldv_stop()) 18 19 /* Infinite loop, that causes verifiers to skip such paths. */ 20 static inline void ldv_stop(void) { 21 LDV_STOP: goto LDV_STOP; 22 } 23 24 /* Special nondeterministic functions. */ 25 int ldv_undef_int(void); 26 void *ldv_undef_ptr(void); 27 unsigned long ldv_undef_ulong(void); 28 /* Return nondeterministic negative integer number. */ 29 static inline int ldv_undef_int_negative(void) 30 { 31 int ret = ldv_undef_int(); 32 33 ldv_assume(ret < 0); 34 35 return ret; 36 } 37 /* Return nondeterministic nonpositive integer number. */ 38 static inline int ldv_undef_int_nonpositive(void) 39 { 40 int ret = ldv_undef_int(); 41 42 ldv_assume(ret <= 0); 43 44 return ret; 45 } 46 47 /* Add explicit model for __builin_expect GCC function. Without the model a 48 return value will be treated as nondetermined by verifiers. */ 49 long __builtin_expect(long exp, long c) 50 { 51 return exp; 52 } 53 54 /* This function causes the program to exit abnormally. GCC implements this 55 function by using a target-dependent mechanism (such as intentionally executing 56 an illegal instruction) or by calling abort. The mechanism used may vary from 57 release to release so you should not rely on any particular implementation. 58 http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ 59 void __builtin_trap(void) 60 { 61 ldv_assert(0); 62 } 63 64 /* The constant is for simulating an error of ldv_undef_ptr() function. */ 65 #define LDV_PTR_MAX 2012 66 67 #endif /* _LDV_RCV_H_ */
1 /* 2 * device.h - generic, centralized driver model 3 * 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 5 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> 6 * Copyright (c) 2008-2009 Novell Inc. 7 * 8 * This file is released under the GPLv2 9 * 10 * See Documentation/driver-model/ for more information. 11 */ 12 13 #ifndef _DEVICE_H_ 14 #define _DEVICE_H_ 15 16 #include <linux/ioport.h> 17 #include <linux/kobject.h> 18 #include <linux/klist.h> 19 #include <linux/list.h> 20 #include <linux/lockdep.h> 21 #include <linux/compiler.h> 22 #include <linux/types.h> 23 #include <linux/mutex.h> 24 #include <linux/pinctrl/devinfo.h> 25 #include <linux/pm.h> 26 #include <linux/atomic.h> 27 #include <linux/ratelimit.h> 28 #include <linux/uidgid.h> 29 #include <linux/gfp.h> 30 #include <asm/device.h> 31 32 struct device; 33 struct device_private; 34 struct device_driver; 35 struct driver_private; 36 struct module; 37 struct class; 38 struct subsys_private; 39 struct bus_type; 40 struct device_node; 41 struct iommu_ops; 42 struct iommu_group; 43 44 struct bus_attribute { 45 struct attribute attr; 46 ssize_t (*show)(struct bus_type *bus, char *buf); 47 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); 48 }; 49 50 #define BUS_ATTR(_name, _mode, _show, _store) \ 51 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 52 #define BUS_ATTR_RW(_name) \ 53 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) 54 #define BUS_ATTR_RO(_name) \ 55 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) 56 57 extern int __must_check bus_create_file(struct bus_type *, 58 struct bus_attribute *); 59 extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 60 61 /** 62 * struct bus_type - The bus type of the device 63 * 64 * @name: The name of the bus. 65 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 66 * @dev_root: Default device to use as the parent. 67 * @dev_attrs: Default attributes of the devices on the bus. 68 * @bus_groups: Default attributes of the bus. 69 * @dev_groups: Default attributes of the devices on the bus. 70 * @drv_groups: Default attributes of the device drivers on the bus. 71 * @match: Called, perhaps multiple times, whenever a new device or driver 72 * is added for this bus. It should return a nonzero value if the 73 * given device can be handled by the given driver. 74 * @uevent: Called when a device is added, removed, or a few other things 75 * that generate uevents to add the environment variables. 76 * @probe: Called when a new device or driver add to this bus, and callback 77 * the specific driver's probe to initial the matched device. 78 * @remove: Called when a device removed from this bus. 79 * @shutdown: Called at shut-down time to quiesce the device. 80 * 81 * @online: Called to put the device back online (after offlining it). 82 * @offline: Called to put the device offline for hot-removal. May fail. 83 * 84 * @suspend: Called when a device on this bus wants to go to sleep mode. 85 * @resume: Called to bring a device on this bus out of sleep mode. 86 * @pm: Power management operations of this bus, callback the specific 87 * device driver's pm-ops. 88 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU 89 * driver implementations to a bus and allow the driver to do 90 * bus-specific setup 91 * @p: The private data of the driver core, only the driver core can 92 * touch this. 93 * @lock_key: Lock class key for use by the lock validator 94 * 95 * A bus is a channel between the processor and one or more devices. For the 96 * purposes of the device model, all devices are connected via a bus, even if 97 * it is an internal, virtual, "platform" bus. Buses can plug into each other. 98 * A USB controller is usually a PCI device, for example. The device model 99 * represents the actual connections between buses and the devices they control. 100 * A bus is represented by the bus_type structure. It contains the name, the 101 * default attributes, the bus' methods, PM operations, and the driver core's 102 * private data. 103 */ 104 struct bus_type { 105 const char *name; 106 const char *dev_name; 107 struct device *dev_root; 108 struct device_attribute *dev_attrs; /* use dev_groups instead */ 109 const struct attribute_group **bus_groups; 110 const struct attribute_group **dev_groups; 111 const struct attribute_group **drv_groups; 112 113 int (*match)(struct device *dev, struct device_driver *drv); 114 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 115 int (*probe)(struct device *dev); 116 int (*remove)(struct device *dev); 117 void (*shutdown)(struct device *dev); 118 119 int (*online)(struct device *dev); 120 int (*offline)(struct device *dev); 121 122 int (*suspend)(struct device *dev, pm_message_t state); 123 int (*resume)(struct device *dev); 124 125 const struct dev_pm_ops *pm; 126 127 struct iommu_ops *iommu_ops; 128 129 struct subsys_private *p; 130 struct lock_class_key lock_key; 131 }; 132 133 extern int __must_check bus_register(struct bus_type *bus); 134 135 extern void bus_unregister(struct bus_type *bus); 136 137 extern int __must_check bus_rescan_devices(struct bus_type *bus); 138 139 /* iterator helpers for buses */ 140 struct subsys_dev_iter { 141 struct klist_iter ki; 142 const struct device_type *type; 143 }; 144 void subsys_dev_iter_init(struct subsys_dev_iter *iter, 145 struct bus_type *subsys, 146 struct device *start, 147 const struct device_type *type); 148 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); 149 void subsys_dev_iter_exit(struct subsys_dev_iter *iter); 150 151 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 152 int (*fn)(struct device *dev, void *data)); 153 struct device *bus_find_device(struct bus_type *bus, struct device *start, 154 void *data, 155 int (*match)(struct device *dev, void *data)); 156 struct device *bus_find_device_by_name(struct bus_type *bus, 157 struct device *start, 158 const char *name); 159 struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, 160 struct device *hint); 161 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 162 void *data, int (*fn)(struct device_driver *, void *)); 163 void bus_sort_breadthfirst(struct bus_type *bus, 164 int (*compare)(const struct device *a, 165 const struct device *b)); 166 /* 167 * Bus notifiers: Get notified of addition/removal of devices 168 * and binding/unbinding of drivers to devices. 169 * In the long run, it should be a replacement for the platform 170 * notify hooks. 171 */ 172 struct notifier_block; 173 174 extern int bus_register_notifier(struct bus_type *bus, 175 struct notifier_block *nb); 176 extern int bus_unregister_notifier(struct bus_type *bus, 177 struct notifier_block *nb); 178 179 /* All 4 notifers below get called with the target struct device * 180 * as an argument. Note that those functions are likely to be called 181 * with the device lock held in the core, so be careful. 182 */ 183 #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 184 #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 185 #define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be 186 bound */ 187 #define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */ 188 #define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be 189 unbound */ 190 #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound 191 from the device */ 192 193 extern struct kset *bus_get_kset(struct bus_type *bus); 194 extern struct klist *bus_get_device_klist(struct bus_type *bus); 195 196 /** 197 * struct device_driver - The basic device driver structure 198 * @name: Name of the device driver. 199 * @bus: The bus which the device of this driver belongs to. 200 * @owner: The module owner. 201 * @mod_name: Used for built-in modules. 202 * @suppress_bind_attrs: Disables bind/unbind via sysfs. 203 * @of_match_table: The open firmware table. 204 * @acpi_match_table: The ACPI match table. 205 * @probe: Called to query the existence of a specific device, 206 * whether this driver can work with it, and bind the driver 207 * to a specific device. 208 * @remove: Called when the device is removed from the system to 209 * unbind a device from this driver. 210 * @shutdown: Called at shut-down time to quiesce the device. 211 * @suspend: Called to put the device to sleep mode. Usually to a 212 * low power state. 213 * @resume: Called to bring a device from sleep mode. 214 * @groups: Default attributes that get created by the driver core 215 * automatically. 216 * @pm: Power management operations of the device which matched 217 * this driver. 218 * @p: Driver core's private data, no one other than the driver 219 * core can touch this. 220 * 221 * The device driver-model tracks all of the drivers known to the system. 222 * The main reason for this tracking is to enable the driver core to match 223 * up drivers with new devices. Once drivers are known objects within the 224 * system, however, a number of other things become possible. Device drivers 225 * can export information and configuration variables that are independent 226 * of any specific device. 227 */ 228 struct device_driver { 229 const char *name; 230 struct bus_type *bus; 231 232 struct module *owner; 233 const char *mod_name; /* used for built-in modules */ 234 235 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 236 237 const struct of_device_id *of_match_table; 238 const struct acpi_device_id *acpi_match_table; 239 240 int (*probe) (struct device *dev); 241 int (*remove) (struct device *dev); 242 void (*shutdown) (struct device *dev); 243 int (*suspend) (struct device *dev, pm_message_t state); 244 int (*resume) (struct device *dev); 245 const struct attribute_group **groups; 246 247 const struct dev_pm_ops *pm; 248 249 struct driver_private *p; 250 }; 251 252 253 extern int __must_check driver_register(struct device_driver *drv); 254 extern void driver_unregister(struct device_driver *drv); 255 256 extern struct device_driver *driver_find(const char *name, 257 struct bus_type *bus); 258 extern int driver_probe_done(void); 259 extern void wait_for_device_probe(void); 260 261 262 /* sysfs interface for exporting driver attributes */ 263 264 struct driver_attribute { 265 struct attribute attr; 266 ssize_t (*show)(struct device_driver *driver, char *buf); 267 ssize_t (*store)(struct device_driver *driver, const char *buf, 268 size_t count); 269 }; 270 271 #define DRIVER_ATTR(_name, _mode, _show, _store) \ 272 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) 273 #define DRIVER_ATTR_RW(_name) \ 274 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) 275 #define DRIVER_ATTR_RO(_name) \ 276 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) 277 #define DRIVER_ATTR_WO(_name) \ 278 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name) 279 280 extern int __must_check driver_create_file(struct device_driver *driver, 281 const struct driver_attribute *attr); 282 extern void driver_remove_file(struct device_driver *driver, 283 const struct driver_attribute *attr); 284 285 extern int __must_check driver_for_each_device(struct device_driver *drv, 286 struct device *start, 287 void *data, 288 int (*fn)(struct device *dev, 289 void *)); 290 struct device *driver_find_device(struct device_driver *drv, 291 struct device *start, void *data, 292 int (*match)(struct device *dev, void *data)); 293 294 /** 295 * struct subsys_interface - interfaces to device functions 296 * @name: name of the device function 297 * @subsys: subsytem of the devices to attach to 298 * @node: the list of functions registered at the subsystem 299 * @add_dev: device hookup to device function handler 300 * @remove_dev: device hookup to device function handler 301 * 302 * Simple interfaces attached to a subsystem. Multiple interfaces can 303 * attach to a subsystem and its devices. Unlike drivers, they do not 304 * exclusively claim or control devices. Interfaces usually represent 305 * a specific functionality of a subsystem/class of devices. 306 */ 307 struct subsys_interface { 308 const char *name; 309 struct bus_type *subsys; 310 struct list_head node; 311 int (*add_dev)(struct device *dev, struct subsys_interface *sif); 312 int (*remove_dev)(struct device *dev, struct subsys_interface *sif); 313 }; 314 315 int subsys_interface_register(struct subsys_interface *sif); 316 void subsys_interface_unregister(struct subsys_interface *sif); 317 318 int subsys_system_register(struct bus_type *subsys, 319 const struct attribute_group **groups); 320 int subsys_virtual_register(struct bus_type *subsys, 321 const struct attribute_group **groups); 322 323 /** 324 * struct class - device classes 325 * @name: Name of the class. 326 * @owner: The module owner. 327 * @class_attrs: Default attributes of this class. 328 * @dev_groups: Default attributes of the devices that belong to the class. 329 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 330 * @dev_uevent: Called when a device is added, removed from this class, or a 331 * few other things that generate uevents to add the environment 332 * variables. 333 * @devnode: Callback to provide the devtmpfs. 334 * @class_release: Called to release this class. 335 * @dev_release: Called to release the device. 336 * @suspend: Used to put the device to sleep mode, usually to a low power 337 * state. 338 * @resume: Used to bring the device from the sleep mode. 339 * @ns_type: Callbacks so sysfs can detemine namespaces. 340 * @namespace: Namespace of the device belongs to this class. 341 * @pm: The default device power management operations of this class. 342 * @p: The private data of the driver core, no one other than the 343 * driver core can touch this. 344 * 345 * A class is a higher-level view of a device that abstracts out low-level 346 * implementation details. Drivers may see a SCSI disk or an ATA disk, but, 347 * at the class level, they are all simply disks. Classes allow user space 348 * to work with devices based on what they do, rather than how they are 349 * connected or how they work. 350 */ 351 struct class { 352 const char *name; 353 struct module *owner; 354 355 struct class_attribute *class_attrs; 356 const struct attribute_group **dev_groups; 357 struct kobject *dev_kobj; 358 359 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 360 char *(*devnode)(struct device *dev, umode_t *mode); 361 362 void (*class_release)(struct class *class); 363 void (*dev_release)(struct device *dev); 364 365 int (*suspend)(struct device *dev, pm_message_t state); 366 int (*resume)(struct device *dev); 367 368 const struct kobj_ns_type_operations *ns_type; 369 const void *(*namespace)(struct device *dev); 370 371 const struct dev_pm_ops *pm; 372 373 struct subsys_private *p; 374 }; 375 376 struct class_dev_iter { 377 struct klist_iter ki; 378 const struct device_type *type; 379 }; 380 381 extern struct kobject *sysfs_dev_block_kobj; 382 extern struct kobject *sysfs_dev_char_kobj; 383 extern int __must_check __class_register(struct class *class, 384 struct lock_class_key *key); 385 extern void class_unregister(struct class *class); 386 387 /* This is a #define to keep the compiler from merging different 388 * instances of the __key variable */ 389 #define class_register(class) \ 390 ({ \ 391 static struct lock_class_key __key; \ 392 __class_register(class, &__key); \ 393 }) 394 395 struct class_compat; 396 struct class_compat *class_compat_register(const char *name); 397 void class_compat_unregister(struct class_compat *cls); 398 int class_compat_create_link(struct class_compat *cls, struct device *dev, 399 struct device *device_link); 400 void class_compat_remove_link(struct class_compat *cls, struct device *dev, 401 struct device *device_link); 402 403 extern void class_dev_iter_init(struct class_dev_iter *iter, 404 struct class *class, 405 struct device *start, 406 const struct device_type *type); 407 extern struct device *class_dev_iter_next(struct class_dev_iter *iter); 408 extern void class_dev_iter_exit(struct class_dev_iter *iter); 409 410 extern int class_for_each_device(struct class *class, struct device *start, 411 void *data, 412 int (*fn)(struct device *dev, void *data)); 413 extern struct device *class_find_device(struct class *class, 414 struct device *start, const void *data, 415 int (*match)(struct device *, const void *)); 416 417 struct class_attribute { 418 struct attribute attr; 419 ssize_t (*show)(struct class *class, struct class_attribute *attr, 420 char *buf); 421 ssize_t (*store)(struct class *class, struct class_attribute *attr, 422 const char *buf, size_t count); 423 }; 424 425 #define CLASS_ATTR(_name, _mode, _show, _store) \ 426 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 427 #define CLASS_ATTR_RW(_name) \ 428 struct class_attribute class_attr_##_name = __ATTR_RW(_name) 429 #define CLASS_ATTR_RO(_name) \ 430 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 431 432 extern int __must_check class_create_file_ns(struct class *class, 433 const struct class_attribute *attr, 434 const void *ns); 435 extern void class_remove_file_ns(struct class *class, 436 const struct class_attribute *attr, 437 const void *ns); 438 439 static inline int __must_check class_create_file(struct class *class, 440 const struct class_attribute *attr) 441 { 442 return class_create_file_ns(class, attr, NULL); 443 } 444 445 static inline void class_remove_file(struct class *class, 446 const struct class_attribute *attr) 447 { 448 return class_remove_file_ns(class, attr, NULL); 449 } 450 451 /* Simple class attribute that is just a static string */ 452 struct class_attribute_string { 453 struct class_attribute attr; 454 char *str; 455 }; 456 457 /* Currently read-only only */ 458 #define _CLASS_ATTR_STRING(_name, _mode, _str) \ 459 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } 460 #define CLASS_ATTR_STRING(_name, _mode, _str) \ 461 struct class_attribute_string class_attr_##_name = \ 462 _CLASS_ATTR_STRING(_name, _mode, _str) 463 464 extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, 465 char *buf); 466 467 struct class_interface { 468 struct list_head node; 469 struct class *class; 470 471 int (*add_dev) (struct device *, struct class_interface *); 472 void (*remove_dev) (struct device *, struct class_interface *); 473 }; 474 475 extern int __must_check class_interface_register(struct class_interface *); 476 extern void class_interface_unregister(struct class_interface *); 477 478 extern struct class * __must_check __class_create(struct module *owner, 479 const char *name, 480 struct lock_class_key *key); 481 extern void class_destroy(struct class *cls); 482 483 /* This is a #define to keep the compiler from merging different 484 * instances of the __key variable */ 485 #define class_create(owner, name) \ 486 ({ \ 487 static struct lock_class_key __key; \ 488 __class_create(owner, name, &__key); \ 489 }) 490 491 /* 492 * The type of device, "struct device" is embedded in. A class 493 * or bus can contain devices of different types 494 * like "partitions" and "disks", "mouse" and "event". 495 * This identifies the device type and carries type-specific 496 * information, equivalent to the kobj_type of a kobject. 497 * If "name" is specified, the uevent will contain it in 498 * the DEVTYPE variable. 499 */ 500 struct device_type { 501 const char *name; 502 const struct attribute_group **groups; 503 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 504 char *(*devnode)(struct device *dev, umode_t *mode, 505 kuid_t *uid, kgid_t *gid); 506 void (*release)(struct device *dev); 507 508 const struct dev_pm_ops *pm; 509 }; 510 511 /* interface for exporting device attributes */ 512 struct device_attribute { 513 struct attribute attr; 514 ssize_t (*show)(struct device *dev, struct device_attribute *attr, 515 char *buf); 516 ssize_t (*store)(struct device *dev, struct device_attribute *attr, 517 const char *buf, size_t count); 518 }; 519 520 struct dev_ext_attribute { 521 struct device_attribute attr; 522 void *var; 523 }; 524 525 ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, 526 char *buf); 527 ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, 528 const char *buf, size_t count); 529 ssize_t device_show_int(struct device *dev, struct device_attribute *attr, 530 char *buf); 531 ssize_t device_store_int(struct device *dev, struct device_attribute *attr, 532 const char *buf, size_t count); 533 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, 534 char *buf); 535 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, 536 const char *buf, size_t count); 537 538 #define DEVICE_ATTR(_name, _mode, _show, _store) \ 539 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 540 #define DEVICE_ATTR_RW(_name) \ 541 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 542 #define DEVICE_ATTR_RO(_name) \ 543 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 544 #define DEVICE_ATTR_WO(_name) \ 545 struct device_attribute dev_attr_##_name = __ATTR_WO(_name) 546 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 547 struct dev_ext_attribute dev_attr_##_name = \ 548 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 549 #define DEVICE_INT_ATTR(_name, _mode, _var) \ 550 struct dev_ext_attribute dev_attr_##_name = \ 551 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } 552 #define DEVICE_BOOL_ATTR(_name, _mode, _var) \ 553 struct dev_ext_attribute dev_attr_##_name = \ 554 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } 555 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ 556 struct device_attribute dev_attr_##_name = \ 557 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 558 559 extern int device_create_file(struct device *device, 560 const struct device_attribute *entry); 561 extern void device_remove_file(struct device *dev, 562 const struct device_attribute *attr); 563 extern bool device_remove_file_self(struct device *dev, 564 const struct device_attribute *attr); 565 extern int __must_check device_create_bin_file(struct device *dev, 566 const struct bin_attribute *attr); 567 extern void device_remove_bin_file(struct device *dev, 568 const struct bin_attribute *attr); 569 570 /* device resource management */ 571 typedef void (*dr_release_t)(struct device *dev, void *res); 572 typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 573 574 #ifdef CONFIG_DEBUG_DEVRES 575 extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp, 576 const char *name); 577 #define devres_alloc(release, size, gfp) \ 578 __devres_alloc(release, size, gfp, #release) 579 #else 580 extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp); 581 #endif 582 extern void devres_for_each_res(struct device *dev, dr_release_t release, 583 dr_match_t match, void *match_data, 584 void (*fn)(struct device *, void *, void *), 585 void *data); 586 extern void devres_free(void *res); 587 extern void devres_add(struct device *dev, void *res); 588 extern void *devres_find(struct device *dev, dr_release_t release, 589 dr_match_t match, void *match_data); 590 extern void *devres_get(struct device *dev, void *new_res, 591 dr_match_t match, void *match_data); 592 extern void *devres_remove(struct device *dev, dr_release_t release, 593 dr_match_t match, void *match_data); 594 extern int devres_destroy(struct device *dev, dr_release_t release, 595 dr_match_t match, void *match_data); 596 extern int devres_release(struct device *dev, dr_release_t release, 597 dr_match_t match, void *match_data); 598 599 /* devres group */ 600 extern void * __must_check devres_open_group(struct device *dev, void *id, 601 gfp_t gfp); 602 extern void devres_close_group(struct device *dev, void *id); 603 extern void devres_remove_group(struct device *dev, void *id); 604 extern int devres_release_group(struct device *dev, void *id); 605 606 /* managed devm_k.alloc/kfree for device drivers */ 607 extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 608 static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 609 { 610 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 611 } 612 static inline void *devm_kmalloc_array(struct device *dev, 613 size_t n, size_t size, gfp_t flags) 614 { 615 if (size != 0 && n > SIZE_MAX / size) 616 return NULL; 617 return devm_kmalloc(dev, n * size, flags); 618 } 619 static inline void *devm_kcalloc(struct device *dev, 620 size_t n, size_t size, gfp_t flags) 621 { 622 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 623 } 624 extern void devm_kfree(struct device *dev, void *p); 625 extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); 626 extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, 627 gfp_t gfp); 628 629 extern unsigned long devm_get_free_pages(struct device *dev, 630 gfp_t gfp_mask, unsigned int order); 631 extern void devm_free_pages(struct device *dev, unsigned long addr); 632 633 void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 634 void __iomem *devm_request_and_ioremap(struct device *dev, 635 struct resource *res); 636 637 /* allows to add/remove a custom action to devres stack */ 638 int devm_add_action(struct device *dev, void (*action)(void *), void *data); 639 void devm_remove_action(struct device *dev, void (*action)(void *), void *data); 640 641 struct device_dma_parameters { 642 /* 643 * a low level driver may set these to teach IOMMU code about 644 * sg limitations. 645 */ 646 unsigned int max_segment_size; 647 unsigned long segment_boundary_mask; 648 }; 649 650 struct acpi_device; 651 652 struct acpi_dev_node { 653 #ifdef CONFIG_ACPI 654 struct acpi_device *companion; 655 #endif 656 }; 657 658 /** 659 * struct device - The basic device structure 660 * @parent: The device's "parent" device, the device to which it is attached. 661 * In most cases, a parent device is some sort of bus or host 662 * controller. If parent is NULL, the device, is a top-level device, 663 * which is not usually what you want. 664 * @p: Holds the private data of the driver core portions of the device. 665 * See the comment of the struct device_private for detail. 666 * @kobj: A top-level, abstract class from which other classes are derived. 667 * @init_name: Initial name of the device. 668 * @type: The type of device. 669 * This identifies the device type and carries type-specific 670 * information. 671 * @mutex: Mutex to synchronize calls to its driver. 672 * @bus: Type of bus device is on. 673 * @driver: Which driver has allocated this 674 * @platform_data: Platform data specific to the device. 675 * Example: For devices on custom boards, as typical of embedded 676 * and SOC based hardware, Linux often uses platform_data to point 677 * to board-specific structures describing devices and how they 678 * are wired. That can include what ports are available, chip 679 * variants, which GPIO pins act in what additional roles, and so 680 * on. This shrinks the "Board Support Packages" (BSPs) and 681 * minimizes board-specific #ifdefs in drivers. 682 * @driver_data: Private pointer for driver specific info. 683 * @power: For device power management. 684 * See Documentation/power/devices.txt for details. 685 * @pm_domain: Provide callbacks that are executed during system suspend, 686 * hibernation, system resume and during runtime PM transitions 687 * along with subsystem-level and driver-level callbacks. 688 * @pins: For device pin management. 689 * See Documentation/pinctrl.txt for details. 690 * @numa_node: NUMA node this device is close to. 691 * @dma_mask: Dma mask (if dma'ble device). 692 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 693 * hardware supports 64-bit addresses for consistent allocations 694 * such descriptors. 695 * @dma_pfn_offset: offset of DMA memory range relatively of RAM 696 * @dma_parms: A low level driver may set these to teach IOMMU code about 697 * segment limitations. 698 * @dma_pools: Dma pools (if dma'ble device). 699 * @dma_mem: Internal for coherent mem override. 700 * @cma_area: Contiguous memory area for dma allocations 701 * @archdata: For arch-specific additions. 702 * @of_node: Associated device tree node. 703 * @acpi_node: Associated ACPI device node. 704 * @devt: For creating the sysfs "dev". 705 * @id: device instance 706 * @devres_lock: Spinlock to protect the resource of the device. 707 * @devres_head: The resources list of the device. 708 * @knode_class: The node used to add the device to the class list. 709 * @class: The class of the device. 710 * @groups: Optional attribute groups. 711 * @release: Callback to free the device after all references have 712 * gone away. This should be set by the allocator of the 713 * device (i.e. the bus driver that discovered the device). 714 * @iommu_group: IOMMU group the device belongs to. 715 * 716 * @offline_disabled: If set, the device is permanently online. 717 * @offline: Set after successful invocation of bus type's .offline(). 718 * 719 * At the lowest level, every device in a Linux system is represented by an 720 * instance of struct device. The device structure contains the information 721 * that the device model core needs to model the system. Most subsystems, 722 * however, track additional information about the devices they host. As a 723 * result, it is rare for devices to be represented by bare device structures; 724 * instead, that structure, like kobject structures, is usually embedded within 725 * a higher-level representation of the device. 726 */ 727 struct device { 728 struct device *parent; 729 730 struct device_private *p; 731 732 struct kobject kobj; 733 const char *init_name; /* initial name of the device */ 734 const struct device_type *type; 735 736 struct mutex mutex; /* mutex to synchronize calls to 737 * its driver. 738 */ 739 740 struct bus_type *bus; /* type of bus device is on */ 741 struct device_driver *driver; /* which driver has allocated this 742 device */ 743 void *platform_data; /* Platform specific data, device 744 core doesn't touch it */ 745 void *driver_data; /* Driver data, set and get with 746 dev_set/get_drvdata */ 747 struct dev_pm_info power; 748 struct dev_pm_domain *pm_domain; 749 750 #ifdef CONFIG_PINCTRL 751 struct dev_pin_info *pins; 752 #endif 753 754 #ifdef CONFIG_NUMA 755 int numa_node; /* NUMA node this device is close to */ 756 #endif 757 u64 *dma_mask; /* dma mask (if dma'able device) */ 758 u64 coherent_dma_mask;/* Like dma_mask, but for 759 alloc_coherent mappings as 760 not all hardware supports 761 64 bit addresses for consistent 762 allocations such descriptors. */ 763 unsigned long dma_pfn_offset; 764 765 struct device_dma_parameters *dma_parms; 766 767 struct list_head dma_pools; /* dma pools (if dma'ble) */ 768 769 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 770 override */ 771 #ifdef CONFIG_DMA_CMA 772 struct cma *cma_area; /* contiguous memory area for dma 773 allocations */ 774 #endif 775 /* arch specific additions */ 776 struct dev_archdata archdata; 777 778 struct device_node *of_node; /* associated device tree node */ 779 struct acpi_dev_node acpi_node; /* associated ACPI device node */ 780 781 dev_t devt; /* dev_t, creates the sysfs "dev" */ 782 u32 id; /* device instance */ 783 784 spinlock_t devres_lock; 785 struct list_head devres_head; 786 787 struct klist_node knode_class; 788 struct class *class; 789 const struct attribute_group **groups; /* optional groups */ 790 791 void (*release)(struct device *dev); 792 struct iommu_group *iommu_group; 793 794 bool offline_disabled:1; 795 bool offline:1; 796 }; 797 798 static inline struct device *kobj_to_dev(struct kobject *kobj) 799 { 800 return container_of(kobj, struct device, kobj); 801 } 802 803 /* Get the wakeup routines, which depend on struct device */ 804 #include <linux/pm_wakeup.h> 805 806 static inline const char *dev_name(const struct device *dev) 807 { 808 /* Use the init name until the kobject becomes available */ 809 if (dev->init_name) 810 return dev->init_name; 811 812 return kobject_name(&dev->kobj); 813 } 814 815 extern __printf(2, 3) 816 int dev_set_name(struct device *dev, const char *name, ...); 817 818 #ifdef CONFIG_NUMA 819 static inline int dev_to_node(struct device *dev) 820 { 821 return dev->numa_node; 822 } 823 static inline void set_dev_node(struct device *dev, int node) 824 { 825 dev->numa_node = node; 826 } 827 #else 828 static inline int dev_to_node(struct device *dev) 829 { 830 return -1; 831 } 832 static inline void set_dev_node(struct device *dev, int node) 833 { 834 } 835 #endif 836 837 static inline void *dev_get_drvdata(const struct device *dev) 838 { 839 return dev->driver_data; 840 } 841 842 static inline void dev_set_drvdata(struct device *dev, void *data) 843 { 844 dev->driver_data = data; 845 } 846 847 static inline struct pm_subsys_data *dev_to_psd(struct device *dev) 848 { 849 return dev ? dev->power.subsys_data : NULL; 850 } 851 852 static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 853 { 854 return dev->kobj.uevent_suppress; 855 } 856 857 static inline void dev_set_uevent_suppress(struct device *dev, int val) 858 { 859 dev->kobj.uevent_suppress = val; 860 } 861 862 static inline int device_is_registered(struct device *dev) 863 { 864 return dev->kobj.state_in_sysfs; 865 } 866 867 static inline void device_enable_async_suspend(struct device *dev) 868 { 869 if (!dev->power.is_prepared) 870 dev->power.async_suspend = true; 871 } 872 873 static inline void device_disable_async_suspend(struct device *dev) 874 { 875 if (!dev->power.is_prepared) 876 dev->power.async_suspend = false; 877 } 878 879 static inline bool device_async_suspend_enabled(struct device *dev) 880 { 881 return !!dev->power.async_suspend; 882 } 883 884 static inline void pm_suspend_ignore_children(struct device *dev, bool enable) 885 { 886 dev->power.ignore_children = enable; 887 } 888 889 static inline void dev_pm_syscore_device(struct device *dev, bool val) 890 { 891 #ifdef CONFIG_PM_SLEEP 892 dev->power.syscore = val; 893 #endif 894 } 895 896 static inline void device_lock(struct device *dev) 897 { 898 mutex_lock(&dev->mutex); 899 } 900 901 static inline int device_trylock(struct device *dev) 902 { 903 return mutex_trylock(&dev->mutex); 904 } 905 906 static inline void device_unlock(struct device *dev) 907 { 908 mutex_unlock(&dev->mutex); 909 } 910 911 void driver_init(void); 912 913 /* 914 * High level routines for use by the bus drivers 915 */ 916 extern int __must_check device_register(struct device *dev); 917 extern void device_unregister(struct device *dev); 918 extern void device_initialize(struct device *dev); 919 extern int __must_check device_add(struct device *dev); 920 extern void device_del(struct device *dev); 921 extern int device_for_each_child(struct device *dev, void *data, 922 int (*fn)(struct device *dev, void *data)); 923 extern struct device *device_find_child(struct device *dev, void *data, 924 int (*match)(struct device *dev, void *data)); 925 extern int device_rename(struct device *dev, const char *new_name); 926 extern int device_move(struct device *dev, struct device *new_parent, 927 enum dpm_order dpm_order); 928 extern const char *device_get_devnode(struct device *dev, 929 umode_t *mode, kuid_t *uid, kgid_t *gid, 930 const char **tmp); 931 932 static inline bool device_supports_offline(struct device *dev) 933 { 934 return dev->bus && dev->bus->offline && dev->bus->online; 935 } 936 937 extern void lock_device_hotplug(void); 938 extern void unlock_device_hotplug(void); 939 extern int lock_device_hotplug_sysfs(void); 940 extern int device_offline(struct device *dev); 941 extern int device_online(struct device *dev); 942 /* 943 * Root device objects for grouping under /sys/devices 944 */ 945 extern struct device *__root_device_register(const char *name, 946 struct module *owner); 947 948 /* This is a macro to avoid include problems with THIS_MODULE */ 949 #define root_device_register(name) \ 950 __root_device_register(name, THIS_MODULE) 951 952 extern void root_device_unregister(struct device *root); 953 954 static inline void *dev_get_platdata(const struct device *dev) 955 { 956 return dev->platform_data; 957 } 958 959 /* 960 * Manual binding of a device to driver. See drivers/base/bus.c 961 * for information on use. 962 */ 963 extern int __must_check device_bind_driver(struct device *dev); 964 extern void device_release_driver(struct device *dev); 965 extern int __must_check device_attach(struct device *dev); 966 extern int __must_check driver_attach(struct device_driver *drv); 967 extern int __must_check device_reprobe(struct device *dev); 968 969 /* 970 * Easy functions for dynamically creating devices on the fly 971 */ 972 extern struct device *device_create_vargs(struct class *cls, 973 struct device *parent, 974 dev_t devt, 975 void *drvdata, 976 const char *fmt, 977 va_list vargs); 978 extern __printf(5, 6) 979 struct device *device_create(struct class *cls, struct device *parent, 980 dev_t devt, void *drvdata, 981 const char *fmt, ...); 982 extern __printf(6, 7) 983 struct device *device_create_with_groups(struct class *cls, 984 struct device *parent, dev_t devt, void *drvdata, 985 const struct attribute_group **groups, 986 const char *fmt, ...); 987 extern void device_destroy(struct class *cls, dev_t devt); 988 989 /* 990 * Platform "fixup" functions - allow the platform to have their say 991 * about devices and actions that the general device layer doesn't 992 * know about. 993 */ 994 /* Notify platform of device discovery */ 995 extern int (*platform_notify)(struct device *dev); 996 997 extern int (*platform_notify_remove)(struct device *dev); 998 999 1000 /* 1001 * get_device - atomically increment the reference count for the device. 1002 * 1003 */ 1004 extern struct device *get_device(struct device *dev); 1005 extern void put_device(struct device *dev); 1006 1007 #ifdef CONFIG_DEVTMPFS 1008 extern int devtmpfs_create_node(struct device *dev); 1009 extern int devtmpfs_delete_node(struct device *dev); 1010 extern int devtmpfs_mount(const char *mntdir); 1011 #else 1012 static inline int devtmpfs_create_node(struct device *dev) { return 0; } 1013 static inline int devtmpfs_delete_node(struct device *dev) { return 0; } 1014 static inline int devtmpfs_mount(const char *mountpoint) { return 0; } 1015 #endif 1016 1017 /* drivers/base/power/shutdown.c */ 1018 extern void device_shutdown(void); 1019 1020 /* debugging and troubleshooting/diagnostic helpers. */ 1021 extern const char *dev_driver_string(const struct device *dev); 1022 1023 1024 #ifdef CONFIG_PRINTK 1025 1026 extern __printf(3, 0) 1027 int dev_vprintk_emit(int level, const struct device *dev, 1028 const char *fmt, va_list args); 1029 extern __printf(3, 4) 1030 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1031 1032 extern __printf(3, 4) 1033 int dev_printk(const char *level, const struct device *dev, 1034 const char *fmt, ...); 1035 extern __printf(2, 3) 1036 int dev_emerg(const struct device *dev, const char *fmt, ...); 1037 extern __printf(2, 3) 1038 int dev_alert(const struct device *dev, const char *fmt, ...); 1039 extern __printf(2, 3) 1040 int dev_crit(const struct device *dev, const char *fmt, ...); 1041 extern __printf(2, 3) 1042 int dev_err(const struct device *dev, const char *fmt, ...); 1043 extern __printf(2, 3) 1044 int dev_warn(const struct device *dev, const char *fmt, ...); 1045 extern __printf(2, 3) 1046 int dev_notice(const struct device *dev, const char *fmt, ...); 1047 extern __printf(2, 3) 1048 int _dev_info(const struct device *dev, const char *fmt, ...); 1049 1050 #else 1051 1052 static inline __printf(3, 0) 1053 int dev_vprintk_emit(int level, const struct device *dev, 1054 const char *fmt, va_list args) 1055 { return 0; } 1056 static inline __printf(3, 4) 1057 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) 1058 { return 0; } 1059 1060 static inline int __dev_printk(const char *level, const struct device *dev, 1061 struct va_format *vaf) 1062 { return 0; } 1063 static inline __printf(3, 4) 1064 int dev_printk(const char *level, const struct device *dev, 1065 const char *fmt, ...) 1066 { return 0; } 1067 1068 static inline __printf(2, 3) 1069 int dev_emerg(const struct device *dev, const char *fmt, ...) 1070 { return 0; } 1071 static inline __printf(2, 3) 1072 int dev_crit(const struct device *dev, const char *fmt, ...) 1073 { return 0; } 1074 static inline __printf(2, 3) 1075 int dev_alert(const struct device *dev, const char *fmt, ...) 1076 { return 0; } 1077 static inline __printf(2, 3) 1078 int dev_err(const struct device *dev, const char *fmt, ...) 1079 { return 0; } 1080 static inline __printf(2, 3) 1081 int dev_warn(const struct device *dev, const char *fmt, ...) 1082 { return 0; } 1083 static inline __printf(2, 3) 1084 int dev_notice(const struct device *dev, const char *fmt, ...) 1085 { return 0; } 1086 static inline __printf(2, 3) 1087 int _dev_info(const struct device *dev, const char *fmt, ...) 1088 { return 0; } 1089 1090 #endif 1091 1092 /* 1093 * Stupid hackaround for existing uses of non-printk uses dev_info 1094 * 1095 * Note that the definition of dev_info below is actually _dev_info 1096 * and a macro is used to avoid redefining dev_info 1097 */ 1098 1099 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 1100 1101 #if defined(CONFIG_DYNAMIC_DEBUG) 1102 #define dev_dbg(dev, format, ...) \ 1103 do { \ 1104 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 1105 } while (0) 1106 #elif defined(DEBUG) 1107 #define dev_dbg(dev, format, arg...) \ 1108 dev_printk(KERN_DEBUG, dev, format, ##arg) 1109 #else 1110 #define dev_dbg(dev, format, arg...) \ 1111 ({ \ 1112 if (0) \ 1113 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1114 0; \ 1115 }) 1116 #endif 1117 1118 #define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 1119 do { \ 1120 static DEFINE_RATELIMIT_STATE(_rs, \ 1121 DEFAULT_RATELIMIT_INTERVAL, \ 1122 DEFAULT_RATELIMIT_BURST); \ 1123 if (__ratelimit(&_rs)) \ 1124 dev_level(dev, fmt, ##__VA_ARGS__); \ 1125 } while (0) 1126 1127 #define dev_emerg_ratelimited(dev, fmt, ...) \ 1128 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) 1129 #define dev_alert_ratelimited(dev, fmt, ...) \ 1130 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) 1131 #define dev_crit_ratelimited(dev, fmt, ...) \ 1132 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) 1133 #define dev_err_ratelimited(dev, fmt, ...) \ 1134 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) 1135 #define dev_warn_ratelimited(dev, fmt, ...) \ 1136 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__) 1137 #define dev_notice_ratelimited(dev, fmt, ...) \ 1138 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1139 #define dev_info_ratelimited(dev, fmt, ...) \ 1140 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1141 #if defined(CONFIG_DYNAMIC_DEBUG) 1142 /* descriptor check is first to prevent flooding with "callbacks suppressed" */ 1143 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1144 do { \ 1145 static DEFINE_RATELIMIT_STATE(_rs, \ 1146 DEFAULT_RATELIMIT_INTERVAL, \ 1147 DEFAULT_RATELIMIT_BURST); \ 1148 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1149 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1150 __ratelimit(&_rs)) \ 1151 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 1152 ##__VA_ARGS__); \ 1153 } while (0) 1154 #elif defined(DEBUG) 1155 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1156 do { \ 1157 static DEFINE_RATELIMIT_STATE(_rs, \ 1158 DEFAULT_RATELIMIT_INTERVAL, \ 1159 DEFAULT_RATELIMIT_BURST); \ 1160 if (__ratelimit(&_rs)) \ 1161 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1162 } while (0) 1163 #else 1164 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1165 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 1166 #endif 1167 1168 #ifdef VERBOSE_DEBUG 1169 #define dev_vdbg dev_dbg 1170 #else 1171 #define dev_vdbg(dev, format, arg...) \ 1172 ({ \ 1173 if (0) \ 1174 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1175 0; \ 1176 }) 1177 #endif 1178 1179 /* 1180 * dev_WARN*() acts like dev_printk(), but with the key difference of 1181 * using WARN/WARN_ONCE to include file/line information and a backtrace. 1182 */ 1183 #define dev_WARN(dev, format, arg...) \ 1184 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg); 1185 1186 #define dev_WARN_ONCE(dev, condition, format, arg...) \ 1187 WARN_ONCE(condition, "%s %s: " format, \ 1188 dev_driver_string(dev), dev_name(dev), ## arg) 1189 1190 /* Create alias, so I can be autoloaded. */ 1191 #define MODULE_ALIAS_CHARDEV(major,minor) \ 1192 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 1193 #define MODULE_ALIAS_CHARDEV_MAJOR(major) \ 1194 MODULE_ALIAS("char-major-" __stringify(major) "-*") 1195 1196 #ifdef CONFIG_SYSFS_DEPRECATED 1197 extern long sysfs_deprecated; 1198 #else 1199 #define sysfs_deprecated 0 1200 #endif 1201 1202 /** 1203 * module_driver() - Helper macro for drivers that don't do anything 1204 * special in module init/exit. This eliminates a lot of boilerplate. 1205 * Each module may only use this macro once, and calling it replaces 1206 * module_init() and module_exit(). 1207 * 1208 * @__driver: driver name 1209 * @__register: register function for this driver type 1210 * @__unregister: unregister function for this driver type 1211 * @...: Additional arguments to be passed to __register and __unregister. 1212 * 1213 * Use this macro to construct bus specific macros for registering 1214 * drivers, and do not use it on its own. 1215 */ 1216 #define module_driver(__driver, __register, __unregister, ...) \ 1217 static int __init __driver##_init(void) \ 1218 { \ 1219 return __register(&(__driver) , ##__VA_ARGS__); \ 1220 } \ 1221 module_init(__driver##_init); \ 1222 static void __exit __driver##_exit(void) \ 1223 { \ 1224 __unregister(&(__driver) , ##__VA_ARGS__); \ 1225 } \ 1226 module_exit(__driver##_exit); 1227 1228 #endif /* _DEVICE_H_ */
1 /* 2 * kref.h - library routines for handling generic reference counted objects 3 * 4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 5 * Copyright (C) 2004 IBM Corp. 6 * 7 * based on kobject.h which was: 8 * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org> 9 * Copyright (C) 2002-2003 Open Source Development Labs 10 * 11 * This file is released under the GPLv2. 12 * 13 */ 14 15 #ifndef _KREF_H_ 16 #define _KREF_H_ 17 18 #include <linux/bug.h> 19 #include <linux/atomic.h> 20 #include <linux/kernel.h> 21 #include <linux/mutex.h> 22 #include <linux/spinlock.h> 23 24 struct kref { 25 atomic_t refcount; 26 }; 27 28 /** 29 * kref_init - initialize object. 30 * @kref: object in question. 31 */ 32 static inline void kref_init(struct kref *kref) 33 { 34 atomic_set(&kref->refcount, 1); 35 } 36 37 /** 38 * kref_get - increment refcount for object. 39 * @kref: object. 40 */ 41 static inline void kref_get(struct kref *kref) 42 { 43 /* If refcount was 0 before incrementing then we have a race 44 * condition when this kref is freeing by some other thread right now. 45 * In this case one should use kref_get_unless_zero() 46 */ 47 WARN_ON_ONCE(atomic_inc_return(&kref->refcount) < 2); 48 } 49 50 /** 51 * kref_sub - subtract a number of refcounts for object. 52 * @kref: object. 53 * @count: Number of recounts to subtract. 54 * @release: pointer to the function that will clean up the object when the 55 * last reference to the object is released. 56 * This pointer is required, and it is not acceptable to pass kfree 57 * in as this function. If the caller does pass kfree to this 58 * function, you will be publicly mocked mercilessly by the kref 59 * maintainer, and anyone else who happens to notice it. You have 60 * been warned. 61 * 62 * Subtract @count from the refcount, and if 0, call release(). 63 * Return 1 if the object was removed, otherwise return 0. Beware, if this 64 * function returns 0, you still can not count on the kref from remaining in 65 * memory. Only use the return value if you want to see if the kref is now 66 * gone, not present. 67 */ 68 static inline int kref_sub(struct kref *kref, unsigned int count, 69 void (*release)(struct kref *kref)) 70 { 71 WARN_ON(release == NULL); 72 73 if (atomic_sub_and_test((int) count, &kref->refcount)) { 74 release(kref); 75 return 1; 76 } 77 return 0; 78 } 79 80 /** 81 * kref_put - decrement refcount for object. 82 * @kref: object. 83 * @release: pointer to the function that will clean up the object when the 84 * last reference to the object is released. 85 * This pointer is required, and it is not acceptable to pass kfree 86 * in as this function. If the caller does pass kfree to this 87 * function, you will be publicly mocked mercilessly by the kref 88 * maintainer, and anyone else who happens to notice it. You have 89 * been warned. 90 * 91 * Decrement the refcount, and if 0, call release(). 92 * Return 1 if the object was removed, otherwise return 0. Beware, if this 93 * function returns 0, you still can not count on the kref from remaining in 94 * memory. Only use the return value if you want to see if the kref is now 95 * gone, not present. 96 */ 97 static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) 98 { 99 return kref_sub(kref, 1, release); 100 } 101 102 /** 103 * kref_put_spinlock_irqsave - decrement refcount for object. 104 * @kref: object. 105 * @release: pointer to the function that will clean up the object when the 106 * last reference to the object is released. 107 * This pointer is required, and it is not acceptable to pass kfree 108 * in as this function. 109 * @lock: lock to take in release case 110 * 111 * Behaves identical to kref_put with one exception. If the reference count 112 * drops to zero, the lock will be taken atomically wrt dropping the reference 113 * count. The release function has to call spin_unlock() without _irqrestore. 114 */ 115 static inline int kref_put_spinlock_irqsave(struct kref *kref, 116 void (*release)(struct kref *kref), 117 spinlock_t *lock) 118 { 119 unsigned long flags; 120 121 WARN_ON(release == NULL); 122 if (atomic_add_unless(&kref->refcount, -1, 1)) 123 return 0; 124 spin_lock_irqsave(lock, flags); 125 if (atomic_dec_and_test(&kref->refcount)) { 126 release(kref); 127 local_irq_restore(flags); 128 return 1; 129 } 130 spin_unlock_irqrestore(lock, flags); 131 return 0; 132 } 133 134 static inline int kref_put_mutex(struct kref *kref, 135 void (*release)(struct kref *kref), 136 struct mutex *lock) 137 { 138 WARN_ON(release == NULL); 139 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) { 140 mutex_lock(lock); 141 if (unlikely(!atomic_dec_and_test(&kref->refcount))) { 142 mutex_unlock(lock); 143 return 0; 144 } 145 release(kref); 146 return 1; 147 } 148 return 0; 149 } 150 151 /** 152 * kref_get_unless_zero - Increment refcount for object unless it is zero. 153 * @kref: object. 154 * 155 * Return non-zero if the increment succeeded. Otherwise return 0. 156 * 157 * This function is intended to simplify locking around refcounting for 158 * objects that can be looked up from a lookup structure, and which are 159 * removed from that lookup structure in the object destructor. 160 * Operations on such objects require at least a read lock around 161 * lookup + kref_get, and a write lock around kref_put + remove from lookup 162 * structure. Furthermore, RCU implementations become extremely tricky. 163 * With a lookup followed by a kref_get_unless_zero *with return value check* 164 * locking in the kref_put path can be deferred to the actual removal from 165 * the lookup structure and RCU lookups become trivial. 166 */ 167 static inline int __must_check kref_get_unless_zero(struct kref *kref) 168 { 169 return atomic_add_unless(&kref->refcount, 1, 0); 170 } 171 #endif /* _KREF_H_ */
1 /* 2 * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk). 3 * 4 * (C) SGI 2006, Christoph Lameter 5 * Cleaned up and restructured to ease the addition of alternative 6 * implementations of SLAB allocators. 7 * (C) Linux Foundation 2008-2013 8 * Unified interface for all slab allocators 9 */ 10 11 #ifndef _LINUX_SLAB_H 12 #define _LINUX_SLAB_H 13 14 #include <linux/gfp.h> 15 #include <linux/types.h> 16 #include <linux/workqueue.h> 17 18 19 /* 20 * Flags to pass to kmem_cache_create(). 21 * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set. 22 */ 23 #define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */ 24 #define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */ 25 #define SLAB_POISON 0x00000800UL /* DEBUG: Poison objects */ 26 #define SLAB_HWCACHE_ALIGN 0x00002000UL /* Align objs on cache lines */ 27 #define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */ 28 #define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */ 29 #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */ 30 /* 31 * SLAB_DESTROY_BY_RCU - **WARNING** READ THIS! 32 * 33 * This delays freeing the SLAB page by a grace period, it does _NOT_ 34 * delay object freeing. This means that if you do kmem_cache_free() 35 * that memory location is free to be reused at any time. Thus it may 36 * be possible to see another object there in the same RCU grace period. 37 * 38 * This feature only ensures the memory location backing the object 39 * stays valid, the trick to using this is relying on an independent 40 * object validation pass. Something like: 41 * 42 * rcu_read_lock() 43 * again: 44 * obj = lockless_lookup(key); 45 * if (obj) { 46 * if (!try_get_ref(obj)) // might fail for free objects 47 * goto again; 48 * 49 * if (obj->key != key) { // not the object we expected 50 * put_ref(obj); 51 * goto again; 52 * } 53 * } 54 * rcu_read_unlock(); 55 * 56 * This is useful if we need to approach a kernel structure obliquely, 57 * from its address obtained without the usual locking. We can lock 58 * the structure to stabilize it and check it's still at the given address, 59 * only if we can be sure that the memory has not been meanwhile reused 60 * for some other kind of object (which our subsystem's lock might corrupt). 61 * 62 * rcu_read_lock before reading the address, then rcu_read_unlock after 63 * taking the spinlock within the structure expected at that address. 64 */ 65 #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ 66 #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ 67 #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */ 68 69 /* Flag to prevent checks on free */ 70 #ifdef CONFIG_DEBUG_OBJECTS 71 # define SLAB_DEBUG_OBJECTS 0x00400000UL 72 #else 73 # define SLAB_DEBUG_OBJECTS 0x00000000UL 74 #endif 75 76 #define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */ 77 78 /* Don't track use of uninitialized memory */ 79 #ifdef CONFIG_KMEMCHECK 80 # define SLAB_NOTRACK 0x01000000UL 81 #else 82 # define SLAB_NOTRACK 0x00000000UL 83 #endif 84 #ifdef CONFIG_FAILSLAB 85 # define SLAB_FAILSLAB 0x02000000UL /* Fault injection mark */ 86 #else 87 # define SLAB_FAILSLAB 0x00000000UL 88 #endif 89 90 /* The following flags affect the page allocator grouping pages by mobility */ 91 #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 92 #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 93 /* 94 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. 95 * 96 * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault. 97 * 98 * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can. 99 * Both make kfree a no-op. 100 */ 101 #define ZERO_SIZE_PTR ((void *)16) 102 103 #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 104 (unsigned long)ZERO_SIZE_PTR) 105 106 #include <linux/kmemleak.h> 107 108 struct mem_cgroup; 109 /* 110 * struct kmem_cache related prototypes 111 */ 112 void __init kmem_cache_init(void); 113 int slab_is_available(void); 114 115 struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 116 unsigned long, 117 void (*)(void *)); 118 #ifdef CONFIG_MEMCG_KMEM 119 struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *, 120 struct kmem_cache *, 121 const char *); 122 #endif 123 void kmem_cache_destroy(struct kmem_cache *); 124 int kmem_cache_shrink(struct kmem_cache *); 125 void kmem_cache_free(struct kmem_cache *, void *); 126 127 /* 128 * Please use this macro to create slab caches. Simply specify the 129 * name of the structure and maybe some flags that are listed above. 130 * 131 * The alignment of the struct determines object alignment. If you 132 * f.e. add ____cacheline_aligned_in_smp to the struct declaration 133 * then the objects will be properly aligned in SMP configurations. 134 */ 135 #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\ 136 sizeof(struct __struct), __alignof__(struct __struct),\ 137 (__flags), NULL) 138 139 /* 140 * Common kmalloc functions provided by all allocators 141 */ 142 void * __must_check __krealloc(const void *, size_t, gfp_t); 143 void * __must_check krealloc(const void *, size_t, gfp_t); 144 void kfree(const void *); 145 void kzfree(const void *); 146 size_t ksize(const void *); 147 148 /* 149 * Some archs want to perform DMA into kmalloc caches and need a guaranteed 150 * alignment larger than the alignment of a 64-bit integer. 151 * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that. 152 */ 153 #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8 154 #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN 155 #define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN 156 #define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN) 157 #else 158 #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) 159 #endif 160 161 #ifdef CONFIG_SLOB 162 /* 163 * Common fields provided in kmem_cache by all slab allocators 164 * This struct is either used directly by the allocator (SLOB) 165 * or the allocator must include definitions for all fields 166 * provided in kmem_cache_common in their definition of kmem_cache. 167 * 168 * Once we can do anonymous structs (C11 standard) we could put a 169 * anonymous struct definition in these allocators so that the 170 * separate allocations in the kmem_cache structure of SLAB and 171 * SLUB is no longer needed. 172 */ 173 struct kmem_cache { 174 unsigned int object_size;/* The original size of the object */ 175 unsigned int size; /* The aligned/padded/added on size */ 176 unsigned int align; /* Alignment as calculated */ 177 unsigned long flags; /* Active flags on the slab */ 178 const char *name; /* Slab name for sysfs */ 179 int refcount; /* Use counter */ 180 void (*ctor)(void *); /* Called on object slot creation */ 181 struct list_head list; /* List of all slab caches on the system */ 182 }; 183 184 #endif /* CONFIG_SLOB */ 185 186 /* 187 * Kmalloc array related definitions 188 */ 189 190 #ifdef CONFIG_SLAB 191 /* 192 * The largest kmalloc size supported by the SLAB allocators is 193 * 32 megabyte (2^25) or the maximum allocatable page order if that is 194 * less than 32 MB. 195 * 196 * WARNING: Its not easy to increase this value since the allocators have 197 * to do various tricks to work around compiler limitations in order to 198 * ensure proper constant folding. 199 */ 200 #define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ 201 (MAX_ORDER + PAGE_SHIFT - 1) : 25) 202 #define KMALLOC_SHIFT_MAX KMALLOC_SHIFT_HIGH 203 #ifndef KMALLOC_SHIFT_LOW 204 #define KMALLOC_SHIFT_LOW 5 205 #endif 206 #endif 207 208 #ifdef CONFIG_SLUB 209 /* 210 * SLUB directly allocates requests fitting in to an order-1 page 211 * (PAGE_SIZE*2). Larger requests are passed to the page allocator. 212 */ 213 #define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1) 214 #define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT) 215 #ifndef KMALLOC_SHIFT_LOW 216 #define KMALLOC_SHIFT_LOW 3 217 #endif 218 #endif 219 220 #ifdef CONFIG_SLOB 221 /* 222 * SLOB passes all requests larger than one page to the page allocator. 223 * No kmalloc array is necessary since objects of different sizes can 224 * be allocated from the same page. 225 */ 226 #define KMALLOC_SHIFT_HIGH PAGE_SHIFT 227 #define KMALLOC_SHIFT_MAX 30 228 #ifndef KMALLOC_SHIFT_LOW 229 #define KMALLOC_SHIFT_LOW 3 230 #endif 231 #endif 232 233 /* Maximum allocatable size */ 234 #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) 235 /* Maximum size for which we actually use a slab cache */ 236 #define KMALLOC_MAX_CACHE_SIZE (1UL << KMALLOC_SHIFT_HIGH) 237 /* Maximum order allocatable via the slab allocagtor */ 238 #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_MAX - PAGE_SHIFT) 239 240 /* 241 * Kmalloc subsystem. 242 */ 243 #ifndef KMALLOC_MIN_SIZE 244 #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 245 #endif 246 247 /* 248 * This restriction comes from byte sized index implementation. 249 * Page size is normally 2^12 bytes and, in this case, if we want to use 250 * byte sized index which can represent 2^8 entries, the size of the object 251 * should be equal or greater to 2^12 / 2^8 = 2^4 = 16. 252 * If minimum size of kmalloc is less than 16, we use it as minimum object 253 * size and give up to use byte sized index. 254 */ 255 #define SLAB_OBJ_MIN_SIZE (KMALLOC_MIN_SIZE < 16 ? \ 256 (KMALLOC_MIN_SIZE) : 16) 257 258 #ifndef CONFIG_SLOB 259 extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 260 #ifdef CONFIG_ZONE_DMA 261 extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; 262 #endif 263 264 /* 265 * Figure out which kmalloc slab an allocation of a certain size 266 * belongs to. 267 * 0 = zero alloc 268 * 1 = 65 .. 96 bytes 269 * 2 = 120 .. 192 bytes 270 * n = 2^(n-1) .. 2^n -1 271 */ 272 static __always_inline int kmalloc_index(size_t size) 273 { 274 if (!size) 275 return 0; 276 277 if (size <= KMALLOC_MIN_SIZE) 278 return KMALLOC_SHIFT_LOW; 279 280 if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96) 281 return 1; 282 if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192) 283 return 2; 284 if (size <= 8) return 3; 285 if (size <= 16) return 4; 286 if (size <= 32) return 5; 287 if (size <= 64) return 6; 288 if (size <= 128) return 7; 289 if (size <= 256) return 8; 290 if (size <= 512) return 9; 291 if (size <= 1024) return 10; 292 if (size <= 2 * 1024) return 11; 293 if (size <= 4 * 1024) return 12; 294 if (size <= 8 * 1024) return 13; 295 if (size <= 16 * 1024) return 14; 296 if (size <= 32 * 1024) return 15; 297 if (size <= 64 * 1024) return 16; 298 if (size <= 128 * 1024) return 17; 299 if (size <= 256 * 1024) return 18; 300 if (size <= 512 * 1024) return 19; 301 if (size <= 1024 * 1024) return 20; 302 if (size <= 2 * 1024 * 1024) return 21; 303 if (size <= 4 * 1024 * 1024) return 22; 304 if (size <= 8 * 1024 * 1024) return 23; 305 if (size <= 16 * 1024 * 1024) return 24; 306 if (size <= 32 * 1024 * 1024) return 25; 307 if (size <= 64 * 1024 * 1024) return 26; 308 BUG(); 309 310 /* Will never be reached. Needed because the compiler may complain */ 311 return -1; 312 } 313 #endif /* !CONFIG_SLOB */ 314 315 void *__kmalloc(size_t size, gfp_t flags); 316 void *kmem_cache_alloc(struct kmem_cache *, gfp_t flags); 317 318 #ifdef CONFIG_NUMA 319 void *__kmalloc_node(size_t size, gfp_t flags, int node); 320 void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 321 #else 322 static __always_inline void *__kmalloc_node(size_t size, gfp_t flags, int node) 323 { 324 return __kmalloc(size, flags); 325 } 326 327 static __always_inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node) 328 { 329 return kmem_cache_alloc(s, flags); 330 } 331 #endif 332 333 #ifdef CONFIG_TRACING 334 extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t); 335 336 #ifdef CONFIG_NUMA 337 extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s, 338 gfp_t gfpflags, 339 int node, size_t size); 340 #else 341 static __always_inline void * 342 kmem_cache_alloc_node_trace(struct kmem_cache *s, 343 gfp_t gfpflags, 344 int node, size_t size) 345 { 346 return kmem_cache_alloc_trace(s, gfpflags, size); 347 } 348 #endif /* CONFIG_NUMA */ 349 350 #else /* CONFIG_TRACING */ 351 static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s, 352 gfp_t flags, size_t size) 353 { 354 return kmem_cache_alloc(s, flags); 355 } 356 357 static __always_inline void * 358 kmem_cache_alloc_node_trace(struct kmem_cache *s, 359 gfp_t gfpflags, 360 int node, size_t size) 361 { 362 return kmem_cache_alloc_node(s, gfpflags, node); 363 } 364 #endif /* CONFIG_TRACING */ 365 366 #ifdef CONFIG_SLAB 367 #include <linux/slab_def.h> 368 #endif 369 370 #ifdef CONFIG_SLUB 371 #include <linux/slub_def.h> 372 #endif 373 374 extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order); 375 376 #ifdef CONFIG_TRACING 377 extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order); 378 #else 379 static __always_inline void * 380 kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) 381 { 382 return kmalloc_order(size, flags, order); 383 } 384 #endif 385 386 static __always_inline void *kmalloc_large(size_t size, gfp_t flags) 387 { 388 unsigned int order = get_order(size); 389 return kmalloc_order_trace(size, flags, order); 390 } 391 392 /** 393 * kmalloc - allocate memory 394 * @size: how many bytes of memory are required. 395 * @flags: the type of memory to allocate. 396 * 397 * kmalloc is the normal method of allocating memory 398 * for objects smaller than page size in the kernel. 399 * 400 * The @flags argument may be one of: 401 * 402 * %GFP_USER - Allocate memory on behalf of user. May sleep. 403 * 404 * %GFP_KERNEL - Allocate normal kernel ram. May sleep. 405 * 406 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools. 407 * For example, use this inside interrupt handlers. 408 * 409 * %GFP_HIGHUSER - Allocate pages from high memory. 410 * 411 * %GFP_NOIO - Do not do any I/O at all while trying to get memory. 412 * 413 * %GFP_NOFS - Do not make any fs calls while trying to get memory. 414 * 415 * %GFP_NOWAIT - Allocation will not sleep. 416 * 417 * %__GFP_THISNODE - Allocate node-local memory only. 418 * 419 * %GFP_DMA - Allocation suitable for DMA. 420 * Should only be used for kmalloc() caches. Otherwise, use a 421 * slab created with SLAB_DMA. 422 * 423 * Also it is possible to set different flags by OR'ing 424 * in one or more of the following additional @flags: 425 * 426 * %__GFP_COLD - Request cache-cold pages instead of 427 * trying to return cache-warm pages. 428 * 429 * %__GFP_HIGH - This allocation has high priority and may use emergency pools. 430 * 431 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail 432 * (think twice before using). 433 * 434 * %__GFP_NORETRY - If memory is not immediately available, 435 * then give up at once. 436 * 437 * %__GFP_NOWARN - If allocation fails, don't issue any warnings. 438 * 439 * %__GFP_REPEAT - If allocation fails initially, try once more before failing. 440 * 441 * There are other flags available as well, but these are not intended 442 * for general use, and so are not documented here. For a full list of 443 * potential flags, always refer to linux/gfp.h. 444 */ 445 static __always_inline void *kmalloc(size_t size, gfp_t flags) 446 { 447 if (__builtin_constant_p(size)) { 448 if (size > KMALLOC_MAX_CACHE_SIZE) 449 return kmalloc_large(size, flags); 450 #ifndef CONFIG_SLOB 451 if (!(flags & GFP_DMA)) { 452 int index = kmalloc_index(size); 453 454 if (!index) 455 return ZERO_SIZE_PTR; 456 457 return kmem_cache_alloc_trace(kmalloc_caches[index], 458 flags, size); 459 } 460 #endif 461 } 462 return __kmalloc(size, flags); 463 } 464 465 /* 466 * Determine size used for the nth kmalloc cache. 467 * return size or 0 if a kmalloc cache for that 468 * size does not exist 469 */ 470 static __always_inline int kmalloc_size(int n) 471 { 472 #ifndef CONFIG_SLOB 473 if (n > 2) 474 return 1 << n; 475 476 if (n == 1 && KMALLOC_MIN_SIZE <= 32) 477 return 96; 478 479 if (n == 2 && KMALLOC_MIN_SIZE <= 64) 480 return 192; 481 #endif 482 return 0; 483 } 484 485 static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 486 { 487 #ifndef CONFIG_SLOB 488 if (__builtin_constant_p(size) && 489 size <= KMALLOC_MAX_CACHE_SIZE && !(flags & GFP_DMA)) { 490 int i = kmalloc_index(size); 491 492 if (!i) 493 return ZERO_SIZE_PTR; 494 495 return kmem_cache_alloc_node_trace(kmalloc_caches[i], 496 flags, node, size); 497 } 498 #endif 499 return __kmalloc_node(size, flags, node); 500 } 501 502 /* 503 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 504 * Intended for arches that get misalignment faults even for 64 bit integer 505 * aligned buffers. 506 */ 507 #ifndef ARCH_SLAB_MINALIGN 508 #define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) 509 #endif 510 /* 511 * This is the main placeholder for memcg-related information in kmem caches. 512 * struct kmem_cache will hold a pointer to it, so the memory cost while 513 * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it 514 * would otherwise be if that would be bundled in kmem_cache: we'll need an 515 * extra pointer chase. But the trade off clearly lays in favor of not 516 * penalizing non-users. 517 * 518 * Both the root cache and the child caches will have it. For the root cache, 519 * this will hold a dynamically allocated array large enough to hold 520 * information about the currently limited memcgs in the system. To allow the 521 * array to be accessed without taking any locks, on relocation we free the old 522 * version only after a grace period. 523 * 524 * Child caches will hold extra metadata needed for its operation. Fields are: 525 * 526 * @memcg: pointer to the memcg this cache belongs to 527 * @list: list_head for the list of all caches in this memcg 528 * @root_cache: pointer to the global, root cache, this cache was derived from 529 * @nr_pages: number of pages that belongs to this cache. 530 */ 531 struct memcg_cache_params { 532 bool is_root_cache; 533 union { 534 struct { 535 struct rcu_head rcu_head; 536 struct kmem_cache *memcg_caches[0]; 537 }; 538 struct { 539 struct mem_cgroup *memcg; 540 struct list_head list; 541 struct kmem_cache *root_cache; 542 atomic_t nr_pages; 543 }; 544 }; 545 }; 546 547 int memcg_update_all_caches(int num_memcgs); 548 549 struct seq_file; 550 int cache_show(struct kmem_cache *s, struct seq_file *m); 551 void print_slabinfo_header(struct seq_file *m); 552 553 /** 554 * kmalloc_array - allocate memory for an array. 555 * @n: number of elements. 556 * @size: element size. 557 * @flags: the type of memory to allocate (see kmalloc). 558 */ 559 static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 560 { 561 if (size != 0 && n > SIZE_MAX / size) 562 return NULL; 563 return __kmalloc(n * size, flags); 564 } 565 566 /** 567 * kcalloc - allocate memory for an array. The memory is set to zero. 568 * @n: number of elements. 569 * @size: element size. 570 * @flags: the type of memory to allocate (see kmalloc). 571 */ 572 static inline void *kcalloc(size_t n, size_t size, gfp_t flags) 573 { 574 return kmalloc_array(n, size, flags | __GFP_ZERO); 575 } 576 577 /* 578 * kmalloc_track_caller is a special version of kmalloc that records the 579 * calling function of the routine calling it for slab leak tracking instead 580 * of just the calling function (confusing, eh?). 581 * It's useful when the call to kmalloc comes from a widely-used standard 582 * allocator where we care about the real place the memory allocation 583 * request comes from. 584 */ 585 #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 586 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \ 587 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING)) 588 extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 589 #define kmalloc_track_caller(size, flags) \ 590 __kmalloc_track_caller(size, flags, _RET_IP_) 591 #else 592 #define kmalloc_track_caller(size, flags) \ 593 __kmalloc(size, flags) 594 #endif /* DEBUG_SLAB */ 595 596 #ifdef CONFIG_NUMA 597 /* 598 * kmalloc_node_track_caller is a special version of kmalloc_node that 599 * records the calling function of the routine calling it for slab leak 600 * tracking instead of just the calling function (confusing, eh?). 601 * It's useful when the call to kmalloc_node comes from a widely-used 602 * standard allocator where we care about the real place the memory 603 * allocation request comes from. 604 */ 605 #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 606 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \ 607 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING)) 608 extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 609 #define kmalloc_node_track_caller(size, flags, node) \ 610 __kmalloc_node_track_caller(size, flags, node, \ 611 _RET_IP_) 612 #else 613 #define kmalloc_node_track_caller(size, flags, node) \ 614 __kmalloc_node(size, flags, node) 615 #endif 616 617 #else /* CONFIG_NUMA */ 618 619 #define kmalloc_node_track_caller(size, flags, node) \ 620 kmalloc_track_caller(size, flags) 621 622 #endif /* CONFIG_NUMA */ 623 624 /* 625 * Shortcuts 626 */ 627 static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags) 628 { 629 return kmem_cache_alloc(k, flags | __GFP_ZERO); 630 } 631 632 /** 633 * kzalloc - allocate memory. The memory is set to zero. 634 * @size: how many bytes of memory are required. 635 * @flags: the type of memory to allocate (see kmalloc). 636 */ 637 static inline void *kzalloc(size_t size, gfp_t flags) 638 { 639 return kmalloc(size, flags | __GFP_ZERO); 640 } 641 642 /** 643 * kzalloc_node - allocate zeroed memory from a particular memory node. 644 * @size: how many bytes of memory are required. 645 * @flags: the type of memory to allocate (see kmalloc). 646 * @node: memory node from which to allocate 647 */ 648 static inline void *kzalloc_node(size_t size, gfp_t flags, int node) 649 { 650 return kmalloc_node(size, flags | __GFP_ZERO, node); 651 } 652 653 /* 654 * Determine the size of a slab object 655 */ 656 static inline unsigned int kmem_cache_size(struct kmem_cache *s) 657 { 658 return s->object_size; 659 } 660 661 void __init kmem_cache_init_late(void); 662 663 #endif /* _LINUX_SLAB_H */
1 #ifndef __LINUX_USB_H 2 #define __LINUX_USB_H 3 4 #include <linux/mod_devicetable.h> 5 #include <linux/usb/ch9.h> 6 7 #define USB_MAJOR 180 8 #define USB_DEVICE_MAJOR 189 9 10 11 #ifdef __KERNEL__ 12 13 #include <linux/errno.h> /* for -ENODEV */ 14 #include <linux/delay.h> /* for mdelay() */ 15 #include <linux/interrupt.h> /* for in_interrupt() */ 16 #include <linux/list.h> /* for struct list_head */ 17 #include <linux/kref.h> /* for struct kref */ 18 #include <linux/device.h> /* for struct device */ 19 #include <linux/fs.h> /* for struct file_operations */ 20 #include <linux/completion.h> /* for struct completion */ 21 #include <linux/sched.h> /* for current && schedule_timeout */ 22 #include <linux/mutex.h> /* for struct mutex */ 23 #include <linux/pm_runtime.h> /* for runtime PM */ 24 25 struct usb_device; 26 struct usb_driver; 27 struct wusb_dev; 28 29 /*-------------------------------------------------------------------------*/ 30 31 /* 32 * Host-side wrappers for standard USB descriptors ... these are parsed 33 * from the data provided by devices. Parsing turns them from a flat 34 * sequence of descriptors into a hierarchy: 35 * 36 * - devices have one (usually) or more configs; 37 * - configs have one (often) or more interfaces; 38 * - interfaces have one (usually) or more settings; 39 * - each interface setting has zero or (usually) more endpoints. 40 * - a SuperSpeed endpoint has a companion descriptor 41 * 42 * And there might be other descriptors mixed in with those. 43 * 44 * Devices may also have class-specific or vendor-specific descriptors. 45 */ 46 47 struct ep_device; 48 49 /** 50 * struct usb_host_endpoint - host-side endpoint descriptor and queue 51 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 52 * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint 53 * @urb_list: urbs queued to this endpoint; maintained by usbcore 54 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 55 * with one or more transfer descriptors (TDs) per urb 56 * @ep_dev: ep_device for sysfs info 57 * @extra: descriptors following this endpoint in the configuration 58 * @extralen: how many bytes of "extra" are valid 59 * @enabled: URBs may be submitted to this endpoint 60 * @streams: number of USB-3 streams allocated on the endpoint 61 * 62 * USB requests are always queued to a given endpoint, identified by a 63 * descriptor within an active interface in a given USB configuration. 64 */ 65 struct usb_host_endpoint { 66 struct usb_endpoint_descriptor desc; 67 struct usb_ss_ep_comp_descriptor ss_ep_comp; 68 struct list_head urb_list; 69 void *hcpriv; 70 struct ep_device *ep_dev; /* For sysfs info */ 71 72 unsigned char *extra; /* Extra descriptors */ 73 int extralen; 74 int enabled; 75 int streams; 76 }; 77 78 /* host-side wrapper for one interface setting's parsed descriptors */ 79 struct usb_host_interface { 80 struct usb_interface_descriptor desc; 81 82 int extralen; 83 unsigned char *extra; /* Extra descriptors */ 84 85 /* array of desc.bNumEndpoint endpoints associated with this 86 * interface setting. these will be in no particular order. 87 */ 88 struct usb_host_endpoint *endpoint; 89 90 char *string; /* iInterface string, if present */ 91 }; 92 93 enum usb_interface_condition { 94 USB_INTERFACE_UNBOUND = 0, 95 USB_INTERFACE_BINDING, 96 USB_INTERFACE_BOUND, 97 USB_INTERFACE_UNBINDING, 98 }; 99 100 /** 101 * struct usb_interface - what usb device drivers talk to 102 * @altsetting: array of interface structures, one for each alternate 103 * setting that may be selected. Each one includes a set of 104 * endpoint configurations. They will be in no particular order. 105 * @cur_altsetting: the current altsetting. 106 * @num_altsetting: number of altsettings defined. 107 * @intf_assoc: interface association descriptor 108 * @minor: the minor number assigned to this interface, if this 109 * interface is bound to a driver that uses the USB major number. 110 * If this interface does not use the USB major, this field should 111 * be unused. The driver should set this value in the probe() 112 * function of the driver, after it has been assigned a minor 113 * number from the USB core by calling usb_register_dev(). 114 * @condition: binding state of the interface: not bound, binding 115 * (in probe()), bound to a driver, or unbinding (in disconnect()) 116 * @sysfs_files_created: sysfs attributes exist 117 * @ep_devs_created: endpoint child pseudo-devices exist 118 * @unregistering: flag set when the interface is being unregistered 119 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 120 * capability during autosuspend. 121 * @needs_altsetting0: flag set when a set-interface request for altsetting 0 122 * has been deferred. 123 * @needs_binding: flag set when the driver should be re-probed or unbound 124 * following a reset or suspend operation it doesn't support. 125 * @dev: driver model's view of this device 126 * @usb_dev: if an interface is bound to the USB major, this will point 127 * to the sysfs representation for that device. 128 * @pm_usage_cnt: PM usage counter for this interface 129 * @reset_ws: Used for scheduling resets from atomic context. 130 * @reset_running: set to 1 if the interface is currently running a 131 * queued reset so that usb_cancel_queued_reset() doesn't try to 132 * remove from the workqueue when running inside the worker 133 * thread. See __usb_queue_reset_device(). 134 * @resetting_device: USB core reset the device, so use alt setting 0 as 135 * current; needs bandwidth alloc after reset. 136 * 137 * USB device drivers attach to interfaces on a physical device. Each 138 * interface encapsulates a single high level function, such as feeding 139 * an audio stream to a speaker or reporting a change in a volume control. 140 * Many USB devices only have one interface. The protocol used to talk to 141 * an interface's endpoints can be defined in a usb "class" specification, 142 * or by a product's vendor. The (default) control endpoint is part of 143 * every interface, but is never listed among the interface's descriptors. 144 * 145 * The driver that is bound to the interface can use standard driver model 146 * calls such as dev_get_drvdata() on the dev member of this structure. 147 * 148 * Each interface may have alternate settings. The initial configuration 149 * of a device sets altsetting 0, but the device driver can change 150 * that setting using usb_set_interface(). Alternate settings are often 151 * used to control the use of periodic endpoints, such as by having 152 * different endpoints use different amounts of reserved USB bandwidth. 153 * All standards-conformant USB devices that use isochronous endpoints 154 * will use them in non-default settings. 155 * 156 * The USB specification says that alternate setting numbers must run from 157 * 0 to one less than the total number of alternate settings. But some 158 * devices manage to mess this up, and the structures aren't necessarily 159 * stored in numerical order anyhow. Use usb_altnum_to_altsetting() to 160 * look up an alternate setting in the altsetting array based on its number. 161 */ 162 struct usb_interface { 163 /* array of alternate settings for this interface, 164 * stored in no particular order */ 165 struct usb_host_interface *altsetting; 166 167 struct usb_host_interface *cur_altsetting; /* the currently 168 * active alternate setting */ 169 unsigned num_altsetting; /* number of alternate settings */ 170 171 /* If there is an interface association descriptor then it will list 172 * the associated interfaces */ 173 struct usb_interface_assoc_descriptor *intf_assoc; 174 175 int minor; /* minor number this interface is 176 * bound to */ 177 enum usb_interface_condition condition; /* state of binding */ 178 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 179 unsigned ep_devs_created:1; /* endpoint "devices" exist */ 180 unsigned unregistering:1; /* unregistration is in progress */ 181 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 182 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ 183 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 184 unsigned reset_running:1; 185 unsigned resetting_device:1; /* true: bandwidth alloc after reset */ 186 187 struct device dev; /* interface specific device info */ 188 struct device *usb_dev; 189 atomic_t pm_usage_cnt; /* usage counter for autosuspend */ 190 struct work_struct reset_ws; /* for resets in atomic context */ 191 }; 192 #define to_usb_interface(d) container_of(d, struct usb_interface, dev) 193 194 static inline void *usb_get_intfdata(struct usb_interface *intf) 195 { 196 return dev_get_drvdata(&intf->dev); 197 } 198 199 static inline void usb_set_intfdata(struct usb_interface *intf, void *data) 200 { 201 dev_set_drvdata(&intf->dev, data); 202 } 203 204 struct usb_interface *usb_get_intf(struct usb_interface *intf); 205 void usb_put_intf(struct usb_interface *intf); 206 207 /* Hard limit */ 208 #define USB_MAXENDPOINTS 30 209 /* this maximum is arbitrary */ 210 #define USB_MAXINTERFACES 32 211 #define USB_MAXIADS (USB_MAXINTERFACES/2) 212 213 /** 214 * struct usb_interface_cache - long-term representation of a device interface 215 * @num_altsetting: number of altsettings defined. 216 * @ref: reference counter. 217 * @altsetting: variable-length array of interface structures, one for 218 * each alternate setting that may be selected. Each one includes a 219 * set of endpoint configurations. They will be in no particular order. 220 * 221 * These structures persist for the lifetime of a usb_device, unlike 222 * struct usb_interface (which persists only as long as its configuration 223 * is installed). The altsetting arrays can be accessed through these 224 * structures at any time, permitting comparison of configurations and 225 * providing support for the /proc/bus/usb/devices pseudo-file. 226 */ 227 struct usb_interface_cache { 228 unsigned num_altsetting; /* number of alternate settings */ 229 struct kref ref; /* reference counter */ 230 231 /* variable-length array of alternate settings for this interface, 232 * stored in no particular order */ 233 struct usb_host_interface altsetting[0]; 234 }; 235 #define ref_to_usb_interface_cache(r) \ 236 container_of(r, struct usb_interface_cache, ref) 237 #define altsetting_to_usb_interface_cache(a) \ 238 container_of(a, struct usb_interface_cache, altsetting[0]) 239 240 /** 241 * struct usb_host_config - representation of a device's configuration 242 * @desc: the device's configuration descriptor. 243 * @string: pointer to the cached version of the iConfiguration string, if 244 * present for this configuration. 245 * @intf_assoc: list of any interface association descriptors in this config 246 * @interface: array of pointers to usb_interface structures, one for each 247 * interface in the configuration. The number of interfaces is stored 248 * in desc.bNumInterfaces. These pointers are valid only while the 249 * the configuration is active. 250 * @intf_cache: array of pointers to usb_interface_cache structures, one 251 * for each interface in the configuration. These structures exist 252 * for the entire life of the device. 253 * @extra: pointer to buffer containing all extra descriptors associated 254 * with this configuration (those preceding the first interface 255 * descriptor). 256 * @extralen: length of the extra descriptors buffer. 257 * 258 * USB devices may have multiple configurations, but only one can be active 259 * at any time. Each encapsulates a different operational environment; 260 * for example, a dual-speed device would have separate configurations for 261 * full-speed and high-speed operation. The number of configurations 262 * available is stored in the device descriptor as bNumConfigurations. 263 * 264 * A configuration can contain multiple interfaces. Each corresponds to 265 * a different function of the USB device, and all are available whenever 266 * the configuration is active. The USB standard says that interfaces 267 * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot 268 * of devices get this wrong. In addition, the interface array is not 269 * guaranteed to be sorted in numerical order. Use usb_ifnum_to_if() to 270 * look up an interface entry based on its number. 271 * 272 * Device drivers should not attempt to activate configurations. The choice 273 * of which configuration to install is a policy decision based on such 274 * considerations as available power, functionality provided, and the user's 275 * desires (expressed through userspace tools). However, drivers can call 276 * usb_reset_configuration() to reinitialize the current configuration and 277 * all its interfaces. 278 */ 279 struct usb_host_config { 280 struct usb_config_descriptor desc; 281 282 char *string; /* iConfiguration string, if present */ 283 284 /* List of any Interface Association Descriptors in this 285 * configuration. */ 286 struct usb_interface_assoc_descriptor *intf_assoc[USB_MAXIADS]; 287 288 /* the interfaces associated with this configuration, 289 * stored in no particular order */ 290 struct usb_interface *interface[USB_MAXINTERFACES]; 291 292 /* Interface information available even when this is not the 293 * active configuration */ 294 struct usb_interface_cache *intf_cache[USB_MAXINTERFACES]; 295 296 unsigned char *extra; /* Extra descriptors */ 297 int extralen; 298 }; 299 300 /* USB2.0 and USB3.0 device BOS descriptor set */ 301 struct usb_host_bos { 302 struct usb_bos_descriptor *desc; 303 304 /* wireless cap descriptor is handled by wusb */ 305 struct usb_ext_cap_descriptor *ext_cap; 306 struct usb_ss_cap_descriptor *ss_cap; 307 struct usb_ss_container_id_descriptor *ss_id; 308 }; 309 310 int __usb_get_extra_descriptor(char *buffer, unsigned size, 311 unsigned char type, void **ptr); 312 #define usb_get_extra_descriptor(ifpoint, type, ptr) \ 313 __usb_get_extra_descriptor((ifpoint)->extra, \ 314 (ifpoint)->extralen, \ 315 type, (void **)ptr) 316 317 /* ----------------------------------------------------------------------- */ 318 319 /* USB device number allocation bitmap */ 320 struct usb_devmap { 321 unsigned long devicemap[128 / (8*sizeof(unsigned long))]; 322 }; 323 324 /* 325 * Allocated per bus (tree of devices) we have: 326 */ 327 struct usb_bus { 328 struct device *controller; /* host/master side hardware */ 329 int busnum; /* Bus number (in order of reg) */ 330 const char *bus_name; /* stable id (PCI slot_name etc) */ 331 u8 uses_dma; /* Does the host controller use DMA? */ 332 u8 uses_pio_for_control; /* 333 * Does the host controller use PIO 334 * for control transfers? 335 */ 336 u8 otg_port; /* 0, or number of OTG/HNP port */ 337 unsigned is_b_host:1; /* true during some HNP roleswitches */ 338 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 339 unsigned no_stop_on_short:1; /* 340 * Quirk: some controllers don't stop 341 * the ep queue on a short transfer 342 * with the URB_SHORT_NOT_OK flag set. 343 */ 344 unsigned no_sg_constraint:1; /* no sg constraint */ 345 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 346 347 int devnum_next; /* Next open device number in 348 * round-robin allocation */ 349 350 struct usb_devmap devmap; /* device address allocation map */ 351 struct usb_device *root_hub; /* Root hub */ 352 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */ 353 struct list_head bus_list; /* list of busses */ 354 355 struct mutex usb_address0_mutex; /* unaddressed device mutex */ 356 357 int bandwidth_allocated; /* on this bus: how much of the time 358 * reserved for periodic (intr/iso) 359 * requests is used, on average? 360 * Units: microseconds/frame. 361 * Limits: Full/low speed reserve 90%, 362 * while high speed reserves 80%. 363 */ 364 int bandwidth_int_reqs; /* number of Interrupt requests */ 365 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 366 367 unsigned resuming_ports; /* bit array: resuming root-hub ports */ 368 369 #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 370 struct mon_bus *mon_bus; /* non-null when associated */ 371 int monitored; /* non-zero when monitored */ 372 #endif 373 }; 374 375 struct usb_dev_state; 376 377 /* ----------------------------------------------------------------------- */ 378 379 struct usb_tt; 380 381 enum usb_device_removable { 382 USB_DEVICE_REMOVABLE_UNKNOWN = 0, 383 USB_DEVICE_REMOVABLE, 384 USB_DEVICE_FIXED, 385 }; 386 387 enum usb_port_connect_type { 388 USB_PORT_CONNECT_TYPE_UNKNOWN = 0, 389 USB_PORT_CONNECT_TYPE_HOT_PLUG, 390 USB_PORT_CONNECT_TYPE_HARD_WIRED, 391 USB_PORT_NOT_USED, 392 }; 393 394 /* 395 * USB 2.0 Link Power Management (LPM) parameters. 396 */ 397 struct usb2_lpm_parameters { 398 /* Best effort service latency indicate how long the host will drive 399 * resume on an exit from L1. 400 */ 401 unsigned int besl; 402 403 /* Timeout value in microseconds for the L1 inactivity (LPM) timer. 404 * When the timer counts to zero, the parent hub will initiate a LPM 405 * transition to L1. 406 */ 407 int timeout; 408 }; 409 410 /* 411 * USB 3.0 Link Power Management (LPM) parameters. 412 * 413 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit. 414 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit. 415 * All three are stored in nanoseconds. 416 */ 417 struct usb3_lpm_parameters { 418 /* 419 * Maximum exit latency (MEL) for the host to send a packet to the 420 * device (either a Ping for isoc endpoints, or a data packet for 421 * interrupt endpoints), the hubs to decode the packet, and for all hubs 422 * in the path to transition the links to U0. 423 */ 424 unsigned int mel; 425 /* 426 * Maximum exit latency for a device-initiated LPM transition to bring 427 * all links into U0. Abbreviated as "PEL" in section 9.4.12 of the USB 428 * 3.0 spec, with no explanation of what "P" stands for. "Path"? 429 */ 430 unsigned int pel; 431 432 /* 433 * The System Exit Latency (SEL) includes PEL, and three other 434 * latencies. After a device initiates a U0 transition, it will take 435 * some time from when the device sends the ERDY to when it will finally 436 * receive the data packet. Basically, SEL should be the worse-case 437 * latency from when a device starts initiating a U0 transition to when 438 * it will get data. 439 */ 440 unsigned int sel; 441 /* 442 * The idle timeout value that is currently programmed into the parent 443 * hub for this device. When the timer counts to zero, the parent hub 444 * will initiate an LPM transition to either U1 or U2. 445 */ 446 int timeout; 447 }; 448 449 /** 450 * struct usb_device - kernel's representation of a USB device 451 * @devnum: device number; address on a USB bus 452 * @devpath: device ID string for use in messages (e.g., /port/...) 453 * @route: tree topology hex string for use with xHCI 454 * @state: device state: configured, not attached, etc. 455 * @speed: device speed: high/full/low (or error) 456 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub 457 * @ttport: device port on that tt hub 458 * @toggle: one bit for each endpoint, with ([0] = IN, [1] = OUT) endpoints 459 * @parent: our hub, unless we're the root 460 * @bus: bus we're part of 461 * @ep0: endpoint 0 data (default control pipe) 462 * @dev: generic device interface 463 * @descriptor: USB device descriptor 464 * @bos: USB device BOS descriptor set 465 * @config: all of the device's configs 466 * @actconfig: the active configuration 467 * @ep_in: array of IN endpoints 468 * @ep_out: array of OUT endpoints 469 * @rawdescriptors: raw descriptors for each config 470 * @bus_mA: Current available from the bus 471 * @portnum: parent port number (origin 1) 472 * @level: number of USB hub ancestors 473 * @can_submit: URBs may be submitted 474 * @persist_enabled: USB_PERSIST enabled for this device 475 * @have_langid: whether string_langid is valid 476 * @authorized: policy has said we can use it; 477 * (user space) policy determines if we authorize this device to be 478 * used or not. By default, wired USB devices are authorized. 479 * WUSB devices are not, until we authorize them from user space. 480 * FIXME -- complete doc 481 * @authenticated: Crypto authentication passed 482 * @wusb: device is Wireless USB 483 * @lpm_capable: device supports LPM 484 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 485 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM 486 * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled 487 * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled 488 * @usb3_lpm_enabled: USB3 hardware LPM enabled 489 * @string_langid: language ID for strings 490 * @product: iProduct string, if present (static) 491 * @manufacturer: iManufacturer string, if present (static) 492 * @serial: iSerialNumber string, if present (static) 493 * @filelist: usbfs files that are open to this device 494 * @maxchild: number of ports if hub 495 * @quirks: quirks of the whole device 496 * @urbnum: number of URBs submitted for the whole device 497 * @active_duration: total time device is not suspended 498 * @connect_time: time device was first connected 499 * @do_remote_wakeup: remote wakeup should be enabled 500 * @reset_resume: needs reset instead of resume 501 * @port_is_suspended: the upstream port is suspended (L2 or U3) 502 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 503 * specific data for the device. 504 * @slot_id: Slot ID assigned by xHCI 505 * @removable: Device can be physically removed from this port 506 * @l1_params: best effor service latency for USB2 L1 LPM state, and L1 timeout. 507 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout. 508 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout. 509 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm() 510 * to keep track of the number of functions that require USB 3.0 Link Power 511 * Management to be disabled for this usb_device. This count should only 512 * be manipulated by those functions, with the bandwidth_mutex is held. 513 * 514 * Notes: 515 * Usbcore drivers should not set usbdev->state directly. Instead use 516 * usb_set_device_state(). 517 */ 518 struct usb_device { 519 int devnum; 520 char devpath[16]; 521 u32 route; 522 enum usb_device_state state; 523 enum usb_device_speed speed; 524 525 struct usb_tt *tt; 526 int ttport; 527 528 unsigned int toggle[2]; 529 530 struct usb_device *parent; 531 struct usb_bus *bus; 532 struct usb_host_endpoint ep0; 533 534 struct device dev; 535 536 struct usb_device_descriptor descriptor; 537 struct usb_host_bos *bos; 538 struct usb_host_config *config; 539 540 struct usb_host_config *actconfig; 541 struct usb_host_endpoint *ep_in[16]; 542 struct usb_host_endpoint *ep_out[16]; 543 544 char **rawdescriptors; 545 546 unsigned short bus_mA; 547 u8 portnum; 548 u8 level; 549 550 unsigned can_submit:1; 551 unsigned persist_enabled:1; 552 unsigned have_langid:1; 553 unsigned authorized:1; 554 unsigned authenticated:1; 555 unsigned wusb:1; 556 unsigned lpm_capable:1; 557 unsigned usb2_hw_lpm_capable:1; 558 unsigned usb2_hw_lpm_besl_capable:1; 559 unsigned usb2_hw_lpm_enabled:1; 560 unsigned usb2_hw_lpm_allowed:1; 561 unsigned usb3_lpm_enabled:1; 562 int string_langid; 563 564 /* static strings from the device */ 565 char *product; 566 char *manufacturer; 567 char *serial; 568 569 struct list_head filelist; 570 571 int maxchild; 572 573 u32 quirks; 574 atomic_t urbnum; 575 576 unsigned long active_duration; 577 578 #ifdef CONFIG_PM 579 unsigned long connect_time; 580 581 unsigned do_remote_wakeup:1; 582 unsigned reset_resume:1; 583 unsigned port_is_suspended:1; 584 #endif 585 struct wusb_dev *wusb_dev; 586 int slot_id; 587 enum usb_device_removable removable; 588 struct usb2_lpm_parameters l1_params; 589 struct usb3_lpm_parameters u1_params; 590 struct usb3_lpm_parameters u2_params; 591 unsigned lpm_disable_count; 592 }; 593 #define to_usb_device(d) container_of(d, struct usb_device, dev) 594 595 static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) 596 { 597 return to_usb_device(intf->dev.parent); 598 } 599 600 extern struct usb_device *usb_get_dev(struct usb_device *dev); 601 extern void usb_put_dev(struct usb_device *dev); 602 extern struct usb_device *usb_hub_find_child(struct usb_device *hdev, 603 int port1); 604 605 /** 606 * usb_hub_for_each_child - iterate over all child devices on the hub 607 * @hdev: USB device belonging to the usb hub 608 * @port1: portnum associated with child device 609 * @child: child device pointer 610 */ 611 #define usb_hub_for_each_child(hdev, port1, child) \ 612 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \ 613 port1 <= hdev->maxchild; \ 614 child = usb_hub_find_child(hdev, ++port1)) \ 615 if (!child) continue; else 616 617 /* USB device locking */ 618 #define usb_lock_device(udev) device_lock(&(udev)->dev) 619 #define usb_unlock_device(udev) device_unlock(&(udev)->dev) 620 #define usb_trylock_device(udev) device_trylock(&(udev)->dev) 621 extern int usb_lock_device_for_reset(struct usb_device *udev, 622 const struct usb_interface *iface); 623 624 /* USB port reset for device reinitialization */ 625 extern int usb_reset_device(struct usb_device *dev); 626 extern void usb_queue_reset_device(struct usb_interface *dev); 627 628 #ifdef CONFIG_ACPI 629 extern int usb_acpi_set_power_state(struct usb_device *hdev, int index, 630 bool enable); 631 extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index); 632 #else 633 static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index, 634 bool enable) { return 0; } 635 static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index) 636 { return true; } 637 #endif 638 639 /* USB autosuspend and autoresume */ 640 #ifdef CONFIG_PM_RUNTIME 641 extern void usb_enable_autosuspend(struct usb_device *udev); 642 extern void usb_disable_autosuspend(struct usb_device *udev); 643 644 extern int usb_autopm_get_interface(struct usb_interface *intf); 645 extern void usb_autopm_put_interface(struct usb_interface *intf); 646 extern int usb_autopm_get_interface_async(struct usb_interface *intf); 647 extern void usb_autopm_put_interface_async(struct usb_interface *intf); 648 extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf); 649 extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); 650 651 static inline void usb_mark_last_busy(struct usb_device *udev) 652 { 653 pm_runtime_mark_last_busy(&udev->dev); 654 } 655 656 #else 657 658 static inline int usb_enable_autosuspend(struct usb_device *udev) 659 { return 0; } 660 static inline int usb_disable_autosuspend(struct usb_device *udev) 661 { return 0; } 662 663 static inline int usb_autopm_get_interface(struct usb_interface *intf) 664 { return 0; } 665 static inline int usb_autopm_get_interface_async(struct usb_interface *intf) 666 { return 0; } 667 668 static inline void usb_autopm_put_interface(struct usb_interface *intf) 669 { } 670 static inline void usb_autopm_put_interface_async(struct usb_interface *intf) 671 { } 672 static inline void usb_autopm_get_interface_no_resume( 673 struct usb_interface *intf) 674 { } 675 static inline void usb_autopm_put_interface_no_suspend( 676 struct usb_interface *intf) 677 { } 678 static inline void usb_mark_last_busy(struct usb_device *udev) 679 { } 680 #endif 681 682 extern int usb_disable_lpm(struct usb_device *udev); 683 extern void usb_enable_lpm(struct usb_device *udev); 684 /* Same as above, but these functions lock/unlock the bandwidth_mutex. */ 685 extern int usb_unlocked_disable_lpm(struct usb_device *udev); 686 extern void usb_unlocked_enable_lpm(struct usb_device *udev); 687 688 extern int usb_disable_ltm(struct usb_device *udev); 689 extern void usb_enable_ltm(struct usb_device *udev); 690 691 static inline bool usb_device_supports_ltm(struct usb_device *udev) 692 { 693 if (udev->speed != USB_SPEED_SUPER || !udev->bos || !udev->bos->ss_cap) 694 return false; 695 return udev->bos->ss_cap->bmAttributes & USB_LTM_SUPPORT; 696 } 697 698 static inline bool usb_device_no_sg_constraint(struct usb_device *udev) 699 { 700 return udev && udev->bus && udev->bus->no_sg_constraint; 701 } 702 703 704 /*-------------------------------------------------------------------------*/ 705 706 /* for drivers using iso endpoints */ 707 extern int usb_get_current_frame_number(struct usb_device *usb_dev); 708 709 /* Sets up a group of bulk endpoints to support multiple stream IDs. */ 710 extern int usb_alloc_streams(struct usb_interface *interface, 711 struct usb_host_endpoint **eps, unsigned int num_eps, 712 unsigned int num_streams, gfp_t mem_flags); 713 714 /* Reverts a group of bulk endpoints back to not using stream IDs. */ 715 extern int usb_free_streams(struct usb_interface *interface, 716 struct usb_host_endpoint **eps, unsigned int num_eps, 717 gfp_t mem_flags); 718 719 /* used these for multi-interface device registration */ 720 extern int usb_driver_claim_interface(struct usb_driver *driver, 721 struct usb_interface *iface, void *priv); 722 723 /** 724 * usb_interface_claimed - returns true iff an interface is claimed 725 * @iface: the interface being checked 726 * 727 * Return: %true (nonzero) iff the interface is claimed, else %false 728 * (zero). 729 * 730 * Note: 731 * Callers must own the driver model's usb bus readlock. So driver 732 * probe() entries don't need extra locking, but other call contexts 733 * may need to explicitly claim that lock. 734 * 735 */ 736 static inline int usb_interface_claimed(struct usb_interface *iface) 737 { 738 return (iface->dev.driver != NULL); 739 } 740 741 extern void usb_driver_release_interface(struct usb_driver *driver, 742 struct usb_interface *iface); 743 const struct usb_device_id *usb_match_id(struct usb_interface *interface, 744 const struct usb_device_id *id); 745 extern int usb_match_one_id(struct usb_interface *interface, 746 const struct usb_device_id *id); 747 748 extern int usb_for_each_dev(void *data, int (*fn)(struct usb_device *, void *)); 749 extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 750 int minor); 751 extern struct usb_interface *usb_ifnum_to_if(const struct usb_device *dev, 752 unsigned ifnum); 753 extern struct usb_host_interface *usb_altnum_to_altsetting( 754 const struct usb_interface *intf, unsigned int altnum); 755 extern struct usb_host_interface *usb_find_alt_setting( 756 struct usb_host_config *config, 757 unsigned int iface_num, 758 unsigned int alt_num); 759 760 /* port claiming functions */ 761 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, 762 struct usb_dev_state *owner); 763 int usb_hub_release_port(struct usb_device *hdev, unsigned port1, 764 struct usb_dev_state *owner); 765 766 /** 767 * usb_make_path - returns stable device path in the usb tree 768 * @dev: the device whose path is being constructed 769 * @buf: where to put the string 770 * @size: how big is "buf"? 771 * 772 * Return: Length of the string (> 0) or negative if size was too small. 773 * 774 * Note: 775 * This identifier is intended to be "stable", reflecting physical paths in 776 * hardware such as physical bus addresses for host controllers or ports on 777 * USB hubs. That makes it stay the same until systems are physically 778 * reconfigured, by re-cabling a tree of USB devices or by moving USB host 779 * controllers. Adding and removing devices, including virtual root hubs 780 * in host controller driver modules, does not change these path identifiers; 781 * neither does rebooting or re-enumerating. These are more useful identifiers 782 * than changeable ("unstable") ones like bus numbers or device addresses. 783 * 784 * With a partial exception for devices connected to USB 2.0 root hubs, these 785 * identifiers are also predictable. So long as the device tree isn't changed, 786 * plugging any USB device into a given hub port always gives it the same path. 787 * Because of the use of "companion" controllers, devices connected to ports on 788 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 789 * high speed, and a different one if they are full or low speed. 790 */ 791 static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) 792 { 793 int actual; 794 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name, 795 dev->devpath); 796 return (actual >= (int)size) ? -1 : actual; 797 } 798 799 /*-------------------------------------------------------------------------*/ 800 801 #define USB_DEVICE_ID_MATCH_DEVICE \ 802 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 803 #define USB_DEVICE_ID_MATCH_DEV_RANGE \ 804 (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI) 805 #define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ 806 (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE) 807 #define USB_DEVICE_ID_MATCH_DEV_INFO \ 808 (USB_DEVICE_ID_MATCH_DEV_CLASS | \ 809 USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \ 810 USB_DEVICE_ID_MATCH_DEV_PROTOCOL) 811 #define USB_DEVICE_ID_MATCH_INT_INFO \ 812 (USB_DEVICE_ID_MATCH_INT_CLASS | \ 813 USB_DEVICE_ID_MATCH_INT_SUBCLASS | \ 814 USB_DEVICE_ID_MATCH_INT_PROTOCOL) 815 816 /** 817 * USB_DEVICE - macro used to describe a specific usb device 818 * @vend: the 16 bit USB Vendor ID 819 * @prod: the 16 bit USB Product ID 820 * 821 * This macro is used to create a struct usb_device_id that matches a 822 * specific device. 823 */ 824 #define USB_DEVICE(vend, prod) \ 825 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ 826 .idVendor = (vend), \ 827 .idProduct = (prod) 828 /** 829 * USB_DEVICE_VER - describe a specific usb device with a version range 830 * @vend: the 16 bit USB Vendor ID 831 * @prod: the 16 bit USB Product ID 832 * @lo: the bcdDevice_lo value 833 * @hi: the bcdDevice_hi value 834 * 835 * This macro is used to create a struct usb_device_id that matches a 836 * specific device, with a version range. 837 */ 838 #define USB_DEVICE_VER(vend, prod, lo, hi) \ 839 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ 840 .idVendor = (vend), \ 841 .idProduct = (prod), \ 842 .bcdDevice_lo = (lo), \ 843 .bcdDevice_hi = (hi) 844 845 /** 846 * USB_DEVICE_INTERFACE_CLASS - describe a usb device with a specific interface class 847 * @vend: the 16 bit USB Vendor ID 848 * @prod: the 16 bit USB Product ID 849 * @cl: bInterfaceClass value 850 * 851 * This macro is used to create a struct usb_device_id that matches a 852 * specific interface class of devices. 853 */ 854 #define USB_DEVICE_INTERFACE_CLASS(vend, prod, cl) \ 855 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 856 USB_DEVICE_ID_MATCH_INT_CLASS, \ 857 .idVendor = (vend), \ 858 .idProduct = (prod), \ 859 .bInterfaceClass = (cl) 860 861 /** 862 * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol 863 * @vend: the 16 bit USB Vendor ID 864 * @prod: the 16 bit USB Product ID 865 * @pr: bInterfaceProtocol value 866 * 867 * This macro is used to create a struct usb_device_id that matches a 868 * specific interface protocol of devices. 869 */ 870 #define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \ 871 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 872 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 873 .idVendor = (vend), \ 874 .idProduct = (prod), \ 875 .bInterfaceProtocol = (pr) 876 877 /** 878 * USB_DEVICE_INTERFACE_NUMBER - describe a usb device with a specific interface number 879 * @vend: the 16 bit USB Vendor ID 880 * @prod: the 16 bit USB Product ID 881 * @num: bInterfaceNumber value 882 * 883 * This macro is used to create a struct usb_device_id that matches a 884 * specific interface number of devices. 885 */ 886 #define USB_DEVICE_INTERFACE_NUMBER(vend, prod, num) \ 887 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ 888 USB_DEVICE_ID_MATCH_INT_NUMBER, \ 889 .idVendor = (vend), \ 890 .idProduct = (prod), \ 891 .bInterfaceNumber = (num) 892 893 /** 894 * USB_DEVICE_INFO - macro used to describe a class of usb devices 895 * @cl: bDeviceClass value 896 * @sc: bDeviceSubClass value 897 * @pr: bDeviceProtocol value 898 * 899 * This macro is used to create a struct usb_device_id that matches a 900 * specific class of devices. 901 */ 902 #define USB_DEVICE_INFO(cl, sc, pr) \ 903 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \ 904 .bDeviceClass = (cl), \ 905 .bDeviceSubClass = (sc), \ 906 .bDeviceProtocol = (pr) 907 908 /** 909 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 910 * @cl: bInterfaceClass value 911 * @sc: bInterfaceSubClass value 912 * @pr: bInterfaceProtocol value 913 * 914 * This macro is used to create a struct usb_device_id that matches a 915 * specific class of interfaces. 916 */ 917 #define USB_INTERFACE_INFO(cl, sc, pr) \ 918 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \ 919 .bInterfaceClass = (cl), \ 920 .bInterfaceSubClass = (sc), \ 921 .bInterfaceProtocol = (pr) 922 923 /** 924 * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces 925 * @vend: the 16 bit USB Vendor ID 926 * @prod: the 16 bit USB Product ID 927 * @cl: bInterfaceClass value 928 * @sc: bInterfaceSubClass value 929 * @pr: bInterfaceProtocol value 930 * 931 * This macro is used to create a struct usb_device_id that matches a 932 * specific device with a specific class of interfaces. 933 * 934 * This is especially useful when explicitly matching devices that have 935 * vendor specific bDeviceClass values, but standards-compliant interfaces. 936 */ 937 #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \ 938 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 939 | USB_DEVICE_ID_MATCH_DEVICE, \ 940 .idVendor = (vend), \ 941 .idProduct = (prod), \ 942 .bInterfaceClass = (cl), \ 943 .bInterfaceSubClass = (sc), \ 944 .bInterfaceProtocol = (pr) 945 946 /** 947 * USB_VENDOR_AND_INTERFACE_INFO - describe a specific usb vendor with a class of usb interfaces 948 * @vend: the 16 bit USB Vendor ID 949 * @cl: bInterfaceClass value 950 * @sc: bInterfaceSubClass value 951 * @pr: bInterfaceProtocol value 952 * 953 * This macro is used to create a struct usb_device_id that matches a 954 * specific vendor with a specific class of interfaces. 955 * 956 * This is especially useful when explicitly matching devices that have 957 * vendor specific bDeviceClass values, but standards-compliant interfaces. 958 */ 959 #define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \ 960 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 961 | USB_DEVICE_ID_MATCH_VENDOR, \ 962 .idVendor = (vend), \ 963 .bInterfaceClass = (cl), \ 964 .bInterfaceSubClass = (sc), \ 965 .bInterfaceProtocol = (pr) 966 967 /* ----------------------------------------------------------------------- */ 968 969 /* Stuff for dynamic usb ids */ 970 struct usb_dynids { 971 spinlock_t lock; 972 struct list_head list; 973 }; 974 975 struct usb_dynid { 976 struct list_head node; 977 struct usb_device_id id; 978 }; 979 980 extern ssize_t usb_store_new_id(struct usb_dynids *dynids, 981 const struct usb_device_id *id_table, 982 struct device_driver *driver, 983 const char *buf, size_t count); 984 985 extern ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf); 986 987 /** 988 * struct usbdrv_wrap - wrapper for driver-model structure 989 * @driver: The driver-model core driver structure. 990 * @for_devices: Non-zero for device drivers, 0 for interface drivers. 991 */ 992 struct usbdrv_wrap { 993 struct device_driver driver; 994 int for_devices; 995 }; 996 997 /** 998 * struct usb_driver - identifies USB interface driver to usbcore 999 * @name: The driver name should be unique among USB drivers, 1000 * and should normally be the same as the module name. 1001 * @probe: Called to see if the driver is willing to manage a particular 1002 * interface on a device. If it is, probe returns zero and uses 1003 * usb_set_intfdata() to associate driver-specific data with the 1004 * interface. It may also use usb_set_interface() to specify the 1005 * appropriate altsetting. If unwilling to manage the interface, 1006 * return -ENODEV, if genuine IO errors occurred, an appropriate 1007 * negative errno value. 1008 * @disconnect: Called when the interface is no longer accessible, usually 1009 * because its device has been (or is being) disconnected or the 1010 * driver module is being unloaded. 1011 * @unlocked_ioctl: Used for drivers that want to talk to userspace through 1012 * the "usbfs" filesystem. This lets devices provide ways to 1013 * expose information to user space regardless of where they 1014 * do (or don't) show up otherwise in the filesystem. 1015 * @suspend: Called when the device is going to be suspended by the 1016 * system either from system sleep or runtime suspend context. The 1017 * return value will be ignored in system sleep context, so do NOT 1018 * try to continue using the device if suspend fails in this case. 1019 * Instead, let the resume or reset-resume routine recover from 1020 * the failure. 1021 * @resume: Called when the device is being resumed by the system. 1022 * @reset_resume: Called when the suspended device has been reset instead 1023 * of being resumed. 1024 * @pre_reset: Called by usb_reset_device() when the device is about to be 1025 * reset. This routine must not return until the driver has no active 1026 * URBs for the device, and no more URBs may be submitted until the 1027 * post_reset method is called. 1028 * @post_reset: Called by usb_reset_device() after the device 1029 * has been reset 1030 * @id_table: USB drivers use ID table to support hotplugging. 1031 * Export this with MODULE_DEVICE_TABLE(usb,...). This must be set 1032 * or your driver's probe function will never get called. 1033 * @dynids: used internally to hold the list of dynamically added device 1034 * ids for this driver. 1035 * @drvwrap: Driver-model core structure wrapper. 1036 * @no_dynamic_id: if set to 1, the USB core will not allow dynamic ids to be 1037 * added to this driver by preventing the sysfs file from being created. 1038 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend 1039 * for interfaces bound to this driver. 1040 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable 1041 * endpoints before calling the driver's disconnect method. 1042 * @disable_hub_initiated_lpm: if set to 0, the USB core will not allow hubs 1043 * to initiate lower power link state transitions when an idle timeout 1044 * occurs. Device-initiated USB 3.0 link PM will still be allowed. 1045 * 1046 * USB interface drivers must provide a name, probe() and disconnect() 1047 * methods, and an id_table. Other driver fields are optional. 1048 * 1049 * The id_table is used in hotplugging. It holds a set of descriptors, 1050 * and specialized data may be associated with each entry. That table 1051 * is used by both user and kernel mode hotplugging support. 1052 * 1053 * The probe() and disconnect() methods are called in a context where 1054 * they can sleep, but they should avoid abusing the privilege. Most 1055 * work to connect to a device should be done when the device is opened, 1056 * and undone at the last close. The disconnect code needs to address 1057 * concurrency issues with respect to open() and close() methods, as 1058 * well as forcing all pending I/O requests to complete (by unlinking 1059 * them as necessary, and blocking until the unlinks complete). 1060 */ 1061 struct usb_driver { 1062 const char *name; 1063 1064 int (*probe) (struct usb_interface *intf, 1065 const struct usb_device_id *id); 1066 1067 void (*disconnect) (struct usb_interface *intf); 1068 1069 int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code, 1070 void *buf); 1071 1072 int (*suspend) (struct usb_interface *intf, pm_message_t message); 1073 int (*resume) (struct usb_interface *intf); 1074 int (*reset_resume)(struct usb_interface *intf); 1075 1076 int (*pre_reset)(struct usb_interface *intf); 1077 int (*post_reset)(struct usb_interface *intf); 1078 1079 const struct usb_device_id *id_table; 1080 1081 struct usb_dynids dynids; 1082 struct usbdrv_wrap drvwrap; 1083 unsigned int no_dynamic_id:1; 1084 unsigned int supports_autosuspend:1; 1085 unsigned int disable_hub_initiated_lpm:1; 1086 unsigned int soft_unbind:1; 1087 }; 1088 #define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) 1089 1090 /** 1091 * struct usb_device_driver - identifies USB device driver to usbcore 1092 * @name: The driver name should be unique among USB drivers, 1093 * and should normally be the same as the module name. 1094 * @probe: Called to see if the driver is willing to manage a particular 1095 * device. If it is, probe returns zero and uses dev_set_drvdata() 1096 * to associate driver-specific data with the device. If unwilling 1097 * to manage the device, return a negative errno value. 1098 * @disconnect: Called when the device is no longer accessible, usually 1099 * because it has been (or is being) disconnected or the driver's 1100 * module is being unloaded. 1101 * @suspend: Called when the device is going to be suspended by the system. 1102 * @resume: Called when the device is being resumed by the system. 1103 * @drvwrap: Driver-model core structure wrapper. 1104 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend 1105 * for devices bound to this driver. 1106 * 1107 * USB drivers must provide all the fields listed above except drvwrap. 1108 */ 1109 struct usb_device_driver { 1110 const char *name; 1111 1112 int (*probe) (struct usb_device *udev); 1113 void (*disconnect) (struct usb_device *udev); 1114 1115 int (*suspend) (struct usb_device *udev, pm_message_t message); 1116 int (*resume) (struct usb_device *udev, pm_message_t message); 1117 struct usbdrv_wrap drvwrap; 1118 unsigned int supports_autosuspend:1; 1119 }; 1120 #define to_usb_device_driver(d) container_of(d, struct usb_device_driver, \ 1121 drvwrap.driver) 1122 1123 extern struct bus_type usb_bus_type; 1124 1125 /** 1126 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 1127 * @name: the usb class device name for this driver. Will show up in sysfs. 1128 * @devnode: Callback to provide a naming hint for a possible 1129 * device node to create. 1130 * @fops: pointer to the struct file_operations of this driver. 1131 * @minor_base: the start of the minor range for this driver. 1132 * 1133 * This structure is used for the usb_register_dev() and 1134 * usb_unregister_dev() functions, to consolidate a number of the 1135 * parameters used for them. 1136 */ 1137 struct usb_class_driver { 1138 char *name; 1139 char *(*devnode)(struct device *dev, umode_t *mode); 1140 const struct file_operations *fops; 1141 int minor_base; 1142 }; 1143 1144 /* 1145 * use these in module_init()/module_exit() 1146 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 1147 */ 1148 extern int usb_register_driver(struct usb_driver *, struct module *, 1149 const char *); 1150 1151 /* use a define to avoid include chaining to get THIS_MODULE & friends */ 1152 #define usb_register(driver) \ 1153 usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) 1154 1155 extern void usb_deregister(struct usb_driver *); 1156 1157 /** 1158 * module_usb_driver() - Helper macro for registering a USB driver 1159 * @__usb_driver: usb_driver struct 1160 * 1161 * Helper macro for USB drivers which do not do anything special in module 1162 * init/exit. This eliminates a lot of boilerplate. Each module may only 1163 * use this macro once, and calling it replaces module_init() and module_exit() 1164 */ 1165 #define module_usb_driver(__usb_driver) \ 1166 module_driver(__usb_driver, usb_register, \ 1167 usb_deregister) 1168 1169 extern int usb_register_device_driver(struct usb_device_driver *, 1170 struct module *); 1171 extern void usb_deregister_device_driver(struct usb_device_driver *); 1172 1173 extern int usb_register_dev(struct usb_interface *intf, 1174 struct usb_class_driver *class_driver); 1175 extern void usb_deregister_dev(struct usb_interface *intf, 1176 struct usb_class_driver *class_driver); 1177 1178 extern int usb_disabled(void); 1179 1180 /* ----------------------------------------------------------------------- */ 1181 1182 /* 1183 * URB support, for asynchronous request completions 1184 */ 1185 1186 /* 1187 * urb->transfer_flags: 1188 * 1189 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). 1190 */ 1191 #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1192 #define URB_ISO_ASAP 0x0002 /* iso-only; use the first unexpired 1193 * slot in the schedule */ 1194 #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 1195 #define URB_NO_FSBR 0x0020 /* UHCI-specific */ 1196 #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 1197 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt 1198 * needed */ 1199 #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 1200 1201 /* The following flags are used internally by usbcore and HCDs */ 1202 #define URB_DIR_IN 0x0200 /* Transfer from device to host */ 1203 #define URB_DIR_OUT 0 1204 #define URB_DIR_MASK URB_DIR_IN 1205 1206 #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */ 1207 #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */ 1208 #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */ 1209 #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */ 1210 #define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ 1211 #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ 1212 #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ 1213 #define URB_ALIGNED_TEMP_BUFFER 0x00800000 /* Temp buffer was alloc'd */ 1214 1215 struct usb_iso_packet_descriptor { 1216 unsigned int offset; 1217 unsigned int length; /* expected length */ 1218 unsigned int actual_length; 1219 int status; 1220 }; 1221 1222 struct urb; 1223 1224 struct usb_anchor { 1225 struct list_head urb_list; 1226 wait_queue_head_t wait; 1227 spinlock_t lock; 1228 atomic_t suspend_wakeups; 1229 unsigned int poisoned:1; 1230 }; 1231 1232 static inline void init_usb_anchor(struct usb_anchor *anchor) 1233 { 1234 memset(anchor, 0, sizeof(*anchor)); 1235 INIT_LIST_HEAD(&anchor->urb_list); 1236 init_waitqueue_head(&anchor->wait); 1237 spin_lock_init(&anchor->lock); 1238 } 1239 1240 typedef void (*usb_complete_t)(struct urb *); 1241 1242 /** 1243 * struct urb - USB Request Block 1244 * @urb_list: For use by current owner of the URB. 1245 * @anchor_list: membership in the list of an anchor 1246 * @anchor: to anchor URBs to a common mooring 1247 * @ep: Points to the endpoint's data structure. Will eventually 1248 * replace @pipe. 1249 * @pipe: Holds endpoint number, direction, type, and more. 1250 * Create these values with the eight macros available; 1251 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1252 * (control), "bulk", "int" (interrupt), or "iso" (isochronous). 1253 * For example usb_sndbulkpipe() or usb_rcvintpipe(). Endpoint 1254 * numbers range from zero to fifteen. Note that "in" endpoint two 1255 * is a different endpoint (and pipe) from "out" endpoint two. 1256 * The current configuration controls the existence, type, and 1257 * maximum packet size of any given endpoint. 1258 * @stream_id: the endpoint's stream ID for bulk streams 1259 * @dev: Identifies the USB device to perform the request. 1260 * @status: This is read in non-iso completion functions to get the 1261 * status of the particular request. ISO requests only use it 1262 * to tell whether the URB was unlinked; detailed status for 1263 * each frame is in the fields of the iso_frame-desc. 1264 * @transfer_flags: A variety of flags may be used to affect how URB 1265 * submission, unlinking, or operation are handled. Different 1266 * kinds of URB can use different flags. 1267 * @transfer_buffer: This identifies the buffer to (or from) which the I/O 1268 * request will be performed unless URB_NO_TRANSFER_DMA_MAP is set 1269 * (however, do not leave garbage in transfer_buffer even then). 1270 * This buffer must be suitable for DMA; allocate it with 1271 * kmalloc() or equivalent. For transfers to "in" endpoints, contents 1272 * of this buffer will be modified. This buffer is used for the data 1273 * stage of control transfers. 1274 * @transfer_dma: When transfer_flags includes URB_NO_TRANSFER_DMA_MAP, 1275 * the device driver is saying that it provided this DMA address, 1276 * which the host controller driver should use in preference to the 1277 * transfer_buffer. 1278 * @sg: scatter gather buffer list, the buffer size of each element in 1279 * the list (except the last) must be divisible by the endpoint's 1280 * max packet size if no_sg_constraint isn't set in 'struct usb_bus' 1281 * @num_mapped_sgs: (internal) number of mapped sg entries 1282 * @num_sgs: number of entries in the sg list 1283 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1284 * be broken up into chunks according to the current maximum packet 1285 * size for the endpoint, which is a function of the configuration 1286 * and is encoded in the pipe. When the length is zero, neither 1287 * transfer_buffer nor transfer_dma is used. 1288 * @actual_length: This is read in non-iso completion functions, and 1289 * it tells how many bytes (out of transfer_buffer_length) were 1290 * transferred. It will normally be the same as requested, unless 1291 * either an error was reported or a short read was performed. 1292 * The URB_SHORT_NOT_OK transfer flag may be used to make such 1293 * short reads be reported as errors. 1294 * @setup_packet: Only used for control transfers, this points to eight bytes 1295 * of setup data. Control transfers always start by sending this data 1296 * to the device. Then transfer_buffer is read or written, if needed. 1297 * @setup_dma: DMA pointer for the setup packet. The caller must not use 1298 * this field; setup_packet must point to a valid buffer. 1299 * @start_frame: Returns the initial frame for isochronous transfers. 1300 * @number_of_packets: Lists the number of ISO transfer buffers. 1301 * @interval: Specifies the polling interval for interrupt or isochronous 1302 * transfers. The units are frames (milliseconds) for full and low 1303 * speed devices, and microframes (1/8 millisecond) for highspeed 1304 * and SuperSpeed devices. 1305 * @error_count: Returns the number of ISO transfers that reported errors. 1306 * @context: For use in completion functions. This normally points to 1307 * request-specific driver context. 1308 * @complete: Completion handler. This URB is passed as the parameter to the 1309 * completion function. The completion function may then do what 1310 * it likes with the URB, including resubmitting or freeing it. 1311 * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1312 * collect the transfer status for each buffer. 1313 * 1314 * This structure identifies USB transfer requests. URBs must be allocated by 1315 * calling usb_alloc_urb() and freed with a call to usb_free_urb(). 1316 * Initialization may be done using various usb_fill_*_urb() functions. URBs 1317 * are submitted using usb_submit_urb(), and pending requests may be canceled 1318 * using usb_unlink_urb() or usb_kill_urb(). 1319 * 1320 * Data Transfer Buffers: 1321 * 1322 * Normally drivers provide I/O buffers allocated with kmalloc() or otherwise 1323 * taken from the general page pool. That is provided by transfer_buffer 1324 * (control requests also use setup_packet), and host controller drivers 1325 * perform a dma mapping (and unmapping) for each buffer transferred. Those 1326 * mapping operations can be expensive on some platforms (perhaps using a dma 1327 * bounce buffer or talking to an IOMMU), 1328 * although they're cheap on commodity x86 and ppc hardware. 1329 * 1330 * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag, 1331 * which tells the host controller driver that no such mapping is needed for 1332 * the transfer_buffer since 1333 * the device driver is DMA-aware. For example, a device driver might 1334 * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map(). 1335 * When this transfer flag is provided, host controller drivers will 1336 * attempt to use the dma address found in the transfer_dma 1337 * field rather than determining a dma address themselves. 1338 * 1339 * Note that transfer_buffer must still be set if the controller 1340 * does not support DMA (as indicated by bus.uses_dma) and when talking 1341 * to root hub. If you have to trasfer between highmem zone and the device 1342 * on such controller, create a bounce buffer or bail out with an error. 1343 * If transfer_buffer cannot be set (is in highmem) and the controller is DMA 1344 * capable, assign NULL to it, so that usbmon knows not to use the value. 1345 * The setup_packet must always be set, so it cannot be located in highmem. 1346 * 1347 * Initialization: 1348 * 1349 * All URBs submitted must initialize the dev, pipe, transfer_flags (may be 1350 * zero), and complete fields. All URBs must also initialize 1351 * transfer_buffer and transfer_buffer_length. They may provide the 1352 * URB_SHORT_NOT_OK transfer flag, indicating that short reads are 1353 * to be treated as errors; that flag is invalid for write requests. 1354 * 1355 * Bulk URBs may 1356 * use the URB_ZERO_PACKET transfer flag, indicating that bulk OUT transfers 1357 * should always terminate with a short packet, even if it means adding an 1358 * extra zero length packet. 1359 * 1360 * Control URBs must provide a valid pointer in the setup_packet field. 1361 * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA 1362 * beforehand. 1363 * 1364 * Interrupt URBs must provide an interval, saying how often (in milliseconds 1365 * or, for highspeed devices, 125 microsecond units) 1366 * to poll for transfers. After the URB has been submitted, the interval 1367 * field reflects how the transfer was actually scheduled. 1368 * The polling interval may be more frequent than requested. 1369 * For example, some controllers have a maximum interval of 32 milliseconds, 1370 * while others support intervals of up to 1024 milliseconds. 1371 * Isochronous URBs also have transfer intervals. (Note that for isochronous 1372 * endpoints, as well as high speed interrupt endpoints, the encoding of 1373 * the transfer interval in the endpoint descriptor is logarithmic. 1374 * Device drivers must convert that value to linear units themselves.) 1375 * 1376 * If an isochronous endpoint queue isn't already running, the host 1377 * controller will schedule a new URB to start as soon as bandwidth 1378 * utilization allows. If the queue is running then a new URB will be 1379 * scheduled to start in the first transfer slot following the end of the 1380 * preceding URB, if that slot has not already expired. If the slot has 1381 * expired (which can happen when IRQ delivery is delayed for a long time), 1382 * the scheduling behavior depends on the URB_ISO_ASAP flag. If the flag 1383 * is clear then the URB will be scheduled to start in the expired slot, 1384 * implying that some of its packets will not be transferred; if the flag 1385 * is set then the URB will be scheduled in the first unexpired slot, 1386 * breaking the queue's synchronization. Upon URB completion, the 1387 * start_frame field will be set to the (micro)frame number in which the 1388 * transfer was scheduled. Ranges for frame counter values are HC-specific 1389 * and can go from as low as 256 to as high as 65536 frames. 1390 * 1391 * Isochronous URBs have a different data transfer model, in part because 1392 * the quality of service is only "best effort". Callers provide specially 1393 * allocated URBs, with number_of_packets worth of iso_frame_desc structures 1394 * at the end. Each such packet is an individual ISO transfer. Isochronous 1395 * URBs are normally queued, submitted by drivers to arrange that 1396 * transfers are at least double buffered, and then explicitly resubmitted 1397 * in completion handlers, so 1398 * that data (such as audio or video) streams at as constant a rate as the 1399 * host controller scheduler can support. 1400 * 1401 * Completion Callbacks: 1402 * 1403 * The completion callback is made in_interrupt(), and one of the first 1404 * things that a completion handler should do is check the status field. 1405 * The status field is provided for all URBs. It is used to report 1406 * unlinked URBs, and status for all non-ISO transfers. It should not 1407 * be examined before the URB is returned to the completion handler. 1408 * 1409 * The context field is normally used to link URBs back to the relevant 1410 * driver or request state. 1411 * 1412 * When the completion callback is invoked for non-isochronous URBs, the 1413 * actual_length field tells how many bytes were transferred. This field 1414 * is updated even when the URB terminated with an error or was unlinked. 1415 * 1416 * ISO transfer status is reported in the status and actual_length fields 1417 * of the iso_frame_desc array, and the number of errors is reported in 1418 * error_count. Completion callbacks for ISO transfers will normally 1419 * (re)submit URBs to ensure a constant transfer rate. 1420 * 1421 * Note that even fields marked "public" should not be touched by the driver 1422 * when the urb is owned by the hcd, that is, since the call to 1423 * usb_submit_urb() till the entry into the completion routine. 1424 */ 1425 struct urb { 1426 /* private: usb core and host controller only fields in the urb */ 1427 struct kref kref; /* reference count of the URB */ 1428 void *hcpriv; /* private data for host controller */ 1429 atomic_t use_count; /* concurrent submissions counter */ 1430 atomic_t reject; /* submissions will fail */ 1431 int unlinked; /* unlink error code */ 1432 1433 /* public: documented fields in the urb that can be used by drivers */ 1434 struct list_head urb_list; /* list head for use by the urb's 1435 * current owner */ 1436 struct list_head anchor_list; /* the URB may be anchored */ 1437 struct usb_anchor *anchor; 1438 struct usb_device *dev; /* (in) pointer to associated device */ 1439 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ 1440 unsigned int pipe; /* (in) pipe information */ 1441 unsigned int stream_id; /* (in) stream ID */ 1442 int status; /* (return) non-ISO status */ 1443 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1444 void *transfer_buffer; /* (in) associated data buffer */ 1445 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1446 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1447 int num_mapped_sgs; /* (internal) mapped sg entries */ 1448 int num_sgs; /* (in) number of entries in the sg list */ 1449 u32 transfer_buffer_length; /* (in) data buffer length */ 1450 u32 actual_length; /* (return) actual transfer length */ 1451 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1452 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */ 1453 int start_frame; /* (modify) start frame (ISO) */ 1454 int number_of_packets; /* (in) number of ISO packets */ 1455 int interval; /* (modify) transfer interval 1456 * (INT/ISO) */ 1457 int error_count; /* (return) number of ISO errors */ 1458 void *context; /* (in) context for completion */ 1459 usb_complete_t complete; /* (in) completion routine */ 1460 struct usb_iso_packet_descriptor iso_frame_desc[0]; 1461 /* (in) ISO ONLY */ 1462 }; 1463 1464 /* ----------------------------------------------------------------------- */ 1465 1466 /** 1467 * usb_fill_control_urb - initializes a control urb 1468 * @urb: pointer to the urb to initialize. 1469 * @dev: pointer to the struct usb_device for this urb. 1470 * @pipe: the endpoint pipe 1471 * @setup_packet: pointer to the setup_packet buffer 1472 * @transfer_buffer: pointer to the transfer buffer 1473 * @buffer_length: length of the transfer buffer 1474 * @complete_fn: pointer to the usb_complete_t function 1475 * @context: what to set the urb context to. 1476 * 1477 * Initializes a control urb with the proper information needed to submit 1478 * it to a device. 1479 */ 1480 static inline void usb_fill_control_urb(struct urb *urb, 1481 struct usb_device *dev, 1482 unsigned int pipe, 1483 unsigned char *setup_packet, 1484 void *transfer_buffer, 1485 int buffer_length, 1486 usb_complete_t complete_fn, 1487 void *context) 1488 { 1489 urb->dev = dev; 1490 urb->pipe = pipe; 1491 urb->setup_packet = setup_packet; 1492 urb->transfer_buffer = transfer_buffer; 1493 urb->transfer_buffer_length = buffer_length; 1494 urb->complete = complete_fn; 1495 urb->context = context; 1496 } 1497 1498 /** 1499 * usb_fill_bulk_urb - macro to help initialize a bulk urb 1500 * @urb: pointer to the urb to initialize. 1501 * @dev: pointer to the struct usb_device for this urb. 1502 * @pipe: the endpoint pipe 1503 * @transfer_buffer: pointer to the transfer buffer 1504 * @buffer_length: length of the transfer buffer 1505 * @complete_fn: pointer to the usb_complete_t function 1506 * @context: what to set the urb context to. 1507 * 1508 * Initializes a bulk urb with the proper information needed to submit it 1509 * to a device. 1510 */ 1511 static inline void usb_fill_bulk_urb(struct urb *urb, 1512 struct usb_device *dev, 1513 unsigned int pipe, 1514 void *transfer_buffer, 1515 int buffer_length, 1516 usb_complete_t complete_fn, 1517 void *context) 1518 { 1519 urb->dev = dev; 1520 urb->pipe = pipe; 1521 urb->transfer_buffer = transfer_buffer; 1522 urb->transfer_buffer_length = buffer_length; 1523 urb->complete = complete_fn; 1524 urb->context = context; 1525 } 1526 1527 /** 1528 * usb_fill_int_urb - macro to help initialize a interrupt urb 1529 * @urb: pointer to the urb to initialize. 1530 * @dev: pointer to the struct usb_device for this urb. 1531 * @pipe: the endpoint pipe 1532 * @transfer_buffer: pointer to the transfer buffer 1533 * @buffer_length: length of the transfer buffer 1534 * @complete_fn: pointer to the usb_complete_t function 1535 * @context: what to set the urb context to. 1536 * @interval: what to set the urb interval to, encoded like 1537 * the endpoint descriptor's bInterval value. 1538 * 1539 * Initializes a interrupt urb with the proper information needed to submit 1540 * it to a device. 1541 * 1542 * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic 1543 * encoding of the endpoint interval, and express polling intervals in 1544 * microframes (eight per millisecond) rather than in frames (one per 1545 * millisecond). 1546 * 1547 * Wireless USB also uses the logarithmic encoding, but specifies it in units of 1548 * 128us instead of 125us. For Wireless USB devices, the interval is passed 1549 * through to the host controller, rather than being translated into microframe 1550 * units. 1551 */ 1552 static inline void usb_fill_int_urb(struct urb *urb, 1553 struct usb_device *dev, 1554 unsigned int pipe, 1555 void *transfer_buffer, 1556 int buffer_length, 1557 usb_complete_t complete_fn, 1558 void *context, 1559 int interval) 1560 { 1561 urb->dev = dev; 1562 urb->pipe = pipe; 1563 urb->transfer_buffer = transfer_buffer; 1564 urb->transfer_buffer_length = buffer_length; 1565 urb->complete = complete_fn; 1566 urb->context = context; 1567 1568 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) { 1569 /* make sure interval is within allowed range */ 1570 interval = clamp(interval, 1, 16); 1571 1572 urb->interval = 1 << (interval - 1); 1573 } else { 1574 urb->interval = interval; 1575 } 1576 1577 urb->start_frame = -1; 1578 } 1579 1580 extern void usb_init_urb(struct urb *urb); 1581 extern struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags); 1582 extern void usb_free_urb(struct urb *urb); 1583 #define usb_put_urb usb_free_urb 1584 extern struct urb *usb_get_urb(struct urb *urb); 1585 extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); 1586 extern int usb_unlink_urb(struct urb *urb); 1587 extern void usb_kill_urb(struct urb *urb); 1588 extern void usb_poison_urb(struct urb *urb); 1589 extern void usb_unpoison_urb(struct urb *urb); 1590 extern void usb_block_urb(struct urb *urb); 1591 extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1592 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1593 extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1594 extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1595 extern void usb_anchor_suspend_wakeups(struct usb_anchor *anchor); 1596 extern void usb_anchor_resume_wakeups(struct usb_anchor *anchor); 1597 extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1598 extern void usb_unanchor_urb(struct urb *urb); 1599 extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1600 unsigned int timeout); 1601 extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor); 1602 extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); 1603 extern int usb_anchor_empty(struct usb_anchor *anchor); 1604 1605 #define usb_unblock_urb usb_unpoison_urb 1606 1607 /** 1608 * usb_urb_dir_in - check if an URB describes an IN transfer 1609 * @urb: URB to be checked 1610 * 1611 * Return: 1 if @urb describes an IN transfer (device-to-host), 1612 * otherwise 0. 1613 */ 1614 static inline int usb_urb_dir_in(struct urb *urb) 1615 { 1616 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; 1617 } 1618 1619 /** 1620 * usb_urb_dir_out - check if an URB describes an OUT transfer 1621 * @urb: URB to be checked 1622 * 1623 * Return: 1 if @urb describes an OUT transfer (host-to-device), 1624 * otherwise 0. 1625 */ 1626 static inline int usb_urb_dir_out(struct urb *urb) 1627 { 1628 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1629 } 1630 1631 void *usb_alloc_coherent(struct usb_device *dev, size_t size, 1632 gfp_t mem_flags, dma_addr_t *dma); 1633 void usb_free_coherent(struct usb_device *dev, size_t size, 1634 void *addr, dma_addr_t dma); 1635 1636 #if 0 1637 struct urb *usb_buffer_map(struct urb *urb); 1638 void usb_buffer_dmasync(struct urb *urb); 1639 void usb_buffer_unmap(struct urb *urb); 1640 #endif 1641 1642 struct scatterlist; 1643 int usb_buffer_map_sg(const struct usb_device *dev, int is_in, 1644 struct scatterlist *sg, int nents); 1645 #if 0 1646 void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in, 1647 struct scatterlist *sg, int n_hw_ents); 1648 #endif 1649 void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in, 1650 struct scatterlist *sg, int n_hw_ents); 1651 1652 /*-------------------------------------------------------------------* 1653 * SYNCHRONOUS CALL SUPPORT * 1654 *-------------------------------------------------------------------*/ 1655 1656 extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, 1657 __u8 request, __u8 requesttype, __u16 value, __u16 index, 1658 void *data, __u16 size, int timeout); 1659 extern int usb_interrupt_msg(struct usb_device *usb_dev, unsigned int pipe, 1660 void *data, int len, int *actual_length, int timeout); 1661 extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, 1662 void *data, int len, int *actual_length, 1663 int timeout); 1664 1665 /* wrappers around usb_control_msg() for the most common standard requests */ 1666 extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, 1667 unsigned char descindex, void *buf, int size); 1668 extern int usb_get_status(struct usb_device *dev, 1669 int type, int target, void *data); 1670 extern int usb_string(struct usb_device *dev, int index, 1671 char *buf, size_t size); 1672 1673 /* wrappers that also update important state inside usbcore */ 1674 extern int usb_clear_halt(struct usb_device *dev, int pipe); 1675 extern int usb_reset_configuration(struct usb_device *dev); 1676 extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); 1677 extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); 1678 1679 /* this request isn't really synchronous, but it belongs with the others */ 1680 extern int usb_driver_set_configuration(struct usb_device *udev, int config); 1681 1682 /* choose and set configuration for device */ 1683 extern int usb_choose_configuration(struct usb_device *udev); 1684 extern int usb_set_configuration(struct usb_device *dev, int configuration); 1685 1686 /* 1687 * timeouts, in milliseconds, used for sending/receiving control messages 1688 * they typically complete within a few frames (msec) after they're issued 1689 * USB identifies 5 second timeouts, maybe more in a few cases, and a few 1690 * slow devices (like some MGE Ellipse UPSes) actually push that limit. 1691 */ 1692 #define USB_CTRL_GET_TIMEOUT 5000 1693 #define USB_CTRL_SET_TIMEOUT 5000 1694 1695 1696 /** 1697 * struct usb_sg_request - support for scatter/gather I/O 1698 * @status: zero indicates success, else negative errno 1699 * @bytes: counts bytes transferred. 1700 * 1701 * These requests are initialized using usb_sg_init(), and then are used 1702 * as request handles passed to usb_sg_wait() or usb_sg_cancel(). Most 1703 * members of the request object aren't for driver access. 1704 * 1705 * The status and bytecount values are valid only after usb_sg_wait() 1706 * returns. If the status is zero, then the bytecount matches the total 1707 * from the request. 1708 * 1709 * After an error completion, drivers may need to clear a halt condition 1710 * on the endpoint. 1711 */ 1712 struct usb_sg_request { 1713 int status; 1714 size_t bytes; 1715 1716 /* private: 1717 * members below are private to usbcore, 1718 * and are not provided for driver access! 1719 */ 1720 spinlock_t lock; 1721 1722 struct usb_device *dev; 1723 int pipe; 1724 1725 int entries; 1726 struct urb **urbs; 1727 1728 int count; 1729 struct completion complete; 1730 }; 1731 1732 int usb_sg_init( 1733 struct usb_sg_request *io, 1734 struct usb_device *dev, 1735 unsigned pipe, 1736 unsigned period, 1737 struct scatterlist *sg, 1738 int nents, 1739 size_t length, 1740 gfp_t mem_flags 1741 ); 1742 void usb_sg_cancel(struct usb_sg_request *io); 1743 void usb_sg_wait(struct usb_sg_request *io); 1744 1745 1746 /* ----------------------------------------------------------------------- */ 1747 1748 /* 1749 * For various legacy reasons, Linux has a small cookie that's paired with 1750 * a struct usb_device to identify an endpoint queue. Queue characteristics 1751 * are defined by the endpoint's descriptor. This cookie is called a "pipe", 1752 * an unsigned int encoded as: 1753 * 1754 * - direction: bit 7 (0 = Host-to-Device [Out], 1755 * 1 = Device-to-Host [In] ... 1756 * like endpoint bEndpointAddress) 1757 * - device address: bits 8-14 ... bit positions known to uhci-hcd 1758 * - endpoint: bits 15-18 ... bit positions known to uhci-hcd 1759 * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt, 1760 * 10 = control, 11 = bulk) 1761 * 1762 * Given the device address and endpoint descriptor, pipes are redundant. 1763 */ 1764 1765 /* NOTE: these are not the standard USB_ENDPOINT_XFER_* values!! */ 1766 /* (yet ... they're the values used by usbfs) */ 1767 #define PIPE_ISOCHRONOUS 0 1768 #define PIPE_INTERRUPT 1 1769 #define PIPE_CONTROL 2 1770 #define PIPE_BULK 3 1771 1772 #define usb_pipein(pipe) ((pipe) & USB_DIR_IN) 1773 #define usb_pipeout(pipe) (!usb_pipein(pipe)) 1774 1775 #define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f) 1776 #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf) 1777 1778 #define usb_pipetype(pipe) (((pipe) >> 30) & 3) 1779 #define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS) 1780 #define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT) 1781 #define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL) 1782 #define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK) 1783 1784 static inline unsigned int __create_pipe(struct usb_device *dev, 1785 unsigned int endpoint) 1786 { 1787 return (dev->devnum << 8) | (endpoint << 15); 1788 } 1789 1790 /* Create various pipes... */ 1791 #define usb_sndctrlpipe(dev, endpoint) \ 1792 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) 1793 #define usb_rcvctrlpipe(dev, endpoint) \ 1794 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1795 #define usb_sndisocpipe(dev, endpoint) \ 1796 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) 1797