Error Trace

[Home]

Bug # 2

Show/hide error trace
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;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
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;
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;
33 typedef __u16 __be16;
34 typedef __u32 __le32;
35 typedef __u32 __be32;
40 typedef __u32 __wsum;
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;
108 typedef __u32 uint32_t;
111 typedef __u64 uint64_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 ;
54 struct net_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;
259 struct __anonstruct_seqlock_t_33 { struct seqcount seqcount; spinlock_t lock; } ;
259 typedef struct __anonstruct_seqlock_t_33 seqlock_t;
433 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
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; } ;
12 struct __wait_queue ;
12 typedef struct __wait_queue wait_queue_t;
15 struct __wait_queue { unsigned int flags; void *private; int (*func)(wait_queue_t *, unsigned int, int, void *); struct list_head task_list; } ;
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 ;
105 struct llist_head { struct llist_node *first; } ;
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 ;
22 struct bio_vec ;
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; } ;
906 struct ctl_table ;
835 struct nsproxy ;
836 struct ctl_table_root ;
837 struct ctl_table_header ;
838 struct ctl_dir ;
39 typedef int proc_handler(struct ctl_table *, int, void *, size_t *, loff_t *);
59 struct ctl_table_poll { atomic_t event; wait_queue_head_t wait; } ;
98 struct ctl_table { const char *procname; void *data; int maxlen; umode_t mode; struct ctl_table *child; proc_handler *proc_handler; struct ctl_table_poll *poll; void *extra1; void *extra2; } ;
119 struct ctl_node { struct rb_node node; struct ctl_table_header *header; } ;
124 struct __anonstruct_ldv_13726_129 { struct ctl_table *ctl_table; int used; int count; int nreg; } ;
124 union __anonunion_ldv_13728_128 { struct __anonstruct_ldv_13726_129 ldv_13726; struct callback_head rcu; } ;
124 struct ctl_table_set ;
124 struct ctl_table_header { union __anonunion_ldv_13728_128 ldv_13728; struct completion *unregistering; struct ctl_table *ctl_table_arg; struct ctl_table_root *root; struct ctl_table_set *set; struct ctl_dir *parent; struct ctl_node *node; } ;
145 struct ctl_dir { struct ctl_table_header header; struct rb_root root; } ;
151 struct ctl_table_set { int (*is_seen)(struct ctl_table_set *); struct ctl_dir dir; } ;
156 struct ctl_table_root { struct ctl_table_set default_set; struct ctl_table_set * (*lookup)(struct ctl_table_root *, struct nsproxy *); int (*permissions)(struct ctl_table_header *, struct ctl_table *); } ;
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;
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; } ;
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; } ;
628 struct usb_ctrlrequest { __u8 bRequestType; __u8 bRequest; __le16 wValue; __le16 wIndex; __le16 wLength; } ;
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 } ;
359 struct proc_dir_entry ;
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]; } ;
450 struct tasklet_struct { struct tasklet_struct *next; unsigned long state; atomic_t count; void (*func)(unsigned long); unsigned long data; } ;
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 ;
32 struct cgroup_subsys_state ;
19 struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; } ;
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); } ;
855 struct net ;
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; } ;
12 struct plist_head { struct list_head node_list; } ;
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; } ;
1060 struct uts_namespace ;
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 ;
273 struct usb_driver ;
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; } ;
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; } ;
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]; } ;
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_26739_199 { struct callback_head callback_head; struct kmem_cache *memcg_caches[0U]; } ;
501 struct __anonstruct_ldv_26745_200 { struct mem_cgroup *memcg; struct list_head list; struct kmem_cache *root_cache; atomic_t nr_pages; } ;
501 union __anonunion_ldv_26746_198 { struct __anonstruct_ldv_26739_199 ldv_26739; struct __anonstruct_ldv_26745_200 ldv_26745; } ;
501 struct memcg_cache_params { bool is_root_cache; union __anonunion_ldv_26746_198 ldv_26746; } ;
114 struct iovec { void *iov_base; __kernel_size_t iov_len; } ;
27 union __anonunion_ldv_26958_201 { const struct iovec *iov; const struct bio_vec *bvec; } ;
27 struct iov_iter { int type; size_t iov_offset; size_t count; union __anonunion_ldv_26958_201 ldv_26958; unsigned long nr_segs; } ;
11 typedef unsigned short __kernel_sa_family_t;
23 typedef __kernel_sa_family_t sa_family_t;
24 struct sockaddr { sa_family_t sa_family; char sa_data[14U]; } ;
140 struct sk_buff ;
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); } ;
2112 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; } ;
17 struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; } ;
38 typedef s32 dma_cookie_t;
1164 struct dma_attrs { unsigned long flags[1U]; } ;
70 enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ;
77 struct dma_map_ops { void * (*alloc)(struct device *, size_t , dma_addr_t *, gfp_t , struct dma_attrs *); void (*free)(struct device *, size_t , void *, dma_addr_t , struct dma_attrs *); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t , size_t , struct dma_attrs *); int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t , size_t , struct dma_attrs *); dma_addr_t (*map_page)(struct device *, struct page *, unsigned long, size_t , enum dma_data_direction , struct dma_attrs *); void (*unmap_page)(struct device *, dma_addr_t , size_t , enum dma_data_direction , struct dma_attrs *); int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , struct dma_attrs *); void (*sync_single_for_cpu)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_single_for_device)(struct device *, dma_addr_t , size_t , enum dma_data_direction ); void (*sync_sg_for_cpu)(struct device *, struct scatterlist *, int, enum dma_data_direction ); void (*sync_sg_for_device)(struct device *, struct scatterlist *, int, enum dma_data_direction ); int (*mapping_error)(struct device *, dma_addr_t ); int (*dma_supported)(struct device *, u64 ); int (*set_dma_mask)(struct device *, u64 ); int is_phys; } ;
15 typedef u64 netdev_features_t;
18 struct nf_conntrack { atomic_t use; } ;
137 struct nf_bridge_info { atomic_t use; unsigned int mask; struct net_device *physindev; struct net_device *physoutdev; unsigned long data[4U]; } ;
147 struct sk_buff_head { struct sk_buff *next; struct sk_buff *prev; __u32 qlen; spinlock_t lock; } ;
360 typedef unsigned int sk_buff_data_t;
361 struct __anonstruct_ldv_31949_206 { u32 stamp_us; u32 stamp_jiffies; } ;
361 union __anonunion_ldv_31950_205 { u64 v64; struct __anonstruct_ldv_31949_206 ldv_31949; } ;
361 struct skb_mstamp { union __anonunion_ldv_31950_205 ldv_31950; } ;
414 union __anonunion_ldv_31969_207 { ktime_t tstamp; struct skb_mstamp skb_mstamp; } ;
414 struct sec_path ;
414 struct __anonstruct_ldv_31985_209 { __u16 csum_start; __u16 csum_offset; } ;
414 union __anonunion_ldv_31986_208 { __wsum csum; struct __anonstruct_ldv_31985_209 ldv_31985; } ;
414 union __anonunion_ldv_32025_210 { unsigned int napi_id; dma_cookie_t dma_cookie; } ;
414 union __anonunion_ldv_32031_211 { __u32 mark; __u32 dropcount; __u32 reserved_tailroom; } ;
414 struct sk_buff { struct sk_buff *next; struct sk_buff *prev; union __anonunion_ldv_31969_207 ldv_31969; struct sock *sk; struct net_device *dev; char cb[48U]; unsigned long _skb_refdst; struct sec_path *sp; unsigned int len; unsigned int data_len; __u16 mac_len; __u16 hdr_len; union __anonunion_ldv_31986_208 ldv_31986; __u32 priority; unsigned char ignore_df; unsigned char cloned; unsigned char ip_summed; unsigned char nohdr; unsigned char nfctinfo; unsigned char pkt_type; unsigned char fclone; unsigned char ipvs_property; unsigned char peeked; unsigned char nf_trace; __be16 protocol; void (*destructor)(struct sk_buff *); struct nf_conntrack *nfct; struct nf_bridge_info *nf_bridge; int skb_iif; __u32 hash; __be16 vlan_proto; __u16 vlan_tci; __u16 tc_index; __u16 tc_verd; __u16 queue_mapping; unsigned char ndisc_nodetype; unsigned char pfmemalloc; unsigned char ooo_okay; unsigned char l4_hash; unsigned char wifi_acked_valid; unsigned char wifi_acked; unsigned char no_fcs; unsigned char head_frag; unsigned char encapsulation; unsigned char encap_hdr_csum; unsigned char csum_valid; unsigned char csum_complete_sw; union __anonunion_ldv_32025_210 ldv_32025; __u32 secmark; union __anonunion_ldv_32031_211 ldv_32031; __be16 inner_protocol; __u16 inner_transport_header; __u16 inner_network_header; __u16 inner_mac_header; __u16 transport_header; __u16 network_header; __u16 mac_header; sk_buff_data_t tail; sk_buff_data_t end; unsigned char *head; unsigned char *data; unsigned int truesize; atomic_t users; } ;
641 struct dst_entry ;
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_212 { 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_212 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 dql { unsigned int num_queued; unsigned int adj_limit; unsigned int last_obj_cnt; unsigned int limit; unsigned int num_completed; unsigned int prev_ovlimit; unsigned int prev_num_queued; unsigned int prev_last_obj_cnt; unsigned int lowest_slack; unsigned long slack_start_time; unsigned int max_limit; unsigned int min_limit; unsigned int slack_hold_time; } ;
43 struct __anonstruct_sync_serial_settings_213 { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } ;
43 typedef struct __anonstruct_sync_serial_settings_213 sync_serial_settings;
50 struct __anonstruct_te1_settings_214 { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } ;
50 typedef struct __anonstruct_te1_settings_214 te1_settings;
55 struct __anonstruct_raw_hdlc_proto_215 { unsigned short encoding; unsigned short parity; } ;
55 typedef struct __anonstruct_raw_hdlc_proto_215 raw_hdlc_proto;
65 struct __anonstruct_fr_proto_216 { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } ;
65 typedef struct __anonstruct_fr_proto_216 fr_proto;
69 struct __anonstruct_fr_proto_pvc_217 { unsigned int dlci; } ;
69 typedef struct __anonstruct_fr_proto_pvc_217 fr_proto_pvc;
74 struct __anonstruct_fr_proto_pvc_info_218 { unsigned int dlci; char master[16U]; } ;
74 typedef struct __anonstruct_fr_proto_pvc_info_218 fr_proto_pvc_info;
79 struct __anonstruct_cisco_proto_219 { unsigned int interval; unsigned int timeout; } ;
79 typedef struct __anonstruct_cisco_proto_219 cisco_proto;
117 struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ;
177 union __anonunion_ifs_ifsu_220 { raw_hdlc_proto *raw_hdlc; cisco_proto *cisco; fr_proto *fr; fr_proto_pvc *fr_pvc; fr_proto_pvc_info *fr_pvc_info; sync_serial_settings *sync; te1_settings *te1; } ;
177 struct if_settings { unsigned int type; unsigned int size; union __anonunion_ifs_ifsu_220 ifs_ifsu; } ;
195 union __anonunion_ifr_ifrn_221 { char ifrn_name[16U]; } ;
195 union __anonunion_ifr_ifru_222 { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16U]; char ifru_newname[16U]; void *ifru_data; struct if_settings ifru_settings; } ;
195 struct ifreq { union __anonunion_ifr_ifrn_221 ifr_ifrn; union __anonunion_ifr_ifru_222 ifr_ifru; } ;
39 typedef s32 compat_long_t;
44 typedef u32 compat_uptr_t;
276 struct compat_robust_list { compat_uptr_t next; } ;
280 struct compat_robust_list_head { struct compat_robust_list list; compat_long_t futex_offset; compat_uptr_t list_op_pending; } ;
703 struct ethhdr { unsigned char h_dest[6U]; unsigned char h_source[6U]; __be16 h_proto; } ;
34 struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u8 mdio_support; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u8 eth_tp_mdix; __u8 eth_tp_mdix_ctrl; __u32 lp_advertising; __u32 reserved[2U]; } ;
125 struct ethtool_drvinfo { __u32 cmd; char driver[32U]; char version[32U]; char fw_version[32U]; char bus_info[32U]; char reserved1[32U]; char reserved2[12U]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; } ;
187 struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[6U]; } ;
211 struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0U]; } ;
233 struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0U]; } ;
259 struct ethtool_eee { __u32 cmd; __u32 supported; __u32 advertised; __u32 lp_advertised; __u32 eee_active; __u32 eee_enabled; __u32 tx_lpi_enabled; __u32 tx_lpi_timer; __u32 reserved[2U]; } ;
288 struct ethtool_modinfo { __u32 cmd; __u32 type; __u32 eeprom_len; __u32 reserved[8U]; } ;
305 struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; } ;
404 struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; } ;
441 struct ethtool_channels { __u32 cmd; __u32 max_rx; __u32 max_tx; __u32 max_other; __u32 max_combined; __u32 rx_count; __u32 tx_count; __u32 other_count; __u32 combined_count; } ;
469 struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; } ;
568 struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0U]; } ;
600 struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0U]; } ;
642 struct ethtool_tcpip4_spec { __be32 ip4src; __be32 ip4dst; __be16 psrc; __be16 pdst; __u8 tos; } ;
675 struct ethtool_ah_espip4_spec { __be32 ip4src; __be32 ip4dst; __be32 spi; __u8 tos; } ;
691 struct ethtool_usrip4_spec { __be32 ip4src; __be32 ip4dst; __be32 l4_4_bytes; __u8 tos; __u8 ip_ver; __u8 proto; } ;
711 union ethtool_flow_union { struct ethtool_tcpip4_spec tcp_ip4_spec; struct ethtool_tcpip4_spec udp_ip4_spec; struct ethtool_tcpip4_spec sctp_ip4_spec; struct ethtool_ah_espip4_spec ah_ip4_spec; struct ethtool_ah_espip4_spec esp_ip4_spec; struct ethtool_usrip4_spec usr_ip4_spec; struct ethhdr ether_spec; __u8 hdata[52U]; } ;
722 struct ethtool_flow_ext { __u8 padding[2U]; unsigned char h_dest[6U]; __be16 vlan_etype; __be16 vlan_tci; __be32 data[2U]; } ;
741 struct ethtool_rx_flow_spec { __u32 flow_type; union ethtool_flow_union h_u; struct ethtool_flow_ext h_ext; union ethtool_flow_union m_u; struct ethtool_flow_ext m_ext; __u64 ring_cookie; __u32 location; } ;
767 struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; struct ethtool_rx_flow_spec fs; __u32 rule_cnt; __u32 rule_locs[0U]; } ;
933 struct ethtool_flash { __u32 cmd; __u32 region; char data[128U]; } ;
941 struct ethtool_dump { __u32 cmd; __u32 version; __u32 flag; __u32 len; __u8 data[0U]; } ;
1017 struct ethtool_ts_info { __u32 cmd; __u32 so_timestamping; __s32 phc_index; __u32 tx_types; __u32 tx_reserved[3U]; __u32 rx_filters; __u32 rx_reserved[3U]; } ;
44 enum ethtool_phys_id_state { ETHTOOL_ID_INACTIVE = 0, ETHTOOL_ID_ACTIVE = 1, ETHTOOL_ID_ON = 2, ETHTOOL_ID_OFF = 3 } ;
79 struct ethtool_ops { int (*get_settings)(struct net_device *, struct ethtool_cmd *); int (*set_settings)(struct net_device *, struct ethtool_cmd *); void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); int (*get_regs_len)(struct net_device *); void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); u32 (*get_msglevel)(struct net_device *); void (*set_msglevel)(struct net_device *, u32 ); int (*nway_reset)(struct net_device *); u32 (*get_link)(struct net_device *); int (*get_eeprom_len)(struct net_device *); int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam *); int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam *); void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); void (*get_strings)(struct net_device *, u32 , u8 *); int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state ); void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); int (*begin)(struct net_device *); void (*complete)(struct net_device *); u32 (*get_priv_flags)(struct net_device *); int (*set_priv_flags)(struct net_device *, u32 ); int (*get_sset_count)(struct net_device *, int); int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, u32 *); int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); int (*flash_device)(struct net_device *, struct ethtool_flash *); int (*reset)(struct net_device *, u32 *); u32 (*get_rxfh_key_size)(struct net_device *); u32 (*get_rxfh_indir_size)(struct net_device *); int (*get_rxfh)(struct net_device *, u32 *, u8 *); int (*set_rxfh)(struct net_device *, const u32 *, const u8 *); void (*get_channels)(struct net_device *, struct ethtool_channels *); int (*set_channels)(struct net_device *, struct ethtool_channels *); int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); int (*get_dump_data)(struct net_device *, struct ethtool_dump *, void *); int (*set_dump)(struct net_device *, struct ethtool_dump *); int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *); int (*get_module_info)(struct net_device *, struct ethtool_modinfo *); int (*get_module_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); int (*get_eee)(struct net_device *, struct ethtool_eee *); int (*set_eee)(struct net_device *, struct ethtool_eee *); } ;
235 struct prot_inuse ;
236 struct netns_core { struct ctl_table_header *sysctl_hdr; int sysctl_somaxconn; struct prot_inuse *inuse; } ;
38 struct u64_stats_sync { } ;
145 struct ipstats_mib { u64 mibs[36U]; struct u64_stats_sync syncp; } ;
61 struct icmp_mib { unsigned long mibs[28U]; } ;
67 struct icmpmsg_mib { atomic_long_t mibs[512U]; } ;
72 struct icmpv6_mib { unsigned long mibs[6U]; } ;
83 struct icmpv6msg_mib { atomic_long_t mibs[512U]; } ;
93 struct tcp_mib { unsigned long mibs[16U]; } ;
100 struct udp_mib { unsigned long mibs[8U]; } ;
106 struct linux_mib { unsigned long mibs[103U]; } ;
112 struct linux_xfrm_mib { unsigned long mibs[29U]; } ;
118 struct netns_mib { struct tcp_mib *tcp_statistics; struct ipstats_mib *ip_statistics; struct linux_mib *net_statistics; struct udp_mib *udp_statistics; struct udp_mib *udplite_statistics; struct icmp_mib *icmp_statistics; struct icmpmsg_mib *icmpmsg_statistics; struct proc_dir_entry *proc_net_devsnmp6; struct udp_mib *udp_stats_in6; struct udp_mib *udplite_stats_in6; struct ipstats_mib *ipv6_statistics; struct icmpv6_mib *icmpv6_statistics; struct icmpv6msg_mib *icmpv6msg_statistics; struct linux_xfrm_mib *xfrm_statistics; } ;
26 struct netns_unix { int sysctl_max_dgram_qlen; struct ctl_table_header *ctl; } ;
12 struct netns_packet { struct mutex sklist_lock; struct hlist_head sklist; } ;
14 struct netns_frags { int nqueues; struct list_head lru_list; spinlock_t lru_lock; struct percpu_counter mem; int timeout; int high_thresh; int low_thresh; } ;
180 struct tcpm_hash_bucket ;
181 struct ipv4_devconf ;
182 struct fib_rules_ops ;
183 struct fib_table ;
184 struct local_ports { seqlock_t lock; int range[2U]; } ;
22 struct ping_group_range { seqlock_t lock; kgid_t range[2U]; } ;
27 struct inet_peer_base ;
27 struct xt_table ;
27 struct netns_ipv4 { struct ctl_table_header *forw_hdr; struct ctl_table_header *frags_hdr; struct ctl_table_header *ipv4_hdr; struct ctl_table_header *route_hdr; struct ctl_table_header *xfrm4_hdr; struct ipv4_devconf *devconf_all; struct ipv4_devconf *devconf_dflt; struct fib_rules_ops *rules_ops; bool fib_has_custom_rules; struct fib_table *fib_local; struct fib_table *fib_main; struct fib_table *fib_default; int fib_num_tclassid_users; struct hlist_head *fib_table_hash; struct sock *fibnl; struct sock **icmp_sk; struct inet_peer_base *peers; struct tcpm_hash_bucket *tcp_metrics_hash; unsigned int tcp_metrics_hash_log; struct netns_frags frags; struct xt_table *iptable_filter; struct xt_table *iptable_mangle; struct xt_table *iptable_raw; struct xt_table *arptable_filter; struct xt_table *iptable_security; struct xt_table *nat_table; int sysctl_icmp_echo_ignore_all; int sysctl_icmp_echo_ignore_broadcasts; int sysctl_icmp_ignore_bogus_error_responses; int sysctl_icmp_ratelimit; int sysctl_icmp_ratemask; int sysctl_icmp_errors_use_inbound_ifaddr; struct local_ports ip_local_ports; int sysctl_tcp_ecn; int sysctl_ip_no_pmtu_disc; int sysctl_ip_fwd_use_pmtu; int sysctl_fwmark_reflect; int sysctl_tcp_fwmark_accept; struct ping_group_range ping_group_range; atomic_t dev_addr_genid; unsigned long *sysctl_local_reserved_ports; struct list_head mr_tables; struct fib_rules_ops *mr_rules_ops; atomic_t rt_genid; } ;
102 struct neighbour ;
102 struct dst_ops { unsigned short family; __be16 protocol; unsigned int gc_thresh; int (*gc)(struct dst_ops *); struct dst_entry * (*check)(struct dst_entry *, __u32 ); unsigned int (*default_advmss)(const struct dst_entry *); unsigned int (*mtu)(const struct dst_entry *); u32 * (*cow_metrics)(struct dst_entry *, unsigned long); void (*destroy)(struct dst_entry *); void (*ifdown)(struct dst_entry *, struct net_device *, int); struct dst_entry * (*negative_advice)(struct dst_entry *); void (*link_failure)(struct sk_buff *); void (*update_pmtu)(struct dst_entry *, struct sock *, struct sk_buff *, u32 ); void (*redirect)(struct dst_entry *, struct sock *, struct sk_buff *); int (*local_out)(struct sk_buff *); struct neighbour * (*neigh_lookup)(const struct dst_entry *, struct sk_buff *, const void *); struct kmem_cache *kmem_cachep; struct percpu_counter pcpuc_entries; } ;
73 struct netns_sysctl_ipv6 { struct ctl_table_header *hdr; struct ctl_table_header *route_hdr; struct ctl_table_header *icmp_hdr; struct ctl_table_header *frags_hdr; struct ctl_table_header *xfrm6_hdr; int bindv6only; int flush_delay; int ip6_rt_max_size; int ip6_rt_gc_min_interval; int ip6_rt_gc_timeout; int ip6_rt_gc_interval; int ip6_rt_gc_elasticity; int ip6_rt_mtu_expires; int ip6_rt_min_advmss; int flowlabel_consistency; int icmpv6_time; int anycast_src_echo_reply; int fwmark_reflect; } ;
35 struct ipv6_devconf ;
35 struct rt6_info ;
35 struct rt6_statistics ;
35 struct fib6_table ;
35 struct netns_ipv6 { struct netns_sysctl_ipv6 sysctl; struct ipv6_devconf *devconf_all; struct ipv6_devconf *devconf_dflt; struct inet_peer_base *peers; struct netns_frags frags; struct xt_table *ip6table_filter; struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; struct xt_table *ip6table_security; struct xt_table *ip6table_nat; struct rt6_info *ip6_null_entry; struct rt6_statistics *rt6_stats; struct timer_list ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; struct dst_ops ip6_dst_ops; unsigned int ip6_rt_gc_expire; unsigned long ip6_rt_last_gc; struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; struct fib6_table *fib6_local_tbl; struct fib_rules_ops *fib6_rules_ops; struct sock **icmp_sk; struct sock *ndisc_sk; struct sock *tcp_sk; struct sock *igmp_sk; struct list_head mr6_tables; struct fib_rules_ops *mr6_rules_ops; atomic_t dev_addr_genid; atomic_t rt_genid; } ;
80 struct netns_nf_frag { struct netns_sysctl_ipv6 sysctl; struct netns_frags frags; } ;
86 struct netns_sysctl_lowpan { struct ctl_table_header *frags_hdr; } ;
14 struct netns_ieee802154_lowpan { struct netns_sysctl_lowpan sysctl; struct netns_frags frags; u16 max_dsize; } ;
21 struct sctp_mib ;
22 struct netns_sctp { struct sctp_mib *sctp_statistics; struct proc_dir_entry *proc_net_sctp; struct ctl_table_header *sysctl_header; struct sock *ctl_sock; struct list_head local_addr_list; struct list_head addr_waitq; struct timer_list addr_wq_timer; struct list_head auto_asconf_splist; spinlock_t addr_wq_lock; spinlock_t local_addr_lock; unsigned int rto_initial; unsigned int rto_min; unsigned int rto_max; int rto_alpha; int rto_beta; int max_burst; int cookie_preserve_enable; char *sctp_hmac_alg; unsigned int valid_cookie_life; unsigned int sack_timeout; unsigned int hb_interval; int max_retrans_association; int max_retrans_path; int max_retrans_init; int pf_retrans; int sndbuf_policy; int rcvbuf_policy; int default_auto_asconf; int addip_enable; int addip_noauth; int prsctp_enable; int auth_enable; int scope_policy; int rwnd_upd_shift; unsigned long max_autoclose; } ;
133 struct netns_dccp { struct sock *v4_ctl_sk; struct sock *v6_ctl_sk; } ;
324 struct nlattr ;
337 struct nf_logger ;
338 struct netns_nf { struct proc_dir_entry *proc_netfilter; const struct nf_logger *nf_loggers[13U]; struct ctl_table_header *nf_log_dir_header; } ;
17 struct ebt_table ;
18 struct netns_xt { struct list_head tables[13U]; bool notrack_deprecated_warning; struct ebt_table *broute_table; struct ebt_table *frame_filter; struct ebt_table *frame_nat; bool ulog_warn_deprecated; bool ebt_ulog_warn_deprecated; } ;
24 struct hlist_nulls_node ;
24 struct hlist_nulls_head { struct hlist_nulls_node *first; } ;
20 struct hlist_nulls_node { struct hlist_nulls_node *next; struct hlist_nulls_node **pprev; } ;
32 struct nf_proto_net { struct ctl_table_header *ctl_table_header; struct ctl_table *ctl_table; struct ctl_table_header *ctl_compat_header; struct ctl_table *ctl_compat_table; unsigned int users; } ;
24 struct nf_generic_net { struct nf_proto_net pn; unsigned int timeout; } ;
29 struct nf_tcp_net { struct nf_proto_net pn; unsigned int timeouts[14U]; unsigned int tcp_loose; unsigned int tcp_be_liberal; unsigned int tcp_max_retrans; } ;
43 struct nf_udp_net { struct nf_proto_net pn; unsigned int timeouts[2U]; } ;
48 struct nf_icmp_net { struct nf_proto_net pn; unsigned int timeout; } ;
53 struct nf_ip_net { struct nf_generic_net generic; struct nf_tcp_net tcp; struct nf_udp_net udp; struct nf_icmp_net icmp; struct nf_icmp_net icmpv6; struct ctl_table_header *ctl_table_header; struct ctl_table *ctl_table; } ;
64 struct ct_pcpu { spinlock_t lock; struct hlist_nulls_head unconfirmed; struct hlist_nulls_head dying; struct hlist_nulls_head tmpl; } ;
72 struct ip_conntrack_stat ;
72 struct nf_ct_event_notifier ;
72 struct nf_exp_event_notifier ;
72 struct netns_ct { atomic_t count; unsigned int expect_count; struct ctl_table_header *sysctl_header; struct ctl_table_header *acct_sysctl_header; struct ctl_table_header *tstamp_sysctl_header; struct ctl_table_header *event_sysctl_header; struct ctl_table_header *helper_sysctl_header; char *slabname; unsigned int sysctl_log_invalid; unsigned int sysctl_events_retry_timeout; int sysctl_events; int sysctl_acct; int sysctl_auto_assign_helper; bool auto_assign_helper_warned; int sysctl_tstamp; int sysctl_checksum; unsigned int htable_size; seqcount_t generation; struct kmem_cache *nf_conntrack_cachep; struct hlist_nulls_head *hash; struct hlist_head *expect_hash; struct ct_pcpu *pcpu_lists; struct ip_conntrack_stat *stat; struct nf_ct_event_notifier *nf_conntrack_event_cb; struct nf_exp_event_notifier *nf_expect_event_cb; struct nf_ip_net nf_ct_proto; unsigned int labels_used; u8 label_words; struct hlist_head *nat_bysource; unsigned int nat_htable_size; } ;
111 struct nft_af_info ;
112 struct netns_nftables { struct list_head af_info; struct list_head commit_list; struct nft_af_info *ipv4; struct nft_af_info *ipv6; struct nft_af_info *inet; struct nft_af_info *arp; struct nft_af_info *bridge; u8 gencursor; u8 genctr; } ;
499 struct flow_cache_percpu { struct hlist_head *hash_table; int hash_count; u32 hash_rnd; int hash_rnd_recalc; struct tasklet_struct flush_tasklet; } ;
16 struct flow_cache { u32 hash_shift; struct flow_cache_percpu *percpu; struct notifier_block hotcpu_notifier; int low_watermark; int high_watermark; struct timer_list rnd_timer; } ;
25 struct xfrm_policy_hash { struct hlist_head *table; unsigned int hmask; } ;
17 struct netns_xfrm { struct list_head state_all; struct hlist_head *state_bydst; struct hlist_head *state_bysrc; struct hlist_head *state_byspi; unsigned int state_hmask; unsigned int state_num; struct work_struct state_hash_work; struct hlist_head state_gc_list; struct work_struct state_gc_work; struct list_head policy_all; struct hlist_head *policy_byidx; unsigned int policy_idx_hmask; struct hlist_head policy_inexact[6U]; struct xfrm_policy_hash policy_bydst[6U]; unsigned int policy_count[6U]; struct work_struct policy_hash_work; struct sock *nlsk; struct sock *nlsk_stash; u32 sysctl_aevent_etime; u32 sysctl_aevent_rseqth; int sysctl_larval_drop; u32 sysctl_acq_expires; struct ctl_table_header *sysctl_hdr; struct dst_ops xfrm4_dst_ops; struct dst_ops xfrm6_dst_ops; spinlock_t xfrm_state_lock; rwlock_t xfrm_policy_lock; struct mutex xfrm_cfg_mutex; struct flow_cache flow_cache_global; atomic_t flow_cache_genid; struct list_head flow_cache_gc_list; spinlock_t flow_cache_gc_lock; struct work_struct flow_cache_gc_work; struct work_struct flow_cache_flush_work; struct mutex flow_flush_sem; } ;
74 struct net_generic ;
75 struct netns_ipvs ;
76 struct net { atomic_t passive; atomic_t count; spinlock_t rules_mod_lock; struct list_head list; struct list_head cleanup_list; struct list_head exit_list; struct user_namespace *user_ns; unsigned int proc_inum; struct proc_dir_entry *proc_net; struct proc_dir_entry *proc_net_stat; struct ctl_table_set sysctls; struct sock *rtnl; struct sock *genl_sock; struct list_head dev_base_head; struct hlist_head *dev_name_head; struct hlist_head *dev_index_head; unsigned int dev_base_seq; int ifindex; unsigned int dev_unreg_count; struct list_head rules_ops; struct net_device *loopback_dev; struct netns_core core; struct netns_mib mib; struct netns_packet packet; struct netns_unix unx; struct netns_ipv4 ipv4; struct netns_ipv6 ipv6; struct netns_ieee802154_lowpan ieee802154_lowpan; struct netns_sctp sctp; struct netns_dccp dccp; struct netns_nf nf; struct netns_xt xt; struct netns_ct ct; struct netns_nftables nft; struct netns_nf_frag nf_frag; struct sock *nfnl; struct sock *nfnl_stash; struct sk_buff_head wext_nlevents; struct net_generic *gen; struct netns_xfrm xfrm; struct netns_ipvs *ipvs; struct sock *diag_nlsk; atomic_t fnhe_genid; } ;
400 struct dsa_chip_data { struct device *mii_bus; int sw_addr; char *port_names[12U]; s8 *rtable; } ;
46 struct dsa_platform_data { struct device *netdev; int nr_chips; struct dsa_chip_data *chip; } ;
61 struct dsa_switch ;
61 struct dsa_switch_tree { struct dsa_platform_data *pd; struct net_device *master_netdev; __be16 tag_protocol; s8 cpu_switch; s8 cpu_port; int link_poll_needed; struct work_struct link_poll_work; struct timer_list link_poll_timer; struct dsa_switch *ds[4U]; } ;
94 struct dsa_switch_driver ;
94 struct mii_bus ;
94 struct dsa_switch { struct dsa_switch_tree *dst; int index; struct dsa_chip_data *pd; struct dsa_switch_driver *drv; struct mii_bus *master_mii_bus; u32 dsa_port_mask; u32 phys_port_mask; struct mii_bus *slave_mii_bus; struct net_device *ports[12U]; } ;
146 struct dsa_switch_driver { struct list_head list; __be16 tag_protocol; int priv_size; char * (*probe)(struct mii_bus *, int); int (*setup)(struct dsa_switch *); int (*set_addr)(struct dsa_switch *, u8 *); int (*phy_read)(struct dsa_switch *, int, int); int (*phy_write)(struct dsa_switch *, int, int, u16 ); void (*poll_link)(struct dsa_switch *); void (*get_strings)(struct dsa_switch *, int, uint8_t *); void (*get_ethtool_stats)(struct dsa_switch *, int, uint64_t *); int (*get_sset_count)(struct dsa_switch *); } ;
205 struct ieee_ets { __u8 willing; __u8 ets_cap; __u8 cbs; __u8 tc_tx_bw[8U]; __u8 tc_rx_bw[8U]; __u8 tc_tsa[8U]; __u8 prio_tc[8U]; __u8 tc_reco_bw[8U]; __u8 tc_reco_tsa[8U]; __u8 reco_prio_tc[8U]; } ;
69 struct ieee_maxrate { __u64 tc_maxrate[8U]; } ;
80 struct ieee_pfc { __u8 pfc_cap; __u8 pfc_en; __u8 mbc; __u16 delay; __u64 requests[8U]; __u64 indications[8U]; } ;
100 struct cee_pg { __u8 willing; __u8 error; __u8 pg_en; __u8 tcs_supported; __u8 pg_bw[8U]; __u8 prio_pg[8U]; } ;
123 struct cee_pfc { __u8 willing; __u8 error; __u8 pfc_en; __u8 tcs_supported; } ;
138 struct dcb_app { __u8 selector; __u8 priority; __u16 protocol; } ;
167 struct dcb_peer_app_info { __u8 willing; __u8 error; } ;
40 struct dcbnl_rtnl_ops { int (*ieee_getets)(struct net_device *, struct ieee_ets *); int (*ieee_setets)(struct net_device *, struct ieee_ets *); int (*ieee_getmaxrate)(struct net_device *, struct ieee_maxrate *); int (*ieee_setmaxrate)(struct net_device *, struct ieee_maxrate *); int (*ieee_getpfc)(struct net_device *, struct ieee_pfc *); int (*ieee_setpfc)(struct net_device *, struct ieee_pfc *); int (*ieee_getapp)(struct net_device *, struct dcb_app *); int (*ieee_setapp)(struct net_device *, struct dcb_app *); int (*ieee_delapp)(struct net_device *, struct dcb_app *); int (*ieee_peer_getets)(struct net_device *, struct ieee_ets *); int (*ieee_peer_getpfc)(struct net_device *, struct ieee_pfc *); u8 (*getstate)(struct net_device *); u8 (*setstate)(struct net_device *, u8 ); void (*getpermhwaddr)(struct net_device *, u8 *); void (*setpgtccfgtx)(struct net_device *, int, u8 , u8 , u8 , u8 ); void (*setpgbwgcfgtx)(struct net_device *, int, u8 ); void (*setpgtccfgrx)(struct net_device *, int, u8 , u8 , u8 , u8 ); void (*setpgbwgcfgrx)(struct net_device *, int, u8 ); void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgtx)(struct net_device *, int, u8 *); void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); void (*getpgbwgcfgrx)(struct net_device *, int, u8 *); void (*setpfccfg)(struct net_device *, int, u8 ); void (*getpfccfg)(struct net_device *, int, u8 *); u8 (*setall)(struct net_device *); u8 (*getcap)(struct net_device *, int, u8 *); int (*getnumtcs)(struct net_device *, int, u8 *); int (*setnumtcs)(struct net_device *, int, u8 ); u8 (*getpfcstate)(struct net_device *); void (*setpfcstate)(struct net_device *, u8 ); void (*getbcncfg)(struct net_device *, int, u32 *); void (*setbcncfg)(struct net_device *, int, u32 ); void (*getbcnrp)(struct net_device *, int, u8 *); void (*setbcnrp)(struct net_device *, int, u8 ); u8 (*setapp)(struct net_device *, u8 , u16 , u8 ); u8 (*getapp)(struct net_device *, u8 , u16 ); u8 (*getfeatcfg)(struct net_device *, int, u8 *); u8 (*setfeatcfg)(struct net_device *, int, u8 ); u8 (*getdcbx)(struct net_device *); u8 (*setdcbx)(struct net_device *, u8 ); int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *, u16 *); int (*peer_getapptable)(struct net_device *, struct dcb_app *); int (*cee_peer_getpg)(struct net_device *, struct cee_pg *); int (*cee_peer_getpfc)(struct net_device *, struct cee_pfc *); } ;
102 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; } ;
919 struct netprio_map { struct callback_head rcu; u32 priomap_len; u32 priomap[]; } ;
3161 struct mnt_namespace ;
3162 struct ipc_namespace ;
3163 struct nsproxy { atomic_t count; struct uts_namespace *uts_ns; struct ipc_namespace *ipc_ns; struct mnt_namespace *mnt_ns; struct pid_namespace *pid_ns_for_children; struct net *net_ns; } ;
41 struct nlmsghdr { __u32 nlmsg_len; __u16 nlmsg_type; __u16 nlmsg_flags; __u32 nlmsg_seq; __u32 nlmsg_pid; } ;
145 struct nlattr { __u16 nla_len; __u16 nla_type; } ;
104 struct netlink_callback { struct sk_buff *skb; const struct nlmsghdr *nlh; int (*dump)(struct sk_buff *, struct netlink_callback *); int (*done)(struct netlink_callback *); void *data; struct module *module; u16 family; u16 min_dump_alloc; unsigned int prev_seq; unsigned int seq; long args[6U]; } ;
180 struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; } ;
39 struct rtnl_link_stats64 { __u64 rx_packets; __u64 tx_packets; __u64 rx_bytes; __u64 tx_bytes; __u64 rx_errors; __u64 tx_errors; __u64 rx_dropped; __u64 tx_dropped; __u64 multicast; __u64 collisions; __u64 rx_length_errors; __u64 rx_over_errors; __u64 rx_crc_errors; __u64 rx_frame_errors; __u64 rx_fifo_errors; __u64 rx_missed_errors; __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; __u64 rx_compressed; __u64 tx_compressed; } ;
547 struct ifla_vf_info { __u32 vf; __u8 mac[32U]; __u32 vlan; __u32 qos; __u32 spoofchk; __u32 linkstate; __u32 min_tx_rate; __u32 max_tx_rate; } ;
28 struct netpoll_info ;
29 struct phy_device ;
30 struct wireless_dev ;
61 enum netdev_tx { __NETDEV_TX_MIN = -2147483648, NETDEV_TX_OK = 0, NETDEV_TX_BUSY = 16, NETDEV_TX_LOCKED = 32 } ;
106 typedef enum netdev_tx netdev_tx_t;
125 struct net_device_stats { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_bytes; unsigned long tx_bytes; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long multicast; unsigned long collisions; unsigned long rx_length_errors; unsigned long rx_over_errors; unsigned long rx_crc_errors; unsigned long rx_frame_errors; unsigned long rx_fifo_errors; unsigned long rx_missed_errors; unsigned long tx_aborted_errors; unsigned long tx_carrier_errors; unsigned long tx_fifo_errors; unsigned long tx_heartbeat_errors; unsigned long tx_window_errors; unsigned long rx_compressed; unsigned long tx_compressed; } ;
186 struct neigh_parms ;
207 struct netdev_hw_addr_list { struct list_head list; int count; } ;
212 struct hh_cache { u16 hh_len; u16 __pad; seqlock_t hh_lock; unsigned long hh_data[16U]; } ;
241 struct header_ops { int (*create)(struct sk_buff *, struct net_device *, unsigned short, const void *, const void *, unsigned int); int (*parse)(const struct sk_buff *, unsigned char *); int (*rebuild)(struct sk_buff *); int (*cache)(const struct neighbour *, struct hh_cache *, __be16 ); void (*cache_update)(struct hh_cache *, const struct net_device *, const unsigned char *); } ;
292 struct napi_struct { struct list_head poll_list; unsigned long state; int weight; unsigned int gro_count; int (*poll)(struct napi_struct *, int); spinlock_t poll_lock; int poll_owner; struct net_device *dev; struct sk_buff *gro_list; struct sk_buff *skb; struct list_head dev_list; struct hlist_node napi_hash_node; unsigned int napi_id; } ;
336 enum rx_handler_result { RX_HANDLER_CONSUMED = 0, RX_HANDLER_ANOTHER = 1, RX_HANDLER_EXACT = 2, RX_HANDLER_PASS = 3 } ;
384 typedef enum rx_handler_result rx_handler_result_t;
385 typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **);
522 struct Qdisc ;
522 struct netdev_queue { struct net_device *dev; struct Qdisc *qdisc; struct Qdisc *qdisc_sleeping; struct kobject kobj; int numa_node; spinlock_t _xmit_lock; int xmit_lock_owner; unsigned long trans_start; unsigned long trans_timeout; unsigned long state; struct dql dql; } ;
591 struct rps_map { unsigned int len; struct callback_head rcu; u16 cpus[0U]; } ;
603 struct rps_dev_flow { u16 cpu; u16 filter; unsigned int last_qtail; } ;
615 struct rps_dev_flow_table { unsigned int mask; struct callback_head rcu; struct rps_dev_flow flows[0U]; } ;
666 struct netdev_rx_queue { struct rps_map *rps_map; struct rps_dev_flow_table *rps_flow_table; struct kobject kobj; struct net_device *dev; } ;
689 struct xps_map { unsigned int len; unsigned int alloc_len; struct callback_head rcu; u16 queues[0U]; } ;
702 struct xps_dev_maps { struct callback_head rcu; struct xps_map *cpu_map[0U]; } ;
713 struct netdev_tc_txq { u16 count; u16 offset; } ;
724 struct netdev_fcoe_hbainfo { char manufacturer[64U]; char serial_number[64U]; char hardware_version[64U]; char driver_version[64U]; char optionrom_version[64U]; char firmware_version[64U]; char model[256U]; char model_description[256U]; } ;
740 struct netdev_phys_port_id { unsigned char id[32U]; unsigned char id_len; } ;
753 struct net_device_ops { int (*ndo_init)(struct net_device *); void (*ndo_uninit)(struct net_device *); int (*ndo_open)(struct net_device *); int (*ndo_stop)(struct net_device *); netdev_tx_t (*ndo_start_xmit)(struct sk_buff *, struct net_device *); u16 (*ndo_select_queue)(struct net_device *, struct sk_buff *, void *, u16 (*)(struct net_device *, struct sk_buff *)); void (*ndo_change_rx_flags)(struct net_device *, int); void (*ndo_set_rx_mode)(struct net_device *); int (*ndo_set_mac_address)(struct net_device *, void *); int (*ndo_validate_addr)(struct net_device *); int (*ndo_do_ioctl)(struct net_device *, struct ifreq *, int); int (*ndo_set_config)(struct net_device *, struct ifmap *); int (*ndo_change_mtu)(struct net_device *, int); int (*ndo_neigh_setup)(struct net_device *, struct neigh_parms *); void (*ndo_tx_timeout)(struct net_device *); struct rtnl_link_stats64 * (*ndo_get_stats64)(struct net_device *, struct rtnl_link_stats64 *); struct net_device_stats * (*ndo_get_stats)(struct net_device *); int (*ndo_vlan_rx_add_vid)(struct net_device *, __be16 , u16 ); int (*ndo_vlan_rx_kill_vid)(struct net_device *, __be16 , u16 ); void (*ndo_poll_controller)(struct net_device *); int (*ndo_netpoll_setup)(struct net_device *, struct netpoll_info *); void (*ndo_netpoll_cleanup)(struct net_device *); int (*ndo_busy_poll)(struct napi_struct *); int (*ndo_set_vf_mac)(struct net_device *, int, u8 *); int (*ndo_set_vf_vlan)(struct net_device *, int, u16 , u8 ); int (*ndo_set_vf_rate)(struct net_device *, int, int, int); int (*ndo_set_vf_spoofchk)(struct net_device *, int, bool ); int (*ndo_get_vf_config)(struct net_device *, int, struct ifla_vf_info *); int (*ndo_set_vf_link_state)(struct net_device *, int, int); int (*ndo_set_vf_port)(struct net_device *, int, struct nlattr **); int (*ndo_get_vf_port)(struct net_device *, int, struct sk_buff *); int (*ndo_setup_tc)(struct net_device *, u8 ); int (*ndo_fcoe_enable)(struct net_device *); int (*ndo_fcoe_disable)(struct net_device *); int (*ndo_fcoe_ddp_setup)(struct net_device *, u16 , struct scatterlist *, unsigned int); int (*ndo_fcoe_ddp_done)(struct net_device *, u16 ); int (*ndo_fcoe_ddp_target)(struct net_device *, u16 , struct scatterlist *, unsigned int); int (*ndo_fcoe_get_hbainfo)(struct net_device *, struct netdev_fcoe_hbainfo *); int (*ndo_fcoe_get_wwn)(struct net_device *, u64 *, int); int (*ndo_rx_flow_steer)(struct net_device *, const struct sk_buff *, u16 , u32 ); int (*ndo_add_slave)(struct net_device *, struct net_device *); int (*ndo_del_slave)(struct net_device *, struct net_device *); netdev_features_t (*ndo_fix_features)(struct net_device *, netdev_features_t ); int (*ndo_set_features)(struct net_device *, netdev_features_t ); int (*ndo_neigh_construct)(struct neighbour *); void (*ndo_neigh_destroy)(struct neighbour *); int (*ndo_fdb_add)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *, u16 ); int (*ndo_fdb_del)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *); int (*ndo_fdb_dump)(struct sk_buff *, struct netlink_callback *, struct net_device *, int); int (*ndo_bridge_setlink)(struct net_device *, struct nlmsghdr *); int (*ndo_bridge_getlink)(struct sk_buff *, u32 , u32 , struct net_device *, u32 ); int (*ndo_bridge_dellink)(struct net_device *, struct nlmsghdr *); int (*ndo_change_carrier)(struct net_device *, bool ); int (*ndo_get_phys_port_id)(struct net_device *, struct netdev_phys_port_id *); void (*ndo_add_vxlan_port)(struct net_device *, sa_family_t , __be16 ); void (*ndo_del_vxlan_port)(struct net_device *, sa_family_t , __be16 ); void * (*ndo_dfwd_add_station)(struct net_device *, struct net_device *); void (*ndo_dfwd_del_station)(struct net_device *, void *); netdev_tx_t (*ndo_dfwd_start_xmit)(struct sk_buff *, struct net_device *, void *); int (*ndo_get_lock_subclass)(struct net_device *); } ;
1187 struct __anonstruct_adj_list_249 { struct list_head upper; struct list_head lower; } ;
1187 struct __anonstruct_all_adj_list_250 { struct list_head upper; struct list_head lower; } ;
1187 struct iw_handler_def ;
1187 struct iw_public_data ;
1187 struct forwarding_accel_ops ;
1187 struct vlan_info ;
1187 struct tipc_bearer ;
1187 struct in_device ;
1187 struct dn_dev ;
1187 struct inet6_dev ;
1187 struct cpu_rmap ;
1187 struct pcpu_lstats ;
1187 struct pcpu_sw_netstats ;
1187 struct pcpu_dstats ;
1187 struct pcpu_vstats ;
1187 union __anonunion_ldv_41114_251 { void *ml_priv; struct pcpu_lstats *lstats; struct pcpu_sw_netstats *tstats; struct pcpu_dstats *dstats; struct pcpu_vstats *vstats; } ;
1187 struct garp_port ;
1187 struct mrp_port ;
1187 struct rtnl_link_ops ;
1187 struct net_device { char name[16U]; struct hlist_node name_hlist; char *ifalias; unsigned long mem_end; unsigned long mem_start; unsigned long base_addr; int irq; unsigned long state; struct list_head dev_list; struct list_head napi_list; struct list_head unreg_list; struct list_head close_list; struct __anonstruct_adj_list_249 adj_list; struct __anonstruct_all_adj_list_250 all_adj_list; netdev_features_t features; netdev_features_t hw_features; netdev_features_t wanted_features; netdev_features_t vlan_features; netdev_features_t hw_enc_features; netdev_features_t mpls_features; int ifindex; int iflink; struct net_device_stats stats; atomic_long_t rx_dropped; atomic_long_t tx_dropped; atomic_t carrier_changes; const struct iw_handler_def *wireless_handlers; struct iw_public_data *wireless_data; const struct net_device_ops *netdev_ops; const struct ethtool_ops *ethtool_ops; const struct forwarding_accel_ops *fwd_ops; const struct header_ops *header_ops; unsigned int flags; unsigned int priv_flags; unsigned short gflags; unsigned short padded; unsigned char operstate; unsigned char link_mode; unsigned char if_port; unsigned char dma; unsigned int mtu; unsigned short type; unsigned short hard_header_len; unsigned short needed_headroom; unsigned short needed_tailroom; unsigned char perm_addr[32U]; unsigned char addr_assign_type; unsigned char addr_len; unsigned short neigh_priv_len; unsigned short dev_id; unsigned short dev_port; spinlock_t addr_list_lock; struct netdev_hw_addr_list uc; struct netdev_hw_addr_list mc; struct netdev_hw_addr_list dev_addrs; struct kset *queues_kset; bool uc_promisc; unsigned int promiscuity; unsigned int allmulti; struct vlan_info *vlan_info; struct dsa_switch_tree *dsa_ptr; struct tipc_bearer *tipc_ptr; void *atalk_ptr; struct in_device *ip_ptr; struct dn_dev *dn_ptr; struct inet6_dev *ip6_ptr; void *ax25_ptr; struct wireless_dev *ieee80211_ptr; unsigned long last_rx; unsigned char *dev_addr; struct netdev_rx_queue *_rx; unsigned int num_rx_queues; unsigned int real_num_rx_queues; rx_handler_func_t *rx_handler; void *rx_handler_data; struct netdev_queue *ingress_queue; unsigned char broadcast[32U]; struct netdev_queue *_tx; unsigned int num_tx_queues; unsigned int real_num_tx_queues; struct Qdisc *qdisc; unsigned long tx_queue_len; spinlock_t tx_global_lock; struct xps_dev_maps *xps_maps; struct cpu_rmap *rx_cpu_rmap; unsigned long trans_start; int watchdog_timeo; struct timer_list watchdog_timer; int *pcpu_refcnt; struct list_head todo_list; struct hlist_node index_hlist; struct list_head link_watch_list; unsigned char reg_state; bool dismantle; unsigned short rtnl_link_state; void (*destructor)(struct net_device *); struct netpoll_info *npinfo; struct net *nd_net; union __anonunion_ldv_41114_251 ldv_41114; struct garp_port *garp_port; struct mrp_port *mrp_port; struct device dev; const struct attribute_group *sysfs_groups[4U]; const struct attribute_group *sysfs_rx_queue_group; const struct rtnl_link_ops *rtnl_link_ops; unsigned int gso_max_size; u16 gso_max_segs; const struct dcbnl_rtnl_ops *dcbnl_ops; u8 num_tc; struct netdev_tc_txq tc_to_txq[16U]; u8 prio_tc_map[16U]; unsigned int fcoe_ddp_xid; struct netprio_map *priomap; struct phy_device *phydev; struct lock_class_key *qdisc_tx_busylock; int group; struct pm_qos_request pm_qos_req; } ;
1806 struct pcpu_sw_netstats { u64 rx_packets; u64 rx_bytes; u64 tx_packets; u64 tx_bytes; struct u64_stats_sync syncp; } ;
2548 enum skb_free_reason { SKB_REASON_CONSUMED = 0, SKB_REASON_DROPPED = 1 } ;
6 typedef unsigned char cc_t;
7 typedef unsigned int speed_t;
8 typedef unsigned int tcflag_t;
30 struct ktermios { tcflag_t c_iflag; tcflag_t c_oflag; tcflag_t c_cflag; tcflag_t c_lflag; cc_t c_line; cc_t c_cc[19U]; speed_t c_ispeed; speed_t c_ospeed; } ;
41 struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; } ;
93 struct termiox { __u16 x_hflag; __u16 x_cflag; __u16 x_rflag[5U]; __u16 x_sflag; } ;
16 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count; } ;
34 struct tty_driver ;
35 struct serial_icounter_struct ;
36 struct tty_operations { struct tty_struct * (*lookup)(struct tty_driver *, struct inode *, int); int (*install)(struct tty_driver *, struct tty_struct *); void (*remove)(struct tty_driver *, struct tty_struct *); int (*open)(struct tty_struct *, struct file *); void (*close)(struct tty_struct *, struct file *); void (*shutdown)(struct tty_struct *); void (*cleanup)(struct tty_struct *); int (*write)(struct tty_struct *, const unsigned char *, int); int (*put_char)(struct tty_struct *, unsigned char); void (*flush_chars)(struct tty_struct *); int (*write_room)(struct tty_struct *); int (*chars_in_buffer)(struct tty_struct *); int (*ioctl)(struct tty_struct *, unsigned int, unsigned long); long int (*compat_ioctl)(struct tty_struct *, unsigned int, unsigned long); void (*set_termios)(struct tty_struct *, struct ktermios *); void (*throttle)(struct tty_struct *); void (*unthrottle)(struct tty_struct *); void (*stop)(struct tty_struct *); void (*start)(struct tty_struct *); void (*hangup)(struct tty_struct *); int (*break_ctl)(struct tty_struct *, int); void (*flush_buffer)(struct tty_struct *); void (*set_ldisc)(struct tty_struct *); void (*wait_until_sent)(struct tty_struct *, int); void (*send_xchar)(struct tty_struct *, char); int (*tiocmget)(struct tty_struct *); int (*tiocmset)(struct tty_struct *, unsigned int, unsigned int); int (*resize)(struct tty_struct *, struct winsize *); int (*set_termiox)(struct tty_struct *, struct termiox *); int (*get_icount)(struct tty_struct *, struct serial_icounter_struct *); int (*poll_init)(struct tty_driver *, int, char *); int (*poll_get_char)(struct tty_driver *, int); void (*poll_put_char)(struct tty_driver *, int, char); const struct file_operations *proc_fops; } ;
289 struct tty_port ;
289 struct tty_driver { int magic; struct kref kref; struct cdev *cdevs; struct module *owner; const char *driver_name; const char *name; int name_base; int major; int minor_start; unsigned int num; short type; short subtype; struct ktermios init_termios; unsigned long flags; struct proc_dir_entry *proc_entry; struct tty_driver *other; struct tty_struct **ttys; struct tty_port **ports; struct ktermios **termios; void *driver_state; const struct tty_operations *ops; struct list_head tty_drivers; } ;
356 struct ld_semaphore { long count; raw_spinlock_t wait_lock; unsigned int wait_readers; struct list_head read_wait; struct list_head write_wait; struct lockdep_map dep_map; } ;
170 struct tty_ldisc_ops { int magic; char *name; int num; int flags; int (*open)(struct tty_struct *); void (*close)(struct tty_struct *); void (*flush_buffer)(struct tty_struct *); ssize_t (*chars_in_buffer)(struct tty_struct *); ssize_t (*read)(struct tty_struct *, struct file *, unsigned char *, size_t ); ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t ); int (*ioctl)(struct tty_struct *, struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct tty_struct *, struct file *, unsigned int, unsigned long); void (*set_termios)(struct tty_struct *, struct ktermios *); unsigned int (*poll)(struct tty_struct *, struct file *, struct poll_table_struct *); int (*hangup)(struct tty_struct *); void (*receive_buf)(struct tty_struct *, const unsigned char *, char *, int); void (*write_wakeup)(struct tty_struct *); void (*dcd_change)(struct tty_struct *, unsigned int); void (*fasync)(struct tty_struct *, int); int (*receive_buf2)(struct tty_struct *, const unsigned char *, char *, int); struct module *owner; int refcount; } ;
220 struct tty_ldisc { struct tty_ldisc_ops *ops; struct tty_struct *tty; } ;
225 union __anonunion_ldv_42939_252 { struct tty_buffer *next; struct llist_node free; } ;
225 struct tty_buffer { union __anonunion_ldv_42939_252 ldv_42939; int used; int size; int commit; int read; int flags; unsigned long data[0U]; } ;
59 struct tty_bufhead { struct tty_buffer *head; struct work_struct work; struct mutex lock; atomic_t priority; struct tty_buffer sentinel; struct llist_head free; atomic_t mem_used; int mem_limit; struct tty_buffer *tail; } ;
71 struct tty_port_operations { int (*carrier_raised)(struct tty_port *); void (*dtr_rts)(struct tty_port *, int); void (*shutdown)(struct tty_port *); int (*activate)(struct tty_port *, struct tty_struct *); void (*destruct)(struct tty_port *); } ;
197 struct tty_port { struct tty_bufhead buf; struct tty_struct *tty; struct tty_struct *itty; const struct tty_port_operations *ops; spinlock_t lock; int blocked_open; int count; wait_queue_head_t open_wait; wait_queue_head_t close_wait; wait_queue_head_t delta_msr_wait; unsigned long flags; unsigned char console; unsigned char low_latency; struct mutex mutex; struct mutex buf_mutex; unsigned char *xmit_buf; unsigned int close_delay; unsigned int closing_wait; int drain_delay; struct kref kref; } ;
222 struct tty_struct { int magic; struct kref kref; struct device *dev; struct tty_driver *driver; const struct tty_operations *ops; int index; struct ld_semaphore ldisc_sem; struct tty_ldisc *ldisc; struct mutex atomic_write_lock; struct mutex legacy_mutex; struct mutex throttle_mutex; struct rw_semaphore termios_rwsem; struct mutex winsize_mutex; spinlock_t ctrl_lock; struct ktermios termios; struct ktermios termios_locked; struct termiox *termiox; char name[64U]; struct pid *pgrp; struct pid *session; unsigned long flags; int count; struct winsize winsize; unsigned char stopped; unsigned char hw_stopped; unsigned char flow_stopped; unsigned char packet; unsigned char ctrl_status; unsigned int receive_room; int flow_change; struct tty_struct *link; struct fasync_struct *fasync; int alt_speed; wait_queue_head_t write_wait; wait_queue_head_t read_wait; struct work_struct hangup_work; void *disc_data; void *driver_data; struct list_head tty_files; unsigned char closing; unsigned char *write_buf; int write_cnt; struct work_struct SAK_work; struct tty_port *port; } ;
64 enum debuglevel { DEBUG_INTR = 8, DEBUG_CMD = 32, DEBUG_STREAM = 64, DEBUG_STREAM_DUMP = 128, DEBUG_LLDATA = 256, DEBUG_EVENT = 512, DEBUG_HDLC = 2048, DEBUG_CHANNEL = 4096, DEBUG_TRANSCMD = 8192, DEBUG_MCMD = 16384, DEBUG_INIT = 32768, DEBUG_SUSPEND = 65536, DEBUG_OUTPUT = 131072, DEBUG_ISO = 262144, DEBUG_IF = 524288, DEBUG_USBREQ = 1048576, DEBUG_LOCKCMD = 2097152, DEBUG_ANY = 4194303 } ;
110 struct gigaset_ops ;
111 struct gigaset_driver ;
112 struct usb_cardstate ;
113 struct ser_cardstate ;
114 struct bas_cardstate ;
115 struct bc_state ;
116 struct usb_bc_state ;
117 struct ser_bc_state ;
118 struct bas_bc_state ;
119 struct reply_t { int resp_code; int min_ConState; int max_ConState; int parameter; int new_ConState; int timeout; int action[3U]; char *command; } ;
279 struct cardstate ;
279 struct inbuf_t { struct cardstate *cs; int inputstate; int head; int tail; unsigned char data[8192U]; } ;
286 struct isowbuf_t { int read; int nextread; int write; atomic_t writesem; int wbits; unsigned char data[4112U]; unsigned char idle; } ;
313 struct isow_urbctx_t { struct urb *urb; struct bc_state *bcs; int limit; int status; } ;
328 struct at_state_t { struct list_head list; int waiting; int getstring; unsigned int timer_index; unsigned long timer_expires; int timer_active; unsigned int ConState; struct reply_t *replystruct; int cid; int int_var[3U]; char *str_var[5U]; unsigned int pending_commands; unsigned int seq_index; struct cardstate *cs; struct bc_state *bcs; } ;
351 struct event_t { int type; void *ptr; void *arg; int parameter; int cid; struct at_state_t *at_state; } ;
359 union __anonunion_hw_253 { struct ser_bc_state *ser; struct usb_bc_state *usb; struct bas_bc_state *bas; } ;
359 struct bc_state { struct sk_buff *tx_skb; struct sk_buff_head squeue; int corrupted; int trans_down; int trans_up; struct at_state_t at_state; unsigned int rx_bufsize; struct sk_buff *rx_skb; __u16 rx_fcs; int inputstate; int channel; struct cardstate *cs; unsigned int chstate; int ignore; unsigned int proto2; char *commands[7U]; int emptycount; int busy; int use_count; union __anonunion_hw_253 hw; void *ap; int apconnstate; spinlock_t aplock; } ;
404 struct cmdbuf_t ;
404 union __anonunion_hw_254 { struct usb_cardstate *usb; struct ser_cardstate *ser; struct bas_cardstate *bas; } ;
404 struct cardstate { struct gigaset_driver *driver; unsigned int minor_index; struct device *dev; struct device *tty_dev; unsigned int flags; const struct gigaset_ops *ops; wait_queue_head_t waitqueue; int waiting; int mode; int mstate; int cmd_result; int channels; struct bc_state *bcs; int onechannel; spinlock_t lock; struct at_state_t at_state; struct list_head temp_at_states; struct inbuf_t *inbuf; struct cmdbuf_t *cmdbuf; struct cmdbuf_t *lastcmdbuf; spinlock_t cmdlock; unsigned int curlen; unsigned int cmdbytes; struct tty_port port; struct tasklet_struct if_wake_tasklet; unsigned int control_state; unsigned int fwver[4U]; int gotfwver; unsigned int running; unsigned int connected; unsigned int isdn_up; unsigned int cidmode; int myid; void *iif; unsigned short hw_hdr_len; struct reply_t *tabnocid; struct reply_t *tabcid; int cs_init; int ignoreframes; struct mutex mutex; struct timer_list timer; int retry_count; int dle; int cur_at_seq; int curchannel; int commands_pending; struct tasklet_struct event_tasklet; struct tasklet_struct write_tasklet; struct event_t events[64U]; unsigned int ev_tail; unsigned int ev_head; spinlock_t ev_lock; unsigned char respdata[512U]; unsigned int cbytes; union __anonunion_hw_254 hw; } ;
506 struct gigaset_driver { struct list_head list; spinlock_t lock; struct tty_driver *tty; unsigned int have_tty; unsigned int minor; unsigned int minors; struct cardstate *cs; int blocked; const struct gigaset_ops *ops; struct module *owner; } ;
520 struct cmdbuf_t { struct cmdbuf_t *next; struct cmdbuf_t *prev; int len; int offset; struct tasklet_struct *wake_tasklet; unsigned char buf[0U]; } ;
527 struct bas_bc_state { int running; atomic_t corrbytes; spinlock_t isooutlock; struct isow_urbctx_t isoouturbs[3U]; struct isow_urbctx_t *isooutdone; struct isow_urbctx_t *isooutfree; struct isow_urbctx_t *isooutovfl; struct isowbuf_t *isooutbuf; unsigned int numsub; struct tasklet_struct sent_tasklet; spinlock_t isoinlock; struct urb *isoinurbs[3U]; unsigned char isoinbuf[384U]; struct urb *isoindone; int isoinstatus; int loststatus; unsigned int isoinlost; unsigned int seqlen; unsigned int inbyte; unsigned int inbits; unsigned int goodbytes; unsigned int alignerrs; unsigned int fcserrs; unsigned int frameerrs; unsigned int giants; unsigned int runts; unsigned int aborts; unsigned int shared0s; unsigned int stolen0s; struct tasklet_struct rcvd_tasklet; } ;
566 struct gigaset_ops { int (*write_cmd)(struct cardstate *, struct cmdbuf_t *); int (*write_room)(struct cardstate *); int (*chars_in_buffer)(struct cardstate *); int (*brkchars)(struct cardstate *, const unsigned char *); int (*init_bchannel)(struct bc_state *); int (*close_bchannel)(struct bc_state *); int (*initbcshw)(struct bc_state *); void (*freebcshw)(struct bc_state *); void (*reinitbcshw)(struct bc_state *); int (*initcshw)(struct cardstate *); void (*freecshw)(struct cardstate *); int (*set_modem_ctrl)(struct cardstate *, unsigned int, unsigned int); int (*baud_rate)(struct cardstate *, unsigned int); int (*set_line_ctrl)(struct cardstate *, unsigned int); int (*send_skb)(struct bc_state *, struct sk_buff *); void (*handle_input)(struct inbuf_t *); } ;
104 struct bas_cardstate { struct usb_device *udev; struct usb_interface *interface; unsigned char minor; struct urb *urb_ctrl; struct usb_ctrlrequest dr_ctrl; struct timer_list timer_ctrl; int retry_ctrl; struct timer_list timer_atrdy; struct urb *urb_cmd_out; struct usb_ctrlrequest dr_cmd_out; int retry_cmd_out; struct urb *urb_cmd_in; struct usb_ctrlrequest dr_cmd_in; struct timer_list timer_cmd_in; unsigned char *rcvbuf; struct urb *urb_int_in; unsigned char *int_in_buf; struct work_struct int_in_wq; struct timer_list timer_int_in; int retry_int_in; spinlock_t lock; int basstate; int pending; wait_queue_head_t waitqueue; int rcvbuf_size; int retry_cmd_in; } ;
3310 typedef struct usb_device *ldv_func_ret_type;
3321 typedef struct usb_device *ldv_func_ret_type___0;
1 long int __builtin_expect(long exp, long c);
33 extern struct module __this_module;
204 int test_and_set_bit(long nr, volatile unsigned long *addr);
139 int printk(const char *, ...);
391 int snprintf(char *, size_t , const char *, ...);
24 void INIT_LIST_HEAD(struct list_head *list);
60 int memcmp(const void *, const void *, size_t );
25 int atomic_read(const atomic_t *v);
37 void atomic_set(atomic_t *v, int i);
49 void atomic_add(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 *);
32 unsigned long int _raw_spin_lock_irqsave(raw_spinlock_t *);
43 void _raw_spin_unlock_irqrestore(raw_spinlock_t *, unsigned long);
290 raw_spinlock_t * spinlock_check(spinlock_t *lock);
356 void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
68 void __init_waitqueue_head(wait_queue_head_t *, const char *, struct lock_class_key *);
144 void __wake_up(wait_queue_head_t *, unsigned int, int, void *);
823 long int prepare_to_wait_event(wait_queue_head_t *, wait_queue_t *, int);
824 void finish_wait(wait_queue_head_t *, wait_queue_t *);
175 void mutex_unlock(struct mutex *);
77 extern volatile unsigned long jiffies;
94 void init_timer_key(struct timer_list *, unsigned int, const char *, struct lock_class_key *);
175 int del_timer(struct timer_list *);
176 int mod_timer(struct timer_list *, unsigned long);
245 int del_timer_sync(struct timer_list *);
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 *);
447 bool cancel_work_sync(struct work_struct *);
471 bool queue_work(struct workqueue_struct *wq, struct work_struct *work);
530 bool schedule_work(struct work_struct *work);
514 void __tasklet_schedule(struct tasklet_struct *);
516 void tasklet_schedule(struct tasklet_struct *t);
522 void __tasklet_hi_schedule(struct tasklet_struct *);
524 void tasklet_hi_schedule(struct tasklet_struct *t);
570 void tasklet_kill(struct tasklet_struct *);
572 void tasklet_init(struct tasklet_struct *, void (*)(unsigned long), unsigned long);
837 void * dev_get_drvdata(const struct device *dev);
842 void dev_set_drvdata(struct device *dev, void *data);
906 void device_unlock(struct device *dev);
1042 int dev_err(const struct device *, const char *, ...);
1044 int dev_warn(const struct device *, const char *, ...);
1046 int dev_notice(const struct device *, const char *, ...);
1048 int _dev_info(const struct device *, const char *, ...);
377 long int schedule_timeout(long);
194 void * usb_get_intfdata(struct usb_interface *intf);
199 void usb_set_intfdata(struct usb_interface *intf, void *data);
595 struct usb_device * ldv_interface_to_usbdev_5(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_6(struct usb_device *ldv_func_arg1);
609 void usb_put_dev(struct usb_device *);
612 void ldv_usb_put_dev_7(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 *);
626 void usb_queue_reset_device(struct usb_interface *);
1148 int usb_register_driver(struct usb_driver *, struct module *, const char *);
1155 void usb_deregister(struct usb_driver *);
1480 void usb_fill_control_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, unsigned char *setup_packet, void *transfer_buffer, int buffer_length, void (*complete_fn)(struct urb *), void *context);
1552 void usb_fill_int_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, void *transfer_buffer, int buffer_length, void (*complete_fn)(struct urb *), void *context, int interval);
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 );
1586 int usb_unlink_urb(struct urb *);
1587 void usb_kill_urb(struct urb *);
1656 int usb_control_msg(struct usb_device *, unsigned int, __u8 , __u8 , __u16 , __u16 , void *, __u16 , int);
1674 int usb_clear_halt(struct usb_device *, int);
1676 int usb_set_interface(struct usb_device *, int, int);
1784 unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint);
14 void ldv_interface_to_usbdev();
15 void ldv_usb_get_dev();
16 void ldv_usb_put_dev();
144 void kfree(const void *);
315 void * __kmalloc(size_t , gfp_t );
445 void * kmalloc(size_t size, gfp_t flags);
1189 __u32 skb_queue_len(const struct sk_buff_head *list_);
1364 void skb_queue_head(struct sk_buff_head *, struct sk_buff *);
1413 struct sk_buff * skb_dequeue(struct sk_buff_head *);
1583 unsigned char * skb_pull(struct sk_buff *, unsigned int);
2555 void __dev_kfree_skb_any(struct sk_buff *, enum skb_free_reason );
2586 void dev_kfree_skb_any(struct sk_buff *skb);
63 extern int gigaset_debuglevel;
109 void gigaset_dbg_buffer(enum debuglevel , const unsigned char *, size_t , const unsigned char *);
644 int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb);
648 void gigaset_isoc_input(struct inbuf_t *inbuf);
652 void gigaset_isoc_receive(unsigned char *src, unsigned int count, struct bc_state *bcs);
657 int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len);
660 void gigaset_isowbuf_init(struct isowbuf_t *iwb, unsigned char idle);
663 int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size);
676 void gigaset_skb_sent(struct bc_state *, struct sk_buff *);
723 struct gigaset_driver * gigaset_initdriver(unsigned int, unsigned int, const char *, const char *, const struct gigaset_ops *, struct module *);
730 void gigaset_freedriver(struct gigaset_driver *);
734 void gigaset_blockdriver(struct gigaset_driver *);
738 struct cardstate * gigaset_initcs(struct gigaset_driver *, int, int, int, int, const char *);
743 void gigaset_freecs(struct cardstate *);
746 int gigaset_start(struct cardstate *);
749 void gigaset_stop(struct cardstate *);
752 int gigaset_shutdown(struct cardstate *);
761 struct event_t * gigaset_add_event(struct cardstate *, struct at_state_t *, int, void *, int, void *);
769 void gigaset_schedule_event(struct cardstate *cs);
780 void gigaset_bchannel_down(struct bc_state *bcs);
788 void gigaset_bchannel_up(struct bc_state *bcs);
813 int gigaset_fill_inbuf(struct inbuf_t *, const unsigned char *, unsigned int);
45 int startmode = 1;
46 int cidmode = 1;
72 const struct usb_device_id gigaset_table[5U] = { { 3U, 1665U, 1U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0UL }, { 3U, 1665U, 2U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0UL }, { 3U, 1665U, 33U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0UL }, { 3U, 1665U, 34U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 0UL } };
80 const struct usb_device_id __mod_usb__gigaset_table_device_table = { };
85 int gigaset_probe(struct usb_interface *interface, const struct usb_device_id *id);
89 void gigaset_disconnect(struct usb_interface *interface);
92 int gigaset_suspend(struct usb_interface *intf, pm_message_t message);
93 int gigaset_resume(struct usb_interface *intf);
96 int gigaset_pre_reset(struct usb_interface *intf);
97 int gigaset_post_reset(struct usb_interface *intf);
99 int atread_submit(struct cardstate *cs, int timeout);
100 void stopurbs(struct bas_bc_state *ubc);
101 int req_submit(struct bc_state *bcs, int req, int val, int timeout);
102 int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len);
103 int start_cbsend(struct cardstate *cs);
155 struct gigaset_driver *driver = 0;
158 struct usb_driver gigaset_usb_driver = { "bas_gigaset", &gigaset_probe, &gigaset_disconnect, 0, &gigaset_suspend, &gigaset_resume, &gigaset_post_reset, &gigaset_pre_reset, &gigaset_post_reset, (const struct usb_device_id *)(&gigaset_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, 0U, 1U, 0U };
173 char * get_usb_rcmsg(int rc);
214 char * get_usb_statmsg(int status);
260 char * usb_pipetype_str(int pipe);
276 void dump_urb(enum debuglevel level, const char *tag, struct urb *urb);
323 int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned int old_state, unsigned int new_state);
329 int gigaset_baud_rate(struct cardstate *cs, unsigned int cflag);
334 int gigaset_set_line_ctrl(struct cardstate *cs, unsigned int cflag);
341 int update_basstate(struct bas_cardstate *ucs, int set, int clear);
362 void error_hangup(struct bc_state *bcs);
378 void error_reset(struct cardstate *cs);
392 void check_pending(struct bas_cardstate *ucs);
453 void cmd_in_timeout(unsigned long data);
494 void read_ctrl_callback(struct urb *urb);
623 void int_in_work(struct work_struct *work);
659 void int_in_resubmit(unsigned long data);
688 void read_int_callback(struct urb *urb);
869 void read_iso_callback(struct urb *urb);
934 void write_iso_callback(struct urb *urb);
972 int starturbs(struct bc_state *bcs);
1097 int submit_iso_write_urb(struct isow_urbctx_t *ucx);
1174 void write_iso_tasklet(unsigned long data);
1317 void read_iso_tasklet(unsigned long data);
1461 void req_timeout(unsigned long data);
1532 void write_ctrl_callback(struct urb *urb);
1664 int gigaset_init_bchannel(struct bc_state *bcs);
1720 int gigaset_close_bchannel(struct bc_state *bcs);
1760 void complete_cb(struct cardstate *cs);
1791 void write_command_callback(struct urb *urb);
1857 void atrdy_timeout(unsigned long data);
1985 int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb);
2067 int gigaset_write_room(struct cardstate *cs);
2080 int gigaset_chars_in_buffer(struct cardstate *cs);
2092 int gigaset_brkchars(struct cardstate *cs, const unsigned char *buf);
2105 void gigaset_freebcshw(struct bc_state *bcs);
2137 int gigaset_initbcshw(struct bc_state *bcs);
2190 void gigaset_reinitbcshw(struct bc_state *bcs);
2202 void gigaset_freecshw(struct cardstate *cs);
2216 int gigaset_initcshw(struct cardstate *cs);
2257 void freeurbs(struct cardstate *cs);
2583 const struct gigaset_ops gigops = { &gigaset_write_cmd, &gigaset_write_room, &gigaset_chars_in_buffer, &gigaset_brkchars, &gigaset_init_bchannel, &gigaset_close_bchannel, &gigaset_initbcshw, &gigaset_freebcshw, &gigaset_reinitbcshw, &gigaset_initcshw, &gigaset_freecshw, &gigaset_set_modem_ctrl, &gigaset_baud_rate, &gigaset_set_line_ctrl, &gigaset_isoc_send_skb, &gigaset_isoc_input };
2605 int bas_gigaset_init();
2636 void bas_gigaset_exit();
2710 void ldv_check_final_state();
2713 void ldv_check_return_value(int);
2716 void ldv_check_return_value_probe(int retval);
2719 void ldv_initialize();
2722 void ldv_handler_precall();
2725 int nondet_int();
2728 int LDV_IN_INTERRUPT = 0;
2731 void ldv_main0_sequence_infinite_withcheck_stateful();
474 extern const char hex_asc[];
71 void warn_slowpath_null(const char *, const int);
55 void * memset(void *, int, size_t );
90 void atomic_inc(atomic_t *v);
116 int atomic_dec_and_test(atomic_t *v);
1381 void skb_queue_tail(struct sk_buff_head *, struct sk_buff *);
1440 bool skb_is_nonlinear(const struct sk_buff *skb);
1527 unsigned char * skb_tail_pointer(const struct sk_buff *skb);
1532 void skb_reset_tail_pointer(struct sk_buff *skb);
1537 void skb_set_tail_pointer(struct sk_buff *skb, const int offset);
1565 unsigned char * skb_put(struct sk_buff *, unsigned int);
1566 unsigned char * __skb_put(struct sk_buff *skb, unsigned int len);
1666 void skb_reserve(struct sk_buff *skb, int len);
1919 void __skb_trim(struct sk_buff *skb, unsigned int len);
1929 void skb_trim(struct sk_buff *, unsigned int);
2016 struct sk_buff * __netdev_alloc_skb(struct net_device *, unsigned int, gfp_t );
2032 struct sk_buff * netdev_alloc_skb(struct net_device *dev, unsigned int length);
2046 struct sk_buff * dev_alloc_skb(unsigned int length);
6 extern const u16 crc_ccitt_table[256U];
10 u16 crc_ccitt_byte(u16 crc, const u8 c);
677 void gigaset_skb_rcvd(struct bc_state *, struct sk_buff *);
678 void gigaset_isdn_rcv_err(struct bc_state *);
698 void gigaset_handle_modem_response(struct cardstate *);
795 struct sk_buff * gigaset_new_rx_skb(struct bc_state *bcs);
830 void gigaset_if_receive(struct cardstate *, unsigned char *, size_t );
6 extern const u8 byte_rev_table[256U];
8 u8 bitrev8(u8 byte);
54 int isowbuf_freebytes(struct isowbuf_t *iwb);
77 int isowbuf_startwrite(struct isowbuf_t *iwb);
95 int isowbuf_donewrite(struct isowbuf_t *iwb);
109 void isowbuf_putbits(struct isowbuf_t *iwb, u32 data, int nbits);
130 void isowbuf_putflag(struct isowbuf_t *iwb);
230 void dump_bytes(enum debuglevel level, const char *tag, unsigned char *bytes, int count);
267 const u16 stufftab[1280U] = { 0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U, 16U, 17U, 18U, 19U, 20U, 21U, 22U, 23U, 24U, 25U, 26U, 27U, 28U, 29U, 30U, 8223U, 32U, 33U, 34U, 35U, 36U, 37U, 38U, 39U, 40U, 41U, 42U, 43U, 44U, 45U, 46U, 47U, 48U, 49U, 50U, 51U, 52U, 53U, 54U, 55U, 56U, 57U, 58U, 59U, 60U, 61U, 8254U, 8287U, 64U, 65U, 66U, 67U, 68U, 69U, 70U, 71U, 72U, 73U, 74U, 75U, 76U, 77U, 78U, 79U, 80U, 81U, 82U, 83U, 84U, 85U, 86U, 87U, 88U, 89U, 90U, 91U, 92U, 93U, 94U, 8351U, 96U, 97U, 98U, 99U, 100U, 101U, 102U, 103U, 104U, 105U, 106U, 107U, 108U, 109U, 110U, 111U, 112U, 113U, 114U, 115U, 116U, 117U, 118U, 119U, 120U, 121U, 122U, 123U, 8316U, 8317U, 8382U, 8415U, 1152U, 1153U, 1154U, 1155U, 1156U, 1157U, 1158U, 1159U, 1160U, 1161U, 1162U, 1163U, 1164U, 1165U, 1166U, 1167U, 1168U, 1169U, 1170U, 1171U, 1172U, 1173U, 1174U, 1175U, 1176U, 1177U, 1178U, 1179U, 1180U, 1181U, 1182U, 9503U, 1184U, 1185U, 1186U, 1187U, 1188U, 1189U, 1190U, 1191U, 1192U, 1193U, 1194U, 1195U, 1196U, 1197U, 1198U, 1199U, 1200U, 1201U, 1202U, 1203U, 1204U, 1205U, 1206U, 1207U, 1208U, 1209U, 1210U, 1211U, 1212U, 1213U, 9534U, 9567U, 2240U, 2241U, 2242U, 2243U, 2244U, 2245U, 2246U, 2247U, 2248U, 2249U, 2250U, 2251U, 2252U, 2253U, 2254U, 2255U, 2256U, 2257U, 2258U, 2259U, 2260U, 2261U, 2262U, 2263U, 2264U, 2265U, 2266U, 2267U, 2268U, 2269U, 2270U, 10655U, 3296U, 3297U, 3298U, 3299U, 3300U, 3301U, 3302U, 3303U, 3304U, 3305U, 3306U, 3307U, 3308U, 3309U, 3310U, 3311U, 4336U, 4337U, 4338U, 4339U, 4340U, 4341U, 4342U, 4343U, 8440U, 8441U, 8442U, 8443U, 9596U, 9597U, 10686U, 11743U, 0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 9U, 10U, 11U, 12U, 13U, 14U, 8207U, 16U, 17U, 18U, 19U, 20U, 21U, 22U, 23U, 24U, 25U, 26U, 27U, 28U, 29U, 30U, 8239U, 32U, 33U, 34U, 35U, 36U, 37U, 38U, 39U, 40U, 41U, 42U, 43U, 44U, 45U, 46U, 8271U, 48U, 49U, 50U, 51U, 52U, 53U, 54U, 55U, 56U, 57U, 58U, 59U, 60U, 61U, 8254U, 8303U, 64U, 65U, 66U, 67U, 68U, 69U, 70U, 71U, 72U, 73U, 74U, 75U, 76U, 77U, 78U, 8335U, 80U, 81U, 82U, 83U, 84U, 85U, 86U, 87U, 88U, 89U, 90U, 91U, 92U, 93U, 94U, 8367U, 96U, 97U, 98U, 99U, 100U, 101U, 102U, 103U, 104U, 105U, 106U, 107U, 108U, 109U, 110U, 8399U, 112U, 113U, 114U, 115U, 116U, 117U, 118U, 119U, 120U, 121U, 122U, 123U, 8316U, 8317U, 8382U, 8431U, 1152U, 1153U, 1154U, 1155U, 1156U, 1157U, 1158U, 1159U, 1160U, 1161U, 1162U, 1163U, 1164U, 1165U, 1166U, 9487U, 1168U, 1169U, 1170U, 1171U, 1172U, 1173U, 1174U, 1175U, 1176U, 1177U, 1178U, 1179U, 1180U, 1181U, 1182U, 9519U, 1184U, 1185U, 1186U, 1187U, 1188U, 1189U, 1190U, 1191U, 1192U, 1193U, 1194U, 1195U, 1196U, 1197U, 1198U, 9551U, 1200U, 1201U, 1202U, 1203U, 1204U, 1205U, 1206U, 1207U, 1208U, 1209U, 1210U, 1211U, 1212U, 1213U, 9534U, 9583U, 2240U, 2241U, 2242U, 2243U, 2244U, 2245U, 2246U, 2247U, 2248U, 2249U, 2250U, 2251U, 2252U, 2253U, 2254U, 10639U, 2256U, 2257U, 2258U, 2259U, 2260U, 2261U, 2262U, 2263U, 2264U, 2265U, 2266U, 2267U, 2268U, 2269U, 2270U, 10671U, 3296U, 3297U, 3298U, 3299U, 3300U, 3301U, 3302U, 3303U, 3304U, 3305U, 3306U, 3307U, 3308U, 3309U, 3310U, 11727U, 4336U, 4337U, 4338U, 4339U, 4340U, 4341U, 4342U, 4343U, 8440U, 8441U, 8442U, 8443U, 9596U, 9597U, 10686U, 12783U, 0U, 1U, 2U, 3U, 4U, 5U, 6U, 8199U, 8U, 9U, 10U, 11U, 12U, 13U, 14U, 8215U, 16U, 17U, 18U, 19U, 20U, 21U, 22U, 8231U, 24U, 25U, 26U, 27U, 28U, 29U, 30U, 8247U, 32U, 33U, 34U, 35U, 36U, 37U, 38U, 8263U, 40U, 41U, 42U, 43U, 44U, 45U, 46U, 8279U, 48U, 49U, 50U, 51U, 52U, 53U, 54U, 8295U, 56U, 57U, 58U, 59U, 60U, 61U, 8254U, 8311U, 64U, 65U, 66U, 67U, 68U, 69U, 70U, 8327U, 72U, 73U, 74U, 75U, 76U, 77U, 78U, 8343U, 80U, 81U, 82U, 83U, 84U, 85U, 86U, 8359U, 88U, 89U, 90U, 91U, 92U, 93U, 94U, 8375U, 96U, 97U, 98U, 99U, 100U, 101U, 102U, 8391U, 104U, 105U, 106U, 107U, 108U, 109U, 110U, 8407U, 112U, 113U, 114U, 115U, 116U, 117U, 118U, 8423U, 120U, 121U, 122U, 123U, 8316U, 8317U, 8382U, 8439U, 1152U, 1153U, 1154U, 1155U, 1156U, 1157U, 1158U, 9479U, 1160U, 1161U, 1162U, 1163U, 1164U, 1165U, 1166U, 9495U, 1168U, 1169U, 1170U, 1171U, 1172U, 1173U, 1174U, 9511U, 1176U, 1177U, 1178U, 1179U, 1180U, 1181U, 1182U, 9527U, 1184U, 1185U, 1186U, 1187U, 1188U, 1189U, 1190U, 9543U, 1192U, 1193U, 1194U, 1195U, 1196U, 1197U, 1198U, 9559U, 1200U, 1201U, 1202U, 1203U, 1204U, 1205U, 1206U, 9575U, 1208U, 1209U, 1210U, 1211U, 1212U, 1213U, 9534U, 9591U, 2240U, 2241U, 2242U, 2243U, 2244U, 2245U, 2246U, 10631U, 2248U, 2249U, 2250U, 2251U, 2252U, 2253U, 2254U, 10647U, 2256U, 2257U, 2258U, 2259U, 2260U, 2261U, 2262U, 10663U, 2264U, 2265U, 2266U, 2267U, 2268U, 2269U, 2270U, 10679U, 3296U, 3297U, 3298U, 3299U, 3300U, 3301U, 3302U, 11719U, 3304U, 3305U, 3306U, 3307U, 3308U, 3309U, 3310U, 11735U, 4336U, 4337U, 4338U, 4339U, 4340U, 4341U, 4342U, 12775U, 8440U, 8441U, 8442U, 8443U, 9596U, 9597U, 10686U, 16887U, 0U, 1U, 2U, 8195U, 4U, 5U, 6U, 8203U, 8U, 9U, 10U, 8211U, 12U, 13U, 14U, 8219U, 16U, 17U, 18U, 8227U, 20U, 21U, 22U, 8235U, 24U, 25U, 26U, 8243U, 28U, 29U, 30U, 8251U, 32U, 33U, 34U, 8259U, 36U, 37U, 38U, 8267U, 40U, 41U, 42U, 8275U, 44U, 45U, 46U, 8283U, 48U, 49U, 50U, 8291U, 52U, 53U, 54U, 8299U, 56U, 57U, 58U, 8307U, 60U, 61U, 8254U, 8315U, 64U, 65U, 66U, 8323U, 68U, 69U, 70U, 8331U, 72U, 73U, 74U, 8339U, 76U, 77U, 78U, 8347U, 80U, 81U, 82U, 8355U, 84U, 85U, 86U, 8363U, 88U, 89U, 90U, 8371U, 92U, 93U, 94U, 8379U, 96U, 97U, 98U, 8387U, 100U, 101U, 102U, 8395U, 104U, 105U, 106U, 8403U, 108U, 109U, 110U, 8411U, 112U, 113U, 114U, 8419U, 116U, 117U, 118U, 8427U, 120U, 121U, 122U, 8435U, 8316U, 8317U, 8382U, 16635U, 1152U, 1153U, 1154U, 9475U, 1156U, 1157U, 1158U, 9483U, 1160U, 1161U, 1162U, 9491U, 1164U, 1165U, 1166U, 9499U, 1168U, 1169U, 1170U, 9507U, 1172U, 1173U, 1174U, 9515U, 1176U, 1177U, 1178U, 9523U, 1180U, 1181U, 1182U, 9531U, 1184U, 1185U, 1186U, 9539U, 1188U, 1189U, 1190U, 9547U, 1192U, 1193U, 1194U, 9555U, 1196U, 1197U, 1198U, 9563U, 1200U, 1201U, 1202U, 9571U, 1204U, 1205U, 1206U, 9579U, 1208U, 1209U, 1210U, 9587U, 1212U, 1213U, 9534U, 9595U, 2240U, 2241U, 2242U, 10627U, 2244U, 2245U, 2246U, 10635U, 2248U, 2249U, 2250U, 10643U, 2252U, 2253U, 2254U, 10651U, 2256U, 2257U, 2258U, 10659U, 2260U, 2261U, 2262U, 10667U, 2264U, 2265U, 2266U, 10675U, 2268U, 2269U, 2270U, 10683U, 3296U, 3297U, 3298U, 11715U, 3300U, 3301U, 3302U, 11723U, 3304U, 3305U, 3306U, 11731U, 3308U, 3309U, 3310U, 11739U, 4336U, 4337U, 4338U, 12771U, 4340U, 4341U, 4342U, 12779U, 8440U, 8441U, 8442U, 16883U, 9596U, 9597U, 10686U, 18171U, 0U, 8193U, 2U, 8197U, 4U, 8201U, 6U, 8205U, 8U, 8209U, 10U, 8213U, 12U, 8217U, 14U, 8221U, 16U, 8225U, 18U, 8229U, 20U, 8233U, 22U, 8237U, 24U, 8241U, 26U, 8245U, 28U, 8249U, 30U, 8253U, 32U, 8257U, 34U, 8261U, 36U, 8265U, 38U, 8269U, 40U, 8273U, 42U, 8277U, 44U, 8281U, 46U, 8285U, 48U, 8289U, 50U, 8293U, 52U, 8297U, 54U, 8301U, 56U, 8305U, 58U, 8309U, 60U, 8313U, 8254U, 16509U, 64U, 8321U, 66U, 8325U, 68U, 8329U, 70U, 8333U, 72U, 8337U, 74U, 8341U, 76U, 8345U, 78U, 8349U, 80U, 8353U, 82U, 8357U, 84U, 8361U, 86U, 8365U, 88U, 8369U, 90U, 8373U, 92U, 8377U, 94U, 8381U, 96U, 8385U, 98U, 8389U, 100U, 8393U, 102U, 8397U, 104U, 8401U, 106U, 8405U, 108U, 8409U, 110U, 8413U, 112U, 8417U, 114U, 8421U, 116U, 8425U, 118U, 8429U, 120U, 8433U, 122U, 8437U, 8316U, 16633U, 8382U, 16765U, 1152U, 9473U, 1154U, 9477U, 1156U, 9481U, 1158U, 9485U, 1160U, 9489U, 1162U, 9493U, 1164U, 9497U, 1166U, 9501U, 1168U, 9505U, 1170U, 9509U, 1172U, 9513U, 1174U, 9517U, 1176U, 9521U, 1178U, 9525U, 1180U, 9529U, 1182U, 9533U, 1184U, 9537U, 1186U, 9541U, 1188U, 9545U, 1190U, 9549U, 1192U, 9553U, 1194U, 9557U, 1196U, 9561U, 1198U, 9565U, 1200U, 9569U, 1202U, 9573U, 1204U, 9577U, 1206U, 9581U, 1208U, 9585U, 1210U, 9589U, 1212U, 9593U, 9534U, 18045U, 2240U, 10625U, 2242U, 10629U, 2244U, 10633U, 2246U, 10637U, 2248U, 10641U, 2250U, 10645U, 2252U, 10649U, 2254U, 10653U, 2256U, 10657U, 2258U, 10661U, 2260U, 10665U, 2262U, 10669U, 2264U, 10673U, 2266U, 10677U, 2268U, 10681U, 2270U, 10685U, 3296U, 11713U, 3298U, 11717U, 3300U, 11721U, 3302U, 11725U, 3304U, 11729U, 3306U, 11733U, 3308U, 11737U, 3310U, 11741U, 4336U, 12769U, 4338U, 12773U, 4340U, 12777U, 4342U, 12781U, 8440U, 16881U, 8442U, 16885U, 9596U, 18169U, 10686U, 19325U };
370 int hdlc_bitstuff_byte(struct isowbuf_t *iwb, unsigned char cin, int ones);
413 int hdlc_buildframe(struct isowbuf_t *iwb, unsigned char *in, int count);
466 int trans_buildframe(struct isowbuf_t *iwb, unsigned char *in, int count);
517 void hdlc_putbyte(unsigned char c, struct bc_state *bcs);
536 void hdlc_flush(struct bc_state *bcs);
551 void hdlc_done(struct bc_state *bcs);
594 void hdlc_frag(struct bc_state *bcs, unsigned int inbits);
616 const unsigned char bitcounts[256U] = { 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 4U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 5U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 4U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 128U, 6U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 4U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 5U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 4U, 0U, 1U, 0U, 2U, 0U, 1U, 0U, 3U, 0U, 1U, 0U, 2U, 128U, 129U, 128U, 7U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 19U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 20U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 19U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 21U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 19U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 20U, 16U, 17U, 16U, 18U, 16U, 17U, 16U, 19U, 16U, 17U, 16U, 18U, 16U, 17U, 144U, 22U, 32U, 33U, 32U, 34U, 32U, 33U, 32U, 35U, 32U, 33U, 32U, 34U, 32U, 33U, 32U, 36U, 32U, 33U, 32U, 34U, 32U, 33U, 32U, 35U, 32U, 33U, 32U, 34U, 32U, 33U, 32U, 37U, 48U, 49U, 48U, 50U, 48U, 49U, 48U, 51U, 48U, 49U, 48U, 50U, 48U, 49U, 48U, 52U, 64U, 65U, 64U, 66U, 64U, 65U, 64U, 67U, 80U, 81U, 80U, 82U, 96U, 97U, 112U, 120U };
646 void hdlc_unpack(unsigned char *src, unsigned int count, struct bc_state *bcs);
852 void trans_receive(unsigned char *src, unsigned int count, struct bc_state *bcs);
910 void cmd_loop(unsigned char *src, int numbytes, struct inbuf_t *inbuf);
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
{
2733 struct usb_interface *var_group1;
2734 const struct usb_device_id *var_gigaset_probe_43_p1;
2735 int res_gigaset_probe_43;
2736 pm_message_t var_gigaset_suspend_45_p1;
2737 int ldv_s_gigaset_usb_driver_usb_driver;
2738 int tmp;
2739 int tmp___0;
2740 int tmp___1;
2965 ldv_s_gigaset_usb_driver_usb_driver = 0;
2921 LDV_IN_INTERRUPT = 1;
2930 ldv_initialize() { /* Function call is skipped due to function is undefined */}
2962 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
2963 -bas_gigaset_init()
{
2607 int result;
2610 driver = gigaset_initdriver(16U, 1U, "bas_gigaset", "ttyGB", &gigops, &__this_module) { /* Function call is skipped due to function is undefined */}
2613 assume(!(((unsigned long)driver) == 0UL));
2617 result = usb_register_driver(&gigaset_usb_driver, &__this_module, "bas_gigaset") { /* Function call is skipped due to function is undefined */}
2618 assume(!(result < 0));
2623 printk("\016bas_gigaset: USB Driver for Gigaset 307x\n") { /* Function call is skipped due to function is undefined */}
2624 return 0;;
}
2963 assume(!(tmp != 0));
2968 goto ldv_44669;
2968 tmp___1 = nondet_int() { /* Function call is skipped due to function is undefined */}
2968 assume(tmp___1 != 0);
2971 goto ldv_44668;
2969 ldv_44668:;
2972 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
2972 switch (tmp___0)
2973 assume(tmp___0 == 0);
2977 assume(ldv_s_gigaset_usb_driver_usb_driver == 0);
3008 -gigaset_probe(var_group1, var_gigaset_probe_43_p1)
{
2297 struct usb_host_interface *hostif;
2298 struct usb_device *udev;
2299 struct usb_device *tmp;
2300 struct cardstate *cs;
2301 struct bas_cardstate *ucs;
2302 struct bas_bc_state *ubc;
2303 struct usb_endpoint_descriptor *endpoint;
2304 int i;
2305 int j;
2306 int rc;
2307 long tmp___0;
2308 long tmp___1;
2309 int tmp___2;
2310 struct urb *tmp___3;
2311 struct urb *tmp___4;
2312 struct urb *tmp___5;
2313 struct urb *tmp___6;
2314 struct urb *tmp___7;
2315 struct urb *tmp___8;
2316 unsigned int tmp___9;
2317 char *tmp___10;
2299 -interface_to_usbdev(interface)
{
3310 ldv_func_ret_type ldv_func_res;
3311 struct usb_device *tmp;
3312 -ldv_interface_to_usbdev_5(intf)
{
597 const struct device *__mptr;
597 __mptr = (const struct device *)(intf->dev.parent);
597 return ((struct usb_device *)__mptr) + 18446744073709551472UL;;
}
3312 ldv_func_res = tmp;
3314 -ldv_interface_to_usbdev()
{
25 assume(ldv_usb_dev_state == 0);
27 ldv_usb_dev_state = 1;
28 return ;;
}
3316 return ldv_func_res;;
}
2299 udev = tmp;
2300 cs = (struct cardstate *)0;
2301 ucs = (struct bas_cardstate *)0;
2307 -__builtin_expect((((unsigned int)gigaset_debuglevel) & 32768U) != 0U, 0L)
{
51 return exp;;
}
2307 assume(!(tmp___0 != 0L));
2313 hostif = interface->cur_altsetting;
2314 assume(!(((unsigned int)(hostif->desc.bAlternateSetting)) != 3U));
2331 assume(!(((unsigned int)(hostif->desc.bInterfaceClass)) != 255U));
2337 _dev_info((const struct device *)(&(udev->dev)), "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n", "gigaset_probe", (int)(udev->descriptor.idVendor), (int)(udev->descriptor.idProduct)) { /* Function call is skipped due to function is undefined */}
2343 cs = gigaset_initcs(driver, 2, 0, 0, cidmode, "bas_gigaset") { /* Function call is skipped due to function is undefined */}
2345 assume(!(((unsigned long)cs) == 0UL));
2347 ucs = cs->hw.bas;
2350 -ldv_usb_get_dev_6(udev)
{
3321 ldv_func_ret_type___0 ldv_func_res;
3322 struct usb_device *tmp;
3323 tmp = usb_get_dev(ldv_func_arg1) { /* Function call is skipped due to function is undefined */}
3323 ldv_func_res = tmp;
3325 -ldv_usb_get_dev()
{
34 assume(!(ldv_usb_dev_state < 1));
39 ldv_usb_dev_state = ldv_usb_dev_state + 1;
40 return ;;
}
3327 return ldv_func_res;;
}
2351 ucs->udev = udev;
2352 ucs->interface = interface;
2353 cs->dev = &(interface->dev);
2360 tmp___3 = usb_alloc_urb(0, 208U) { /* Function call is skipped due to function is undefined */}
2360 ucs->urb_int_in = tmp___3;
2360 assume(((unsigned long)tmp___3) == 0UL);
2364 goto allocerr;
2413 allocerr:;
2415 const struct device *__CPAchecker_TMP_4 = (const struct device *)(cs->dev);
2415 dev_err(__CPAchecker_TMP_4, "could not allocate URBs\n") { /* Function call is skipped due to function is undefined */}
2416 rc = -12;
2417 error:;
2418 -freeurbs(cs)
{
2259 struct bas_cardstate *ucs;
2260 struct bas_bc_state *ubc;
2261 int i;
2262 int j;
2263 long tmp;
2259 ucs = cs->hw.bas;
2263 -__builtin_expect((((unsigned int)gigaset_debuglevel) & 32768U) != 0U, 0L)
{
51 return exp;;
}
2263 assume(!(tmp != 0L));
2264 j = 0;
2264 goto ldv_44527;
2264 assume(j <= 1);
2266 goto ldv_44526;
2265 ldv_44526:;
2265 ubc = ((cs->bcs) + ((unsigned long)j))->hw.bas;
2266 i = 0;
2266 goto ldv_44521;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(!(i <= 2));
2271 i = 0;
2271 goto ldv_44524;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(!(i <= 2));
2264 j = j + 1;
2265 ldv_44527:;
2264 assume(j <= 1);
2266 goto ldv_44526;
2265 ldv_44526:;
2265 ubc = ((cs->bcs) + ((unsigned long)j))->hw.bas;
2266 i = 0;
2266 goto ldv_44521;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(i <= 2);
2268 goto ldv_44520;
2267 ldv_44520:;
2267 usb_kill_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2268 usb_free_urb(((ubc->isoouturbs)[i]).urb) { /* Function call is skipped due to function is undefined */}
2269 ((ubc->isoouturbs)[i]).urb = (struct urb *)0;
2266 i = i + 1;
2267 ldv_44521:;
2266 assume(!(i <= 2));
2271 i = 0;
2271 goto ldv_44524;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(i <= 2);
2273 goto ldv_44523;
2272 ldv_44523:;
2272 usb_kill_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2273 usb_free_urb((ubc->isoinurbs)[i]) { /* Function call is skipped due to function is undefined */}
2274 (ubc->isoinurbs)[i] = (struct urb *)0;
2271 i = i + 1;
2272 ldv_44524:;
2271 assume(!(i <= 2));
2264 j = j + 1;
2265 ldv_44527:;
2264 assume(!(j <= 1));
2277 usb_kill_urb(ucs->urb_int_in) { /* Function call is skipped due to function is undefined */}
2278 usb_free_urb(ucs->urb_int_in) { /* Function call is skipped due to function is undefined */}
2279 ucs->urb_int_in = (struct urb *)0;
2280 usb_kill_urb(ucs->urb_cmd_out) { /* Function call is skipped due to function is undefined */}
2281 usb_free_urb(ucs->urb_cmd_out) { /* Function call is skipped due to function is undefined */}
2282 ucs->urb_cmd_out = (struct urb *)0;
2283 usb_kill_urb(ucs->urb_cmd_in) { /* Function call is skipped due to function is undefined */}
2284 usb_free_urb(ucs->urb_cmd_in) { /* Function call is skipped due to function is undefined */}
2285 ucs->urb_cmd_in = (struct urb *)0;
2286 usb_kill_urb(ucs->urb_ctrl) { /* Function call is skipped due to function is undefined */}
2287 usb_free_urb(ucs->urb_ctrl) { /* Function call is skipped due to function is undefined */}
2288 ucs->urb_ctrl = (struct urb *)0;
2289 return ;;
}
2419 -usb_set_intfdata(interface, (void *)0)
{
201 -dev_set_drvdata(&(intf->dev), data)
{
844 dev->driver_data = data;
845 return ;;
}
202 return ;;
}
2420 gigaset_freecs(cs) { /* Function call is skipped due to function is undefined */}
2421 return rc;;
}
3009 ldv_check_return_value(res_gigaset_probe_43) { /* Function call is skipped due to function is undefined */}
3010 -ldv_check_return_value_probe(res_gigaset_probe_43)
{
60 assume(!(retval == 0));
62 assume(!(ldv_usb_dev_state < 2));
62 -ldv_error()
{
15 LDV_ERROR:;
12 goto LDV_ERROR;
}
}
}
Source code
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 * USB driver for Gigaset 307x base via direct USB connection. 20 * 21 * Copyright (c) 2001 by Hansjoerg Lipp <hjlipp@web.de>, 22 * Tilman Schmidt <tilman@imap.cc>, 23 * Stefan Eilers. 24 * 25 * ===================================================================== 26 * This program is free software; you can redistribute it and/or 27 * modify it under the terms of the GNU General Public License as 28 * published by the Free Software Foundation; either version 2 of 29 * the License, or (at your option) any later version. 30 * ===================================================================== 31 */ 32 33 #include "gigaset.h" 34 #include <linux/usb.h> 35 #include <linux/module.h> 36 #include <linux/moduleparam.h> 37 38 /* Version Information */ 39 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 40 #define DRIVER_DESC "USB Driver for Gigaset 307x" 41 42 43 /* Module parameters */ 44 45 static int startmode = SM_ISDN; 46 static int cidmode = 1; 47 48 module_param(startmode, int, S_IRUGO); 49 module_param(cidmode, int, S_IRUGO); 50 MODULE_PARM_DESC(startmode, "start in isdn4linux mode"); 51 MODULE_PARM_DESC(cidmode, "Call-ID mode"); 52 53 #define GIGASET_MINORS 1 54 #define GIGASET_MINOR 16 55 #define GIGASET_MODULENAME "bas_gigaset" 56 #define GIGASET_DEVNAME "ttyGB" 57 58 /* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ 59 #define IF_WRITEBUF 264 60 61 /* interrupt pipe message size according to ibid. ch. 2.2 */ 62 #define IP_MSGSIZE 3 63 64 /* Values for the Gigaset 307x */ 65 #define USB_GIGA_VENDOR_ID 0x0681 66 #define USB_3070_PRODUCT_ID 0x0001 67 #define USB_3075_PRODUCT_ID 0x0002 68 #define USB_SX303_PRODUCT_ID 0x0021 69 #define USB_SX353_PRODUCT_ID 0x0022 70 71 /* table of devices that work with this driver */ 72 static const struct usb_device_id gigaset_table[] = { 73 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, 74 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, 75 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, 76 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX353_PRODUCT_ID) }, 77 { } /* Terminating entry */ 78 }; 79 80 MODULE_DEVICE_TABLE(usb, gigaset_table); 81 82 /*======================= local function prototypes ==========================*/ 83 84 /* function called if a new device belonging to this driver is connected */ 85 static int gigaset_probe(struct usb_interface *interface, 86 const struct usb_device_id *id); 87 88 /* Function will be called if the device is unplugged */ 89 static void gigaset_disconnect(struct usb_interface *interface); 90 91 /* functions called before/after suspend */ 92 static int gigaset_suspend(struct usb_interface *intf, pm_message_t message); 93 static int gigaset_resume(struct usb_interface *intf); 94 95 /* functions called before/after device reset */ 96 static int gigaset_pre_reset(struct usb_interface *intf); 97 static int gigaset_post_reset(struct usb_interface *intf); 98 99 static int atread_submit(struct cardstate *, int); 100 static void stopurbs(struct bas_bc_state *); 101 static int req_submit(struct bc_state *, int, int, int); 102 static int atwrite_submit(struct cardstate *, unsigned char *, int); 103 static int start_cbsend(struct cardstate *); 104 105 /*============================================================================*/ 106 107 struct bas_cardstate { 108 struct usb_device *udev; /* USB device pointer */ 109 struct usb_interface *interface; /* interface for this device */ 110 unsigned char minor; /* starting minor number */ 111 112 struct urb *urb_ctrl; /* control pipe default URB */ 113 struct usb_ctrlrequest dr_ctrl; 114 struct timer_list timer_ctrl; /* control request timeout */ 115 int retry_ctrl; 116 117 struct timer_list timer_atrdy; /* AT command ready timeout */ 118 struct urb *urb_cmd_out; /* for sending AT commands */ 119 struct usb_ctrlrequest dr_cmd_out; 120 int retry_cmd_out; 121 122 struct urb *urb_cmd_in; /* for receiving AT replies */ 123 struct usb_ctrlrequest dr_cmd_in; 124 struct timer_list timer_cmd_in; /* receive request timeout */ 125 unsigned char *rcvbuf; /* AT reply receive buffer */ 126 127 struct urb *urb_int_in; /* URB for interrupt pipe */ 128 unsigned char *int_in_buf; 129 struct work_struct int_in_wq; /* for usb_clear_halt() */ 130 struct timer_list timer_int_in; /* int read retry delay */ 131 int retry_int_in; 132 133 spinlock_t lock; /* locks all following */ 134 int basstate; /* bitmap (BS_*) */ 135 int pending; /* uncompleted base request */ 136 wait_queue_head_t waitqueue; 137 int rcvbuf_size; /* size of AT receive buffer */ 138 /* 0: no receive in progress */ 139 int retry_cmd_in; /* receive req retry count */ 140 }; 141 142 /* status of direct USB connection to 307x base (bits in basstate) */ 143 #define BS_ATOPEN 0x001 /* AT channel open */ 144 #define BS_B1OPEN 0x002 /* B channel 1 open */ 145 #define BS_B2OPEN 0x004 /* B channel 2 open */ 146 #define BS_ATREADY 0x008 /* base ready for AT command */ 147 #define BS_INIT 0x010 /* base has signalled INIT_OK */ 148 #define BS_ATTIMER 0x020 /* waiting for HD_READY_SEND_ATDATA */ 149 #define BS_ATRDPEND 0x040 /* urb_cmd_in in use */ 150 #define BS_ATWRPEND 0x080 /* urb_cmd_out in use */ 151 #define BS_SUSPEND 0x100 /* USB port suspended */ 152 #define BS_RESETTING 0x200 /* waiting for HD_RESET_INTERRUPT_PIPE_ACK */ 153 154 155 static struct gigaset_driver *driver; 156 157 /* usb specific object needed to register this driver with the usb subsystem */ 158 static struct usb_driver gigaset_usb_driver = { 159 .name = GIGASET_MODULENAME, 160 .probe = gigaset_probe, 161 .disconnect = gigaset_disconnect, 162 .id_table = gigaset_table, 163 .suspend = gigaset_suspend, 164 .resume = gigaset_resume, 165 .reset_resume = gigaset_post_reset, 166 .pre_reset = gigaset_pre_reset, 167 .post_reset = gigaset_post_reset, 168 .disable_hub_initiated_lpm = 1, 169 }; 170 171 /* get message text for usb_submit_urb return code 172 */ 173 static char *get_usb_rcmsg(int rc) 174 { 175 static char unkmsg[28]; 176 177 switch (rc) { 178 case 0: 179 return "success"; 180 case -ENOMEM: 181 return "out of memory"; 182 case -ENODEV: 183 return "device not present"; 184 case -ENOENT: 185 return "endpoint not present"; 186 case -ENXIO: 187 return "URB type not supported"; 188 case -EINVAL: 189 return "invalid argument"; 190 case -EAGAIN: 191 return "start frame too early or too much scheduled"; 192 case -EFBIG: 193 return "too many isoc frames requested"; 194 case -EPIPE: 195 return "endpoint stalled"; 196 case -EMSGSIZE: 197 return "invalid packet size"; 198 case -ENOSPC: 199 return "would overcommit USB bandwidth"; 200 case -ESHUTDOWN: 201 return "device shut down"; 202 case -EPERM: 203 return "reject flag set"; 204 case -EHOSTUNREACH: 205 return "device suspended"; 206 default: 207 snprintf(unkmsg, sizeof(unkmsg), "unknown error %d", rc); 208 return unkmsg; 209 } 210 } 211 212 /* get message text for USB status code 213 */ 214 static char *get_usb_statmsg(int status) 215 { 216 static char unkmsg[28]; 217 218 switch (status) { 219 case 0: 220 return "success"; 221 case -ENOENT: 222 return "unlinked (sync)"; 223 case -EINPROGRESS: 224 return "URB still pending"; 225 case -EPROTO: 226 return "bitstuff error, timeout, or unknown USB error"; 227 case -EILSEQ: 228 return "CRC mismatch, timeout, or unknown USB error"; 229 case -ETIME: 230 return "USB response timeout"; 231 case -EPIPE: 232 return "endpoint stalled"; 233 case -ECOMM: 234 return "IN buffer overrun"; 235 case -ENOSR: 236 return "OUT buffer underrun"; 237 case -EOVERFLOW: 238 return "endpoint babble"; 239 case -EREMOTEIO: 240 return "short packet"; 241 case -ENODEV: 242 return "device removed"; 243 case -EXDEV: 244 return "partial isoc transfer"; 245 case -EINVAL: 246 return "ISO madness"; 247 case -ECONNRESET: 248 return "unlinked (async)"; 249 case -ESHUTDOWN: 250 return "device shut down"; 251 default: 252 snprintf(unkmsg, sizeof(unkmsg), "unknown status %d", status); 253 return unkmsg; 254 } 255 } 256 257 /* usb_pipetype_str 258 * retrieve string representation of USB pipe type 259 */ 260 static inline char *usb_pipetype_str(int pipe) 261 { 262 if (usb_pipeisoc(pipe)) 263 return "Isoc"; 264 if (usb_pipeint(pipe)) 265 return "Int"; 266 if (usb_pipecontrol(pipe)) 267 return "Ctrl"; 268 if (usb_pipebulk(pipe)) 269 return "Bulk"; 270 return "?"; 271 } 272 273 /* dump_urb 274 * write content of URB to syslog for debugging 275 */ 276 static inline void dump_urb(enum debuglevel level, const char *tag, 277 struct urb *urb) 278 { 279 #ifdef CONFIG_GIGASET_DEBUG 280 int i; 281 gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); 282 if (urb) { 283 gig_dbg(level, 284 " dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, " 285 "hcpriv=0x%08lx, transfer_flags=0x%x,", 286 (unsigned long) urb->dev, 287 usb_pipetype_str(urb->pipe), 288 usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe), 289 usb_pipein(urb->pipe) ? "in" : "out", 290 (unsigned long) urb->hcpriv, 291 urb->transfer_flags); 292 gig_dbg(level, 293 " transfer_buffer=0x%08lx[%d], actual_length=%d, " 294 "setup_packet=0x%08lx,", 295 (unsigned long) urb->transfer_buffer, 296 urb->transfer_buffer_length, urb->actual_length, 297 (unsigned long) urb->setup_packet); 298 gig_dbg(level, 299 " start_frame=%d, number_of_packets=%d, interval=%d, " 300 "error_count=%d,", 301 urb->start_frame, urb->number_of_packets, urb->interval, 302 urb->error_count); 303 gig_dbg(level, 304 " context=0x%08lx, complete=0x%08lx, " 305 "iso_frame_desc[]={", 306 (unsigned long) urb->context, 307 (unsigned long) urb->complete); 308 for (i = 0; i < urb->number_of_packets; i++) { 309 struct usb_iso_packet_descriptor *pifd 310 = &urb->iso_frame_desc[i]; 311 gig_dbg(level, 312 " {offset=%u, length=%u, actual_length=%u, " 313 "status=%u}", 314 pifd->offset, pifd->length, pifd->actual_length, 315 pifd->status); 316 } 317 } 318 gig_dbg(level, "}}"); 319 #endif 320 } 321 322 /* read/set modem control bits etc. (m10x only) */ 323 static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, 324 unsigned new_state) 325 { 326 return -EINVAL; 327 } 328 329 static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) 330 { 331 return -EINVAL; 332 } 333 334 static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) 335 { 336 return -EINVAL; 337 } 338 339 /* set/clear bits in base connection state, return previous state 340 */ 341 static inline int update_basstate(struct bas_cardstate *ucs, 342 int set, int clear) 343 { 344 unsigned long flags; 345 int state; 346 347 spin_lock_irqsave(&ucs->lock, flags); 348 state = ucs->basstate; 349 ucs->basstate = (state & ~clear) | set; 350 spin_unlock_irqrestore(&ucs->lock, flags); 351 return state; 352 } 353 354 /* error_hangup 355 * hang up any existing connection because of an unrecoverable error 356 * This function may be called from any context and takes care of scheduling 357 * the necessary actions for execution outside of interrupt context. 358 * cs->lock must not be held. 359 * argument: 360 * B channel control structure 361 */ 362 static inline void error_hangup(struct bc_state *bcs) 363 { 364 struct cardstate *cs = bcs->cs; 365 366 gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL); 367 gigaset_schedule_event(cs); 368 } 369 370 /* error_reset 371 * reset Gigaset device because of an unrecoverable error 372 * This function may be called from any context, and takes care of 373 * scheduling the necessary actions for execution outside of interrupt context. 374 * cs->hw.bas->lock must not be held. 375 * argument: 376 * controller state structure 377 */ 378 static inline void error_reset(struct cardstate *cs) 379 { 380 /* reset interrupt pipe to recover (ignore errors) */ 381 update_basstate(cs->hw.bas, BS_RESETTING, 0); 382 if (req_submit(cs->bcs, HD_RESET_INTERRUPT_PIPE, 0, BAS_TIMEOUT)) 383 /* submission failed, escalate to USB port reset */ 384 usb_queue_reset_device(cs->hw.bas->interface); 385 } 386 387 /* check_pending 388 * check for completion of pending control request 389 * parameter: 390 * ucs hardware specific controller state structure 391 */ 392 static void check_pending(struct bas_cardstate *ucs) 393 { 394 unsigned long flags; 395 396 spin_lock_irqsave(&ucs->lock, flags); 397 switch (ucs->pending) { 398 case 0: 399 break; 400 case HD_OPEN_ATCHANNEL: 401 if (ucs->basstate & BS_ATOPEN) 402 ucs->pending = 0; 403 break; 404 case HD_OPEN_B1CHANNEL: 405 if (ucs->basstate & BS_B1OPEN) 406 ucs->pending = 0; 407 break; 408 case HD_OPEN_B2CHANNEL: 409 if (ucs->basstate & BS_B2OPEN) 410 ucs->pending = 0; 411 break; 412 case HD_CLOSE_ATCHANNEL: 413 if (!(ucs->basstate & BS_ATOPEN)) 414 ucs->pending = 0; 415 break; 416 case HD_CLOSE_B1CHANNEL: 417 if (!(ucs->basstate & BS_B1OPEN)) 418 ucs->pending = 0; 419 break; 420 case HD_CLOSE_B2CHANNEL: 421 if (!(ucs->basstate & BS_B2OPEN)) 422 ucs->pending = 0; 423 break; 424 case HD_DEVICE_INIT_ACK: /* no reply expected */ 425 ucs->pending = 0; 426 break; 427 case HD_RESET_INTERRUPT_PIPE: 428 if (!(ucs->basstate & BS_RESETTING)) 429 ucs->pending = 0; 430 break; 431 /* 432 * HD_READ_ATMESSAGE and HD_WRITE_ATMESSAGE are handled separately 433 * and should never end up here 434 */ 435 default: 436 dev_warn(&ucs->interface->dev, 437 "unknown pending request 0x%02x cleared\n", 438 ucs->pending); 439 ucs->pending = 0; 440 } 441 442 if (!ucs->pending) 443 del_timer(&ucs->timer_ctrl); 444 445 spin_unlock_irqrestore(&ucs->lock, flags); 446 } 447 448 /* cmd_in_timeout 449 * timeout routine for command input request 450 * argument: 451 * controller state structure 452 */ 453 static void cmd_in_timeout(unsigned long data) 454 { 455 struct cardstate *cs = (struct cardstate *) data; 456 struct bas_cardstate *ucs = cs->hw.bas; 457 int rc; 458 459 if (!ucs->rcvbuf_size) { 460 gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); 461 return; 462 } 463 464 if (ucs->retry_cmd_in++ >= BAS_RETRY) { 465 dev_err(cs->dev, 466 "control read: timeout, giving up after %d tries\n", 467 ucs->retry_cmd_in); 468 kfree(ucs->rcvbuf); 469 ucs->rcvbuf = NULL; 470 ucs->rcvbuf_size = 0; 471 error_reset(cs); 472 return; 473 } 474 475 gig_dbg(DEBUG_USBREQ, "%s: timeout, retry %d", 476 __func__, ucs->retry_cmd_in); 477 rc = atread_submit(cs, BAS_TIMEOUT); 478 if (rc < 0) { 479 kfree(ucs->rcvbuf); 480 ucs->rcvbuf = NULL; 481 ucs->rcvbuf_size = 0; 482 if (rc != -ENODEV) 483 error_reset(cs); 484 } 485 } 486 487 /* read_ctrl_callback 488 * USB completion handler for control pipe input 489 * called by the USB subsystem in interrupt context 490 * parameter: 491 * urb USB request block 492 * urb->context = inbuf structure for controller state 493 */ 494 static void read_ctrl_callback(struct urb *urb) 495 { 496 struct inbuf_t *inbuf = urb->context; 497 struct cardstate *cs = inbuf->cs; 498 struct bas_cardstate *ucs = cs->hw.bas; 499 int status = urb->status; 500 unsigned numbytes; 501 int rc; 502 503 update_basstate(ucs, 0, BS_ATRDPEND); 504 wake_up(&ucs->waitqueue); 505 del_timer(&ucs->timer_cmd_in); 506 507 switch (status) { 508 case 0: /* normal completion */ 509 numbytes = urb->actual_length; 510 if (unlikely(numbytes != ucs->rcvbuf_size)) { 511 dev_warn(cs->dev, 512 "control read: received %d chars, expected %d\n", 513 numbytes, ucs->rcvbuf_size); 514 if (numbytes > ucs->rcvbuf_size) 515 numbytes = ucs->rcvbuf_size; 516 } 517 518 /* copy received bytes to inbuf, notify event layer */ 519 if (gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes)) { 520 gig_dbg(DEBUG_INTR, "%s-->BH", __func__); 521 gigaset_schedule_event(cs); 522 } 523 break; 524 525 case -ENOENT: /* cancelled */ 526 case -ECONNRESET: /* cancelled (async) */ 527 case -EINPROGRESS: /* pending */ 528 case -ENODEV: /* device removed */ 529 case -ESHUTDOWN: /* device shut down */ 530 /* no further action necessary */ 531 gig_dbg(DEBUG_USBREQ, "%s: %s", 532 __func__, get_usb_statmsg(status)); 533 break; 534 535 default: /* other errors: retry */ 536 if (ucs->retry_cmd_in++ < BAS_RETRY) { 537 gig_dbg(DEBUG_USBREQ, "%s: %s, retry %d", __func__, 538 get_usb_statmsg(status), ucs->retry_cmd_in); 539 rc = atread_submit(cs, BAS_TIMEOUT); 540 if (rc >= 0) 541 /* successfully resubmitted, skip freeing */ 542 return; 543 if (rc == -ENODEV) 544 /* disconnect, no further action necessary */ 545 break; 546 } 547 dev_err(cs->dev, "control read: %s, giving up after %d tries\n", 548 get_usb_statmsg(status), ucs->retry_cmd_in); 549 error_reset(cs); 550 } 551 552 /* read finished, free buffer */ 553 kfree(ucs->rcvbuf); 554 ucs->rcvbuf = NULL; 555 ucs->rcvbuf_size = 0; 556 } 557 558 /* atread_submit 559 * submit an HD_READ_ATMESSAGE command URB and optionally start a timeout 560 * parameters: 561 * cs controller state structure 562 * timeout timeout in 1/10 sec., 0: none 563 * return value: 564 * 0 on success 565 * -EBUSY if another request is pending 566 * any URB submission error code 567 */ 568 static int atread_submit(struct cardstate *cs, int timeout) 569 { 570 struct bas_cardstate *ucs = cs->hw.bas; 571 int basstate; 572 int ret; 573 574 gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", 575 ucs->rcvbuf_size); 576 577 basstate = update_basstate(ucs, BS_ATRDPEND, 0); 578 if (basstate & BS_ATRDPEND) { 579 dev_err(cs->dev, 580 "could not submit HD_READ_ATMESSAGE: URB busy\n"); 581 return -EBUSY; 582 } 583 584 if (basstate & BS_SUSPEND) { 585 dev_notice(cs->dev, 586 "HD_READ_ATMESSAGE not submitted, " 587 "suspend in progress\n"); 588 update_basstate(ucs, 0, BS_ATRDPEND); 589 /* treat like disconnect */ 590 return -ENODEV; 591 } 592 593 ucs->dr_cmd_in.bRequestType = IN_VENDOR_REQ; 594 ucs->dr_cmd_in.bRequest = HD_READ_ATMESSAGE; 595 ucs->dr_cmd_in.wValue = 0; 596 ucs->dr_cmd_in.wIndex = 0; 597 ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size); 598 usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev, 599 usb_rcvctrlpipe(ucs->udev, 0), 600 (unsigned char *) &ucs->dr_cmd_in, 601 ucs->rcvbuf, ucs->rcvbuf_size, 602 read_ctrl_callback, cs->inbuf); 603 604 ret = usb_submit_urb(ucs->urb_cmd_in, GFP_ATOMIC); 605 if (ret != 0) { 606 update_basstate(ucs, 0, BS_ATRDPEND); 607 dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", 608 get_usb_rcmsg(ret)); 609 return ret; 610 } 611 612 if (timeout > 0) { 613 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 614 mod_timer(&ucs->timer_cmd_in, jiffies + timeout * HZ / 10); 615 } 616 return 0; 617 } 618 619 /* int_in_work 620 * workqueue routine to clear halt on interrupt in endpoint 621 */ 622 623 static void int_in_work(struct work_struct *work) 624 { 625 struct bas_cardstate *ucs = 626 container_of(work, struct bas_cardstate, int_in_wq); 627 struct urb *urb = ucs->urb_int_in; 628 struct cardstate *cs = urb->context; 629 int rc; 630 631 /* clear halt condition */ 632 rc = usb_clear_halt(ucs->udev, urb->pipe); 633 gig_dbg(DEBUG_USBREQ, "clear_halt: %s", get_usb_rcmsg(rc)); 634 if (rc == 0) 635 /* success, resubmit interrupt read URB */ 636 rc = usb_submit_urb(urb, GFP_ATOMIC); 637 638 switch (rc) { 639 case 0: /* success */ 640 case -ENODEV: /* device gone */ 641 case -EINVAL: /* URB already resubmitted, or terminal badness */ 642 break; 643 default: /* failure: try to recover by resetting the device */ 644 dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc)); 645 rc = usb_lock_device_for_reset(ucs->udev, ucs->interface); 646 if (rc == 0) { 647 rc = usb_reset_device(ucs->udev); 648 usb_unlock_device(ucs->udev); 649 } 650 } 651 ucs->retry_int_in = 0; 652 } 653 654 /* int_in_resubmit 655 * timer routine for interrupt read delayed resubmit 656 * argument: 657 * controller state structure 658 */ 659 static void int_in_resubmit(unsigned long data) 660 { 661 struct cardstate *cs = (struct cardstate *) data; 662 struct bas_cardstate *ucs = cs->hw.bas; 663 int rc; 664 665 if (ucs->retry_int_in++ >= BAS_RETRY) { 666 dev_err(cs->dev, "interrupt read: giving up after %d tries\n", 667 ucs->retry_int_in); 668 usb_queue_reset_device(ucs->interface); 669 return; 670 } 671 672 gig_dbg(DEBUG_USBREQ, "%s: retry %d", __func__, ucs->retry_int_in); 673 rc = usb_submit_urb(ucs->urb_int_in, GFP_ATOMIC); 674 if (rc != 0 && rc != -ENODEV) { 675 dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", 676 get_usb_rcmsg(rc)); 677 usb_queue_reset_device(ucs->interface); 678 } 679 } 680 681 /* read_int_callback 682 * USB completion handler for interrupt pipe input 683 * called by the USB subsystem in interrupt context 684 * parameter: 685 * urb USB request block 686 * urb->context = controller state structure 687 */ 688 static void read_int_callback(struct urb *urb) 689 { 690 struct cardstate *cs = urb->context; 691 struct bas_cardstate *ucs = cs->hw.bas; 692 struct bc_state *bcs; 693 int status = urb->status; 694 unsigned long flags; 695 int rc; 696 unsigned l; 697 int channel; 698 699 switch (status) { 700 case 0: /* success */ 701 ucs->retry_int_in = 0; 702 break; 703 case -EPIPE: /* endpoint stalled */ 704 schedule_work(&ucs->int_in_wq); 705 /* fall through */ 706 case -ENOENT: /* cancelled */ 707 case -ECONNRESET: /* cancelled (async) */ 708 case -EINPROGRESS: /* pending */ 709 case -ENODEV: /* device removed */ 710 case -ESHUTDOWN: /* device shut down */ 711 /* no further action necessary */ 712 gig_dbg(DEBUG_USBREQ, "%s: %s", 713 __func__, get_usb_statmsg(status)); 714 return; 715 case -EPROTO: /* protocol error or unplug */ 716 case -EILSEQ: 717 case -ETIME: 718 /* resubmit after delay */ 719 gig_dbg(DEBUG_USBREQ, "%s: %s", 720 __func__, get_usb_statmsg(status)); 721 mod_timer(&ucs->timer_int_in, jiffies + HZ / 10); 722 return; 723 default: /* other errors: just resubmit */ 724 dev_warn(cs->dev, "interrupt read: %s\n", 725 get_usb_statmsg(status)); 726 goto resubmit; 727 } 728 729 /* drop incomplete packets even if the missing bytes wouldn't matter */ 730 if (unlikely(urb->actual_length < IP_MSGSIZE)) { 731 dev_warn(cs->dev, "incomplete interrupt packet (%d bytes)\n", 732 urb->actual_length); 733 goto resubmit; 734 } 735 736 l = (unsigned) ucs->int_in_buf[1] + 737 (((unsigned) ucs->int_in_buf[2]) << 8); 738 739 gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", 740 urb->actual_length, (int)ucs->int_in_buf[0], l, 741 (int)ucs->int_in_buf[1], (int)ucs->int_in_buf[2]); 742 743 channel = 0; 744 745 switch (ucs->int_in_buf[0]) { 746 case HD_DEVICE_INIT_OK: 747 update_basstate(ucs, BS_INIT, 0); 748 break; 749 750 case HD_READY_SEND_ATDATA: 751 del_timer(&ucs->timer_atrdy); 752 update_basstate(ucs, BS_ATREADY, BS_ATTIMER); 753 start_cbsend(cs); 754 break; 755 756 case HD_OPEN_B2CHANNEL_ACK: 757 ++channel; 758 case HD_OPEN_B1CHANNEL_ACK: 759 bcs = cs->bcs + channel; 760 update_basstate(ucs, BS_B1OPEN << channel, 0); 761 gigaset_bchannel_up(bcs); 762 break; 763 764 case HD_OPEN_ATCHANNEL_ACK: 765 update_basstate(ucs, BS_ATOPEN, 0); 766 start_cbsend(cs); 767 break; 768 769 case HD_CLOSE_B2CHANNEL_ACK: 770 ++channel; 771 case HD_CLOSE_B1CHANNEL_ACK: 772 bcs = cs->bcs + channel; 773 update_basstate(ucs, 0, BS_B1OPEN << channel); 774 stopurbs(bcs->hw.bas); 775 gigaset_bchannel_down(bcs); 776 break; 777 778 case HD_CLOSE_ATCHANNEL_ACK: 779 update_basstate(ucs, 0, BS_ATOPEN); 780 break; 781 782 case HD_B2_FLOW_CONTROL: 783 ++channel; 784 case HD_B1_FLOW_CONTROL: 785 bcs = cs->bcs + channel; 786 atomic_add((l - BAS_NORMFRAME) * BAS_CORRFRAMES, 787 &bcs->hw.bas->corrbytes); 788 gig_dbg(DEBUG_ISO, 789 "Flow control (channel %d, sub %d): 0x%02x => %d", 790 channel, bcs->hw.bas->numsub, l, 791 atomic_read(&bcs->hw.bas->corrbytes)); 792 break; 793 794 case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ 795 if (!l) { 796 dev_warn(cs->dev, 797 "HD_RECEIVEATDATA_ACK with length 0 ignored\n"); 798 break; 799 } 800 spin_lock_irqsave(&cs->lock, flags); 801 if (ucs->basstate & BS_ATRDPEND) { 802 spin_unlock_irqrestore(&cs->lock, flags); 803 dev_warn(cs->dev, 804 "HD_RECEIVEATDATA_ACK(%d) during HD_READ_ATMESSAGE(%d) ignored\n", 805 l, ucs->rcvbuf_size); 806 break; 807 } 808 if (ucs->rcvbuf_size) { 809 /* throw away previous buffer - we have no queue */ 810 dev_err(cs->dev, 811 "receive AT data overrun, %d bytes lost\n", 812 ucs->rcvbuf_size); 813 kfree(ucs->rcvbuf); 814 ucs->rcvbuf_size = 0; 815 } 816 ucs->rcvbuf = kmalloc(l, GFP_ATOMIC); 817 if (ucs->rcvbuf == NULL) { 818 spin_unlock_irqrestore(&cs->lock, flags); 819 dev_err(cs->dev, "out of memory receiving AT data\n"); 820 break; 821 } 822 ucs->rcvbuf_size = l; 823 ucs->retry_cmd_in = 0; 824 rc = atread_submit(cs, BAS_TIMEOUT); 825 if (rc < 0) { 826 kfree(ucs->rcvbuf); 827 ucs->rcvbuf = NULL; 828 ucs->rcvbuf_size = 0; 829 } 830 spin_unlock_irqrestore(&cs->lock, flags); 831 if (rc < 0 && rc != -ENODEV) 832 error_reset(cs); 833 break; 834 835 case HD_RESET_INTERRUPT_PIPE_ACK: 836 update_basstate(ucs, 0, BS_RESETTING); 837 dev_notice(cs->dev, "interrupt pipe reset\n"); 838 break; 839 840 case HD_SUSPEND_END: 841 gig_dbg(DEBUG_USBREQ, "HD_SUSPEND_END"); 842 break; 843 844 default: 845 dev_warn(cs->dev, 846 "unknown Gigaset signal 0x%02x (%u) ignored\n", 847 (int) ucs->int_in_buf[0], l); 848 } 849 850 check_pending(ucs); 851 wake_up(&ucs->waitqueue); 852 853 resubmit: 854 rc = usb_submit_urb(urb, GFP_ATOMIC); 855 if (unlikely(rc != 0 && rc != -ENODEV)) { 856 dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", 857 get_usb_rcmsg(rc)); 858 error_reset(cs); 859 } 860 } 861 862 /* read_iso_callback 863 * USB completion handler for B channel isochronous input 864 * called by the USB subsystem in interrupt context 865 * parameter: 866 * urb USB request block of completed request 867 * urb->context = bc_state structure 868 */ 869 static void read_iso_callback(struct urb *urb) 870 { 871 struct bc_state *bcs; 872 struct bas_bc_state *ubc; 873 int status = urb->status; 874 unsigned long flags; 875 int i, rc; 876 877 /* status codes not worth bothering the tasklet with */ 878 if (unlikely(status == -ENOENT || 879 status == -ECONNRESET || 880 status == -EINPROGRESS || 881 status == -ENODEV || 882 status == -ESHUTDOWN)) { 883 gig_dbg(DEBUG_ISO, "%s: %s", 884 __func__, get_usb_statmsg(status)); 885 return; 886 } 887 888 bcs = urb->context; 889 ubc = bcs->hw.bas; 890 891 spin_lock_irqsave(&ubc->isoinlock, flags); 892 if (likely(ubc->isoindone == NULL)) { 893 /* pass URB to tasklet */ 894 ubc->isoindone = urb; 895 ubc->isoinstatus = status; 896 tasklet_hi_schedule(&ubc->rcvd_tasklet); 897 } else { 898 /* tasklet still busy, drop data and resubmit URB */ 899 gig_dbg(DEBUG_ISO, "%s: overrun", __func__); 900 ubc->loststatus = status; 901 for (i = 0; i < BAS_NUMFRAMES; i++) { 902 ubc->isoinlost += urb->iso_frame_desc[i].actual_length; 903 if (unlikely(urb->iso_frame_desc[i].status != 0 && 904 urb->iso_frame_desc[i].status != -EINPROGRESS)) 905 ubc->loststatus = urb->iso_frame_desc[i].status; 906 urb->iso_frame_desc[i].status = 0; 907 urb->iso_frame_desc[i].actual_length = 0; 908 } 909 if (likely(ubc->running)) { 910 /* urb->dev is clobbered by USB subsystem */ 911 urb->dev = bcs->cs->hw.bas->udev; 912 urb->transfer_flags = URB_ISO_ASAP; 913 urb->number_of_packets = BAS_NUMFRAMES; 914 rc = usb_submit_urb(urb, GFP_ATOMIC); 915 if (unlikely(rc != 0 && rc != -ENODEV)) { 916 dev_err(bcs->cs->dev, 917 "could not resubmit isoc read URB: %s\n", 918 get_usb_rcmsg(rc)); 919 dump_urb(DEBUG_ISO, "isoc read", urb); 920 error_hangup(bcs); 921 } 922 } 923 } 924 spin_unlock_irqrestore(&ubc->isoinlock, flags); 925 } 926 927 /* write_iso_callback 928 * USB completion handler for B channel isochronous output 929 * called by the USB subsystem in interrupt context 930 * parameter: 931 * urb USB request block of completed request 932 * urb->context = isow_urbctx_t structure 933 */ 934 static void write_iso_callback(struct urb *urb) 935 { 936 struct isow_urbctx_t *ucx; 937 struct bas_bc_state *ubc; 938 int status = urb->status; 939 unsigned long flags; 940 941 /* status codes not worth bothering the tasklet with */ 942 if (unlikely(status == -ENOENT || 943 status == -ECONNRESET || 944 status == -EINPROGRESS || 945 status == -ENODEV || 946 status == -ESHUTDOWN)) { 947 gig_dbg(DEBUG_ISO, "%s: %s", 948 __func__, get_usb_statmsg(status)); 949 return; 950 } 951 952 /* pass URB context to tasklet */ 953 ucx = urb->context; 954 ubc = ucx->bcs->hw.bas; 955 ucx->status = status; 956 957 spin_lock_irqsave(&ubc->isooutlock, flags); 958 ubc->isooutovfl = ubc->isooutdone; 959 ubc->isooutdone = ucx; 960 spin_unlock_irqrestore(&ubc->isooutlock, flags); 961 tasklet_hi_schedule(&ubc->sent_tasklet); 962 } 963 964 /* starturbs 965 * prepare and submit USB request blocks for isochronous input and output 966 * argument: 967 * B channel control structure 968 * return value: 969 * 0 on success 970 * < 0 on error (no URBs submitted) 971 */ 972 static int starturbs(struct bc_state *bcs) 973 { 974 struct bas_bc_state *ubc = bcs->hw.bas; 975 struct urb *urb; 976 int j, k; 977 int rc; 978 979 /* initialize L2 reception */ 980 if (bcs->proto2 == L2_HDLC) 981 bcs->inputstate |= INS_flag_hunt; 982 983 /* submit all isochronous input URBs */ 984 ubc->running = 1; 985 for (k = 0; k < BAS_INURBS; k++) { 986 urb = ubc->isoinurbs[k]; 987 if (!urb) { 988 rc = -EFAULT; 989 goto error; 990 } 991 992 urb->dev = bcs->cs->hw.bas->udev; 993 urb->pipe = usb_rcvisocpipe(urb->dev, 3 + 2 * bcs->channel); 994 urb->transfer_flags = URB_ISO_ASAP; 995 urb->transfer_buffer = ubc->isoinbuf + k * BAS_INBUFSIZE; 996 urb->transfer_buffer_length = BAS_INBUFSIZE; 997 urb->number_of_packets = BAS_NUMFRAMES; 998 urb->interval = BAS_FRAMETIME; 999 urb->complete = read_iso_callback; 1000 urb->context = bcs; 1001 for (j = 0; j < BAS_NUMFRAMES; j++) { 1002 urb->iso_frame_desc[j].offset = j * BAS_MAXFRAME; 1003 urb->iso_frame_desc[j].length = BAS_MAXFRAME; 1004 urb->iso_frame_desc[j].status = 0; 1005 urb->iso_frame_desc[j].actual_length = 0; 1006 } 1007 1008 dump_urb(DEBUG_ISO, "Initial isoc read", urb); 1009 rc = usb_submit_urb(urb, GFP_ATOMIC); 1010 if (rc != 0) 1011 goto error; 1012 } 1013 1014 /* initialize L2 transmission */ 1015 gigaset_isowbuf_init(ubc->isooutbuf, PPP_FLAG); 1016 1017 /* set up isochronous output URBs for flag idling */ 1018 for (k = 0; k < BAS_OUTURBS; ++k) { 1019 urb = ubc->isoouturbs[k].urb; 1020 if (!urb) { 1021 rc = -EFAULT; 1022 goto error; 1023 } 1024 urb->dev = bcs->cs->hw.bas->udev; 1025 urb->pipe = usb_sndisocpipe(urb->dev, 4 + 2 * bcs->channel); 1026 urb->transfer_flags = URB_ISO_ASAP; 1027 urb->transfer_buffer = ubc->isooutbuf->data; 1028 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); 1029 urb->number_of_packets = BAS_NUMFRAMES; 1030 urb->interval = BAS_FRAMETIME; 1031 urb->complete = write_iso_callback; 1032 urb->context = &ubc->isoouturbs[k]; 1033 for (j = 0; j < BAS_NUMFRAMES; ++j) { 1034 urb->iso_frame_desc[j].offset = BAS_OUTBUFSIZE; 1035 urb->iso_frame_desc[j].length = BAS_NORMFRAME; 1036 urb->iso_frame_desc[j].status = 0; 1037 urb->iso_frame_desc[j].actual_length = 0; 1038 } 1039 ubc->isoouturbs[k].limit = -1; 1040 } 1041 1042 /* keep one URB free, submit the others */ 1043 for (k = 0; k < BAS_OUTURBS - 1; ++k) { 1044 dump_urb(DEBUG_ISO, "Initial isoc write", urb); 1045 rc = usb_submit_urb(ubc->isoouturbs[k].urb, GFP_ATOMIC); 1046 if (rc != 0) 1047 goto error; 1048 } 1049 dump_urb(DEBUG_ISO, "Initial isoc write (free)", urb); 1050 ubc->isooutfree = &ubc->isoouturbs[BAS_OUTURBS - 1]; 1051 ubc->isooutdone = ubc->isooutovfl = NULL; 1052 return 0; 1053 error: 1054 stopurbs(ubc); 1055 return rc; 1056 } 1057 1058 /* stopurbs 1059 * cancel the USB request blocks for isochronous input and output 1060 * errors are silently ignored 1061 * argument: 1062 * B channel control structure 1063 */ 1064 static void stopurbs(struct bas_bc_state *ubc) 1065 { 1066 int k, rc; 1067 1068 ubc->running = 0; 1069 1070 for (k = 0; k < BAS_INURBS; ++k) { 1071 rc = usb_unlink_urb(ubc->isoinurbs[k]); 1072 gig_dbg(DEBUG_ISO, 1073 "%s: isoc input URB %d unlinked, result = %s", 1074 __func__, k, get_usb_rcmsg(rc)); 1075 } 1076 1077 for (k = 0; k < BAS_OUTURBS; ++k) { 1078 rc = usb_unlink_urb(ubc->isoouturbs[k].urb); 1079 gig_dbg(DEBUG_ISO, 1080 "%s: isoc output URB %d unlinked, result = %s", 1081 __func__, k, get_usb_rcmsg(rc)); 1082 } 1083 } 1084 1085 /* Isochronous Write - Bottom Half */ 1086 /* =============================== */ 1087 1088 /* submit_iso_write_urb 1089 * fill and submit the next isochronous write URB 1090 * parameters: 1091 * ucx context structure containing URB 1092 * return value: 1093 * number of frames submitted in URB 1094 * 0 if URB not submitted because no data available (isooutbuf busy) 1095 * error code < 0 on error 1096 */ 1097 static int submit_iso_write_urb(struct isow_urbctx_t *ucx) 1098 { 1099 struct urb *urb = ucx->urb; 1100 struct bas_bc_state *ubc = ucx->bcs->hw.bas; 1101 struct usb_iso_packet_descriptor *ifd; 1102 int corrbytes, nframe, rc; 1103 1104 /* urb->dev is clobbered by USB subsystem */ 1105 urb->dev = ucx->bcs->cs->hw.bas->udev; 1106 urb->transfer_flags = URB_ISO_ASAP; 1107 urb->transfer_buffer = ubc->isooutbuf->data; 1108 urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); 1109 1110 for (nframe = 0; nframe < BAS_NUMFRAMES; nframe++) { 1111 ifd = &urb->iso_frame_desc[nframe]; 1112 1113 /* compute frame length according to flow control */ 1114 ifd->length = BAS_NORMFRAME; 1115 corrbytes = atomic_read(&ubc->corrbytes); 1116 if (corrbytes != 0) { 1117 gig_dbg(DEBUG_ISO, "%s: corrbytes=%d", 1118 __func__, corrbytes); 1119 if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME) 1120 corrbytes = BAS_HIGHFRAME - BAS_NORMFRAME; 1121 else if (corrbytes < BAS_LOWFRAME - BAS_NORMFRAME) 1122 corrbytes = BAS_LOWFRAME - BAS_NORMFRAME; 1123 ifd->length += corrbytes; 1124 atomic_add(-corrbytes, &ubc->corrbytes); 1125 } 1126 1127 /* retrieve block of data to send */ 1128 rc = gigaset_isowbuf_getbytes(ubc->isooutbuf, ifd->length); 1129 if (rc < 0) { 1130 if (rc == -EBUSY) { 1131 gig_dbg(DEBUG_ISO, 1132 "%s: buffer busy at frame %d", 1133 __func__, nframe); 1134 /* tasklet will be restarted from 1135 gigaset_isoc_send_skb() */ 1136 } else { 1137 dev_err(ucx->bcs->cs->dev, 1138 "%s: buffer error %d at frame %d\n", 1139 __func__, rc, nframe); 1140 return rc; 1141 } 1142 break; 1143 } 1144 ifd->offset = rc; 1145 ucx->limit = ubc->isooutbuf->nextread; 1146 ifd->status = 0; 1147 ifd->actual_length = 0; 1148 } 1149 if (unlikely(nframe == 0)) 1150 return 0; /* no data to send */ 1151 urb->number_of_packets = nframe; 1152 1153 rc = usb_submit_urb(urb, GFP_ATOMIC); 1154 if (unlikely(rc)) { 1155 if (rc == -ENODEV) 1156 /* device removed - give up silently */ 1157 gig_dbg(DEBUG_ISO, "%s: disconnected", __func__); 1158 else 1159 dev_err(ucx->bcs->cs->dev, 1160 "could not submit isoc write URB: %s\n", 1161 get_usb_rcmsg(rc)); 1162 return rc; 1163 } 1164 ++ubc->numsub; 1165 return nframe; 1166 } 1167 1168 /* write_iso_tasklet 1169 * tasklet scheduled when an isochronous output URB from the Gigaset device 1170 * has completed 1171 * parameter: 1172 * data B channel state structure 1173 */ 1174 static void write_iso_tasklet(unsigned long data) 1175 { 1176 struct bc_state *bcs = (struct bc_state *) data; 1177 struct bas_bc_state *ubc = bcs->hw.bas; 1178 struct cardstate *cs = bcs->cs; 1179 struct isow_urbctx_t *done, *next, *ovfl; 1180 struct urb *urb; 1181 int status; 1182 struct usb_iso_packet_descriptor *ifd; 1183 unsigned long flags; 1184 int i; 1185 struct sk_buff *skb; 1186 int len; 1187 int rc; 1188 1189 /* loop while completed URBs arrive in time */ 1190 for (;;) { 1191 if (unlikely(!(ubc->running))) { 1192 gig_dbg(DEBUG_ISO, "%s: not running", __func__); 1193 return; 1194 } 1195 1196 /* retrieve completed URBs */ 1197 spin_lock_irqsave(&ubc->isooutlock, flags); 1198 done = ubc->isooutdone; 1199 ubc->isooutdone = NULL; 1200 ovfl = ubc->isooutovfl; 1201 ubc->isooutovfl = NULL; 1202 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1203 if (ovfl) { 1204 dev_err(cs->dev, "isoc write underrun\n"); 1205 error_hangup(bcs); 1206 break; 1207 } 1208 if (!done) 1209 break; 1210 1211 /* submit free URB if available */ 1212 spin_lock_irqsave(&ubc->isooutlock, flags); 1213 next = ubc->isooutfree; 1214 ubc->isooutfree = NULL; 1215 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1216 if (next) { 1217 rc = submit_iso_write_urb(next); 1218 if (unlikely(rc <= 0 && rc != -ENODEV)) { 1219 /* could not submit URB, put it back */ 1220 spin_lock_irqsave(&ubc->isooutlock, flags); 1221 if (ubc->isooutfree == NULL) { 1222 ubc->isooutfree = next; 1223 next = NULL; 1224 } 1225 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1226 if (next) { 1227 /* couldn't put it back */ 1228 dev_err(cs->dev, 1229 "losing isoc write URB\n"); 1230 error_hangup(bcs); 1231 } 1232 } 1233 } 1234 1235 /* process completed URB */ 1236 urb = done->urb; 1237 status = done->status; 1238 switch (status) { 1239 case -EXDEV: /* partial completion */ 1240 gig_dbg(DEBUG_ISO, "%s: URB partially completed", 1241 __func__); 1242 /* fall through - what's the difference anyway? */ 1243 case 0: /* normal completion */ 1244 /* inspect individual frames 1245 * assumptions (for lack of documentation): 1246 * - actual_length bytes of first frame in error are 1247 * successfully sent 1248 * - all following frames are not sent at all 1249 */ 1250 for (i = 0; i < BAS_NUMFRAMES; i++) { 1251 ifd = &urb->iso_frame_desc[i]; 1252 if (ifd->status || 1253 ifd->actual_length != ifd->length) { 1254 dev_warn(cs->dev, 1255 "isoc write: frame %d[%d/%d]: %s\n", 1256 i, ifd->actual_length, 1257 ifd->length, 1258 get_usb_statmsg(ifd->status)); 1259 break; 1260 } 1261 } 1262 break; 1263 case -EPIPE: /* stall - probably underrun */ 1264 dev_err(cs->dev, "isoc write: stalled\n"); 1265 error_hangup(bcs); 1266 break; 1267 default: /* other errors */ 1268 dev_warn(cs->dev, "isoc write: %s\n", 1269 get_usb_statmsg(status)); 1270 } 1271 1272 /* mark the write buffer area covered by this URB as free */ 1273 if (done->limit >= 0) 1274 ubc->isooutbuf->read = done->limit; 1275 1276 /* mark URB as free */ 1277 spin_lock_irqsave(&ubc->isooutlock, flags); 1278 next = ubc->isooutfree; 1279 ubc->isooutfree = done; 1280 spin_unlock_irqrestore(&ubc->isooutlock, flags); 1281 if (next) { 1282 /* only one URB still active - resubmit one */ 1283 rc = submit_iso_write_urb(next); 1284 if (unlikely(rc <= 0 && rc != -ENODEV)) { 1285 /* couldn't submit */ 1286 error_hangup(bcs); 1287 } 1288 } 1289 } 1290 1291 /* process queued SKBs */ 1292 while ((skb = skb_dequeue(&bcs->squeue))) { 1293 /* copy to output buffer, doing L2 encapsulation */ 1294 len = skb->len; 1295 if (gigaset_isoc_buildframe(bcs, skb->data, len) == -EAGAIN) { 1296 /* insufficient buffer space, push back onto queue */ 1297 skb_queue_head(&bcs->squeue, skb); 1298 gig_dbg(DEBUG_ISO, "%s: skb requeued, qlen=%d", 1299 __func__, skb_queue_len(&bcs->squeue)); 1300 break; 1301 } 1302 skb_pull(skb, len); 1303 gigaset_skb_sent(bcs, skb); 1304 dev_kfree_skb_any(skb); 1305 } 1306 } 1307 1308 /* Isochronous Read - Bottom Half */ 1309 /* ============================== */ 1310 1311 /* read_iso_tasklet 1312 * tasklet scheduled when an isochronous input URB from the Gigaset device 1313 * has completed 1314 * parameter: 1315 * data B channel state structure 1316 */ 1317 static void read_iso_tasklet(unsigned long data) 1318 { 1319 struct bc_state *bcs = (struct bc_state *) data; 1320 struct bas_bc_state *ubc = bcs->hw.bas; 1321 struct cardstate *cs = bcs->cs; 1322 struct urb *urb; 1323 int status; 1324 struct usb_iso_packet_descriptor *ifd; 1325 char *rcvbuf; 1326 unsigned long flags; 1327 int totleft, numbytes, offset, frame, rc; 1328 1329 /* loop while more completed URBs arrive in the meantime */ 1330 for (;;) { 1331 /* retrieve URB */ 1332 spin_lock_irqsave(&ubc->isoinlock, flags); 1333 urb = ubc->isoindone; 1334 if (!urb) { 1335 spin_unlock_irqrestore(&ubc->isoinlock, flags); 1336 return; 1337 } 1338 status = ubc->isoinstatus; 1339 ubc->isoindone = NULL; 1340 if (unlikely(ubc->loststatus != -EINPROGRESS)) { 1341 dev_warn(cs->dev, 1342 "isoc read overrun, URB dropped (status: %s, %d bytes)\n", 1343 get_usb_statmsg(ubc->loststatus), 1344 ubc->isoinlost); 1345 ubc->loststatus = -EINPROGRESS; 1346 } 1347 spin_unlock_irqrestore(&ubc->isoinlock, flags); 1348 1349 if (unlikely(!(ubc->running))) { 1350 gig_dbg(DEBUG_ISO, 1351 "%s: channel not running, " 1352 "dropped URB with status: %s", 1353 __func__, get_usb_statmsg(status)); 1354 return; 1355 } 1356 1357 switch (status) { 1358 case 0: /* normal completion */ 1359 break; 1360 case -EXDEV: /* inspect individual frames 1361 (we do that anyway) */ 1362 gig_dbg(DEBUG_ISO, "%s: URB partially completed", 1363 __func__); 1364 break; 1365 case -ENOENT: 1366 case -ECONNRESET: 1367 case -EINPROGRESS: 1368 gig_dbg(DEBUG_ISO, "%s: %s", 1369 __func__, get_usb_statmsg(status)); 1370 continue; /* -> skip */ 1371 case -EPIPE: 1372 dev_err(cs->dev, "isoc read: stalled\n"); 1373 error_hangup(bcs); 1374 continue; /* -> skip */ 1375 default: /* other error */ 1376 dev_warn(cs->dev, "isoc read: %s\n", 1377 get_usb_statmsg(status)); 1378 goto error; 1379 } 1380 1381 rcvbuf = urb->transfer_buffer; 1382 totleft = urb->actual_length; 1383 for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { 1384 ifd = &urb->iso_frame_desc[frame]; 1385 numbytes = ifd->actual_length; 1386 switch (ifd->status) { 1387 case 0: /* success */ 1388 break; 1389 case -EPROTO: /* protocol error or unplug */ 1390 case -EILSEQ: 1391 case -ETIME: 1392 /* probably just disconnected, ignore */ 1393 gig_dbg(DEBUG_ISO, 1394 "isoc read: frame %d[%d]: %s\n", 1395 frame, numbytes, 1396 get_usb_statmsg(ifd->status)); 1397 break; 1398 default: /* other error */ 1399 /* report, assume transferred bytes are ok */ 1400 dev_warn(cs->dev, 1401 "isoc read: frame %d[%d]: %s\n", 1402 frame, numbytes, 1403 get_usb_statmsg(ifd->status)); 1404 } 1405 if (unlikely(numbytes > BAS_MAXFRAME)) 1406 dev_warn(cs->dev, 1407 "isoc read: frame %d[%d]: %s\n", 1408 frame, numbytes, 1409 "exceeds max frame size"); 1410 if (unlikely(numbytes > totleft)) { 1411 dev_warn(cs->dev, 1412 "isoc read: frame %d[%d]: %s\n", 1413 frame, numbytes, 1414 "exceeds total transfer length"); 1415 numbytes = totleft; 1416 } 1417 offset = ifd->offset; 1418 if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { 1419 dev_warn(cs->dev, 1420 "isoc read: frame %d[%d]: %s\n", 1421 frame, numbytes, 1422 "exceeds end of buffer"); 1423 numbytes = BAS_INBUFSIZE - offset; 1424 } 1425 gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); 1426 totleft -= numbytes; 1427 } 1428 if (unlikely(totleft > 0)) 1429 dev_warn(cs->dev, "isoc read: %d data bytes missing\n", 1430 totleft); 1431 1432 error: 1433 /* URB processed, resubmit */ 1434 for (frame = 0; frame < BAS_NUMFRAMES; frame++) { 1435 urb->iso_frame_desc[frame].status = 0; 1436 urb->iso_frame_desc[frame].actual_length = 0; 1437 } 1438 /* urb->dev is clobbered by USB subsystem */ 1439 urb->dev = bcs->cs->hw.bas->udev; 1440 urb->transfer_flags = URB_ISO_ASAP; 1441 urb->number_of_packets = BAS_NUMFRAMES; 1442 rc = usb_submit_urb(urb, GFP_ATOMIC); 1443 if (unlikely(rc != 0 && rc != -ENODEV)) { 1444 dev_err(cs->dev, 1445 "could not resubmit isoc read URB: %s\n", 1446 get_usb_rcmsg(rc)); 1447 dump_urb(DEBUG_ISO, "resubmit isoc read", urb); 1448 error_hangup(bcs); 1449 } 1450 } 1451 } 1452 1453 /* Channel Operations */ 1454 /* ================== */ 1455 1456 /* req_timeout 1457 * timeout routine for control output request 1458 * argument: 1459 * controller state structure 1460 */ 1461 static void req_timeout(unsigned long data) 1462 { 1463 struct cardstate *cs = (struct cardstate *) data; 1464 struct bas_cardstate *ucs = cs->hw.bas; 1465 int pending; 1466 unsigned long flags; 1467 1468 check_pending(ucs); 1469 1470 spin_lock_irqsave(&ucs->lock, flags); 1471 pending = ucs->pending; 1472 ucs->pending = 0; 1473 spin_unlock_irqrestore(&ucs->lock, flags); 1474 1475 switch (pending) { 1476 case 0: /* no pending request */ 1477 gig_dbg(DEBUG_USBREQ, "%s: no request pending", __func__); 1478 break; 1479 1480 case HD_OPEN_ATCHANNEL: 1481 dev_err(cs->dev, "timeout opening AT channel\n"); 1482 error_reset(cs); 1483 break; 1484 1485 case HD_OPEN_B1CHANNEL: 1486 dev_err(cs->dev, "timeout opening channel 1\n"); 1487 error_hangup(&cs->bcs[0]); 1488 break; 1489 1490 case HD_OPEN_B2CHANNEL: 1491 dev_err(cs->dev, "timeout opening channel 2\n"); 1492 error_hangup(&cs->bcs[1]); 1493 break; 1494 1495 case HD_CLOSE_ATCHANNEL: 1496 dev_err(cs->dev, "timeout closing AT channel\n"); 1497 error_reset(cs); 1498 break; 1499 1500 case HD_CLOSE_B1CHANNEL: 1501 dev_err(cs->dev, "timeout closing channel 1\n"); 1502 error_reset(cs); 1503 break; 1504 1505 case HD_CLOSE_B2CHANNEL: 1506 dev_err(cs->dev, "timeout closing channel 2\n"); 1507 error_reset(cs); 1508 break; 1509 1510 case HD_RESET_INTERRUPT_PIPE: 1511 /* error recovery escalation */ 1512 dev_err(cs->dev, 1513 "reset interrupt pipe timeout, attempting USB reset\n"); 1514 usb_queue_reset_device(ucs->interface); 1515 break; 1516 1517 default: 1518 dev_warn(cs->dev, "request 0x%02x timed out, clearing\n", 1519 pending); 1520 } 1521 1522 wake_up(&ucs->waitqueue); 1523 } 1524 1525 /* write_ctrl_callback 1526 * USB completion handler for control pipe output 1527 * called by the USB subsystem in interrupt context 1528 * parameter: 1529 * urb USB request block of completed request 1530 * urb->context = hardware specific controller state structure 1531 */ 1532 static void write_ctrl_callback(struct urb *urb) 1533 { 1534 struct bas_cardstate *ucs = urb->context; 1535 int status = urb->status; 1536 int rc; 1537 unsigned long flags; 1538 1539 /* check status */ 1540 switch (status) { 1541 case 0: /* normal completion */ 1542 spin_lock_irqsave(&ucs->lock, flags); 1543 switch (ucs->pending) { 1544 case HD_DEVICE_INIT_ACK: /* no reply expected */ 1545 del_timer(&ucs->timer_ctrl); 1546 ucs->pending = 0; 1547 break; 1548 } 1549 spin_unlock_irqrestore(&ucs->lock, flags); 1550 return; 1551 1552 case -ENOENT: /* cancelled */ 1553 case -ECONNRESET: /* cancelled (async) */ 1554 case -EINPROGRESS: /* pending */ 1555 case -ENODEV: /* device removed */ 1556 case -ESHUTDOWN: /* device shut down */ 1557 /* ignore silently */ 1558 gig_dbg(DEBUG_USBREQ, "%s: %s", 1559 __func__, get_usb_statmsg(status)); 1560 break; 1561 1562 default: /* any failure */ 1563 /* don't retry if suspend requested */ 1564 if (++ucs->retry_ctrl > BAS_RETRY || 1565 (ucs->basstate & BS_SUSPEND)) { 1566 dev_err(&ucs->interface->dev, 1567 "control request 0x%02x failed: %s\n", 1568 ucs->dr_ctrl.bRequest, 1569 get_usb_statmsg(status)); 1570 break; /* give up */ 1571 } 1572 dev_notice(&ucs->interface->dev, 1573 "control request 0x%02x: %s, retry %d\n", 1574 ucs->dr_ctrl.bRequest, get_usb_statmsg(status), 1575 ucs->retry_ctrl); 1576 /* urb->dev is clobbered by USB subsystem */ 1577 urb->dev = ucs->udev; 1578 rc = usb_submit_urb(urb, GFP_ATOMIC); 1579 if (unlikely(rc)) { 1580 dev_err(&ucs->interface->dev, 1581 "could not resubmit request 0x%02x: %s\n", 1582 ucs->dr_ctrl.bRequest, get_usb_rcmsg(rc)); 1583 break; 1584 } 1585 /* resubmitted */ 1586 return; 1587 } 1588 1589 /* failed, clear pending request */ 1590 spin_lock_irqsave(&ucs->lock, flags); 1591 del_timer(&ucs->timer_ctrl); 1592 ucs->pending = 0; 1593 spin_unlock_irqrestore(&ucs->lock, flags); 1594 wake_up(&ucs->waitqueue); 1595 } 1596 1597 /* req_submit 1598 * submit a control output request without message buffer to the Gigaset base 1599 * and optionally start a timeout 1600 * parameters: 1601 * bcs B channel control structure 1602 * req control request code (HD_*) 1603 * val control request parameter value (set to 0 if unused) 1604 * timeout timeout in seconds (0: no timeout) 1605 * return value: 1606 * 0 on success 1607 * -EBUSY if another request is pending 1608 * any URB submission error code 1609 */ 1610 static int req_submit(struct bc_state *bcs, int req, int val, int timeout) 1611 { 1612 struct bas_cardstate *ucs = bcs->cs->hw.bas; 1613 int ret; 1614 unsigned long flags; 1615 1616 gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); 1617 1618 spin_lock_irqsave(&ucs->lock, flags); 1619 if (ucs->pending) { 1620 spin_unlock_irqrestore(&ucs->lock, flags); 1621 dev_err(bcs->cs->dev, 1622 "submission of request 0x%02x failed: " 1623 "request 0x%02x still pending\n", 1624 req, ucs->pending); 1625 return -EBUSY; 1626 } 1627 1628 ucs->dr_ctrl.bRequestType = OUT_VENDOR_REQ; 1629 ucs->dr_ctrl.bRequest = req; 1630 ucs->dr_ctrl.wValue = cpu_to_le16(val); 1631 ucs->dr_ctrl.wIndex = 0; 1632 ucs->dr_ctrl.wLength = 0; 1633 usb_fill_control_urb(ucs->urb_ctrl, ucs->udev, 1634 usb_sndctrlpipe(ucs->udev, 0), 1635 (unsigned char *) &ucs->dr_ctrl, NULL, 0, 1636 write_ctrl_callback, ucs); 1637 ucs->retry_ctrl = 0; 1638 ret = usb_submit_urb(ucs->urb_ctrl, GFP_ATOMIC); 1639 if (unlikely(ret)) { 1640 dev_err(bcs->cs->dev, "could not submit request 0x%02x: %s\n", 1641 req, get_usb_rcmsg(ret)); 1642 spin_unlock_irqrestore(&ucs->lock, flags); 1643 return ret; 1644 } 1645 ucs->pending = req; 1646 1647 if (timeout > 0) { 1648 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 1649 mod_timer(&ucs->timer_ctrl, jiffies + timeout * HZ / 10); 1650 } 1651 1652 spin_unlock_irqrestore(&ucs->lock, flags); 1653 return 0; 1654 } 1655 1656 /* gigaset_init_bchannel 1657 * called by common.c to connect a B channel 1658 * initialize isochronous I/O and tell the Gigaset base to open the channel 1659 * argument: 1660 * B channel control structure 1661 * return value: 1662 * 0 on success, error code < 0 on error 1663 */ 1664 static int gigaset_init_bchannel(struct bc_state *bcs) 1665 { 1666 struct cardstate *cs = bcs->cs; 1667 int req, ret; 1668 unsigned long flags; 1669 1670 spin_lock_irqsave(&cs->lock, flags); 1671 if (unlikely(!cs->connected)) { 1672 gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); 1673 spin_unlock_irqrestore(&cs->lock, flags); 1674 return -ENODEV; 1675 } 1676 1677 if (cs->hw.bas->basstate & BS_SUSPEND) { 1678 dev_notice(cs->dev, 1679 "not starting isoc I/O, suspend in progress\n"); 1680 spin_unlock_irqrestore(&cs->lock, flags); 1681 return -EHOSTUNREACH; 1682 } 1683 1684 ret = starturbs(bcs); 1685 if (ret < 0) { 1686 spin_unlock_irqrestore(&cs->lock, flags); 1687 dev_err(cs->dev, 1688 "could not start isoc I/O for channel B%d: %s\n", 1689 bcs->channel + 1, 1690 ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); 1691 if (ret != -ENODEV) 1692 error_hangup(bcs); 1693 return ret; 1694 } 1695 1696 req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; 1697 ret = req_submit(bcs, req, 0, BAS_TIMEOUT); 1698 if (ret < 0) { 1699 dev_err(cs->dev, "could not open channel B%d\n", 1700 bcs->channel + 1); 1701 stopurbs(bcs->hw.bas); 1702 } 1703 1704 spin_unlock_irqrestore(&cs->lock, flags); 1705 if (ret < 0 && ret != -ENODEV) 1706 error_hangup(bcs); 1707 return ret; 1708 } 1709 1710 /* gigaset_close_bchannel 1711 * called by common.c to disconnect a B channel 1712 * tell the Gigaset base to close the channel 1713 * stopping isochronous I/O and LL notification will be done when the 1714 * acknowledgement for the close arrives 1715 * argument: 1716 * B channel control structure 1717 * return value: 1718 * 0 on success, error code < 0 on error 1719 */ 1720 static int gigaset_close_bchannel(struct bc_state *bcs) 1721 { 1722 struct cardstate *cs = bcs->cs; 1723 int req, ret; 1724 unsigned long flags; 1725 1726 spin_lock_irqsave(&cs->lock, flags); 1727 if (unlikely(!cs->connected)) { 1728 spin_unlock_irqrestore(&cs->lock, flags); 1729 gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); 1730 return -ENODEV; 1731 } 1732 1733 if (!(cs->hw.bas->basstate & (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) { 1734 /* channel not running: just signal common.c */ 1735 spin_unlock_irqrestore(&cs->lock, flags); 1736 gigaset_bchannel_down(bcs); 1737 return 0; 1738 } 1739 1740 /* channel running: tell device to close it */ 1741 req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; 1742 ret = req_submit(bcs, req, 0, BAS_TIMEOUT); 1743 if (ret < 0) 1744 dev_err(cs->dev, "closing channel B%d failed\n", 1745 bcs->channel + 1); 1746 1747 spin_unlock_irqrestore(&cs->lock, flags); 1748 return ret; 1749 } 1750 1751 /* Device Operations */ 1752 /* ================= */ 1753 1754 /* complete_cb 1755 * unqueue first command buffer from queue, waking any sleepers 1756 * must be called with cs->cmdlock held 1757 * parameter: 1758 * cs controller state structure 1759 */ 1760 static void complete_cb(struct cardstate *cs) 1761 { 1762 struct cmdbuf_t *cb = cs->cmdbuf; 1763 1764 /* unqueue completed buffer */ 1765 cs->cmdbytes -= cs->curlen; 1766 gig_dbg(DEBUG_OUTPUT, "write_command: sent %u bytes, %u left", 1767 cs->curlen, cs->cmdbytes); 1768 if (cb->next != NULL) { 1769 cs->cmdbuf = cb->next; 1770 cs->cmdbuf->prev = NULL; 1771 cs->curlen = cs->cmdbuf->len; 1772 } else { 1773 cs->cmdbuf = NULL; 1774 cs->lastcmdbuf = NULL; 1775 cs->curlen = 0; 1776 } 1777 1778 if (cb->wake_tasklet) 1779 tasklet_schedule(cb->wake_tasklet); 1780 1781 kfree(cb); 1782 } 1783 1784 /* write_command_callback 1785 * USB completion handler for AT command transmission 1786 * called by the USB subsystem in interrupt context 1787 * parameter: 1788 * urb USB request block of completed request 1789 * urb->context = controller state structure 1790 */ 1791 static void write_command_callback(struct urb *urb) 1792 { 1793 struct cardstate *cs = urb->context; 1794 struct bas_cardstate *ucs = cs->hw.bas; 1795 int status = urb->status; 1796 unsigned long flags; 1797 1798 update_basstate(ucs, 0, BS_ATWRPEND); 1799 wake_up(&ucs->waitqueue); 1800 1801 /* check status */ 1802 switch (status) { 1803 case 0: /* normal completion */ 1804 break; 1805 case -ENOENT: /* cancelled */ 1806 case -ECONNRESET: /* cancelled (async) */ 1807 case -EINPROGRESS: /* pending */ 1808 case -ENODEV: /* device removed */ 1809 case -ESHUTDOWN: /* device shut down */ 1810 /* ignore silently */ 1811 gig_dbg(DEBUG_USBREQ, "%s: %s", 1812 __func__, get_usb_statmsg(status)); 1813 return; 1814 default: /* any failure */ 1815 if (++ucs->retry_cmd_out > BAS_RETRY) { 1816 dev_warn(cs->dev, 1817 "command write: %s, " 1818 "giving up after %d retries\n", 1819 get_usb_statmsg(status), 1820 ucs->retry_cmd_out); 1821 break; 1822 } 1823 if (ucs->basstate & BS_SUSPEND) { 1824 dev_warn(cs->dev, 1825 "command write: %s, " 1826 "won't retry - suspend requested\n", 1827 get_usb_statmsg(status)); 1828 break; 1829 } 1830 if (cs->cmdbuf == NULL) { 1831 dev_warn(cs->dev, 1832 "command write: %s, " 1833 "cannot retry - cmdbuf gone\n", 1834 get_usb_statmsg(status)); 1835 break; 1836 } 1837 dev_notice(cs->dev, "command write: %s, retry %d\n", 1838 get_usb_statmsg(status), ucs->retry_cmd_out); 1839 if (atwrite_submit(cs, cs->cmdbuf->buf, cs->cmdbuf->len) >= 0) 1840 /* resubmitted - bypass regular exit block */ 1841 return; 1842 /* command send failed, assume base still waiting */ 1843 update_basstate(ucs, BS_ATREADY, 0); 1844 } 1845 1846 spin_lock_irqsave(&cs->cmdlock, flags); 1847 if (cs->cmdbuf != NULL) 1848 complete_cb(cs); 1849 spin_unlock_irqrestore(&cs->cmdlock, flags); 1850 } 1851 1852 /* atrdy_timeout 1853 * timeout routine for AT command transmission 1854 * argument: 1855 * controller state structure 1856 */ 1857 static void atrdy_timeout(unsigned long data) 1858 { 1859 struct cardstate *cs = (struct cardstate *) data; 1860 struct bas_cardstate *ucs = cs->hw.bas; 1861 1862 dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n"); 1863 1864 /* fake the missing signal - what else can I do? */ 1865 update_basstate(ucs, BS_ATREADY, BS_ATTIMER); 1866 start_cbsend(cs); 1867 } 1868 1869 /* atwrite_submit 1870 * submit an HD_WRITE_ATMESSAGE command URB 1871 * parameters: 1872 * cs controller state structure 1873 * buf buffer containing command to send 1874 * len length of command to send 1875 * return value: 1876 * 0 on success 1877 * -EBUSY if another request is pending 1878 * any URB submission error code 1879 */ 1880 static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) 1881 { 1882 struct bas_cardstate *ucs = cs->hw.bas; 1883 int rc; 1884 1885 gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); 1886 1887 if (update_basstate(ucs, BS_ATWRPEND, 0) & BS_ATWRPEND) { 1888 dev_err(cs->dev, 1889 "could not submit HD_WRITE_ATMESSAGE: URB busy\n"); 1890 return -EBUSY; 1891 } 1892 1893 ucs->dr_cmd_out.bRequestType = OUT_VENDOR_REQ; 1894 ucs->dr_cmd_out.bRequest = HD_WRITE_ATMESSAGE; 1895 ucs->dr_cmd_out.wValue = 0; 1896 ucs->dr_cmd_out.wIndex = 0; 1897 ucs->dr_cmd_out.wLength = cpu_to_le16(len); 1898 usb_fill_control_urb(ucs->urb_cmd_out, ucs->udev, 1899 usb_sndctrlpipe(ucs->udev, 0), 1900 (unsigned char *) &ucs->dr_cmd_out, buf, len, 1901 write_command_callback, cs); 1902 rc = usb_submit_urb(ucs->urb_cmd_out, GFP_ATOMIC); 1903 if (unlikely(rc)) { 1904 update_basstate(ucs, 0, BS_ATWRPEND); 1905 dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", 1906 get_usb_rcmsg(rc)); 1907 return rc; 1908 } 1909 1910 /* submitted successfully, start timeout if necessary */ 1911 if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) { 1912 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", 1913 ATRDY_TIMEOUT); 1914 mod_timer(&ucs->timer_atrdy, jiffies + ATRDY_TIMEOUT * HZ / 10); 1915 } 1916 return 0; 1917 } 1918 1919 /* start_cbsend 1920 * start transmission of AT command queue if necessary 1921 * parameter: 1922 * cs controller state structure 1923 * return value: 1924 * 0 on success 1925 * error code < 0 on error 1926 */ 1927 static int start_cbsend(struct cardstate *cs) 1928 { 1929 struct cmdbuf_t *cb; 1930 struct bas_cardstate *ucs = cs->hw.bas; 1931 unsigned long flags; 1932 int rc; 1933 int retval = 0; 1934 1935 /* check if suspend requested */ 1936 if (ucs->basstate & BS_SUSPEND) { 1937 gig_dbg(DEBUG_OUTPUT, "suspending"); 1938 return -EHOSTUNREACH; 1939 } 1940 1941 /* check if AT channel is open */ 1942 if (!(ucs->basstate & BS_ATOPEN)) { 1943 gig_dbg(DEBUG_OUTPUT, "AT channel not open"); 1944 rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); 1945 if (rc < 0) { 1946 /* flush command queue */ 1947 spin_lock_irqsave(&cs->cmdlock, flags); 1948 while (cs->cmdbuf != NULL) 1949 complete_cb(cs); 1950 spin_unlock_irqrestore(&cs->cmdlock, flags); 1951 } 1952 return rc; 1953 } 1954 1955 /* try to send first command in queue */ 1956 spin_lock_irqsave(&cs->cmdlock, flags); 1957 1958 while ((cb = cs->cmdbuf) != NULL && (ucs->basstate & BS_ATREADY)) { 1959 ucs->retry_cmd_out = 0; 1960 rc = atwrite_submit(cs, cb->buf, cb->len); 1961 if (unlikely(rc)) { 1962 retval = rc; 1963 complete_cb(cs); 1964 } 1965 } 1966 1967 spin_unlock_irqrestore(&cs->cmdlock, flags); 1968 return retval; 1969 } 1970 1971 /* gigaset_write_cmd 1972 * This function is called by the device independent part of the driver 1973 * to transmit an AT command string to the Gigaset device. 1974 * It encapsulates the device specific method for transmission over the 1975 * direct USB connection to the base. 1976 * The command string is added to the queue of commands to send, and 1977 * USB transmission is started if necessary. 1978 * parameters: 1979 * cs controller state structure 1980 * cb command buffer structure 1981 * return value: 1982 * number of bytes queued on success 1983 * error code < 0 on error 1984 */ 1985 static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) 1986 { 1987 unsigned long flags; 1988 int rc; 1989 1990 gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? 1991 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 1992 "CMD Transmit", cb->len, cb->buf); 1993 1994 /* translate "+++" escape sequence sent as a single separate command 1995 * into "close AT channel" command for error recovery 1996 * The next command will reopen the AT channel automatically. 1997 */ 1998 if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) { 1999 /* If an HD_RECEIVEATDATA_ACK message remains unhandled 2000 * because of an error, the base never sends another one. 2001 * The response channel is thus effectively blocked. 2002 * Closing and reopening the AT channel does *not* clear 2003 * this condition. 2004 * As a stopgap measure, submit a zero-length AT read 2005 * before closing the AT channel. This has the undocumented 2006 * effect of triggering a new HD_RECEIVEATDATA_ACK message 2007 * from the base if necessary. 2008 * The subsequent AT channel close then discards any pending 2009 * messages. 2010 */ 2011 spin_lock_irqsave(&cs->lock, flags); 2012 if (!(cs->hw.bas->basstate & BS_ATRDPEND)) { 2013 kfree(cs->hw.bas->rcvbuf); 2014 cs->hw.bas->rcvbuf = NULL; 2015 cs->hw.bas->rcvbuf_size = 0; 2016 cs->hw.bas->retry_cmd_in = 0; 2017 atread_submit(cs, 0); 2018 } 2019 spin_unlock_irqrestore(&cs->lock, flags); 2020 2021 rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT); 2022 if (cb->wake_tasklet) 2023 tasklet_schedule(cb->wake_tasklet); 2024 if (!rc) 2025 rc = cb->len; 2026 kfree(cb); 2027 return rc; 2028 } 2029 2030 spin_lock_irqsave(&cs->cmdlock, flags); 2031 cb->prev = cs->lastcmdbuf; 2032 if (cs->lastcmdbuf) 2033 cs->lastcmdbuf->next = cb; 2034 else { 2035 cs->cmdbuf = cb; 2036 cs->curlen = cb->len; 2037 } 2038 cs->cmdbytes += cb->len; 2039 cs->lastcmdbuf = cb; 2040 spin_unlock_irqrestore(&cs->cmdlock, flags); 2041 2042 spin_lock_irqsave(&cs->lock, flags); 2043 if (unlikely(!cs->connected)) { 2044 spin_unlock_irqrestore(&cs->lock, flags); 2045 gig_dbg(DEBUG_USBREQ, "%s: not connected", __func__); 2046 /* flush command queue */ 2047 spin_lock_irqsave(&cs->cmdlock, flags); 2048 while (cs->cmdbuf != NULL) 2049 complete_cb(cs); 2050 spin_unlock_irqrestore(&cs->cmdlock, flags); 2051 return -ENODEV; 2052 } 2053 rc = start_cbsend(cs); 2054 spin_unlock_irqrestore(&cs->lock, flags); 2055 return rc < 0 ? rc : cb->len; 2056 } 2057 2058 /* gigaset_write_room 2059 * tty_driver.write_room interface routine 2060 * return number of characters the driver will accept to be written via 2061 * gigaset_write_cmd 2062 * parameter: 2063 * controller state structure 2064 * return value: 2065 * number of characters 2066 */ 2067 static int gigaset_write_room(struct cardstate *cs) 2068 { 2069 return IF_WRITEBUF; 2070 } 2071 2072 /* gigaset_chars_in_buffer 2073 * tty_driver.chars_in_buffer interface routine 2074 * return number of characters waiting to be sent 2075 * parameter: 2076 * controller state structure 2077 * return value: 2078 * number of characters 2079 */ 2080 static int gigaset_chars_in_buffer(struct cardstate *cs) 2081 { 2082 return cs->cmdbytes; 2083 } 2084 2085 /* gigaset_brkchars 2086 * implementation of ioctl(GIGASET_BRKCHARS) 2087 * parameter: 2088 * controller state structure 2089 * return value: 2090 * -EINVAL (unimplemented function) 2091 */ 2092 static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6]) 2093 { 2094 return -EINVAL; 2095 } 2096 2097 2098 /* Device Initialization/Shutdown */ 2099 /* ============================== */ 2100 2101 /* Free hardware dependent part of the B channel structure 2102 * parameter: 2103 * bcs B channel structure 2104 */ 2105 static void gigaset_freebcshw(struct bc_state *bcs) 2106 { 2107 struct bas_bc_state *ubc = bcs->hw.bas; 2108 int i; 2109 2110 if (!ubc) 2111 return; 2112 2113 /* kill URBs and tasklets before freeing - better safe than sorry */ 2114 ubc->running = 0; 2115 gig_dbg(DEBUG_INIT, "%s: killing isoc URBs", __func__); 2116 for (i = 0; i < BAS_OUTURBS; ++i) { 2117 usb_kill_urb(ubc->isoouturbs[i].urb); 2118 usb_free_urb(ubc->isoouturbs[i].urb); 2119 } 2120 for (i = 0; i < BAS_INURBS; ++i) { 2121 usb_kill_urb(ubc->isoinurbs[i]); 2122 usb_free_urb(ubc->isoinurbs[i]); 2123 } 2124 tasklet_kill(&ubc->sent_tasklet); 2125 tasklet_kill(&ubc->rcvd_tasklet); 2126 kfree(ubc->isooutbuf); 2127 kfree(ubc); 2128 bcs->hw.bas = NULL; 2129 } 2130 2131 /* Initialize hardware dependent part of the B channel structure 2132 * parameter: 2133 * bcs B channel structure 2134 * return value: 2135 * 0 on success, error code < 0 on failure 2136 */ 2137 static int gigaset_initbcshw(struct bc_state *bcs) 2138 { 2139 int i; 2140 struct bas_bc_state *ubc; 2141 2142 bcs->hw.bas = ubc = kmalloc(sizeof(struct bas_bc_state), GFP_KERNEL); 2143 if (!ubc) { 2144 pr_err("out of memory\n"); 2145 return -ENOMEM; 2146 } 2147 2148 ubc->running = 0; 2149 atomic_set(&ubc->corrbytes, 0); 2150 spin_lock_init(&ubc->isooutlock); 2151 for (i = 0; i < BAS_OUTURBS; ++i) { 2152 ubc->isoouturbs[i].urb = NULL; 2153 ubc->isoouturbs[i].bcs = bcs; 2154 } 2155 ubc->isooutdone = ubc->isooutfree = ubc->isooutovfl = NULL; 2156 ubc->numsub = 0; 2157 ubc->isooutbuf = kmalloc(sizeof(struct isowbuf_t), GFP_KERNEL); 2158 if (!ubc->isooutbuf) { 2159 pr_err("out of memory\n"); 2160 kfree(ubc); 2161 bcs->hw.bas = NULL; 2162 return -ENOMEM; 2163 } 2164 tasklet_init(&ubc->sent_tasklet, 2165 write_iso_tasklet, (unsigned long) bcs); 2166 2167 spin_lock_init(&ubc->isoinlock); 2168 for (i = 0; i < BAS_INURBS; ++i) 2169 ubc->isoinurbs[i] = NULL; 2170 ubc->isoindone = NULL; 2171 ubc->loststatus = -EINPROGRESS; 2172 ubc->isoinlost = 0; 2173 ubc->seqlen = 0; 2174 ubc->inbyte = 0; 2175 ubc->inbits = 0; 2176 ubc->goodbytes = 0; 2177 ubc->alignerrs = 0; 2178 ubc->fcserrs = 0; 2179 ubc->frameerrs = 0; 2180 ubc->giants = 0; 2181 ubc->runts = 0; 2182 ubc->aborts = 0; 2183 ubc->shared0s = 0; 2184 ubc->stolen0s = 0; 2185 tasklet_init(&ubc->rcvd_tasklet, 2186 read_iso_tasklet, (unsigned long) bcs); 2187 return 0; 2188 } 2189 2190 static void gigaset_reinitbcshw(struct bc_state *bcs) 2191 { 2192 struct bas_bc_state *ubc = bcs->hw.bas; 2193 2194 bcs->hw.bas->running = 0; 2195 atomic_set(&bcs->hw.bas->corrbytes, 0); 2196 bcs->hw.bas->numsub = 0; 2197 spin_lock_init(&ubc->isooutlock); 2198 spin_lock_init(&ubc->isoinlock); 2199 ubc->loststatus = -EINPROGRESS; 2200 } 2201 2202 static void gigaset_freecshw(struct cardstate *cs) 2203 { 2204 /* timers, URBs and rcvbuf are disposed of in disconnect */ 2205 kfree(cs->hw.bas->int_in_buf); 2206 kfree(cs->hw.bas); 2207 cs->hw.bas = NULL; 2208 } 2209 2210 /* Initialize hardware dependent part of the cardstate structure 2211 * parameter: 2212 * cs cardstate structure 2213 * return value: 2214 * 0 on success, error code < 0 on failure 2215 */ 2216 static int gigaset_initcshw(struct cardstate *cs) 2217 { 2218 struct bas_cardstate *ucs; 2219 2220 cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL); 2221 if (!ucs) { 2222 pr_err("out of memory\n"); 2223 return -ENOMEM; 2224 } 2225 ucs->int_in_buf = kmalloc(IP_MSGSIZE, GFP_KERNEL); 2226 if (!ucs->int_in_buf) { 2227 kfree(ucs); 2228 pr_err("out of memory\n"); 2229 return -ENOMEM; 2230 } 2231 2232 ucs->urb_cmd_in = NULL; 2233 ucs->urb_cmd_out = NULL; 2234 ucs->rcvbuf = NULL; 2235 ucs->rcvbuf_size = 0; 2236 2237 spin_lock_init(&ucs->lock); 2238 ucs->pending = 0; 2239 2240 ucs->basstate = 0; 2241 setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs); 2242 setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs); 2243 setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs); 2244 setup_timer(&ucs->timer_int_in, int_in_resubmit, (unsigned long) cs); 2245 init_waitqueue_head(&ucs->waitqueue); 2246 INIT_WORK(&ucs->int_in_wq, int_in_work); 2247 2248 return 0; 2249 } 2250 2251 /* freeurbs 2252 * unlink and deallocate all URBs unconditionally 2253 * caller must make sure that no commands are still in progress 2254 * parameter: 2255 * cs controller state structure 2256 */ 2257 static void freeurbs(struct cardstate *cs) 2258 { 2259 struct bas_cardstate *ucs = cs->hw.bas; 2260 struct bas_bc_state *ubc; 2261 int i, j; 2262 2263 gig_dbg(DEBUG_INIT, "%s: killing URBs", __func__); 2264 for (j = 0; j < BAS_CHANNELS; ++j) { 2265 ubc = cs->bcs[j].hw.bas; 2266 for (i = 0; i < BAS_OUTURBS; ++i) { 2267 usb_kill_urb(ubc->isoouturbs[i].urb); 2268 usb_free_urb(ubc->isoouturbs[i].urb); 2269 ubc->isoouturbs[i].urb = NULL; 2270 } 2271 for (i = 0; i < BAS_INURBS; ++i) { 2272 usb_kill_urb(ubc->isoinurbs[i]); 2273 usb_free_urb(ubc->isoinurbs[i]); 2274 ubc->isoinurbs[i] = NULL; 2275 } 2276 } 2277 usb_kill_urb(ucs->urb_int_in); 2278 usb_free_urb(ucs->urb_int_in); 2279 ucs->urb_int_in = NULL; 2280 usb_kill_urb(ucs->urb_cmd_out); 2281 usb_free_urb(ucs->urb_cmd_out); 2282 ucs->urb_cmd_out = NULL; 2283 usb_kill_urb(ucs->urb_cmd_in); 2284 usb_free_urb(ucs->urb_cmd_in); 2285 ucs->urb_cmd_in = NULL; 2286 usb_kill_urb(ucs->urb_ctrl); 2287 usb_free_urb(ucs->urb_ctrl); 2288 ucs->urb_ctrl = NULL; 2289 } 2290 2291 /* gigaset_probe 2292 * This function is called when a new USB device is connected. 2293 * It checks whether the new device is handled by this driver. 2294 */ 2295 static int gigaset_probe(struct usb_interface *interface, 2296 const struct usb_device_id *id) 2297 { 2298 struct usb_host_interface *hostif; 2299 struct usb_device *udev = interface_to_usbdev(interface); 2300 struct cardstate *cs = NULL; 2301 struct bas_cardstate *ucs = NULL; 2302 struct bas_bc_state *ubc; 2303 struct usb_endpoint_descriptor *endpoint; 2304 int i, j; 2305 int rc; 2306 2307 gig_dbg(DEBUG_INIT, 2308 "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", 2309 __func__, le16_to_cpu(udev->descriptor.idVendor), 2310 le16_to_cpu(udev->descriptor.idProduct)); 2311 2312 /* set required alternate setting */ 2313 hostif = interface->cur_altsetting; 2314 if (hostif->desc.bAlternateSetting != 3) { 2315 gig_dbg(DEBUG_INIT, 2316 "%s: wrong alternate setting %d - trying to switch", 2317 __func__, hostif->desc.bAlternateSetting); 2318 if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) 2319 < 0) { 2320 dev_warn(&udev->dev, "usb_set_interface failed, " 2321 "device %d interface %d altsetting %d\n", 2322 udev->devnum, hostif->desc.bInterfaceNumber, 2323 hostif->desc.bAlternateSetting); 2324 return -ENODEV; 2325 } 2326 hostif = interface->cur_altsetting; 2327 } 2328 2329 /* Reject application specific interfaces 2330 */ 2331 if (hostif->desc.bInterfaceClass != 255) { 2332 dev_warn(&udev->dev, "%s: bInterfaceClass == %d\n", 2333 __func__, hostif->desc.bInterfaceClass); 2334 return -ENODEV; 2335 } 2336 2337 dev_info(&udev->dev, 2338 "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n", 2339 __func__, le16_to_cpu(udev->descriptor.idVendor), 2340 le16_to_cpu(udev->descriptor.idProduct)); 2341 2342 /* allocate memory for our device state and initialize it */ 2343 cs = gigaset_initcs(driver, BAS_CHANNELS, 0, 0, cidmode, 2344 GIGASET_MODULENAME); 2345 if (!cs) 2346 return -ENODEV; 2347 ucs = cs->hw.bas; 2348 2349 /* save off device structure ptrs for later use */ 2350 usb_get_dev(udev); 2351 ucs->udev = udev; 2352 ucs->interface = interface; 2353 cs->dev = &interface->dev; 2354 2355 /* allocate URBs: 2356 * - one for the interrupt pipe 2357 * - three for the different uses of the default control pipe 2358 * - three for each isochronous pipe 2359 */ 2360 if (!(ucs->urb_int_in = usb_alloc_urb(0, GFP_KERNEL)) || 2361 !(ucs->urb_cmd_in = usb_alloc_urb(0, GFP_KERNEL)) || 2362 !(ucs->urb_cmd_out = usb_alloc_urb(0, GFP_KERNEL)) || 2363 !(ucs->urb_ctrl = usb_alloc_urb(0, GFP_KERNEL))) 2364 goto allocerr; 2365 2366 for (j = 0; j < BAS_CHANNELS; ++j) { 2367 ubc = cs->bcs[j].hw.bas; 2368 for (i = 0; i < BAS_OUTURBS; ++i) 2369 if (!(ubc->isoouturbs[i].urb = 2370 usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL))) 2371 goto allocerr; 2372 for (i = 0; i < BAS_INURBS; ++i) 2373 if (!(ubc->isoinurbs[i] = 2374 usb_alloc_urb(BAS_NUMFRAMES, GFP_KERNEL))) 2375 goto allocerr; 2376 } 2377 2378 ucs->rcvbuf = NULL; 2379 ucs->rcvbuf_size = 0; 2380 2381 /* Fill the interrupt urb and send it to the core */ 2382 endpoint = &hostif->endpoint[0].desc; 2383 usb_fill_int_urb(ucs->urb_int_in, udev, 2384 usb_rcvintpipe(udev, 2385 (endpoint->bEndpointAddress) & 0x0f), 2386 ucs->int_in_buf, IP_MSGSIZE, read_int_callback, cs, 2387 endpoint->bInterval); 2388 rc = usb_submit_urb(ucs->urb_int_in, GFP_KERNEL); 2389 if (rc != 0) { 2390 dev_err(cs->dev, "could not submit interrupt URB: %s\n", 2391 get_usb_rcmsg(rc)); 2392 goto error; 2393 } 2394 ucs->retry_int_in = 0; 2395 2396 /* tell the device that the driver is ready */ 2397 rc = req_submit(cs->bcs, HD_DEVICE_INIT_ACK, 0, 0); 2398 if (rc != 0) 2399 goto error; 2400 2401 /* tell common part that the device is ready */ 2402 if (startmode == SM_LOCKED) 2403 cs->mstate = MS_LOCKED; 2404 2405 /* save address of controller structure */ 2406 usb_set_intfdata(interface, cs); 2407 2408 rc = gigaset_start(cs); 2409 if (rc < 0) 2410 goto error; 2411 2412 return 0; 2413 2414 allocerr: 2415 dev_err(cs->dev, "could not allocate URBs\n"); 2416 rc = -ENOMEM; 2417 error: 2418 freeurbs(cs); 2419 usb_set_intfdata(interface, NULL); 2420 gigaset_freecs(cs); 2421 return rc; 2422 } 2423 2424 /* gigaset_disconnect 2425 * This function is called when the Gigaset base is unplugged. 2426 */ 2427 static void gigaset_disconnect(struct usb_interface *interface) 2428 { 2429 struct cardstate *cs; 2430 struct bas_cardstate *ucs; 2431 int j; 2432 2433 cs = usb_get_intfdata(interface); 2434 2435 ucs = cs->hw.bas; 2436 2437 dev_info(cs->dev, "disconnecting Gigaset base\n"); 2438 2439 /* mark base as not ready, all channels disconnected */ 2440 ucs->basstate = 0; 2441 2442 /* tell LL all channels are down */ 2443 for (j = 0; j < BAS_CHANNELS; ++j) 2444 gigaset_bchannel_down(cs->bcs + j); 2445 2446 /* stop driver (common part) */ 2447 gigaset_stop(cs); 2448 2449 /* stop delayed work and URBs, free ressources */ 2450 del_timer_sync(&ucs->timer_ctrl); 2451 del_timer_sync(&ucs->timer_atrdy); 2452 del_timer_sync(&ucs->timer_cmd_in); 2453 del_timer_sync(&ucs->timer_int_in); 2454 cancel_work_sync(&ucs->int_in_wq); 2455 freeurbs(cs); 2456 usb_set_intfdata(interface, NULL); 2457 kfree(ucs->rcvbuf); 2458 ucs->rcvbuf = NULL; 2459 ucs->rcvbuf_size = 0; 2460 usb_put_dev(ucs->udev); 2461 ucs->interface = NULL; 2462 ucs->udev = NULL; 2463 cs->dev = NULL; 2464 gigaset_freecs(cs); 2465 } 2466 2467 /* gigaset_suspend 2468 * This function is called before the USB connection is suspended 2469 * or before the USB device is reset. 2470 * In the latter case, message == PMSG_ON. 2471 */ 2472 static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) 2473 { 2474 struct cardstate *cs = usb_get_intfdata(intf); 2475 struct bas_cardstate *ucs = cs->hw.bas; 2476 int rc; 2477 2478 /* set suspend flag; this stops AT command/response traffic */ 2479 if (update_basstate(ucs, BS_SUSPEND, 0) & BS_SUSPEND) { 2480 gig_dbg(DEBUG_SUSPEND, "already suspended"); 2481 return 0; 2482 } 2483 2484 /* wait a bit for blocking conditions to go away */ 2485 rc = wait_event_timeout(ucs->waitqueue, 2486 !(ucs->basstate & 2487 (BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)), 2488 BAS_TIMEOUT * HZ / 10); 2489 gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc); 2490 2491 /* check for conditions preventing suspend */ 2492 if (ucs->basstate & (BS_B1OPEN | BS_B2OPEN | BS_ATRDPEND | BS_ATWRPEND)) { 2493 dev_warn(cs->dev, "cannot suspend:\n"); 2494 if (ucs->basstate & BS_B1OPEN) 2495 dev_warn(cs->dev, " B channel 1 open\n"); 2496 if (ucs->basstate & BS_B2OPEN) 2497 dev_warn(cs->dev, " B channel 2 open\n"); 2498 if (ucs->basstate & BS_ATRDPEND) 2499 dev_warn(cs->dev, " receiving AT reply\n"); 2500 if (ucs->basstate & BS_ATWRPEND) 2501 dev_warn(cs->dev, " sending AT command\n"); 2502 update_basstate(ucs, 0, BS_SUSPEND); 2503 return -EBUSY; 2504 } 2505 2506 /* close AT channel if open */ 2507 if (ucs->basstate & BS_ATOPEN) { 2508 gig_dbg(DEBUG_SUSPEND, "closing AT channel"); 2509 rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, 0); 2510 if (rc) { 2511 update_basstate(ucs, 0, BS_SUSPEND); 2512 return rc; 2513 } 2514 wait_event_timeout(ucs->waitqueue, !ucs->pending, 2515 BAS_TIMEOUT * HZ / 10); 2516 /* in case of timeout, proceed anyway */ 2517 } 2518 2519 /* kill all URBs and delayed work that might still be pending */ 2520 usb_kill_urb(ucs->urb_ctrl); 2521 usb_kill_urb(ucs->urb_int_in); 2522 del_timer_sync(&ucs->timer_ctrl); 2523 del_timer_sync(&ucs->timer_atrdy); 2524 del_timer_sync(&ucs->timer_cmd_in); 2525 del_timer_sync(&ucs->timer_int_in); 2526 2527 /* don't try to cancel int_in_wq from within reset as it 2528 * might be the one requesting the reset 2529 */ 2530 if (message.event != PM_EVENT_ON) 2531 cancel_work_sync(&ucs->int_in_wq); 2532 2533 gig_dbg(DEBUG_SUSPEND, "suspend complete"); 2534 return 0; 2535 } 2536 2537 /* gigaset_resume 2538 * This function is called after the USB connection has been resumed. 2539 */ 2540 static int gigaset_resume(struct usb_interface *intf) 2541 { 2542 struct cardstate *cs = usb_get_intfdata(intf); 2543 struct bas_cardstate *ucs = cs->hw.bas; 2544 int rc; 2545 2546 /* resubmit interrupt URB for spontaneous messages from base */ 2547 rc = usb_submit_urb(ucs->urb_int_in, GFP_KERNEL); 2548 if (rc) { 2549 dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", 2550 get_usb_rcmsg(rc)); 2551 return rc; 2552 } 2553 ucs->retry_int_in = 0; 2554 2555 /* clear suspend flag to reallow activity */ 2556 update_basstate(ucs, 0, BS_SUSPEND); 2557 2558 gig_dbg(DEBUG_SUSPEND, "resume complete"); 2559 return 0; 2560 } 2561 2562 /* gigaset_pre_reset 2563 * This function is called before the USB connection is reset. 2564 */ 2565 static int gigaset_pre_reset(struct usb_interface *intf) 2566 { 2567 /* handle just like suspend */ 2568 return gigaset_suspend(intf, PMSG_ON); 2569 } 2570 2571 /* gigaset_post_reset 2572 * This function is called after the USB connection has been reset. 2573 */ 2574 static int gigaset_post_reset(struct usb_interface *intf) 2575 { 2576 /* FIXME: send HD_DEVICE_INIT_ACK? */ 2577 2578 /* resume operations */ 2579 return gigaset_resume(intf); 2580 } 2581 2582 2583 static const struct gigaset_ops gigops = { 2584 gigaset_write_cmd, 2585 gigaset_write_room, 2586 gigaset_chars_in_buffer, 2587 gigaset_brkchars, 2588 gigaset_init_bchannel, 2589 gigaset_close_bchannel, 2590 gigaset_initbcshw, 2591 gigaset_freebcshw, 2592 gigaset_reinitbcshw, 2593 gigaset_initcshw, 2594 gigaset_freecshw, 2595 gigaset_set_modem_ctrl, 2596 gigaset_baud_rate, 2597 gigaset_set_line_ctrl, 2598 gigaset_isoc_send_skb, 2599 gigaset_isoc_input, 2600 }; 2601 2602 /* bas_gigaset_init 2603 * This function is called after the kernel module is loaded. 2604 */ 2605 static int __init bas_gigaset_init(void) 2606 { 2607 int result; 2608 2609 /* allocate memory for our driver state and initialize it */ 2610 driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 2611 GIGASET_MODULENAME, GIGASET_DEVNAME, 2612 &gigops, THIS_MODULE); 2613 if (driver == NULL) 2614 goto error; 2615 2616 /* register this driver with the USB subsystem */ 2617 result = usb_register(&gigaset_usb_driver); 2618 if (result < 0) { 2619 pr_err("error %d registering USB driver\n", -result); 2620 goto error; 2621 } 2622 2623 pr_info(DRIVER_DESC "\n"); 2624 return 0; 2625 2626 error: 2627 if (driver) 2628 gigaset_freedriver(driver); 2629 driver = NULL; 2630 return -1; 2631 } 2632 2633 /* bas_gigaset_exit 2634 * This function is called before the kernel module is unloaded. 2635 */ 2636 static void __exit bas_gigaset_exit(void) 2637 { 2638 struct bas_cardstate *ucs; 2639 int i; 2640 2641 gigaset_blockdriver(driver); /* => probe will fail 2642 * => no gigaset_start any more 2643 */ 2644 2645 /* stop all connected devices */ 2646 for (i = 0; i < driver->minors; i++) { 2647 if (gigaset_shutdown(driver->cs + i) < 0) 2648 continue; /* no device */ 2649 /* from now on, no isdn callback should be possible */ 2650 2651 /* close all still open channels */ 2652 ucs = driver->cs[i].hw.bas; 2653 if (ucs->basstate & BS_B1OPEN) { 2654 gig_dbg(DEBUG_INIT, "closing B1 channel"); 2655 usb_control_msg(ucs->udev, 2656 usb_sndctrlpipe(ucs->udev, 0), 2657 HD_CLOSE_B1CHANNEL, OUT_VENDOR_REQ, 2658 0, 0, NULL, 0, BAS_TIMEOUT); 2659 } 2660 if (ucs->basstate & BS_B2OPEN) { 2661 gig_dbg(DEBUG_INIT, "closing B2 channel"); 2662 usb_control_msg(ucs->udev, 2663 usb_sndctrlpipe(ucs->udev, 0), 2664 HD_CLOSE_B2CHANNEL, OUT_VENDOR_REQ, 2665 0, 0, NULL, 0, BAS_TIMEOUT); 2666 } 2667 if (ucs->basstate & BS_ATOPEN) { 2668 gig_dbg(DEBUG_INIT, "closing AT channel"); 2669 usb_control_msg(ucs->udev, 2670 usb_sndctrlpipe(ucs->udev, 0), 2671 HD_CLOSE_ATCHANNEL, OUT_VENDOR_REQ, 2672 0, 0, NULL, 0, BAS_TIMEOUT); 2673 } 2674 ucs->basstate = 0; 2675 } 2676 2677 /* deregister this driver with the USB subsystem */ 2678 usb_deregister(&gigaset_usb_driver); 2679 /* this will call the disconnect-callback */ 2680 /* from now on, no disconnect/probe callback should be running */ 2681 2682 gigaset_freedriver(driver); 2683 driver = NULL; 2684 } 2685 2686 2687 module_init(bas_gigaset_init); 2688 module_exit(bas_gigaset_exit); 2689 2690 MODULE_AUTHOR(DRIVER_AUTHOR); 2691 MODULE_DESCRIPTION(DRIVER_DESC); 2692 MODULE_LICENSE("GPL"); 2693 2694 2695 2696 2697 2698 /* LDV_COMMENT_BEGIN_MAIN */ 2699 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 2700 2701 /*###########################################################################*/ 2702 2703 /*############## Driver Environment Generator 0.2 output ####################*/ 2704 2705 /*###########################################################################*/ 2706 2707 2708 2709 /* 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. */ 2710 void ldv_check_final_state(void); 2711 2712 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 2713 void ldv_check_return_value(int res); 2714 2715 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 2716 void ldv_check_return_value_probe(int res); 2717 2718 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 2719 void ldv_initialize(void); 2720 2721 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 2722 void ldv_handler_precall(void); 2723 2724 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 2725 int nondet_int(void); 2726 2727 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 2728 int LDV_IN_INTERRUPT; 2729 2730 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 2731 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 2732 2733 2734 2735 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 2736 /*============================= VARIABLE DECLARATION PART =============================*/ 2737 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 2738 /* content: static int gigaset_probe(struct usb_interface *interface, const struct usb_device_id *id)*/ 2739 /* LDV_COMMENT_BEGIN_PREP */ 2740 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2741 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2742 #define GIGASET_MINORS 1 2743 #define GIGASET_MINOR 16 2744 #define GIGASET_MODULENAME "bas_gigaset" 2745 #define GIGASET_DEVNAME "ttyGB" 2746 #define IF_WRITEBUF 264 2747 #define IP_MSGSIZE 3 2748 #define USB_GIGA_VENDOR_ID 0x0681 2749 #define USB_3070_PRODUCT_ID 0x0001 2750 #define USB_3075_PRODUCT_ID 0x0002 2751 #define USB_SX303_PRODUCT_ID 0x0021 2752 #define USB_SX353_PRODUCT_ID 0x0022 2753 #define BS_ATOPEN 0x001 2754 #define BS_B1OPEN 0x002 2755 #define BS_B2OPEN 0x004 2756 #define BS_ATREADY 0x008 2757 #define BS_INIT 0x010 2758 #define BS_ATTIMER 0x020 2759 #define BS_ATRDPEND 0x040 2760 #define BS_ATWRPEND 0x080 2761 #define BS_SUSPEND 0x100 2762 #define BS_RESETTING 0x200 2763 #ifdef CONFIG_GIGASET_DEBUG 2764 #endif 2765 /* LDV_COMMENT_END_PREP */ 2766 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "gigaset_probe" */ 2767 struct usb_interface * var_group1; 2768 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "gigaset_probe" */ 2769 const struct usb_device_id * var_gigaset_probe_43_p1; 2770 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "gigaset_probe" */ 2771 static int res_gigaset_probe_43; 2772 /* content: static void gigaset_disconnect(struct usb_interface *interface)*/ 2773 /* LDV_COMMENT_BEGIN_PREP */ 2774 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2775 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2776 #define GIGASET_MINORS 1 2777 #define GIGASET_MINOR 16 2778 #define GIGASET_MODULENAME "bas_gigaset" 2779 #define GIGASET_DEVNAME "ttyGB" 2780 #define IF_WRITEBUF 264 2781 #define IP_MSGSIZE 3 2782 #define USB_GIGA_VENDOR_ID 0x0681 2783 #define USB_3070_PRODUCT_ID 0x0001 2784 #define USB_3075_PRODUCT_ID 0x0002 2785 #define USB_SX303_PRODUCT_ID 0x0021 2786 #define USB_SX353_PRODUCT_ID 0x0022 2787 #define BS_ATOPEN 0x001 2788 #define BS_B1OPEN 0x002 2789 #define BS_B2OPEN 0x004 2790 #define BS_ATREADY 0x008 2791 #define BS_INIT 0x010 2792 #define BS_ATTIMER 0x020 2793 #define BS_ATRDPEND 0x040 2794 #define BS_ATWRPEND 0x080 2795 #define BS_SUSPEND 0x100 2796 #define BS_RESETTING 0x200 2797 #ifdef CONFIG_GIGASET_DEBUG 2798 #endif 2799 /* LDV_COMMENT_END_PREP */ 2800 /* content: static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)*/ 2801 /* LDV_COMMENT_BEGIN_PREP */ 2802 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2803 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2804 #define GIGASET_MINORS 1 2805 #define GIGASET_MINOR 16 2806 #define GIGASET_MODULENAME "bas_gigaset" 2807 #define GIGASET_DEVNAME "ttyGB" 2808 #define IF_WRITEBUF 264 2809 #define IP_MSGSIZE 3 2810 #define USB_GIGA_VENDOR_ID 0x0681 2811 #define USB_3070_PRODUCT_ID 0x0001 2812 #define USB_3075_PRODUCT_ID 0x0002 2813 #define USB_SX303_PRODUCT_ID 0x0021 2814 #define USB_SX353_PRODUCT_ID 0x0022 2815 #define BS_ATOPEN 0x001 2816 #define BS_B1OPEN 0x002 2817 #define BS_B2OPEN 0x004 2818 #define BS_ATREADY 0x008 2819 #define BS_INIT 0x010 2820 #define BS_ATTIMER 0x020 2821 #define BS_ATRDPEND 0x040 2822 #define BS_ATWRPEND 0x080 2823 #define BS_SUSPEND 0x100 2824 #define BS_RESETTING 0x200 2825 #ifdef CONFIG_GIGASET_DEBUG 2826 #endif 2827 /* LDV_COMMENT_END_PREP */ 2828 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "gigaset_suspend" */ 2829 pm_message_t var_gigaset_suspend_45_p1; 2830 /* content: static int gigaset_resume(struct usb_interface *intf)*/ 2831 /* LDV_COMMENT_BEGIN_PREP */ 2832 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2833 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2834 #define GIGASET_MINORS 1 2835 #define GIGASET_MINOR 16 2836 #define GIGASET_MODULENAME "bas_gigaset" 2837 #define GIGASET_DEVNAME "ttyGB" 2838 #define IF_WRITEBUF 264 2839 #define IP_MSGSIZE 3 2840 #define USB_GIGA_VENDOR_ID 0x0681 2841 #define USB_3070_PRODUCT_ID 0x0001 2842 #define USB_3075_PRODUCT_ID 0x0002 2843 #define USB_SX303_PRODUCT_ID 0x0021 2844 #define USB_SX353_PRODUCT_ID 0x0022 2845 #define BS_ATOPEN 0x001 2846 #define BS_B1OPEN 0x002 2847 #define BS_B2OPEN 0x004 2848 #define BS_ATREADY 0x008 2849 #define BS_INIT 0x010 2850 #define BS_ATTIMER 0x020 2851 #define BS_ATRDPEND 0x040 2852 #define BS_ATWRPEND 0x080 2853 #define BS_SUSPEND 0x100 2854 #define BS_RESETTING 0x200 2855 #ifdef CONFIG_GIGASET_DEBUG 2856 #endif 2857 /* LDV_COMMENT_END_PREP */ 2858 /* content: static int gigaset_post_reset(struct usb_interface *intf)*/ 2859 /* LDV_COMMENT_BEGIN_PREP */ 2860 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2861 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2862 #define GIGASET_MINORS 1 2863 #define GIGASET_MINOR 16 2864 #define GIGASET_MODULENAME "bas_gigaset" 2865 #define GIGASET_DEVNAME "ttyGB" 2866 #define IF_WRITEBUF 264 2867 #define IP_MSGSIZE 3 2868 #define USB_GIGA_VENDOR_ID 0x0681 2869 #define USB_3070_PRODUCT_ID 0x0001 2870 #define USB_3075_PRODUCT_ID 0x0002 2871 #define USB_SX303_PRODUCT_ID 0x0021 2872 #define USB_SX353_PRODUCT_ID 0x0022 2873 #define BS_ATOPEN 0x001 2874 #define BS_B1OPEN 0x002 2875 #define BS_B2OPEN 0x004 2876 #define BS_ATREADY 0x008 2877 #define BS_INIT 0x010 2878 #define BS_ATTIMER 0x020 2879 #define BS_ATRDPEND 0x040 2880 #define BS_ATWRPEND 0x080 2881 #define BS_SUSPEND 0x100 2882 #define BS_RESETTING 0x200 2883 #ifdef CONFIG_GIGASET_DEBUG 2884 #endif 2885 /* LDV_COMMENT_END_PREP */ 2886 /* content: static int gigaset_pre_reset(struct usb_interface *intf)*/ 2887 /* LDV_COMMENT_BEGIN_PREP */ 2888 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2889 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2890 #define GIGASET_MINORS 1 2891 #define GIGASET_MINOR 16 2892 #define GIGASET_MODULENAME "bas_gigaset" 2893 #define GIGASET_DEVNAME "ttyGB" 2894 #define IF_WRITEBUF 264 2895 #define IP_MSGSIZE 3 2896 #define USB_GIGA_VENDOR_ID 0x0681 2897 #define USB_3070_PRODUCT_ID 0x0001 2898 #define USB_3075_PRODUCT_ID 0x0002 2899 #define USB_SX303_PRODUCT_ID 0x0021 2900 #define USB_SX353_PRODUCT_ID 0x0022 2901 #define BS_ATOPEN 0x001 2902 #define BS_B1OPEN 0x002 2903 #define BS_B2OPEN 0x004 2904 #define BS_ATREADY 0x008 2905 #define BS_INIT 0x010 2906 #define BS_ATTIMER 0x020 2907 #define BS_ATRDPEND 0x040 2908 #define BS_ATWRPEND 0x080 2909 #define BS_SUSPEND 0x100 2910 #define BS_RESETTING 0x200 2911 #ifdef CONFIG_GIGASET_DEBUG 2912 #endif 2913 /* LDV_COMMENT_END_PREP */ 2914 2915 2916 2917 2918 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 2919 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 2920 /*============================= VARIABLE INITIALIZING PART =============================*/ 2921 LDV_IN_INTERRUPT=1; 2922 2923 2924 2925 2926 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 2927 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 2928 /*============================= FUNCTION CALL SECTION =============================*/ 2929 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 2930 ldv_initialize(); 2931 2932 /** INIT: init_type: ST_MODULE_INIT **/ 2933 /* content: static int __init bas_gigaset_init(void)*/ 2934 /* LDV_COMMENT_BEGIN_PREP */ 2935 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2936 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2937 #define GIGASET_MINORS 1 2938 #define GIGASET_MINOR 16 2939 #define GIGASET_MODULENAME "bas_gigaset" 2940 #define GIGASET_DEVNAME "ttyGB" 2941 #define IF_WRITEBUF 264 2942 #define IP_MSGSIZE 3 2943 #define USB_GIGA_VENDOR_ID 0x0681 2944 #define USB_3070_PRODUCT_ID 0x0001 2945 #define USB_3075_PRODUCT_ID 0x0002 2946 #define USB_SX303_PRODUCT_ID 0x0021 2947 #define USB_SX353_PRODUCT_ID 0x0022 2948 #define BS_ATOPEN 0x001 2949 #define BS_B1OPEN 0x002 2950 #define BS_B2OPEN 0x004 2951 #define BS_ATREADY 0x008 2952 #define BS_INIT 0x010 2953 #define BS_ATTIMER 0x020 2954 #define BS_ATRDPEND 0x040 2955 #define BS_ATWRPEND 0x080 2956 #define BS_SUSPEND 0x100 2957 #define BS_RESETTING 0x200 2958 #ifdef CONFIG_GIGASET_DEBUG 2959 #endif 2960 /* LDV_COMMENT_END_PREP */ 2961 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver init function after driver loading to kernel. This function declared as "MODULE_INIT(function name)". */ 2962 ldv_handler_precall(); 2963 if(bas_gigaset_init()) 2964 goto ldv_final; 2965 int ldv_s_gigaset_usb_driver_usb_driver = 0; 2966 2967 2968 while( nondet_int() 2969 || !(ldv_s_gigaset_usb_driver_usb_driver == 0) 2970 ) { 2971 2972 switch(nondet_int()) { 2973 2974 case 0: { 2975 2976 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 2977 if(ldv_s_gigaset_usb_driver_usb_driver==0) { 2978 2979 /* content: static int gigaset_probe(struct usb_interface *interface, const struct usb_device_id *id)*/ 2980 /* LDV_COMMENT_BEGIN_PREP */ 2981 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 2982 #define DRIVER_DESC "USB Driver for Gigaset 307x" 2983 #define GIGASET_MINORS 1 2984 #define GIGASET_MINOR 16 2985 #define GIGASET_MODULENAME "bas_gigaset" 2986 #define GIGASET_DEVNAME "ttyGB" 2987 #define IF_WRITEBUF 264 2988 #define IP_MSGSIZE 3 2989 #define USB_GIGA_VENDOR_ID 0x0681 2990 #define USB_3070_PRODUCT_ID 0x0001 2991 #define USB_3075_PRODUCT_ID 0x0002 2992 #define USB_SX303_PRODUCT_ID 0x0021 2993 #define USB_SX353_PRODUCT_ID 0x0022 2994 #define BS_ATOPEN 0x001 2995 #define BS_B1OPEN 0x002 2996 #define BS_B2OPEN 0x004 2997 #define BS_ATREADY 0x008 2998 #define BS_INIT 0x010 2999 #define BS_ATTIMER 0x020 3000 #define BS_ATRDPEND 0x040 3001 #define BS_ATWRPEND 0x080 3002 #define BS_SUSPEND 0x100 3003 #define BS_RESETTING 0x200 3004 #ifdef CONFIG_GIGASET_DEBUG 3005 #endif 3006 /* LDV_COMMENT_END_PREP */ 3007 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "gigaset_usb_driver". Standart function test for correct return result. */ 3008 res_gigaset_probe_43 = gigaset_probe( var_group1, var_gigaset_probe_43_p1); 3009 ldv_check_return_value(res_gigaset_probe_43); 3010 ldv_check_return_value_probe(res_gigaset_probe_43); 3011 if(res_gigaset_probe_43) 3012 goto ldv_module_exit; 3013 ldv_s_gigaset_usb_driver_usb_driver++; 3014 3015 } 3016 3017 } 3018 3019 break; 3020 case 1: { 3021 3022 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 3023 if(ldv_s_gigaset_usb_driver_usb_driver==1) { 3024 3025 /* content: static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)*/ 3026 /* LDV_COMMENT_BEGIN_PREP */ 3027 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3028 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3029 #define GIGASET_MINORS 1 3030 #define GIGASET_MINOR 16 3031 #define GIGASET_MODULENAME "bas_gigaset" 3032 #define GIGASET_DEVNAME "ttyGB" 3033 #define IF_WRITEBUF 264 3034 #define IP_MSGSIZE 3 3035 #define USB_GIGA_VENDOR_ID 0x0681 3036 #define USB_3070_PRODUCT_ID 0x0001 3037 #define USB_3075_PRODUCT_ID 0x0002 3038 #define USB_SX303_PRODUCT_ID 0x0021 3039 #define USB_SX353_PRODUCT_ID 0x0022 3040 #define BS_ATOPEN 0x001 3041 #define BS_B1OPEN 0x002 3042 #define BS_B2OPEN 0x004 3043 #define BS_ATREADY 0x008 3044 #define BS_INIT 0x010 3045 #define BS_ATTIMER 0x020 3046 #define BS_ATRDPEND 0x040 3047 #define BS_ATWRPEND 0x080 3048 #define BS_SUSPEND 0x100 3049 #define BS_RESETTING 0x200 3050 #ifdef CONFIG_GIGASET_DEBUG 3051 #endif 3052 /* LDV_COMMENT_END_PREP */ 3053 /* LDV_COMMENT_FUNCTION_CALL Function from field "suspend" from driver structure with callbacks "gigaset_usb_driver" */ 3054 ldv_handler_precall(); 3055 gigaset_suspend( var_group1, var_gigaset_suspend_45_p1); 3056 ldv_s_gigaset_usb_driver_usb_driver++; 3057 3058 } 3059 3060 } 3061 3062 break; 3063 case 2: { 3064 3065 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 3066 if(ldv_s_gigaset_usb_driver_usb_driver==2) { 3067 3068 /* content: static int gigaset_resume(struct usb_interface *intf)*/ 3069 /* LDV_COMMENT_BEGIN_PREP */ 3070 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3071 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3072 #define GIGASET_MINORS 1 3073 #define GIGASET_MINOR 16 3074 #define GIGASET_MODULENAME "bas_gigaset" 3075 #define GIGASET_DEVNAME "ttyGB" 3076 #define IF_WRITEBUF 264 3077 #define IP_MSGSIZE 3 3078 #define USB_GIGA_VENDOR_ID 0x0681 3079 #define USB_3070_PRODUCT_ID 0x0001 3080 #define USB_3075_PRODUCT_ID 0x0002 3081 #define USB_SX303_PRODUCT_ID 0x0021 3082 #define USB_SX353_PRODUCT_ID 0x0022 3083 #define BS_ATOPEN 0x001 3084 #define BS_B1OPEN 0x002 3085 #define BS_B2OPEN 0x004 3086 #define BS_ATREADY 0x008 3087 #define BS_INIT 0x010 3088 #define BS_ATTIMER 0x020 3089 #define BS_ATRDPEND 0x040 3090 #define BS_ATWRPEND 0x080 3091 #define BS_SUSPEND 0x100 3092 #define BS_RESETTING 0x200 3093 #ifdef CONFIG_GIGASET_DEBUG 3094 #endif 3095 /* LDV_COMMENT_END_PREP */ 3096 /* LDV_COMMENT_FUNCTION_CALL Function from field "resume" from driver structure with callbacks "gigaset_usb_driver" */ 3097 ldv_handler_precall(); 3098 gigaset_resume( var_group1); 3099 ldv_s_gigaset_usb_driver_usb_driver++; 3100 3101 } 3102 3103 } 3104 3105 break; 3106 case 3: { 3107 3108 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 3109 if(ldv_s_gigaset_usb_driver_usb_driver==3) { 3110 3111 /* content: static int gigaset_pre_reset(struct usb_interface *intf)*/ 3112 /* LDV_COMMENT_BEGIN_PREP */ 3113 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3114 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3115 #define GIGASET_MINORS 1 3116 #define GIGASET_MINOR 16 3117 #define GIGASET_MODULENAME "bas_gigaset" 3118 #define GIGASET_DEVNAME "ttyGB" 3119 #define IF_WRITEBUF 264 3120 #define IP_MSGSIZE 3 3121 #define USB_GIGA_VENDOR_ID 0x0681 3122 #define USB_3070_PRODUCT_ID 0x0001 3123 #define USB_3075_PRODUCT_ID 0x0002 3124 #define USB_SX303_PRODUCT_ID 0x0021 3125 #define USB_SX353_PRODUCT_ID 0x0022 3126 #define BS_ATOPEN 0x001 3127 #define BS_B1OPEN 0x002 3128 #define BS_B2OPEN 0x004 3129 #define BS_ATREADY 0x008 3130 #define BS_INIT 0x010 3131 #define BS_ATTIMER 0x020 3132 #define BS_ATRDPEND 0x040 3133 #define BS_ATWRPEND 0x080 3134 #define BS_SUSPEND 0x100 3135 #define BS_RESETTING 0x200 3136 #ifdef CONFIG_GIGASET_DEBUG 3137 #endif 3138 /* LDV_COMMENT_END_PREP */ 3139 /* LDV_COMMENT_FUNCTION_CALL Function from field "pre_reset" from driver structure with callbacks "gigaset_usb_driver" */ 3140 ldv_handler_precall(); 3141 gigaset_pre_reset( var_group1); 3142 ldv_s_gigaset_usb_driver_usb_driver++; 3143 3144 } 3145 3146 } 3147 3148 break; 3149 case 4: { 3150 3151 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 3152 if(ldv_s_gigaset_usb_driver_usb_driver==4) { 3153 3154 /* content: static int gigaset_post_reset(struct usb_interface *intf)*/ 3155 /* LDV_COMMENT_BEGIN_PREP */ 3156 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3157 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3158 #define GIGASET_MINORS 1 3159 #define GIGASET_MINOR 16 3160 #define GIGASET_MODULENAME "bas_gigaset" 3161 #define GIGASET_DEVNAME "ttyGB" 3162 #define IF_WRITEBUF 264 3163 #define IP_MSGSIZE 3 3164 #define USB_GIGA_VENDOR_ID 0x0681 3165 #define USB_3070_PRODUCT_ID 0x0001 3166 #define USB_3075_PRODUCT_ID 0x0002 3167 #define USB_SX303_PRODUCT_ID 0x0021 3168 #define USB_SX353_PRODUCT_ID 0x0022 3169 #define BS_ATOPEN 0x001 3170 #define BS_B1OPEN 0x002 3171 #define BS_B2OPEN 0x004 3172 #define BS_ATREADY 0x008 3173 #define BS_INIT 0x010 3174 #define BS_ATTIMER 0x020 3175 #define BS_ATRDPEND 0x040 3176 #define BS_ATWRPEND 0x080 3177 #define BS_SUSPEND 0x100 3178 #define BS_RESETTING 0x200 3179 #ifdef CONFIG_GIGASET_DEBUG 3180 #endif 3181 /* LDV_COMMENT_END_PREP */ 3182 /* LDV_COMMENT_FUNCTION_CALL Function from field "reset_resume" from driver structure with callbacks "gigaset_usb_driver" */ 3183 ldv_handler_precall(); 3184 gigaset_post_reset( var_group1); 3185 ldv_s_gigaset_usb_driver_usb_driver++; 3186 3187 } 3188 3189 } 3190 3191 break; 3192 case 5: { 3193 3194 /** STRUCT: struct type: usb_driver, struct name: gigaset_usb_driver **/ 3195 if(ldv_s_gigaset_usb_driver_usb_driver==5) { 3196 3197 /* content: static void gigaset_disconnect(struct usb_interface *interface)*/ 3198 /* LDV_COMMENT_BEGIN_PREP */ 3199 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3200 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3201 #define GIGASET_MINORS 1 3202 #define GIGASET_MINOR 16 3203 #define GIGASET_MODULENAME "bas_gigaset" 3204 #define GIGASET_DEVNAME "ttyGB" 3205 #define IF_WRITEBUF 264 3206 #define IP_MSGSIZE 3 3207 #define USB_GIGA_VENDOR_ID 0x0681 3208 #define USB_3070_PRODUCT_ID 0x0001 3209 #define USB_3075_PRODUCT_ID 0x0002 3210 #define USB_SX303_PRODUCT_ID 0x0021 3211 #define USB_SX353_PRODUCT_ID 0x0022 3212 #define BS_ATOPEN 0x001 3213 #define BS_B1OPEN 0x002 3214 #define BS_B2OPEN 0x004 3215 #define BS_ATREADY 0x008 3216 #define BS_INIT 0x010 3217 #define BS_ATTIMER 0x020 3218 #define BS_ATRDPEND 0x040 3219 #define BS_ATWRPEND 0x080 3220 #define BS_SUSPEND 0x100 3221 #define BS_RESETTING 0x200 3222 #ifdef CONFIG_GIGASET_DEBUG 3223 #endif 3224 /* LDV_COMMENT_END_PREP */ 3225 /* LDV_COMMENT_FUNCTION_CALL Function from field "disconnect" from driver structure with callbacks "gigaset_usb_driver" */ 3226 ldv_handler_precall(); 3227 gigaset_disconnect( var_group1); 3228 ldv_s_gigaset_usb_driver_usb_driver=0; 3229 3230 } 3231 3232 } 3233 3234 break; 3235 default: break; 3236 3237 } 3238 3239 } 3240 3241 ldv_module_exit: 3242 3243 /** INIT: init_type: ST_MODULE_EXIT **/ 3244 /* content: static void __exit bas_gigaset_exit(void)*/ 3245 /* LDV_COMMENT_BEGIN_PREP */ 3246 #define DRIVER_AUTHOR "Tilman Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>, Stefan Eilers" 3247 #define DRIVER_DESC "USB Driver for Gigaset 307x" 3248 #define GIGASET_MINORS 1 3249 #define GIGASET_MINOR 16 3250 #define GIGASET_MODULENAME "bas_gigaset" 3251 #define GIGASET_DEVNAME "ttyGB" 3252 #define IF_WRITEBUF 264 3253 #define IP_MSGSIZE 3 3254 #define USB_GIGA_VENDOR_ID 0x0681 3255 #define USB_3070_PRODUCT_ID 0x0001 3256 #define USB_3075_PRODUCT_ID 0x0002 3257 #define USB_SX303_PRODUCT_ID 0x0021 3258 #define USB_SX353_PRODUCT_ID 0x0022 3259 #define BS_ATOPEN 0x001 3260 #define BS_B1OPEN 0x002 3261 #define BS_B2OPEN 0x004 3262 #define BS_ATREADY 0x008 3263 #define BS_INIT 0x010 3264 #define BS_ATTIMER 0x020 3265 #define BS_ATRDPEND 0x040 3266 #define BS_ATWRPEND 0x080 3267 #define BS_SUSPEND 0x100 3268 #define BS_RESETTING 0x200 3269 #ifdef CONFIG_GIGASET_DEBUG 3270 #endif 3271 /* LDV_COMMENT_END_PREP */ 3272 /* LDV_COMMENT_FUNCTION_CALL Kernel calls driver release function before driver will be uploaded from kernel. This function declared as "MODULE_EXIT(function name)". */ 3273 ldv_handler_precall(); 3274 bas_gigaset_exit(); 3275 3276 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 3277 ldv_final: ldv_check_final_state(); 3278 3279 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 3280 return; 3281 3282 } 3283 #endif 3284 3285 /* 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 #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(