Error Trace

[Home]

Bug # 181

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()
{
20 typedef unsigned char __u8;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
29 typedef long long __s64;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
16 typedef unsigned char u8;
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;
257 struct kernel_symbol { unsigned long value; const char *name; } ;
33 struct module ;
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;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
152 typedef u64 dma_addr_t;
157 typedef unsigned int gfp_t;
158 typedef unsigned int fmode_t;
161 typedef u64 phys_addr_t;
166 typedef phys_addr_t resource_size_t;
176 struct __anonstruct_atomic_t_6 { int counter; } ;
176 typedef struct __anonstruct_atomic_t_6 atomic_t;
181 struct __anonstruct_atomic64_t_7 { long counter; } ;
181 typedef struct __anonstruct_atomic64_t_7 atomic64_t;
182 struct list_head { struct list_head *next; struct list_head *prev; } ;
187 struct hlist_node ;
187 struct hlist_head { struct hlist_node *first; } ;
191 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ;
202 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ;
125 typedef void (*ctor_fn_t)();
58 struct device ;
467 struct file_operations ;
479 struct completion ;
480 struct pt_regs ;
27 union __anonunion___u_9 { struct list_head *__val; char __c[1U]; } ;
556 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
111 struct timespec ;
112 struct compat_timespec ;
113 struct __anonstruct_futex_25 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
113 struct __anonstruct_nanosleep_26 { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } ;
113 struct pollfd ;
113 struct __anonstruct_poll_27 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
113 union __anonunion____missing_field_name_24 { struct __anonstruct_futex_25 futex; struct __anonstruct_nanosleep_26 nanosleep; struct __anonstruct_poll_27 poll; } ;
113 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_24 __annonCompField4; } ;
39 struct page ;
26 struct task_struct ;
27 struct mm_struct ;
288 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; } ;
66 struct __anonstruct____missing_field_name_30 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_31 { 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; } ;
66 union __anonunion____missing_field_name_29 { struct __anonstruct____missing_field_name_30 __annonCompField5; struct __anonstruct____missing_field_name_31 __annonCompField6; } ;
66 struct desc_struct { union __anonunion____missing_field_name_29 __annonCompField7; } ;
13 typedef unsigned long pteval_t;
14 typedef unsigned long pmdval_t;
16 typedef unsigned long pgdval_t;
17 typedef unsigned long pgprotval_t;
19 struct __anonstruct_pte_t_32 { pteval_t pte; } ;
19 typedef struct __anonstruct_pte_t_32 pte_t;
21 struct pgprot { pgprotval_t pgprot; } ;
256 typedef struct pgprot pgprot_t;
258 struct __anonstruct_pgd_t_33 { pgdval_t pgd; } ;
258 typedef struct __anonstruct_pgd_t_33 pgd_t;
297 struct __anonstruct_pmd_t_35 { pmdval_t pmd; } ;
297 typedef struct __anonstruct_pmd_t_35 pmd_t;
423 typedef struct page *pgtable_t;
434 struct file ;
447 struct seq_file ;
483 struct thread_struct ;
485 struct cpumask ;
20 struct qspinlock { atomic_t val; } ;
33 typedef struct qspinlock arch_spinlock_t;
34 struct qrwlock { atomic_t cnts; arch_spinlock_t wait_lock; } ;
14 typedef struct qrwlock arch_rwlock_t;
247 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
341 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
654 typedef struct cpumask *cpumask_var_t;
23 typedef atomic64_t atomic_long_t;
81 struct static_key { atomic_t enabled; } ;
22 struct tracepoint_func { void *func; void *data; int prio; } ;
28 struct tracepoint { const char *name; struct static_key key; void (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
254 struct fregs_state { u32 cwd; u32 swd; u32 twd; u32 fip; u32 fcs; u32 foo; u32 fos; u32 st_space[20U]; u32 status; } ;
26 struct __anonstruct____missing_field_name_59 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_60 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_58 { struct __anonstruct____missing_field_name_59 __annonCompField13; struct __anonstruct____missing_field_name_60 __annonCompField14; } ;
26 union __anonunion____missing_field_name_61 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_58 __annonCompField15; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_61 __annonCompField16; } ;
66 struct swregs_state { 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; } ;
227 struct xstate_header { u64 xfeatures; u64 xcomp_bv; u64 reserved[6U]; } ;
233 struct xregs_state { struct fxregs_state i387; struct xstate_header header; u8 extended_state_area[0U]; } ;
254 union fpregs_state { struct fregs_state fsave; struct fxregs_state fxsave; struct swregs_state soft; struct xregs_state xsave; u8 __padding[4096U]; } ;
271 struct fpu { unsigned int last_cpu; unsigned char fpstate_active; unsigned char fpregs_active; unsigned char counter; union fpregs_state state; } ;
169 struct seq_operations ;
372 struct perf_event ;
377 struct __anonstruct_mm_segment_t_73 { unsigned long seg; } ;
377 typedef struct __anonstruct_mm_segment_t_73 mm_segment_t;
378 struct thread_struct { struct desc_struct tls_array[3U]; unsigned long sp0; unsigned long sp; unsigned short es; unsigned short ds; unsigned short fsindex; unsigned short gsindex; unsigned long fsbase; unsigned long gsbase; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; mm_segment_t addr_limit; unsigned char sig_on_uaccess_err; unsigned char uaccess_err; struct fpu fpu; } ;
33 struct lockdep_map ;
55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ;
28 struct lockdep_subclass_key { char __one_byte; } ;
53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ;
59 struct lock_class { struct hlist_node 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; } ;
207 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; unsigned int pin_count; } ;
572 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____missing_field_name_75 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_74 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_75 __annonCompField19; } ;
33 struct spinlock { union __anonunion____missing_field_name_74 __annonCompField20; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_76 { 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_76 rwlock_t;
416 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
407 struct __anonstruct_seqlock_t_91 { struct seqcount seqcount; spinlock_t lock; } ;
407 typedef struct __anonstruct_seqlock_t_91 seqlock_t;
601 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
7 typedef __s64 time64_t;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_92 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_92 kuid_t;
27 struct __anonstruct_kgid_t_93 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_93 kgid_t;
139 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; } ;
36 struct vm_area_struct ;
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; } ;
38 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
43 typedef struct __wait_queue_head wait_queue_head_t;
97 struct __anonstruct_nodemask_t_94 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_94 nodemask_t;
247 typedef unsigned int isolate_mode_t;
13 struct optimistic_spin_queue { atomic_t tail; } ;
39 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; void *magic; struct lockdep_map dep_map; } ;
67 struct mutex_waiter { struct list_head list; struct task_struct *task; void *magic; } ;
177 struct rw_semaphore ;
178 struct rw_semaphore { atomic_long_t count; struct list_head wait_list; raw_spinlock_t wait_lock; struct optimistic_spin_queue osq; struct task_struct *owner; struct lockdep_map dep_map; } ;
178 struct completion { unsigned int done; wait_queue_head_t wait; } ;
446 union ktime { s64 tv64; } ;
41 typedef union ktime ktime_t;
1144 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
254 struct hrtimer ;
255 enum hrtimer_restart ;
256 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ;
41 struct rb_root { struct rb_node *rb_node; } ;
835 struct nsproxy ;
278 struct workqueue_struct ;
279 struct work_struct ;
54 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ;
107 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ;
217 struct resource ;
64 struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; unsigned long desc; struct resource *parent; struct resource *sibling; struct resource *child; } ;
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 ;
336 struct wake_irq ;
337 struct pm_domain_data ;
338 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; struct pm_domain_data *domain_data; } ;
556 struct dev_pm_qos ;
556 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 early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; bool no_pm_callbacks; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; struct wake_irq *wakeirq; 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; bool ignore_children; 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; } ;
616 struct dev_pm_domain { struct dev_pm_ops ops; void (*detach)(struct device *, bool ); int (*activate)(struct device *); void (*sync)(struct device *); void (*dismiss)(struct device *); } ;
26 struct ldt_struct ;
26 struct vdso_image ;
26 struct __anonstruct_mm_context_t_165 { struct ldt_struct *ldt; unsigned short ia32_compat; struct mutex lock; void *vdso; const struct vdso_image *vdso_image; atomic_t perf_rdpmc_allowed; } ;
26 typedef struct __anonstruct_mm_context_t_165 mm_context_t;
22 struct bio_vec ;
1276 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
37 struct cred ;
19 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____missing_field_name_211 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_212 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_210 { struct __anonstruct____missing_field_name_211 __annonCompField35; struct __anonstruct____missing_field_name_212 __annonCompField36; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_210 __annonCompField37; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
94 struct return_instance { struct uprobe *uprobe; unsigned long func; unsigned long stack; unsigned long orig_ret_vaddr; bool chained; struct return_instance *next; } ;
110 struct xol_area ;
111 struct uprobes_state { struct xol_area *xol_area; } ;
150 struct address_space ;
151 struct mem_cgroup ;
152 union __anonunion____missing_field_name_213 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
152 union __anonunion____missing_field_name_214 { unsigned long index; void *freelist; } ;
152 struct __anonstruct____missing_field_name_218 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
152 union __anonunion____missing_field_name_217 { atomic_t _mapcount; unsigned int active; struct __anonstruct____missing_field_name_218 __annonCompField40; int units; } ;
152 struct __anonstruct____missing_field_name_216 { union __anonunion____missing_field_name_217 __annonCompField41; atomic_t _refcount; } ;
152 union __anonunion____missing_field_name_215 { unsigned long counters; struct __anonstruct____missing_field_name_216 __annonCompField42; } ;
152 struct dev_pagemap ;
152 struct __anonstruct____missing_field_name_220 { struct page *next; int pages; int pobjects; } ;
152 struct __anonstruct____missing_field_name_221 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
152 struct __anonstruct____missing_field_name_222 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
152 union __anonunion____missing_field_name_219 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_220 __annonCompField44; struct callback_head callback_head; struct __anonstruct____missing_field_name_221 __annonCompField45; struct __anonstruct____missing_field_name_222 __annonCompField46; } ;
152 struct kmem_cache ;
152 union __anonunion____missing_field_name_223 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
152 struct page { unsigned long flags; union __anonunion____missing_field_name_213 __annonCompField38; union __anonunion____missing_field_name_214 __annonCompField39; union __anonunion____missing_field_name_215 __annonCompField43; union __anonunion____missing_field_name_219 __annonCompField47; union __anonunion____missing_field_name_223 __annonCompField48; struct mem_cgroup *mem_cgroup; } ;
197 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
282 struct userfaultfd_ctx ;
282 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
289 struct __anonstruct_shared_224 { struct rb_node rb; unsigned long rb_subtree_last; } ;
289 struct anon_vma ;
289 struct vm_operations_struct ;
289 struct mempolicy ;
289 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; struct __anonstruct_shared_224 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; struct vm_userfaultfd_ctx vm_userfaultfd_ctx; } ;
362 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
367 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
381 struct task_rss_stat { int events; int count[4U]; } ;
389 struct mm_rss_stat { atomic_long_t count[4U]; } ;
394 struct kioctx_table ;
395 struct linux_binfmt ;
395 struct mmu_notifier_mm ;
395 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; atomic_long_t nr_pmds; 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 data_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; void *bd_addr; atomic_long_t hugetlb_usage; struct work_struct async_put_work; } ;
565 struct vm_fault ;
619 struct vdso_image { void *data; unsigned long size; unsigned long alt; unsigned long alt_len; long sym_vvar_start; long sym_vvar_page; long sym_hpet_page; long sym_pvclock_page; long sym_VDSO32_NOTE_MASK; long sym___kernel_sigreturn; long sym___kernel_rt_sigreturn; long sym___kernel_vsyscall; long sym_int80_landing_pad; } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
18 typedef __u64 Elf64_Off;
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;
219 struct elf64_hdr { unsigned char e_ident[16U]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } ;
235 typedef struct elf64_hdr Elf64_Ehdr;
314 struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } ;
326 typedef struct elf64_shdr Elf64_Shdr;
53 union __anonunion____missing_field_name_229 { unsigned long bitmap[4U]; struct callback_head callback_head; } ;
53 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion____missing_field_name_229 __annonCompField49; } ;
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]; } ;
167 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ;
199 struct dentry ;
200 struct iattr ;
201 struct super_block ;
202 struct file_system_type ;
203 struct kernfs_open_node ;
204 struct kernfs_iattrs ;
227 struct kernfs_root ;
227 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; struct kernfs_node *notify_next; } ;
96 union __anonunion____missing_field_name_234 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
96 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____missing_field_name_234 __annonCompField50; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
138 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 *); int (*show_path)(struct seq_file *, struct kernfs_node *, struct kernfs_root *); } ;
157 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; } ;
173 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; void *priv; struct mutex mutex; struct mutex prealloc_mutex; int event; struct list_head list; char *prealloc_buf; size_t atomic_write_len; bool mmapped; const struct vm_operations_struct *vm_ops; } ;
191 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; bool prealloc; 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; } ;
499 struct sock ;
500 struct kobject ;
501 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
507 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); umode_t (*is_bin_visible)(struct kobject *, struct bin_attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
92 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 *); } ;
165 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
530 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; } ;
115 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 *); } ;
123 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
131 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 *); } ;
148 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
223 struct kernel_param ;
228 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 *); } ;
62 struct kparam_string ;
62 struct kparam_array ;
62 union __anonunion____missing_field_name_237 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
62 struct kernel_param { const char *name; struct module *mod; const struct kernel_param_ops *ops; const u16 perm; s8 level; u8 flags; union __anonunion____missing_field_name_237 __annonCompField51; } ;
83 struct kparam_string { unsigned int maxlen; char *string; } ;
89 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
470 struct exception_table_entry ;
24 struct latch_tree_node { struct rb_node node[2U]; } ;
211 struct mod_arch_specific { } ;
39 struct module_param_attrs ;
39 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
50 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 *); } ;
277 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
284 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
291 struct module_layout { void *base; unsigned int size; unsigned int text_size; unsigned int ro_size; unsigned int ro_after_init_size; struct mod_tree_node mtn; } ;
307 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
321 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
329 struct module_sect_attrs ;
329 struct module_notes_attrs ;
329 struct trace_event_call ;
329 struct trace_enum_map ;
329 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 mutex param_lock; 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; bool async_probe_requested; 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)(); struct module_layout core_layout; struct module_layout init_layout; struct mod_arch_specific arch; unsigned int taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; struct mod_kallsyms *kallsyms; struct mod_kallsyms core_kallsyms; 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 trace_event_call **trace_events; unsigned int num_trace_events; struct trace_enum_map **trace_enums; unsigned int num_trace_enums; bool klp; bool klp_alive; struct klp_modinfo *klp_info; struct list_head source_list; struct list_head target_list; void (*exit)(); atomic_t refcnt; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ;
799 struct clk ;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
34 struct iovec { void *iov_base; __kernel_size_t iov_len; } ;
21 struct kvec { void *iov_base; size_t iov_len; } ;
27 union __anonunion____missing_field_name_244 { const struct iovec *iov; const struct kvec *kvec; const struct bio_vec *bvec; } ;
27 struct iov_iter { int type; size_t iov_offset; size_t count; union __anonunion____missing_field_name_244 __annonCompField52; unsigned long nr_segs; } ;
18 struct pid ;
38 struct kiocb ;
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____missing_field_name_299 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_298 { struct __anonstruct____missing_field_name_299 __annonCompField53; } ;
114 struct lockref { union __anonunion____missing_field_name_298 __annonCompField54; } ;
77 struct path ;
78 struct vfsmount ;
79 struct __anonstruct____missing_field_name_301 { u32 hash; u32 len; } ;
79 union __anonunion____missing_field_name_300 { struct __anonstruct____missing_field_name_301 __annonCompField55; u64 hash_len; } ;
79 struct qstr { union __anonunion____missing_field_name_300 __annonCompField56; const unsigned char *name; } ;
65 struct dentry_operations ;
65 union __anonunion____missing_field_name_302 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
65 union __anonunion_d_u_303 { struct hlist_node d_alias; struct hlist_bl_node d_in_lookup_hash; struct callback_head d_rcu; } ;
65 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; union __anonunion____missing_field_name_302 __annonCompField57; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_303 d_u; } ;
121 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 *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); int (*d_init)(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 ); struct dentry * (*d_real)(struct dentry *, const struct inode *, unsigned int); } ;
591 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
19 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; int nid; struct mem_cgroup *memcg; } ;
27 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; } ;
80 struct list_lru_one { struct list_head list; long nr_items; } ;
32 struct list_lru_memcg { struct list_lru_one *lru[0U]; } ;
37 struct list_lru_node { spinlock_t lock; struct list_lru_one lru; struct list_lru_memcg *memcg_lrus; } ;
47 struct list_lru { struct list_lru_node *node; struct list_head list; } ;
63 struct __anonstruct____missing_field_name_305 { struct radix_tree_node *parent; void *private_data; } ;
63 union __anonunion____missing_field_name_304 { struct __anonstruct____missing_field_name_305 __annonCompField58; struct callback_head callback_head; } ;
63 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned int count; union __anonunion____missing_field_name_304 __annonCompField59; struct list_head private_list; void *slots[64U]; unsigned long tags[3U][1U]; } ;
106 struct radix_tree_root { gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
523 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
530 struct pid_namespace ;
530 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 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
44 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
50 struct rcu_sync { int gp_state; int gp_count; wait_queue_head_t gp_wait; int cb_state; struct callback_head cb_head; enum rcu_sync_type gp_type; } ;
65 struct percpu_rw_semaphore { struct rcu_sync rss; unsigned int *fast_read_ctr; struct rw_semaphore rw_sem; atomic_t slow_read_ctr; wait_queue_head_t write_waitq; } ;
54 struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; } ;
87 struct block_device ;
88 struct io_context ;
89 struct cgroup_subsys_state ;
266 struct delayed_call { void (*fn)(void *); void *arg; } ;
261 struct backing_dev_info ;
262 struct bdi_writeback ;
263 struct export_operations ;
265 struct pipe_inode_info ;
266 struct poll_table_struct ;
267 struct kstatfs ;
268 struct swap_info_struct ;
269 struct fscrypt_info ;
270 struct fscrypt_operations ;
76 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; } ;
213 struct dquot ;
214 struct kqid ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_314 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_314 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_315 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_315 __annonCompField61; enum quota_type type; } ;
194 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; time64_t dqb_btime; time64_t dqb_itime; } ;
216 struct quota_format_type ;
217 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_max_spc_limit; qsize_t dqi_max_ino_limit; void *dqi_priv; } ;
282 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; } ;
309 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 *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
321 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 *); int (*get_projid)(struct inode *, kprojid_t *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
338 struct qc_dqblk { int d_fieldmask; u64 d_spc_hardlimit; u64 d_spc_softlimit; u64 d_ino_hardlimit; u64 d_ino_softlimit; u64 d_space; u64 d_ino_count; s64 d_ino_timer; s64 d_spc_timer; int d_ino_warns; int d_spc_warns; u64 d_rt_spc_hardlimit; u64 d_rt_spc_softlimit; u64 d_rt_space; s64 d_rt_spc_timer; int d_rt_spc_warns; } ;
361 struct qc_type_state { unsigned int flags; unsigned int spc_timelimit; unsigned int ino_timelimit; unsigned int rt_spc_timelimit; unsigned int spc_warnlimit; unsigned int ino_warnlimit; unsigned int rt_spc_warnlimit; unsigned long long ino; blkcnt_t blocks; blkcnt_t nextents; } ;
407 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
418 struct qc_info { int i_fieldmask; unsigned int i_flags; unsigned int i_spc_timelimit; unsigned int i_ino_timelimit; unsigned int i_rt_spc_timelimit; unsigned int i_spc_warnlimit; unsigned int i_ino_warnlimit; unsigned int i_rt_spc_warnlimit; } ;
431 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_off)(struct super_block *, int); int (*quota_enable)(struct super_block *, unsigned int); int (*quota_disable)(struct super_block *, unsigned int); int (*quota_sync)(struct super_block *, int); int (*set_info)(struct super_block *, int, struct qc_info *); int (*get_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_nextdqblk)(struct super_block *, struct kqid *, struct qc_dqblk *); int (*set_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_state)(struct super_block *, struct qc_state *); int (*rm_xquota)(struct super_block *, unsigned int); } ;
447 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; } ;
511 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct inode *files[3U]; struct mem_dqinfo info[3U]; const struct quota_format_ops *ops[3U]; } ;
541 struct writeback_control ;
542 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; } ;
367 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)(struct kiocb *, struct iov_iter *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); bool (*isolate_page)(struct page *, isolate_mode_t ); void (*putback_page)(struct page *); 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 *); } ;
426 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; atomic_t i_mmap_writable; struct rb_root i_mmap; struct rw_semaphore i_mmap_rwsem; unsigned long nrpages; unsigned long nrexceptional; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; spinlock_t private_lock; struct list_head private_list; void *private_data; } ;
447 struct request_queue ;
448 struct hd_struct ;
448 struct gendisk ;
448 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; 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; } ;
563 struct posix_acl ;
589 struct inode_operations ;
589 union __anonunion____missing_field_name_320 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
589 union __anonunion____missing_field_name_321 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
589 struct file_lock_context ;
589 struct cdev ;
589 union __anonunion____missing_field_name_322 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
589 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____missing_field_name_320 __annonCompField62; 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 rw_semaphore i_rwsem; unsigned long dirtied_when; unsigned long dirtied_time_when; struct hlist_node i_hash; struct list_head i_io_list; struct bdi_writeback *i_wb; int i_wb_frn_winner; u16 i_wb_frn_avg_time; u16 i_wb_frn_history; struct list_head i_lru; struct list_head i_sb_list; struct list_head i_wb_list; union __anonunion____missing_field_name_321 __annonCompField63; 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_context *i_flctx; struct address_space i_data; struct list_head i_devices; union __anonunion____missing_field_name_322 __annonCompField64; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
843 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
851 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; } ;
874 union __anonunion_f_u_323 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
874 struct file { union __anonunion_f_u_323 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; } ;
959 typedef void *fl_owner_t;
960 struct file_lock ;
961 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
967 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); fl_owner_t (*lm_get_owner)(fl_owner_t ); void (*lm_put_owner)(fl_owner_t ); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, int); bool (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock *, int, struct list_head *); void (*lm_setup)(struct file_lock *, void **); } ;
994 struct nlm_lockowner ;
995 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_325 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_324 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_325 afs; } ;
19 struct file_lock { struct file_lock *fl_next; struct list_head fl_list; 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_324 fl_u; } ;
1047 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1102 struct files_struct ;
1255 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; } ;
1290 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1320 struct super_operations ;
1320 struct xattr_handler ;
1320 struct mtd_info ;
1320 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_iflags; 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; const struct fscrypt_operations *s_cop; 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; unsigned int s_quota_types; 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 hlist_head s_pins; struct user_namespace *s_user_ns; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; struct work_struct destroy_work; struct mutex s_sync_lock; int s_stack_depth; spinlock_t s_inode_list_lock; struct list_head s_inodes; spinlock_t s_inode_wblist_lock; struct list_head s_inodes_wb; } ;
1603 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1616 struct dir_context ;
1641 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1648 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 (*read_iter)(struct kiocb *, struct iov_iter *); ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); int (*iterate)(struct file *, struct dir_context *); int (*iterate_shared)(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 **, void **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); void (*show_fdinfo)(struct seq_file *, struct file *); ssize_t (*copy_file_range)(struct file *, loff_t , struct file *, loff_t , size_t , unsigned int); int (*clone_file_range)(struct file *, loff_t , struct file *, loff_t , u64 ); ssize_t (*dedupe_file_range)(struct file *, u64 , u64 , struct file *, u64 ); } ;
1717 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); const char * (*get_link)(struct dentry *, struct inode *, struct delayed_call *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); 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 *, struct inode *, const char *, const void *, size_t , int); ssize_t (*getxattr)(struct dentry *, struct inode *, 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); } ;
1774 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_super)(struct super_block *); int (*freeze_fs)(struct super_block *); int (*thaw_super)(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 ); struct dquot ** (*get_dquots)(struct inode *); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, struct shrink_control *); long int (*free_cached_objects)(struct super_block *, struct shrink_control *); } ;
2018 struct file_system_type { const char *name; int fs_flags; struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); void (*kill_sb)(struct super_block *); struct module *owner; struct file_system_type *next; struct hlist_head fs_supers; struct lock_class_key s_lock_key; struct lock_class_key s_umount_key; struct lock_class_key s_vfs_rename_key; struct lock_class_key s_writers_key[3U]; struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
4 typedef unsigned long cputime_t;
78 struct user_struct ;
26 struct sysv_shm { struct list_head shm_clist; } ;
24 struct __anonstruct_sigset_t_326 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_326 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_328 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_329 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_330 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_331 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_334 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_333 { struct __anonstruct__addr_bnd_334 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_332 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_333 __annonCompField65; } ;
11 struct __anonstruct__sigpoll_335 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_336 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_327 { int _pad[28U]; struct __anonstruct__kill_328 _kill; struct __anonstruct__timer_329 _timer; struct __anonstruct__rt_330 _rt; struct __anonstruct__sigchld_331 _sigchld; struct __anonstruct__sigfault_332 _sigfault; struct __anonstruct__sigpoll_335 _sigpoll; struct __anonstruct__sigsys_336 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_327 _sifields; } ;
118 typedef struct siginfo siginfo_t;
22 struct sigpending { struct list_head list; sigset_t signal; } ;
257 struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; __sigrestore_t sa_restorer; sigset_t sa_mask; } ;
271 struct k_sigaction { struct sigaction sa; } ;
43 struct seccomp_filter ;
44 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 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; u8 state; u8 is_rel; int start_pid; void *start_site; char start_comm[16U]; } ;
125 struct hrtimer_clock_base { struct hrtimer_cpu_base *cpu_base; int index; clockid_t clockid; struct timerqueue_head active; ktime_t (*get_time)(); ktime_t offset; } ;
158 struct hrtimer_cpu_base { raw_spinlock_t lock; seqcount_t seq; struct hrtimer *running; unsigned int cpu; unsigned int active_bases; unsigned int clock_was_set_seq; bool migration_enabled; bool nohz_active; unsigned char in_hrtirq; unsigned char hres_active; unsigned char hang_detected; ktime_t expires_next; struct hrtimer *next_timer; unsigned int nr_events; unsigned int nr_retries; unsigned int nr_hangs; unsigned int max_hang_time; struct hrtimer_clock_base clock_base[4U]; } ;
12 enum kcov_mode { KCOV_MODE_DISABLED = 0, KCOV_MODE_TRACE = 1 } ;
17 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; } ;
41 struct assoc_array_ptr ;
41 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; } ;
91 union key_payload { void *rcu_data0; void *data[4U]; } ;
128 union __anonunion____missing_field_name_339 { struct list_head graveyard_link; struct rb_node serial_node; } ;
128 struct key_user ;
128 union __anonunion____missing_field_name_340 { time_t expiry; time_t revoked_at; } ;
128 struct __anonstruct____missing_field_name_342 { struct key_type *type; char *description; } ;
128 union __anonunion____missing_field_name_341 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_342 __annonCompField68; } ;
128 struct __anonstruct____missing_field_name_344 { struct list_head name_link; struct assoc_array keys; } ;
128 union __anonunion____missing_field_name_343 { union key_payload payload; struct __anonstruct____missing_field_name_344 __annonCompField70; int reject_error; } ;
128 struct key { atomic_t usage; key_serial_t serial; union __anonunion____missing_field_name_339 __annonCompField66; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_340 __annonCompField67; 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____missing_field_name_341 __annonCompField69; union __anonunion____missing_field_name_343 __annonCompField71; int (*restrict_link)(struct key *, const struct key_type *, const union key_payload *); } ;
377 struct audit_context ;
27 struct group_info { atomic_t usage; int ngroups; int nblocks; kgid_t small_block[32U]; kgid_t *blocks[0U]; } ;
90 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; kernel_cap_t cap_ambient; 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; } ;
377 struct percpu_ref ;
55 typedef void percpu_ref_func_t(struct percpu_ref *);
68 struct percpu_ref { atomic_long_t count; unsigned long percpu_count_ptr; percpu_ref_func_t *release; percpu_ref_func_t *confirm_switch; bool force_atomic; struct callback_head rcu; } ;
325 struct cgroup ;
326 struct cgroup_root ;
327 struct cgroup_subsys ;
328 struct cgroup_taskset ;
372 struct cgroup_file { struct kernfs_node *kn; } ;
90 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; atomic_t online_cnt; struct callback_head callback_head; struct work_struct destroy_work; } ;
141 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[13U]; struct list_head mg_preload_node; struct list_head mg_node; struct cgroup *mg_src_cgrp; struct cgroup *mg_dst_cgrp; struct css_set *mg_dst_cset; struct list_head e_cset_node[13U]; struct list_head task_iters; bool dead; struct callback_head callback_head; } ;
221 struct cgroup { struct cgroup_subsys_state self; unsigned long flags; int id; int level; int populated_cnt; struct kernfs_node *kn; struct cgroup_file procs_file; struct cgroup_file events_file; u16 subtree_control; u16 subtree_ss_mask; u16 old_subtree_control; u16 old_subtree_ss_mask; struct cgroup_subsys_state *subsys[13U]; struct cgroup_root *root; struct list_head cset_links; struct list_head e_csets[13U]; struct list_head pidlists; struct mutex pidlist_mutex; wait_queue_head_t offline_waitq; struct work_struct release_agent_work; int ancestor_ids[]; } ;
306 struct cgroup_root { struct kernfs_root *kf_root; unsigned int subsys_mask; int hierarchy_id; struct cgroup cgrp; int cgrp_ancestor_id_storage; atomic_t nr_cgrps; struct list_head root_list; unsigned int flags; struct idr cgroup_idr; char release_agent_path[4096U]; char name[64U]; } ;
345 struct cftype { char name[64U]; unsigned long private; size_t max_write_len; unsigned int flags; unsigned int file_offset; 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; } ;
430 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_released)(struct cgroup_subsys_state *); void (*css_free)(struct cgroup_subsys_state *); void (*css_reset)(struct cgroup_subsys_state *); int (*can_attach)(struct cgroup_taskset *); void (*cancel_attach)(struct cgroup_taskset *); void (*attach)(struct cgroup_taskset *); void (*post_attach)(); int (*can_fork)(struct task_struct *); void (*cancel_fork)(struct task_struct *); void (*fork)(struct task_struct *); void (*exit)(struct task_struct *); void (*free)(struct task_struct *); void (*bind)(struct cgroup_subsys_state *); bool early_init; bool implicit_on_dfl; bool broken_hierarchy; bool warned_broken_hierarchy; int id; const char *name; const char *legacy_name; struct cgroup_root *root; struct idr css_idr; struct list_head cfts; struct cftype *dfl_cftypes; struct cftype *legacy_cftypes; unsigned int depends_on; } ;
128 struct futex_pi_state ;
129 struct robust_list_head ;
130 struct bio_list ;
131 struct fs_struct ;
132 struct perf_event_context ;
133 struct blk_plug ;
134 struct nameidata ;
188 struct cfs_rq ;
189 struct task_group ;
493 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
536 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; } ;
544 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
551 struct prev_cputime { cputime_t utime; cputime_t stime; raw_spinlock_t lock; } ;
576 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
592 struct task_cputime_atomic { atomic64_t utime; atomic64_t stime; atomic64_t sum_exec_runtime; } ;
614 struct thread_group_cputimer { struct task_cputime_atomic cputime_atomic; bool running; bool checking_timer; } ;
659 struct autogroup ;
660 struct tty_struct ;
660 struct taskstats ;
660 struct tty_audit_buf ;
660 struct signal_struct { atomic_t sigcnt; atomic_t live; int nr_threads; atomic_t oom_victims; 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; seqlock_t stats_lock; cputime_t utime; cputime_t stime; cputime_t cutime; cputime_t cstime; cputime_t gtime; cputime_t cgtime; struct prev_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; struct tty_audit_buf *tty_audit_buf; bool oom_flag_origin; short oom_score_adj; short oom_score_adj_min; struct mutex cred_guard_mutex; } ;
835 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; unsigned long unix_inflight; atomic_long_t pipe_bufs; struct key *uid_keyring; struct key *session_keyring; struct hlist_node uidhash_node; kuid_t uid; atomic_long_t locked_vm; } ;
880 struct reclaim_state ;
881 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
896 struct task_delay_info { spinlock_t lock; unsigned int flags; u64 blkio_start; u64 blkio_delay; u64 swapin_delay; u32 blkio_count; u32 swapin_count; u64 freepages_start; u64 freepages_delay; u32 freepages_count; } ;
953 struct wake_q_node { struct wake_q_node *next; } ;
1220 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1228 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
1286 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; } ;
1321 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; } ;
1358 struct rt_rq ;
1358 struct sched_rt_entity { struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; unsigned short on_rq; unsigned short on_list; struct sched_rt_entity *back; struct sched_rt_entity *parent; struct rt_rq *rt_rq; struct rt_rq *my_q; } ;
1376 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_boosted; int dl_yielded; struct hrtimer dl_timer; } ;
1440 struct tlbflush_unmap_batch { struct cpumask cpumask; bool flush_required; bool writable; } ;
1459 struct sched_class ;
1459 struct compat_robust_list_head ;
1459 struct numa_group ;
1459 struct kcov ;
1459 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; unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; 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; unsigned long rcu_tasks_nvcsw; bool rcu_tasks_holdout; struct list_head rcu_tasks_holdout_list; int rcu_tasks_idle_cpu; 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; 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 long jobctl; unsigned int personality; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; unsigned char sched_migrated; unsigned char sched_remote_wakeup; unsigned char; unsigned char in_execve; unsigned char in_iowait; unsigned char restore_sigmask; unsigned char memcg_may_oom; unsigned char memcg_kmem_skip_account; unsigned char brk_randomized; unsigned long atomic_flags; struct restart_block restart_block; 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 prev_cputime prev_cputime; unsigned long nvcsw; unsigned long nivcsw; u64 start_time; u64 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]; struct nameidata *nameidata; struct sysv_sem sysvsem; struct sysv_shm sysvshm; unsigned long last_switch_count; 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; unsigned int sas_ss_flags; 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 wake_q_node wake_q; struct rb_root pi_waiters; struct rb_node *pi_waiters_leftmost; struct rt_mutex_waiter *pi_blocked_on; 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; unsigned int in_ubsan; 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; unsigned long total_numa_faults; unsigned long numa_faults_locality[3U]; unsigned long numa_pages_migrated; struct tlbflush_unmap_batch tlb_ubc; 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]; u64 timer_slack_ns; u64 default_timer_slack_ns; unsigned int kasan_depth; unsigned long trace; unsigned long trace_recursion; enum kcov_mode kcov_mode; unsigned int kcov_size; void *kcov_area; struct kcov *kcov; struct mem_cgroup *memcg_in_oom; gfp_t memcg_oom_gfp_mask; int memcg_oom_order; unsigned int memcg_nr_pages_over_high; struct uprobe_task *utask; unsigned int sequential_io; unsigned int sequential_io_avg; unsigned long task_state_change; int pagefault_disabled; struct task_struct *oom_reaper_list; struct thread_struct thread; } ;
18 typedef s32 compat_time_t;
39 typedef s32 compat_long_t;
45 typedef u32 compat_uptr_t;
46 struct compat_timespec { compat_time_t tv_sec; s32 tv_nsec; } ;
278 struct compat_robust_list { compat_uptr_t next; } ;
282 struct compat_robust_list_head { struct compat_robust_list list; compat_long_t futex_offset; compat_uptr_t list_op_pending; } ;
63 struct exception_table_entry { int insn; int fixup; int handler; } ;
184 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
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; const struct file *file; void *private; } ;
30 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 *); } ;
222 struct pinctrl ;
223 struct pinctrl_state ;
194 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *init_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ;
76 struct dma_map_ops ;
76 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ;
21 struct pdev_archdata { } ;
24 struct device_private ;
25 struct device_driver ;
26 struct driver_private ;
27 struct class ;
28 struct subsys_private ;
29 struct bus_type ;
30 struct device_node ;
31 struct fwnode_handle ;
32 struct iommu_ops ;
33 struct iommu_group ;
61 struct device_attribute ;
61 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; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
142 struct device_type ;
201 enum probe_type { PROBE_DEFAULT_STRATEGY = 0, PROBE_PREFER_ASYNCHRONOUS = 1, PROBE_FORCE_SYNCHRONOUS = 2 } ;
207 struct of_device_id ;
207 struct acpi_device_id ;
207 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; enum probe_type probe_type; 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; } ;
357 struct class_attribute ;
357 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; } ;
450 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 ); } ;
518 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; } ;
546 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 ); } ;
699 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
708 struct irq_domain ;
708 struct dma_coherent_mem ;
708 struct cma ;
708 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 irq_domain *msi_domain; struct dev_pin_info *pins; struct list_head msi_list; 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 fwnode_handle *fwnode; 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; } ;
862 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct wake_irq *wakeirq; 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; } ;
1327 struct scatterlist ;
89 enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3 } ;
273 struct vm_fault { unsigned int flags; gfp_t gfp_mask; unsigned long pgoff; void *virtual_address; struct page *cow_page; struct page *page; void *entry; } ;
308 struct fault_env { struct vm_area_struct *vma; unsigned long address; unsigned int flags; pmd_t *pmd; pte_t *pte; spinlock_t *ptl; pgtable_t prealloc_pte; } ;
335 struct vm_operations_struct { void (*open)(struct vm_area_struct *); void (*close)(struct vm_area_struct *); int (*mremap)(struct vm_area_struct *); int (*fault)(struct vm_area_struct *, struct vm_fault *); int (*pmd_fault)(struct vm_area_struct *, unsigned long, pmd_t *, unsigned int); void (*map_pages)(struct fault_env *, unsigned long, unsigned long); int (*page_mkwrite)(struct vm_area_struct *, struct vm_fault *); int (*pfn_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); struct page * (*find_special_page)(struct vm_area_struct *, unsigned long); } ;
2451 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; } ;
21 struct sg_table { struct scatterlist *sgl; unsigned int nents; unsigned int orig_nents; } ;
406 struct dma_map_ops { void * (*alloc)(struct device *, size_t , dma_addr_t *, gfp_t , unsigned long); void (*free)(struct device *, size_t , void *, dma_addr_t , unsigned long); int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t , size_t , unsigned long); int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t , size_t , unsigned long); dma_addr_t (*map_page)(struct device *, struct page *, unsigned long, size_t , enum dma_data_direction , unsigned long); void (*unmap_page)(struct device *, dma_addr_t , size_t , enum dma_data_direction , unsigned long); int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , unsigned long); void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction , unsigned long); 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; } ;
199 struct pipe_buf_operations ;
199 struct pipe_buffer { struct page *page; unsigned int offset; unsigned int len; const struct pipe_buf_operations *ops; unsigned int flags; unsigned long private; } ;
27 struct pipe_inode_info { struct mutex mutex; wait_queue_head_t wait; unsigned int nrbufs; unsigned int curbuf; unsigned int buffers; unsigned int readers; unsigned int writers; unsigned int files; unsigned int waiting_writers; unsigned int r_counter; unsigned int w_counter; struct page *tmp_page; struct fasync_struct *fasync_readers; struct fasync_struct *fasync_writers; struct pipe_buffer *bufs; struct user_struct *user; } ;
63 struct pipe_buf_operations { int can_merge; int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *); void (*release)(struct pipe_inode_info *, struct pipe_buffer *); int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); void (*get)(struct pipe_inode_info *, struct pipe_buffer *); } ;
296 struct mii_bus ;
303 struct mdio_device { struct device dev; const struct dev_pm_ops *pm_ops; struct mii_bus *bus; int (*bus_match)(struct device *, struct device_driver *); void (*device_free)(struct mdio_device *); void (*device_remove)(struct mdio_device *); int addr; int flags; } ;
13 typedef unsigned long kernel_ulong_t;
186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; __u32 cls; __u32 cls_msk; } ;
229 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
484 struct platform_device_id { char name[20U]; kernel_ulong_t driver_data; } ;
130 enum ldv_28554 { MDIOBUS_ALLOCATED = 1, MDIOBUS_REGISTERED = 2, MDIOBUS_UNREGISTERED = 3, MDIOBUS_RELEASED = 4 } ;
137 struct mii_bus { struct module *owner; const char *name; char id[17U]; void *priv; int (*read)(struct mii_bus *, int, int); int (*write)(struct mii_bus *, int, int, u16 ); int (*reset)(struct mii_bus *); struct mutex mdio_lock; struct device *parent; enum ldv_28554 state; struct device dev; struct mdio_device *mdio_map[32U]; u32 phy_mask; u32 phy_ignore_ta_mask; int irq[32U]; } ;
841 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
708 struct mfd_cell ;
710 struct platform_device { const char *name; int id; bool id_auto; struct device dev; u32 num_resources; struct resource *resource; const struct platform_device_id *id_entry; char *driver_override; struct mfd_cell *mfd_cell; struct pdev_archdata archdata; } ;
523 enum fwnode_type { FWNODE_INVALID = 0, FWNODE_OF = 1, FWNODE_ACPI = 2, FWNODE_ACPI_DATA = 3, FWNODE_PDATA = 4, FWNODE_IRQCHIP = 5 } ;
532 struct fwnode_handle { enum fwnode_type type; struct fwnode_handle *secondary; } ;
32 typedef u32 phandle;
34 struct property { char *name; int length; void *value; struct property *next; unsigned long _flags; unsigned int unique_id; struct bin_attribute attr; } ;
44 struct device_node { const char *name; const char *type; phandle phandle; const char *full_name; struct fwnode_handle fwnode; struct property *properties; struct property *deadprops; struct device_node *parent; struct device_node *child; struct device_node *sibling; struct kobject kobj; unsigned long _flags; void *data; } ;
33 struct orion_mdio_dev { struct mutex lock; void *regs; struct clk *clk; int err_interrupt; wait_queue_head_t smi_busy_wait; } ;
1 void * __builtin_memcpy(void *, const void *, unsigned long);
243 void __write_once_size(volatile void *p, void *res, int size);
33 extern struct module __this_module;
184 void __might_sleep(const char *, int, int);
414 int snprintf(char *, size_t , const char *, ...);
3 bool ldv_is_err(const void *ptr);
25 void INIT_LIST_HEAD(struct list_head *list);
41 bool IS_ERR(const void *ptr);
72 void __init_waitqueue_head(wait_queue_head_t *, const char *, struct lock_class_key *);
200 void __wake_up(wait_queue_head_t *, unsigned int, int, void *);
990 long int prepare_to_wait_event(wait_queue_head_t *, wait_queue_t *, int);
991 void finish_wait(wait_queue_head_t *, wait_queue_t *);
119 void __mutex_init(struct mutex *, const char *, struct lock_class_key *);
138 void mutex_lock_nested(struct mutex *, unsigned int);
174 void mutex_unlock(struct mutex *);
78 extern volatile unsigned long jiffies;
365 unsigned long int __usecs_to_jiffies(const unsigned int);
401 unsigned long int usecs_to_jiffies(const unsigned int u);
193 resource_size_t resource_size(const struct resource *res);
58 unsigned int readl(const volatile void *addr);
66 void writel(unsigned int val, volatile void *addr);
87 const char * kobject_name(const struct kobject *kobj);
11 void ldv_clk_disable_clk(struct clk *clk);
12 int ldv_clk_enable_clk();
13 void ldv_clk_disable_clk_of_orion_mdio_dev(struct clk *clk);
14 int ldv_clk_enable_clk_of_orion_mdio_dev();
436 long int schedule_timeout(long);
865 const char * dev_name(const struct device *dev);
912 void * dev_get_drvdata(const struct device *dev);
917 void dev_set_drvdata(struct device *dev, void *data);
1135 void dev_err(const struct device *, const char *, ...);
206 int __mdiobus_register(struct mii_bus *, struct module *);
208 void mdiobus_unregister(struct mii_bus *);
210 struct mii_bus * devm_mdiobus_alloc_size(struct device *, int);
76 void * devm_ioremap(struct device *, resource_size_t , resource_size_t );
164 int devm_request_threaded_irq(struct device *, unsigned int, irqreturn_t (*)(int, void *), irqreturn_t (*)(int, void *), unsigned long, const char *, void *);
170 int devm_request_irq(struct device *dev, unsigned int irq, irqreturn_t (*handler)(int, void *), unsigned long irqflags, const char *devname, void *dev_id);
52 struct resource * platform_get_resource(struct platform_device *, unsigned int, unsigned int);
54 int platform_get_irq(struct platform_device *, unsigned int);
211 void * platform_get_drvdata(const struct platform_device *pdev);
216 void platform_set_drvdata(struct platform_device *pdev, void *data);
48 void usleep_range(unsigned long, unsigned long);
249 struct clk * devm_clk_get(struct device *, const char *);
264 int ldv_clk_enable_5(struct clk *clk);
280 void ldv_clk_disable_6(struct clk *clk);
501 int ldv_clk_prepare_enable_7(struct clk *clk);
511 void ldv_clk_disable_unprepare_8(struct clk *clk);
16 int of_mdiobus_register(struct mii_bus *, struct device_node *);
68 int orion_mdio_smi_is_done(struct orion_mdio_dev *dev);
75 int orion_mdio_wait_ready(struct mii_bus *bus);
113 int orion_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
148 int orion_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
171 irqreturn_t orion_mdio_err_irq(int irq, void *dev_id);
186 int orion_mdio_probe(struct platform_device *pdev);
261 int orion_mdio_remove(struct platform_device *pdev);
278 const struct of_device_id __mod_of__orion_mdio_match_device_table[2U] = { };
312 void ldv_check_final_state();
315 void ldv_check_return_value(int);
318 void ldv_check_return_value_probe(int);
321 void ldv_initialize();
324 void ldv_handler_precall();
327 int nondet_int();
330 int LDV_IN_INTERRUPT = 0;
333 void ldv_main0_sequence_infinite_withcheck_stateful();
10 void ldv_error();
25 int ldv_undef_int();
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);
9 int ldv_counter_clk = 0;
34 int ldv_counter_clk_of_orion_mdio_dev = 0;
return ;
}
-entry_point
{
335 struct platform_device *var_group1;
336 int res_orion_mdio_probe_5;
337 int var_orion_mdio_err_irq_4_p0;
338 void *var_orion_mdio_err_irq_4_p1;
339 int ldv_s_orion_mdio_driver_platform_driver;
340 int tmp;
341 int tmp___0;
415 ldv_s_orion_mdio_driver_platform_driver = 0;
405 LDV_IN_INTERRUPT = 1;
414 ldv_initialize() { /* Function call is skipped due to function is undefined */}
420 goto ldv_39552;
420 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
420 assume(tmp___0 != 0);
423 goto ldv_39551;
421 ldv_39551:;
424 tmp = nondet_int() { /* Function call is skipped due to function is undefined */}
424 switch (tmp);
425 assume(tmp == 0);
429 assume(ldv_s_orion_mdio_driver_platform_driver == 0);
448 -orion_mdio_probe(var_group1)
{
188 struct resource *r;
189 struct mii_bus *bus;
190 struct orion_mdio_dev *dev;
191 int ret;
192 const char *tmp;
193 unsigned long long tmp___0;
194 struct lock_class_key __key;
195 _Bool tmp___1;
196 int tmp___2;
197 struct lock_class_key __key___0;
198 _Bool tmp___3;
199 int tmp___4;
193 r = platform_get_resource(pdev, 512U, 0U) { /* Function call is skipped due to function is undefined */}
194 assume(!(((unsigned long)r) == ((unsigned long)((struct resource *)0))));
199 bus = devm_mdiobus_alloc_size(&(pdev->dev), 272) { /* Function call is skipped due to function is undefined */}
201 assume(!(((unsigned long)bus) == ((unsigned long)((struct mii_bus *)0))));
204 bus->name = "orion_mdio_bus";
205 bus->read = &orion_mdio_read;
206 bus->write = &orion_mdio_write;
207 -dev_name((const struct device *)(&(pdev->dev)))
{
867 const char *tmp;
868 unsigned long __CPAchecker_TMP_0 = (unsigned long)(dev->init_name);
868 assume(!(__CPAchecker_TMP_0 != ((unsigned long)((const char *)0))));
871 -kobject_name(&(dev->kobj))
{
89 const char *__CPAchecker_TMP_0 = (const char *)(kobj->name);
89 return __CPAchecker_TMP_0;;
}
871 return tmp;;
}
207 snprintf((char *)(&(bus->id)), 17UL, "%s-mii", tmp) { /* Function call is skipped due to function is undefined */}
209 bus->parent = &(pdev->dev);
211 struct orion_mdio_dev *__CPAchecker_TMP_0 = (struct orion_mdio_dev *)(bus->priv);
211 dev = __CPAchecker_TMP_0;
212 -resource_size((const struct resource *)r)
{
195 unsigned long long __CPAchecker_TMP_0 = (unsigned long long)(res->end);
195 unsigned long long __CPAchecker_TMP_1 = (unsigned long long)(res->start);
195 return (__CPAchecker_TMP_0 - __CPAchecker_TMP_1) + 1ULL;;
}
212 dev->regs = devm_ioremap(&(pdev->dev), r->start, tmp___0) { /* Function call is skipped due to function is undefined */}
213 unsigned long __CPAchecker_TMP_1 = (unsigned long)(dev->regs);
213 assume(__CPAchecker_TMP_1 == ((unsigned long)((void *)0)));
214 dev_err((const struct device *)(&(pdev->dev)), "Unable to remap SMI register\n") { /* Function call is skipped due to function is undefined */}
215 ret = -19;
216 goto out_mdio;
254 out_mdio:;
256 const void *__CPAchecker_TMP_5 = (const void *)(dev->clk);
256 -IS_ERR(__CPAchecker_TMP_5)
{
30 _Bool tmp;
31 -ldv_is_err(ptr)
{
10 return ((unsigned long)ptr) > 2012UL;;
}
31 return tmp;;
}
256 assume(tmp___3 == 0);
256 tmp___4 = 1;
256 assume(!(tmp___4 == 0));
257 -ldv_clk_disable_unprepare_8(dev->clk)
{
61 -ldv_clk_disable_clk_of_orion_mdio_dev(clk)
{
40 assume(ldv_counter_clk_of_orion_mdio_dev != 1);
40 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
}
}
Source code
1 2 /* 3 * Driver for the MDIO interface of Marvell network interfaces. 4 * 5 * Since the MDIO interface of Marvell network interfaces is shared 6 * between all network interfaces, having a single driver allows to 7 * handle concurrent accesses properly (you may have four Ethernet 8 * ports, but they in fact share the same SMI interface to access 9 * the MDIO bus). This driver is currently used by the mvneta and 10 * mv643xx_eth drivers. 11 * 12 * Copyright (C) 2012 Marvell 13 * 14 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 15 * 16 * This file is licensed under the terms of the GNU General Public 17 * License version 2. This program is licensed "as is" without any 18 * warranty of any kind, whether express or implied. 19 */ 20 21 #include <linux/kernel.h> 22 #include <linux/module.h> 23 #include <linux/mutex.h> 24 #include <linux/phy.h> 25 #include <linux/interrupt.h> 26 #include <linux/platform_device.h> 27 #include <linux/delay.h> 28 #include <linux/io.h> 29 #include <linux/clk.h> 30 #include <linux/of_mdio.h> 31 #include <linux/sched.h> 32 #include <linux/wait.h> 33 34 #define MVMDIO_SMI_DATA_SHIFT 0 35 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 36 #define MVMDIO_SMI_PHY_REG_SHIFT 21 37 #define MVMDIO_SMI_READ_OPERATION BIT(26) 38 #define MVMDIO_SMI_WRITE_OPERATION 0 39 #define MVMDIO_SMI_READ_VALID BIT(27) 40 #define MVMDIO_SMI_BUSY BIT(28) 41 #define MVMDIO_ERR_INT_CAUSE 0x007C 42 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 43 #define MVMDIO_ERR_INT_MASK 0x0080 44 45 /* 46 * SMI Timeout measurements: 47 * - Kirkwood 88F6281 (Globalscale Dreamplug): 45us to 95us (Interrupt) 48 * - Armada 370 (Globalscale Mirabox): 41us to 43us (Polled) 49 */ 50 #define MVMDIO_SMI_TIMEOUT 1000 /* 1000us = 1ms */ 51 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 52 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 53 54 struct orion_mdio_dev { 55 struct mutex lock; 56 void __iomem *regs; 57 struct clk *clk; 58 /* 59 * If we have access to the error interrupt pin (which is 60 * somewhat misnamed as it not only reflects internal errors 61 * but also reflects SMI completion), use that to wait for 62 * SMI access completion instead of polling the SMI busy bit. 63 */ 64 int err_interrupt; 65 wait_queue_head_t smi_busy_wait; 66 }; 67 68 static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev) 69 { 70 return !(readl(dev->regs) & MVMDIO_SMI_BUSY); 71 } 72 73 /* Wait for the SMI unit to be ready for another operation 74 */ 75 static int orion_mdio_wait_ready(struct mii_bus *bus) 76 { 77 struct orion_mdio_dev *dev = bus->priv; 78 unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT); 79 unsigned long end = jiffies + timeout; 80 int timedout = 0; 81 82 while (1) { 83 if (orion_mdio_smi_is_done(dev)) 84 return 0; 85 else if (timedout) 86 break; 87 88 if (dev->err_interrupt <= 0) { 89 usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN, 90 MVMDIO_SMI_POLL_INTERVAL_MAX); 91 92 if (time_is_before_jiffies(end)) 93 ++timedout; 94 } else { 95 /* wait_event_timeout does not guarantee a delay of at 96 * least one whole jiffie, so timeout must be no less 97 * than two. 98 */ 99 if (timeout < 2) 100 timeout = 2; 101 wait_event_timeout(dev->smi_busy_wait, 102 orion_mdio_smi_is_done(dev), 103 timeout); 104 105 ++timedout; 106 } 107 } 108 109 dev_err(bus->parent, "Timeout: SMI busy for too long\n"); 110 return -ETIMEDOUT; 111 } 112 113 static int orion_mdio_read(struct mii_bus *bus, int mii_id, 114 int regnum) 115 { 116 struct orion_mdio_dev *dev = bus->priv; 117 u32 val; 118 int ret; 119 120 mutex_lock(&dev->lock); 121 122 ret = orion_mdio_wait_ready(bus); 123 if (ret < 0) 124 goto out; 125 126 writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) | 127 (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | 128 MVMDIO_SMI_READ_OPERATION), 129 dev->regs); 130 131 ret = orion_mdio_wait_ready(bus); 132 if (ret < 0) 133 goto out; 134 135 val = readl(dev->regs); 136 if (!(val & MVMDIO_SMI_READ_VALID)) { 137 dev_err(bus->parent, "SMI bus read not valid\n"); 138 ret = -ENODEV; 139 goto out; 140 } 141 142 ret = val & 0xFFFF; 143 out: 144 mutex_unlock(&dev->lock); 145 return ret; 146 } 147 148 static int orion_mdio_write(struct mii_bus *bus, int mii_id, 149 int regnum, u16 value) 150 { 151 struct orion_mdio_dev *dev = bus->priv; 152 int ret; 153 154 mutex_lock(&dev->lock); 155 156 ret = orion_mdio_wait_ready(bus); 157 if (ret < 0) 158 goto out; 159 160 writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) | 161 (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | 162 MVMDIO_SMI_WRITE_OPERATION | 163 (value << MVMDIO_SMI_DATA_SHIFT)), 164 dev->regs); 165 166 out: 167 mutex_unlock(&dev->lock); 168 return ret; 169 } 170 171 static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id) 172 { 173 struct orion_mdio_dev *dev = dev_id; 174 175 if (readl(dev->regs + MVMDIO_ERR_INT_CAUSE) & 176 MVMDIO_ERR_INT_SMI_DONE) { 177 writel(~MVMDIO_ERR_INT_SMI_DONE, 178 dev->regs + MVMDIO_ERR_INT_CAUSE); 179 wake_up(&dev->smi_busy_wait); 180 return IRQ_HANDLED; 181 } 182 183 return IRQ_NONE; 184 } 185 186 static int orion_mdio_probe(struct platform_device *pdev) 187 { 188 struct resource *r; 189 struct mii_bus *bus; 190 struct orion_mdio_dev *dev; 191 int ret; 192 193 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 194 if (!r) { 195 dev_err(&pdev->dev, "No SMI register address given\n"); 196 return -ENODEV; 197 } 198 199 bus = devm_mdiobus_alloc_size(&pdev->dev, 200 sizeof(struct orion_mdio_dev)); 201 if (!bus) 202 return -ENOMEM; 203 204 bus->name = "orion_mdio_bus"; 205 bus->read = orion_mdio_read; 206 bus->write = orion_mdio_write; 207 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", 208 dev_name(&pdev->dev)); 209 bus->parent = &pdev->dev; 210 211 dev = bus->priv; 212 dev->regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); 213 if (!dev->regs) { 214 dev_err(&pdev->dev, "Unable to remap SMI register\n"); 215 ret = -ENODEV; 216 goto out_mdio; 217 } 218 219 init_waitqueue_head(&dev->smi_busy_wait); 220 221 dev->clk = devm_clk_get(&pdev->dev, NULL); 222 if (!IS_ERR(dev->clk)) 223 clk_prepare_enable(dev->clk); 224 225 dev->err_interrupt = platform_get_irq(pdev, 0); 226 if (dev->err_interrupt > 0) { 227 ret = devm_request_irq(&pdev->dev, dev->err_interrupt, 228 orion_mdio_err_irq, 229 IRQF_SHARED, pdev->name, dev); 230 if (ret) 231 goto out_mdio; 232 233 writel(MVMDIO_ERR_INT_SMI_DONE, 234 dev->regs + MVMDIO_ERR_INT_MASK); 235 236 } else if (dev->err_interrupt == -EPROBE_DEFER) { 237 return -EPROBE_DEFER; 238 } 239 240 mutex_init(&dev->lock); 241 242 if (pdev->dev.of_node) 243 ret = of_mdiobus_register(bus, pdev->dev.of_node); 244 else 245 ret = mdiobus_register(bus); 246 if (ret < 0) { 247 dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); 248 goto out_mdio; 249 } 250 251 platform_set_drvdata(pdev, bus); 252 253 return 0; 254 255 out_mdio: 256 if (!IS_ERR(dev->clk)) 257 clk_disable_unprepare(dev->clk); 258 return ret; 259 } 260 261 static int orion_mdio_remove(struct platform_device *pdev) 262 { 263 struct mii_bus *bus = platform_get_drvdata(pdev); 264 struct orion_mdio_dev *dev = bus->priv; 265 266 writel(0, dev->regs + MVMDIO_ERR_INT_MASK); 267 mdiobus_unregister(bus); 268 if (!IS_ERR(dev->clk)) 269 clk_disable_unprepare(dev->clk); 270 271 return 0; 272 } 273 274 static const struct of_device_id orion_mdio_match[] = { 275 { .compatible = "marvell,orion-mdio" }, 276 { } 277 }; 278 MODULE_DEVICE_TABLE(of, orion_mdio_match); 279 280 static struct platform_driver orion_mdio_driver = { 281 .probe = orion_mdio_probe, 282 .remove = orion_mdio_remove, 283 .driver = { 284 .name = "orion-mdio", 285 .of_match_table = orion_mdio_match, 286 }, 287 }; 288 289 module_platform_driver(orion_mdio_driver); 290 291 MODULE_DESCRIPTION("Marvell MDIO interface driver"); 292 MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 293 MODULE_LICENSE("GPL"); 294 MODULE_ALIAS("platform:orion-mdio"); 295 296 297 298 299 300 /* LDV_COMMENT_BEGIN_MAIN */ 301 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 302 303 /*###########################################################################*/ 304 305 /*############## Driver Environment Generator 0.2 output ####################*/ 306 307 /*###########################################################################*/ 308 309 310 311 /* 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. */ 312 void ldv_check_final_state(void); 313 314 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 315 void ldv_check_return_value(int res); 316 317 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 318 void ldv_check_return_value_probe(int res); 319 320 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 321 void ldv_initialize(void); 322 323 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 324 void ldv_handler_precall(void); 325 326 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 327 int nondet_int(void); 328 329 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 330 int LDV_IN_INTERRUPT; 331 332 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 333 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 334 335 336 337 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 338 /*============================= VARIABLE DECLARATION PART =============================*/ 339 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 340 /* content: static int orion_mdio_probe(struct platform_device *pdev)*/ 341 /* LDV_COMMENT_BEGIN_PREP */ 342 #define MVMDIO_SMI_DATA_SHIFT 0 343 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 344 #define MVMDIO_SMI_PHY_REG_SHIFT 21 345 #define MVMDIO_SMI_READ_OPERATION BIT(26) 346 #define MVMDIO_SMI_WRITE_OPERATION 0 347 #define MVMDIO_SMI_READ_VALID BIT(27) 348 #define MVMDIO_SMI_BUSY BIT(28) 349 #define MVMDIO_ERR_INT_CAUSE 0x007C 350 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 351 #define MVMDIO_ERR_INT_MASK 0x0080 352 #define MVMDIO_SMI_TIMEOUT 1000 353 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 354 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 355 /* LDV_COMMENT_END_PREP */ 356 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_probe" */ 357 struct platform_device * var_group1; 358 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "orion_mdio_probe" */ 359 static int res_orion_mdio_probe_5; 360 /* content: static int orion_mdio_remove(struct platform_device *pdev)*/ 361 /* LDV_COMMENT_BEGIN_PREP */ 362 #define MVMDIO_SMI_DATA_SHIFT 0 363 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 364 #define MVMDIO_SMI_PHY_REG_SHIFT 21 365 #define MVMDIO_SMI_READ_OPERATION BIT(26) 366 #define MVMDIO_SMI_WRITE_OPERATION 0 367 #define MVMDIO_SMI_READ_VALID BIT(27) 368 #define MVMDIO_SMI_BUSY BIT(28) 369 #define MVMDIO_ERR_INT_CAUSE 0x007C 370 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 371 #define MVMDIO_ERR_INT_MASK 0x0080 372 #define MVMDIO_SMI_TIMEOUT 1000 373 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 374 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 375 /* LDV_COMMENT_END_PREP */ 376 377 /** CALLBACK SECTION request_irq **/ 378 /* content: static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)*/ 379 /* LDV_COMMENT_BEGIN_PREP */ 380 #define MVMDIO_SMI_DATA_SHIFT 0 381 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 382 #define MVMDIO_SMI_PHY_REG_SHIFT 21 383 #define MVMDIO_SMI_READ_OPERATION BIT(26) 384 #define MVMDIO_SMI_WRITE_OPERATION 0 385 #define MVMDIO_SMI_READ_VALID BIT(27) 386 #define MVMDIO_SMI_BUSY BIT(28) 387 #define MVMDIO_ERR_INT_CAUSE 0x007C 388 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 389 #define MVMDIO_ERR_INT_MASK 0x0080 390 #define MVMDIO_SMI_TIMEOUT 1000 391 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 392 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 393 /* LDV_COMMENT_END_PREP */ 394 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_err_irq" */ 395 int var_orion_mdio_err_irq_4_p0; 396 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_err_irq" */ 397 void * var_orion_mdio_err_irq_4_p1; 398 399 400 401 402 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 403 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 404 /*============================= VARIABLE INITIALIZING PART =============================*/ 405 LDV_IN_INTERRUPT=1; 406 407 408 409 410 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 411 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 412 /*============================= FUNCTION CALL SECTION =============================*/ 413 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 414 ldv_initialize(); 415 int ldv_s_orion_mdio_driver_platform_driver = 0; 416 417 418 419 420 while( nondet_int() 421 || !(ldv_s_orion_mdio_driver_platform_driver == 0) 422 ) { 423 424 switch(nondet_int()) { 425 426 case 0: { 427 428 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 429 if(ldv_s_orion_mdio_driver_platform_driver==0) { 430 431 /* content: static int orion_mdio_probe(struct platform_device *pdev)*/ 432 /* LDV_COMMENT_BEGIN_PREP */ 433 #define MVMDIO_SMI_DATA_SHIFT 0 434 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 435 #define MVMDIO_SMI_PHY_REG_SHIFT 21 436 #define MVMDIO_SMI_READ_OPERATION BIT(26) 437 #define MVMDIO_SMI_WRITE_OPERATION 0 438 #define MVMDIO_SMI_READ_VALID BIT(27) 439 #define MVMDIO_SMI_BUSY BIT(28) 440 #define MVMDIO_ERR_INT_CAUSE 0x007C 441 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 442 #define MVMDIO_ERR_INT_MASK 0x0080 443 #define MVMDIO_SMI_TIMEOUT 1000 444 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 445 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 446 /* LDV_COMMENT_END_PREP */ 447 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "orion_mdio_driver". Standart function test for correct return result. */ 448 res_orion_mdio_probe_5 = orion_mdio_probe( var_group1); 449 ldv_check_return_value(res_orion_mdio_probe_5); 450 ldv_check_return_value_probe(res_orion_mdio_probe_5); 451 if(res_orion_mdio_probe_5) 452 goto ldv_module_exit; 453 ldv_s_orion_mdio_driver_platform_driver++; 454 455 } 456 457 } 458 459 break; 460 case 1: { 461 462 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 463 if(ldv_s_orion_mdio_driver_platform_driver==1) { 464 465 /* content: static int orion_mdio_remove(struct platform_device *pdev)*/ 466 /* LDV_COMMENT_BEGIN_PREP */ 467 #define MVMDIO_SMI_DATA_SHIFT 0 468 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 469 #define MVMDIO_SMI_PHY_REG_SHIFT 21 470 #define MVMDIO_SMI_READ_OPERATION BIT(26) 471 #define MVMDIO_SMI_WRITE_OPERATION 0 472 #define MVMDIO_SMI_READ_VALID BIT(27) 473 #define MVMDIO_SMI_BUSY BIT(28) 474 #define MVMDIO_ERR_INT_CAUSE 0x007C 475 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 476 #define MVMDIO_ERR_INT_MASK 0x0080 477 #define MVMDIO_SMI_TIMEOUT 1000 478 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 479 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 480 /* LDV_COMMENT_END_PREP */ 481 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "orion_mdio_driver" */ 482 ldv_handler_precall(); 483 orion_mdio_remove( var_group1); 484 ldv_s_orion_mdio_driver_platform_driver=0; 485 486 } 487 488 } 489 490 break; 491 case 2: { 492 493 /** CALLBACK SECTION request_irq **/ 494 LDV_IN_INTERRUPT=2; 495 496 /* content: static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)*/ 497 /* LDV_COMMENT_BEGIN_PREP */ 498 #define MVMDIO_SMI_DATA_SHIFT 0 499 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 500 #define MVMDIO_SMI_PHY_REG_SHIFT 21 501 #define MVMDIO_SMI_READ_OPERATION BIT(26) 502 #define MVMDIO_SMI_WRITE_OPERATION 0 503 #define MVMDIO_SMI_READ_VALID BIT(27) 504 #define MVMDIO_SMI_BUSY BIT(28) 505 #define MVMDIO_ERR_INT_CAUSE 0x007C 506 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 507 #define MVMDIO_ERR_INT_MASK 0x0080 508 #define MVMDIO_SMI_TIMEOUT 1000 509 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 510 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 511 /* LDV_COMMENT_END_PREP */ 512 /* LDV_COMMENT_FUNCTION_CALL */ 513 ldv_handler_precall(); 514 orion_mdio_err_irq( var_orion_mdio_err_irq_4_p0, var_orion_mdio_err_irq_4_p1); 515 LDV_IN_INTERRUPT=1; 516 517 518 519 } 520 521 break; 522 default: break; 523 524 } 525 526 } 527 528 ldv_module_exit: 529 530 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 531 ldv_final: ldv_check_final_state(); 532 533 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 534 return; 535 536 } 537 #endif 538 539 /* LDV_COMMENT_END_MAIN */
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/module.h> 9 struct clk; 10 11 extern void ldv_clk_disable_clk(struct clk *clk); 12 extern int ldv_clk_enable_clk(void); 13 extern void ldv_clk_disable_clk_of_orion_mdio_dev(struct clk *clk); 14 extern int ldv_clk_enable_clk_of_orion_mdio_dev(void); 15 #line 1 "/home/ldvuser/ldv/ref_launches/work/current--X--drivers--X--defaultlinux-4.8-rc1.tar.xz--X--322_7a--X--cpachecker/linux-4.8-rc1.tar.xz/csd_deg_dscv/12140/dscv_tempdir/dscv/ri/322_7a/drivers/net/ethernet/marvell/mvmdio.c" 16 17 /* 18 * Driver for the MDIO interface of Marvell network interfaces. 19 * 20 * Since the MDIO interface of Marvell network interfaces is shared 21 * between all network interfaces, having a single driver allows to 22 * handle concurrent accesses properly (you may have four Ethernet 23 * ports, but they in fact share the same SMI interface to access 24 * the MDIO bus). This driver is currently used by the mvneta and 25 * mv643xx_eth drivers. 26 * 27 * Copyright (C) 2012 Marvell 28 * 29 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 30 * 31 * This file is licensed under the terms of the GNU General Public 32 * License version 2. This program is licensed "as is" without any 33 * warranty of any kind, whether express or implied. 34 */ 35 36 #include <linux/kernel.h> 37 #include <linux/module.h> 38 #include <linux/mutex.h> 39 #include <linux/phy.h> 40 #include <linux/interrupt.h> 41 #include <linux/platform_device.h> 42 #include <linux/delay.h> 43 #include <linux/io.h> 44 #include <linux/clk.h> 45 #include <linux/of_mdio.h> 46 #include <linux/sched.h> 47 #include <linux/wait.h> 48 49 #define MVMDIO_SMI_DATA_SHIFT 0 50 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 51 #define MVMDIO_SMI_PHY_REG_SHIFT 21 52 #define MVMDIO_SMI_READ_OPERATION BIT(26) 53 #define MVMDIO_SMI_WRITE_OPERATION 0 54 #define MVMDIO_SMI_READ_VALID BIT(27) 55 #define MVMDIO_SMI_BUSY BIT(28) 56 #define MVMDIO_ERR_INT_CAUSE 0x007C 57 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 58 #define MVMDIO_ERR_INT_MASK 0x0080 59 60 /* 61 * SMI Timeout measurements: 62 * - Kirkwood 88F6281 (Globalscale Dreamplug): 45us to 95us (Interrupt) 63 * - Armada 370 (Globalscale Mirabox): 41us to 43us (Polled) 64 */ 65 #define MVMDIO_SMI_TIMEOUT 1000 /* 1000us = 1ms */ 66 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 67 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 68 69 struct orion_mdio_dev { 70 struct mutex lock; 71 void __iomem *regs; 72 struct clk *clk; 73 /* 74 * If we have access to the error interrupt pin (which is 75 * somewhat misnamed as it not only reflects internal errors 76 * but also reflects SMI completion), use that to wait for 77 * SMI access completion instead of polling the SMI busy bit. 78 */ 79 int err_interrupt; 80 wait_queue_head_t smi_busy_wait; 81 }; 82 83 static int orion_mdio_smi_is_done(struct orion_mdio_dev *dev) 84 { 85 return !(readl(dev->regs) & MVMDIO_SMI_BUSY); 86 } 87 88 /* Wait for the SMI unit to be ready for another operation 89 */ 90 static int orion_mdio_wait_ready(struct mii_bus *bus) 91 { 92 struct orion_mdio_dev *dev = bus->priv; 93 unsigned long timeout = usecs_to_jiffies(MVMDIO_SMI_TIMEOUT); 94 unsigned long end = jiffies + timeout; 95 int timedout = 0; 96 97 while (1) { 98 if (orion_mdio_smi_is_done(dev)) 99 return 0; 100 else if (timedout) 101 break; 102 103 if (dev->err_interrupt <= 0) { 104 usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN, 105 MVMDIO_SMI_POLL_INTERVAL_MAX); 106 107 if (time_is_before_jiffies(end)) 108 ++timedout; 109 } else { 110 /* wait_event_timeout does not guarantee a delay of at 111 * least one whole jiffie, so timeout must be no less 112 * than two. 113 */ 114 if (timeout < 2) 115 timeout = 2; 116 wait_event_timeout(dev->smi_busy_wait, 117 orion_mdio_smi_is_done(dev), 118 timeout); 119 120 ++timedout; 121 } 122 } 123 124 dev_err(bus->parent, "Timeout: SMI busy for too long\n"); 125 return -ETIMEDOUT; 126 } 127 128 static int orion_mdio_read(struct mii_bus *bus, int mii_id, 129 int regnum) 130 { 131 struct orion_mdio_dev *dev = bus->priv; 132 u32 val; 133 int ret; 134 135 mutex_lock(&dev->lock); 136 137 ret = orion_mdio_wait_ready(bus); 138 if (ret < 0) 139 goto out; 140 141 writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) | 142 (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | 143 MVMDIO_SMI_READ_OPERATION), 144 dev->regs); 145 146 ret = orion_mdio_wait_ready(bus); 147 if (ret < 0) 148 goto out; 149 150 val = readl(dev->regs); 151 if (!(val & MVMDIO_SMI_READ_VALID)) { 152 dev_err(bus->parent, "SMI bus read not valid\n"); 153 ret = -ENODEV; 154 goto out; 155 } 156 157 ret = val & 0xFFFF; 158 out: 159 mutex_unlock(&dev->lock); 160 return ret; 161 } 162 163 static int orion_mdio_write(struct mii_bus *bus, int mii_id, 164 int regnum, u16 value) 165 { 166 struct orion_mdio_dev *dev = bus->priv; 167 int ret; 168 169 mutex_lock(&dev->lock); 170 171 ret = orion_mdio_wait_ready(bus); 172 if (ret < 0) 173 goto out; 174 175 writel(((mii_id << MVMDIO_SMI_PHY_ADDR_SHIFT) | 176 (regnum << MVMDIO_SMI_PHY_REG_SHIFT) | 177 MVMDIO_SMI_WRITE_OPERATION | 178 (value << MVMDIO_SMI_DATA_SHIFT)), 179 dev->regs); 180 181 out: 182 mutex_unlock(&dev->lock); 183 return ret; 184 } 185 186 static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id) 187 { 188 struct orion_mdio_dev *dev = dev_id; 189 190 if (readl(dev->regs + MVMDIO_ERR_INT_CAUSE) & 191 MVMDIO_ERR_INT_SMI_DONE) { 192 writel(~MVMDIO_ERR_INT_SMI_DONE, 193 dev->regs + MVMDIO_ERR_INT_CAUSE); 194 wake_up(&dev->smi_busy_wait); 195 return IRQ_HANDLED; 196 } 197 198 return IRQ_NONE; 199 } 200 201 static int orion_mdio_probe(struct platform_device *pdev) 202 { 203 struct resource *r; 204 struct mii_bus *bus; 205 struct orion_mdio_dev *dev; 206 int ret; 207 208 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 209 if (!r) { 210 dev_err(&pdev->dev, "No SMI register address given\n"); 211 return -ENODEV; 212 } 213 214 bus = devm_mdiobus_alloc_size(&pdev->dev, 215 sizeof(struct orion_mdio_dev)); 216 if (!bus) 217 return -ENOMEM; 218 219 bus->name = "orion_mdio_bus"; 220 bus->read = orion_mdio_read; 221 bus->write = orion_mdio_write; 222 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", 223 dev_name(&pdev->dev)); 224 bus->parent = &pdev->dev; 225 226 dev = bus->priv; 227 dev->regs = devm_ioremap(&pdev->dev, r->start, resource_size(r)); 228 if (!dev->regs) { 229 dev_err(&pdev->dev, "Unable to remap SMI register\n"); 230 ret = -ENODEV; 231 goto out_mdio; 232 } 233 234 init_waitqueue_head(&dev->smi_busy_wait); 235 236 dev->clk = devm_clk_get(&pdev->dev, NULL); 237 if (!IS_ERR(dev->clk)) 238 clk_prepare_enable(dev->clk); 239 240 dev->err_interrupt = platform_get_irq(pdev, 0); 241 if (dev->err_interrupt > 0) { 242 ret = devm_request_irq(&pdev->dev, dev->err_interrupt, 243 orion_mdio_err_irq, 244 IRQF_SHARED, pdev->name, dev); 245 if (ret) 246 goto out_mdio; 247 248 writel(MVMDIO_ERR_INT_SMI_DONE, 249 dev->regs + MVMDIO_ERR_INT_MASK); 250 251 } else if (dev->err_interrupt == -EPROBE_DEFER) { 252 return -EPROBE_DEFER; 253 } 254 255 mutex_init(&dev->lock); 256 257 if (pdev->dev.of_node) 258 ret = of_mdiobus_register(bus, pdev->dev.of_node); 259 else 260 ret = mdiobus_register(bus); 261 if (ret < 0) { 262 dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); 263 goto out_mdio; 264 } 265 266 platform_set_drvdata(pdev, bus); 267 268 return 0; 269 270 out_mdio: 271 if (!IS_ERR(dev->clk)) 272 clk_disable_unprepare(dev->clk); 273 return ret; 274 } 275 276 static int orion_mdio_remove(struct platform_device *pdev) 277 { 278 struct mii_bus *bus = platform_get_drvdata(pdev); 279 struct orion_mdio_dev *dev = bus->priv; 280 281 writel(0, dev->regs + MVMDIO_ERR_INT_MASK); 282 mdiobus_unregister(bus); 283 if (!IS_ERR(dev->clk)) 284 clk_disable_unprepare(dev->clk); 285 286 return 0; 287 } 288 289 static const struct of_device_id orion_mdio_match[] = { 290 { .compatible = "marvell,orion-mdio" }, 291 { } 292 }; 293 MODULE_DEVICE_TABLE(of, orion_mdio_match); 294 295 static struct platform_driver orion_mdio_driver = { 296 .probe = orion_mdio_probe, 297 .remove = orion_mdio_remove, 298 .driver = { 299 .name = "orion-mdio", 300 .of_match_table = orion_mdio_match, 301 }, 302 }; 303 304 module_platform_driver(orion_mdio_driver); 305 306 MODULE_DESCRIPTION("Marvell MDIO interface driver"); 307 MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 308 MODULE_LICENSE("GPL"); 309 MODULE_ALIAS("platform:orion-mdio"); 310 311 312 313 314 315 /* LDV_COMMENT_BEGIN_MAIN */ 316 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 317 318 /*###########################################################################*/ 319 320 /*############## Driver Environment Generator 0.2 output ####################*/ 321 322 /*###########################################################################*/ 323 324 325 326 /* 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. */ 327 void ldv_check_final_state(void); 328 329 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 330 void ldv_check_return_value(int res); 331 332 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 333 void ldv_check_return_value_probe(int res); 334 335 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 336 void ldv_initialize(void); 337 338 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 339 void ldv_handler_precall(void); 340 341 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 342 int nondet_int(void); 343 344 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 345 int LDV_IN_INTERRUPT; 346 347 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 348 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 349 350 351 352 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 353 /*============================= VARIABLE DECLARATION PART =============================*/ 354 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 355 /* content: static int orion_mdio_probe(struct platform_device *pdev)*/ 356 /* LDV_COMMENT_BEGIN_PREP */ 357 #define MVMDIO_SMI_DATA_SHIFT 0 358 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 359 #define MVMDIO_SMI_PHY_REG_SHIFT 21 360 #define MVMDIO_SMI_READ_OPERATION BIT(26) 361 #define MVMDIO_SMI_WRITE_OPERATION 0 362 #define MVMDIO_SMI_READ_VALID BIT(27) 363 #define MVMDIO_SMI_BUSY BIT(28) 364 #define MVMDIO_ERR_INT_CAUSE 0x007C 365 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 366 #define MVMDIO_ERR_INT_MASK 0x0080 367 #define MVMDIO_SMI_TIMEOUT 1000 368 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 369 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 370 /* LDV_COMMENT_END_PREP */ 371 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_probe" */ 372 struct platform_device * var_group1; 373 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "orion_mdio_probe" */ 374 static int res_orion_mdio_probe_5; 375 /* content: static int orion_mdio_remove(struct platform_device *pdev)*/ 376 /* LDV_COMMENT_BEGIN_PREP */ 377 #define MVMDIO_SMI_DATA_SHIFT 0 378 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 379 #define MVMDIO_SMI_PHY_REG_SHIFT 21 380 #define MVMDIO_SMI_READ_OPERATION BIT(26) 381 #define MVMDIO_SMI_WRITE_OPERATION 0 382 #define MVMDIO_SMI_READ_VALID BIT(27) 383 #define MVMDIO_SMI_BUSY BIT(28) 384 #define MVMDIO_ERR_INT_CAUSE 0x007C 385 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 386 #define MVMDIO_ERR_INT_MASK 0x0080 387 #define MVMDIO_SMI_TIMEOUT 1000 388 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 389 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 390 /* LDV_COMMENT_END_PREP */ 391 392 /** CALLBACK SECTION request_irq **/ 393 /* content: static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)*/ 394 /* LDV_COMMENT_BEGIN_PREP */ 395 #define MVMDIO_SMI_DATA_SHIFT 0 396 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 397 #define MVMDIO_SMI_PHY_REG_SHIFT 21 398 #define MVMDIO_SMI_READ_OPERATION BIT(26) 399 #define MVMDIO_SMI_WRITE_OPERATION 0 400 #define MVMDIO_SMI_READ_VALID BIT(27) 401 #define MVMDIO_SMI_BUSY BIT(28) 402 #define MVMDIO_ERR_INT_CAUSE 0x007C 403 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 404 #define MVMDIO_ERR_INT_MASK 0x0080 405 #define MVMDIO_SMI_TIMEOUT 1000 406 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 407 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 408 /* LDV_COMMENT_END_PREP */ 409 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_err_irq" */ 410 int var_orion_mdio_err_irq_4_p0; 411 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "orion_mdio_err_irq" */ 412 void * var_orion_mdio_err_irq_4_p1; 413 414 415 416 417 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 418 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 419 /*============================= VARIABLE INITIALIZING PART =============================*/ 420 LDV_IN_INTERRUPT=1; 421 422 423 424 425 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 426 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 427 /*============================= FUNCTION CALL SECTION =============================*/ 428 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 429 ldv_initialize(); 430 int ldv_s_orion_mdio_driver_platform_driver = 0; 431 432 433 434 435 while( nondet_int() 436 || !(ldv_s_orion_mdio_driver_platform_driver == 0) 437 ) { 438 439 switch(nondet_int()) { 440 441 case 0: { 442 443 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 444 if(ldv_s_orion_mdio_driver_platform_driver==0) { 445 446 /* content: static int orion_mdio_probe(struct platform_device *pdev)*/ 447 /* LDV_COMMENT_BEGIN_PREP */ 448 #define MVMDIO_SMI_DATA_SHIFT 0 449 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 450 #define MVMDIO_SMI_PHY_REG_SHIFT 21 451 #define MVMDIO_SMI_READ_OPERATION BIT(26) 452 #define MVMDIO_SMI_WRITE_OPERATION 0 453 #define MVMDIO_SMI_READ_VALID BIT(27) 454 #define MVMDIO_SMI_BUSY BIT(28) 455 #define MVMDIO_ERR_INT_CAUSE 0x007C 456 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 457 #define MVMDIO_ERR_INT_MASK 0x0080 458 #define MVMDIO_SMI_TIMEOUT 1000 459 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 460 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 461 /* LDV_COMMENT_END_PREP */ 462 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "orion_mdio_driver". Standart function test for correct return result. */ 463 res_orion_mdio_probe_5 = orion_mdio_probe( var_group1); 464 ldv_check_return_value(res_orion_mdio_probe_5); 465 ldv_check_return_value_probe(res_orion_mdio_probe_5); 466 if(res_orion_mdio_probe_5) 467 goto ldv_module_exit; 468 ldv_s_orion_mdio_driver_platform_driver++; 469 470 } 471 472 } 473 474 break; 475 case 1: { 476 477 /** STRUCT: struct type: platform_driver, struct name: orion_mdio_driver **/ 478 if(ldv_s_orion_mdio_driver_platform_driver==1) { 479 480 /* content: static int orion_mdio_remove(struct platform_device *pdev)*/ 481 /* LDV_COMMENT_BEGIN_PREP */ 482 #define MVMDIO_SMI_DATA_SHIFT 0 483 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 484 #define MVMDIO_SMI_PHY_REG_SHIFT 21 485 #define MVMDIO_SMI_READ_OPERATION BIT(26) 486 #define MVMDIO_SMI_WRITE_OPERATION 0 487 #define MVMDIO_SMI_READ_VALID BIT(27) 488 #define MVMDIO_SMI_BUSY BIT(28) 489 #define MVMDIO_ERR_INT_CAUSE 0x007C 490 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 491 #define MVMDIO_ERR_INT_MASK 0x0080 492 #define MVMDIO_SMI_TIMEOUT 1000 493 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 494 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 495 /* LDV_COMMENT_END_PREP */ 496 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "orion_mdio_driver" */ 497 ldv_handler_precall(); 498 orion_mdio_remove( var_group1); 499 ldv_s_orion_mdio_driver_platform_driver=0; 500 501 } 502 503 } 504 505 break; 506 case 2: { 507 508 /** CALLBACK SECTION request_irq **/ 509 LDV_IN_INTERRUPT=2; 510 511 /* content: static irqreturn_t orion_mdio_err_irq(int irq, void *dev_id)*/ 512 /* LDV_COMMENT_BEGIN_PREP */ 513 #define MVMDIO_SMI_DATA_SHIFT 0 514 #define MVMDIO_SMI_PHY_ADDR_SHIFT 16 515 #define MVMDIO_SMI_PHY_REG_SHIFT 21 516 #define MVMDIO_SMI_READ_OPERATION BIT(26) 517 #define MVMDIO_SMI_WRITE_OPERATION 0 518 #define MVMDIO_SMI_READ_VALID BIT(27) 519 #define MVMDIO_SMI_BUSY BIT(28) 520 #define MVMDIO_ERR_INT_CAUSE 0x007C 521 #define MVMDIO_ERR_INT_SMI_DONE 0x00000010 522 #define MVMDIO_ERR_INT_MASK 0x0080 523 #define MVMDIO_SMI_TIMEOUT 1000 524 #define MVMDIO_SMI_POLL_INTERVAL_MIN 45 525 #define MVMDIO_SMI_POLL_INTERVAL_MAX 55 526 /* LDV_COMMENT_END_PREP */ 527 /* LDV_COMMENT_FUNCTION_CALL */ 528 ldv_handler_precall(); 529 orion_mdio_err_irq( var_orion_mdio_err_irq_4_p0, var_orion_mdio_err_irq_4_p1); 530 LDV_IN_INTERRUPT=1; 531 532 533 534 } 535 536 break; 537 default: break; 538 539 } 540 541 } 542 543 ldv_module_exit: 544 545 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 546 ldv_final: ldv_check_final_state(); 547 548 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 549 return; 550 551 } 552 #endif 553 554 /* LDV_COMMENT_END_MAIN */ 555 556 #line 15 "/home/ldvuser/ldv/ref_launches/work/current--X--drivers--X--defaultlinux-4.8-rc1.tar.xz--X--322_7a--X--cpachecker/linux-4.8-rc1.tar.xz/csd_deg_dscv/12140/dscv_tempdir/dscv/ri/322_7a/drivers/net/ethernet/marvell/mvmdio.o.c.prepared"
1 2 #include <verifier/rcv.h> 3 #include <kernel-model/ERR.inc> 4 5 struct clk; 6 7 8 /* LDV_COMMENT_CHANGE_STATE Initialize counter to zero. */ 9 int ldv_counter_clk = 0; 10 11 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_clk_disable_clk') Release. */ 12 void ldv_clk_disable_clk(struct clk *clk) 13 { 14 /* LDV_COMMENT_ASSERT The clk must be freed only once. */ 15 ldv_assert(ldv_counter_clk==1); 16 /* LDV_COMMENT_CHANGE_STATE Increase counter. */ 17 ldv_counter_clk = 0; 18 } 19 20 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_clk_enable_clk') Reset counter. */ 21 int ldv_clk_enable_clk(void) 22 { 23 int retval = ldv_undef_int(); 24 if (!retval) 25 { 26 /* LDV_COMMENT_CHANGE_STATE Increase counter. */ 27 ldv_counter_clk = 1; 28 } 29 return retval; 30 } 31 32 33 /* LDV_COMMENT_CHANGE_STATE Initialize counter to zero. */ 34 int ldv_counter_clk_of_orion_mdio_dev = 0; 35 36 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_clk_disable_clk_of_orion_mdio_dev') Release. */ 37 void ldv_clk_disable_clk_of_orion_mdio_dev(struct clk *clk) 38 { 39 /* LDV_COMMENT_ASSERT The clk must be freed only once. */ 40 ldv_assert(ldv_counter_clk_of_orion_mdio_dev==1); 41 /* LDV_COMMENT_CHANGE_STATE Increase counter. */ 42 ldv_counter_clk_of_orion_mdio_dev = 0; 43 } 44 45 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_clk_enable_clk_of_orion_mdio_dev') Reset counter. */ 46 int ldv_clk_enable_clk_of_orion_mdio_dev(void) 47 { 48 int retval = ldv_undef_int(); 49 if (!retval) 50 { 51 /* LDV_COMMENT_CHANGE_STATE Increase counter. */ 52 ldv_counter_clk_of_orion_mdio_dev = 1; 53 } 54 return retval; 55 }
1 #ifndef _LDV_ERR_ 2 #define _LDV_ERR_ 3 4 #include <linux/kernel.h> 5 6 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err') This function return result of checking if pointer is impossible. */ 7 bool ldv_is_err(const void *ptr) 8 { 9 /*LDV_COMMENT_RETURN Return value of function ldv_is_err_val().*/ 10 return ((unsigned long)ptr > LDV_PTR_MAX); 11 } 12 13 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_err_ptr') This function return pointer. */ 14 void* ldv_err_ptr(long error) 15 { 16 /*LDV_COMMENT_RETURN Return error pointer.*/ 17 return (void *)(LDV_PTR_MAX - error); 18 } 19 20 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_ptr_err') This function return error if pointer is impossible. */ 21 long ldv_ptr_err(const void *ptr) 22 { 23 /*LDV_COMMENT_RETURN Return error code.*/ 24 return (long)(LDV_PTR_MAX - (unsigned long)ptr); 25 } 26 27 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err_or_null') This function check if pointer is impossible or null. */ 28 bool ldv_is_err_or_null(const void *ptr) 29 { 30 /*LDV_COMMENT_RETURN Return 0 if pointer is possible and not zero, and 1 in other cases*/ 31 return !ptr || ldv_is_err((unsigned long)ptr); 32 } 33 34 #endif /* _LDV_ERR_ */
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 long ldv_undef_long(void); 29 /* Return nondeterministic negative integer number. */ 30 static inline int ldv_undef_int_negative(void) 31 { 32 int ret = ldv_undef_int(); 33 34 ldv_assume(ret < 0); 35 36 return ret; 37 } 38 /* Return nondeterministic nonpositive integer number. */ 39 static inline int ldv_undef_int_nonpositive(void) 40 { 41 int ret = ldv_undef_int(); 42 43 ldv_assume(ret <= 0); 44 45 return ret; 46 } 47 48 /* Add explicit model for __builin_expect GCC function. Without the model a 49 return value will be treated as nondetermined by verifiers. */ 50 static inline long __builtin_expect(long exp, long c) 51 { 52 return exp; 53 } 54 55 /* This function causes the program to exit abnormally. GCC implements this 56 function by using a target-dependent mechanism (such as intentionally executing 57 an illegal instruction) or by calling abort. The mechanism used may vary from 58 release to release so you should not rely on any particular implementation. 59 http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */ 60 static inline void __builtin_trap(void) 61 { 62 ldv_assert(0); 63 } 64 65 /* The constant is for simulating an error of ldv_undef_ptr() function. */ 66 #define LDV_PTR_MAX 2012 67 68 #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 fwnode_handle; 42 struct iommu_ops; 43 struct iommu_group; 44 45 struct bus_attribute { 46 struct attribute attr; 47 ssize_t (*show)(struct bus_type *bus, char *buf); 48 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); 49 }; 50 51 #define BUS_ATTR(_name, _mode, _show, _store) \ 52 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 53 #define BUS_ATTR_RW(_name) \ 54 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) 55 #define BUS_ATTR_RO(_name) \ 56 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) 57 58 extern int __must_check bus_create_file(struct bus_type *, 59 struct bus_attribute *); 60 extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 61 62 /** 63 * struct bus_type - The bus type of the device 64 * 65 * @name: The name of the bus. 66 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 67 * @dev_root: Default device to use as the parent. 68 * @dev_attrs: Default attributes of the devices on the bus. 69 * @bus_groups: Default attributes of the bus. 70 * @dev_groups: Default attributes of the devices on the bus. 71 * @drv_groups: Default attributes of the device drivers on the bus. 72 * @match: Called, perhaps multiple times, whenever a new device or driver 73 * is added for this bus. It should return a positive value if the 74 * given device can be handled by the given driver and zero 75 * otherwise. It may also return error code if determining that 76 * the driver supports the device is not possible. In case of 77 * -EPROBE_DEFER it will queue the device for deferred probing. 78 * @uevent: Called when a device is added, removed, or a few other things 79 * that generate uevents to add the environment variables. 80 * @probe: Called when a new device or driver add to this bus, and callback 81 * the specific driver's probe to initial the matched device. 82 * @remove: Called when a device removed from this bus. 83 * @shutdown: Called at shut-down time to quiesce the device. 84 * 85 * @online: Called to put the device back online (after offlining it). 86 * @offline: Called to put the device offline for hot-removal. May fail. 87 * 88 * @suspend: Called when a device on this bus wants to go to sleep mode. 89 * @resume: Called to bring a device on this bus out of sleep mode. 90 * @pm: Power management operations of this bus, callback the specific 91 * device driver's pm-ops. 92 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU 93 * driver implementations to a bus and allow the driver to do 94 * bus-specific setup 95 * @p: The private data of the driver core, only the driver core can 96 * touch this. 97 * @lock_key: Lock class key for use by the lock validator 98 * 99 * A bus is a channel between the processor and one or more devices. For the 100 * purposes of the device model, all devices are connected via a bus, even if 101 * it is an internal, virtual, "platform" bus. Buses can plug into each other. 102 * A USB controller is usually a PCI device, for example. The device model 103 * represents the actual connections between buses and the devices they control. 104 * A bus is represented by the bus_type structure. It contains the name, the 105 * default attributes, the bus' methods, PM operations, and the driver core's 106 * private data. 107 */ 108 struct bus_type { 109 const char *name; 110 const char *dev_name; 111 struct device *dev_root; 112 struct device_attribute *dev_attrs; /* use dev_groups instead */ 113 const struct attribute_group **bus_groups; 114 const struct attribute_group **dev_groups; 115 const struct attribute_group **drv_groups; 116 117 int (*match)(struct device *dev, struct device_driver *drv); 118 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 119 int (*probe)(struct device *dev); 120 int (*remove)(struct device *dev); 121 void (*shutdown)(struct device *dev); 122 123 int (*online)(struct device *dev); 124 int (*offline)(struct device *dev); 125 126 int (*suspend)(struct device *dev, pm_message_t state); 127 int (*resume)(struct device *dev); 128 129 const struct dev_pm_ops *pm; 130 131 const struct iommu_ops *iommu_ops; 132 133 struct subsys_private *p; 134 struct lock_class_key lock_key; 135 }; 136 137 extern int __must_check bus_register(struct bus_type *bus); 138 139 extern void bus_unregister(struct bus_type *bus); 140 141 extern int __must_check bus_rescan_devices(struct bus_type *bus); 142 143 /* iterator helpers for buses */ 144 struct subsys_dev_iter { 145 struct klist_iter ki; 146 const struct device_type *type; 147 }; 148 void subsys_dev_iter_init(struct subsys_dev_iter *iter, 149 struct bus_type *subsys, 150 struct device *start, 151 const struct device_type *type); 152 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); 153 void subsys_dev_iter_exit(struct subsys_dev_iter *iter); 154 155 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, 156 int (*fn)(struct device *dev, void *data)); 157 struct device *bus_find_device(struct bus_type *bus, struct device *start, 158 void *data, 159 int (*match)(struct device *dev, void *data)); 160 struct device *bus_find_device_by_name(struct bus_type *bus, 161 struct device *start, 162 const char *name); 163 struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, 164 struct device *hint); 165 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, 166 void *data, int (*fn)(struct device_driver *, void *)); 167 void bus_sort_breadthfirst(struct bus_type *bus, 168 int (*compare)(const struct device *a, 169 const struct device *b)); 170 /* 171 * Bus notifiers: Get notified of addition/removal of devices 172 * and binding/unbinding of drivers to devices. 173 * In the long run, it should be a replacement for the platform 174 * notify hooks. 175 */ 176 struct notifier_block; 177 178 extern int bus_register_notifier(struct bus_type *bus, 179 struct notifier_block *nb); 180 extern int bus_unregister_notifier(struct bus_type *bus, 181 struct notifier_block *nb); 182 183 /* All 4 notifers below get called with the target struct device * 184 * as an argument. Note that those functions are likely to be called 185 * with the device lock held in the core, so be careful. 186 */ 187 #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 188 #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */ 189 #define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */ 190 #define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be 191 bound */ 192 #define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */ 193 #define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be 194 unbound */ 195 #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound 196 from the device */ 197 #define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */ 198 199 extern struct kset *bus_get_kset(struct bus_type *bus); 200 extern struct klist *bus_get_device_klist(struct bus_type *bus); 201 202 /** 203 * enum probe_type - device driver probe type to try 204 * Device drivers may opt in for special handling of their 205 * respective probe routines. This tells the core what to 206 * expect and prefer. 207 * 208 * @PROBE_DEFAULT_STRATEGY: Used by drivers that work equally well 209 * whether probed synchronously or asynchronously. 210 * @PROBE_PREFER_ASYNCHRONOUS: Drivers for "slow" devices which 211 * probing order is not essential for booting the system may 212 * opt into executing their probes asynchronously. 213 * @PROBE_FORCE_SYNCHRONOUS: Use this to annotate drivers that need 214 * their probe routines to run synchronously with driver and 215 * device registration (with the exception of -EPROBE_DEFER 216 * handling - re-probing always ends up being done asynchronously). 217 * 218 * Note that the end goal is to switch the kernel to use asynchronous 219 * probing by default, so annotating drivers with 220 * %PROBE_PREFER_ASYNCHRONOUS is a temporary measure that allows us 221 * to speed up boot process while we are validating the rest of the 222 * drivers. 223 */ 224 enum probe_type { 225 PROBE_DEFAULT_STRATEGY, 226 PROBE_PREFER_ASYNCHRONOUS, 227 PROBE_FORCE_SYNCHRONOUS, 228 }; 229 230 /** 231 * struct device_driver - The basic device driver structure 232 * @name: Name of the device driver. 233 * @bus: The bus which the device of this driver belongs to. 234 * @owner: The module owner. 235 * @mod_name: Used for built-in modules. 236 * @suppress_bind_attrs: Disables bind/unbind via sysfs. 237 * @probe_type: Type of the probe (synchronous or asynchronous) to use. 238 * @of_match_table: The open firmware table. 239 * @acpi_match_table: The ACPI match table. 240 * @probe: Called to query the existence of a specific device, 241 * whether this driver can work with it, and bind the driver 242 * to a specific device. 243 * @remove: Called when the device is removed from the system to 244 * unbind a device from this driver. 245 * @shutdown: Called at shut-down time to quiesce the device. 246 * @suspend: Called to put the device to sleep mode. Usually to a 247 * low power state. 248 * @resume: Called to bring a device from sleep mode. 249 * @groups: Default attributes that get created by the driver core 250 * automatically. 251 * @pm: Power management operations of the device which matched 252 * this driver. 253 * @p: Driver core's private data, no one other than the driver 254 * core can touch this. 255 * 256 * The device driver-model tracks all of the drivers known to the system. 257 * The main reason for this tracking is to enable the driver core to match 258 * up drivers with new devices. Once drivers are known objects within the 259 * system, however, a number of other things become possible. Device drivers 260 * can export information and configuration variables that are independent 261 * of any specific device. 262 */ 263 struct device_driver { 264 const char *name; 265 struct bus_type *bus; 266 267 struct module *owner; 268 const char *mod_name; /* used for built-in modules */ 269 270 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 271 enum probe_type probe_type; 272 273 const struct of_device_id *of_match_table; 274 const struct acpi_device_id *acpi_match_table; 275 276 int (*probe) (struct device *dev); 277 int (*remove) (struct device *dev); 278 void (*shutdown) (struct device *dev); 279 int (*suspend) (struct device *dev, pm_message_t state); 280 int (*resume) (struct device *dev); 281 const struct attribute_group **groups; 282 283 const struct dev_pm_ops *pm; 284 285 struct driver_private *p; 286 }; 287 288 289 extern int __must_check driver_register(struct device_driver *drv); 290 extern void driver_unregister(struct device_driver *drv); 291 292 extern struct device_driver *driver_find(const char *name, 293 struct bus_type *bus); 294 extern int driver_probe_done(void); 295 extern void wait_for_device_probe(void); 296 297 298 /* sysfs interface for exporting driver attributes */ 299 300 struct driver_attribute { 301 struct attribute attr; 302 ssize_t (*show)(struct device_driver *driver, char *buf); 303 ssize_t (*store)(struct device_driver *driver, const char *buf, 304 size_t count); 305 }; 306 307 #define DRIVER_ATTR(_name, _mode, _show, _store) \ 308 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) 309 #define DRIVER_ATTR_RW(_name) \ 310 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) 311 #define DRIVER_ATTR_RO(_name) \ 312 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) 313 #define DRIVER_ATTR_WO(_name) \ 314 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name) 315 316 extern int __must_check driver_create_file(struct device_driver *driver, 317 const struct driver_attribute *attr); 318 extern void driver_remove_file(struct device_driver *driver, 319 const struct driver_attribute *attr); 320 321 extern int __must_check driver_for_each_device(struct device_driver *drv, 322 struct device *start, 323 void *data, 324 int (*fn)(struct device *dev, 325 void *)); 326 struct device *driver_find_device(struct device_driver *drv, 327 struct device *start, void *data, 328 int (*match)(struct device *dev, void *data)); 329 330 /** 331 * struct subsys_interface - interfaces to device functions 332 * @name: name of the device function 333 * @subsys: subsytem of the devices to attach to 334 * @node: the list of functions registered at the subsystem 335 * @add_dev: device hookup to device function handler 336 * @remove_dev: device hookup to device function handler 337 * 338 * Simple interfaces attached to a subsystem. Multiple interfaces can 339 * attach to a subsystem and its devices. Unlike drivers, they do not 340 * exclusively claim or control devices. Interfaces usually represent 341 * a specific functionality of a subsystem/class of devices. 342 */ 343 struct subsys_interface { 344 const char *name; 345 struct bus_type *subsys; 346 struct list_head node; 347 int (*add_dev)(struct device *dev, struct subsys_interface *sif); 348 void (*remove_dev)(struct device *dev, struct subsys_interface *sif); 349 }; 350 351 int subsys_interface_register(struct subsys_interface *sif); 352 void subsys_interface_unregister(struct subsys_interface *sif); 353 354 int subsys_system_register(struct bus_type *subsys, 355 const struct attribute_group **groups); 356 int subsys_virtual_register(struct bus_type *subsys, 357 const struct attribute_group **groups); 358 359 /** 360 * struct class - device classes 361 * @name: Name of the class. 362 * @owner: The module owner. 363 * @class_attrs: Default attributes of this class. 364 * @dev_groups: Default attributes of the devices that belong to the class. 365 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 366 * @dev_uevent: Called when a device is added, removed from this class, or a 367 * few other things that generate uevents to add the environment 368 * variables. 369 * @devnode: Callback to provide the devtmpfs. 370 * @class_release: Called to release this class. 371 * @dev_release: Called to release the device. 372 * @suspend: Used to put the device to sleep mode, usually to a low power 373 * state. 374 * @resume: Used to bring the device from the sleep mode. 375 * @ns_type: Callbacks so sysfs can detemine namespaces. 376 * @namespace: Namespace of the device belongs to this class. 377 * @pm: The default device power management operations of this class. 378 * @p: The private data of the driver core, no one other than the 379 * driver core can touch this. 380 * 381 * A class is a higher-level view of a device that abstracts out low-level 382 * implementation details. Drivers may see a SCSI disk or an ATA disk, but, 383 * at the class level, they are all simply disks. Classes allow user space 384 * to work with devices based on what they do, rather than how they are 385 * connected or how they work. 386 */ 387 struct class { 388 const char *name; 389 struct module *owner; 390 391 struct class_attribute *class_attrs; 392 const struct attribute_group **dev_groups; 393 struct kobject *dev_kobj; 394 395 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 396 char *(*devnode)(struct device *dev, umode_t *mode); 397 398 void (*class_release)(struct class *class); 399 void (*dev_release)(struct device *dev); 400 401 int (*suspend)(struct device *dev, pm_message_t state); 402 int (*resume)(struct device *dev); 403 404 const struct kobj_ns_type_operations *ns_type; 405 const void *(*namespace)(struct device *dev); 406 407 const struct dev_pm_ops *pm; 408 409 struct subsys_private *p; 410 }; 411 412 struct class_dev_iter { 413 struct klist_iter ki; 414 const struct device_type *type; 415 }; 416 417 extern struct kobject *sysfs_dev_block_kobj; 418 extern struct kobject *sysfs_dev_char_kobj; 419 extern int __must_check __class_register(struct class *class, 420 struct lock_class_key *key); 421 extern void class_unregister(struct class *class); 422 423 /* This is a #define to keep the compiler from merging different 424 * instances of the __key variable */ 425 #define class_register(class) \ 426 ({ \ 427 static struct lock_class_key __key; \ 428 __class_register(class, &__key); \ 429 }) 430 431 struct class_compat; 432 struct class_compat *class_compat_register(const char *name); 433 void class_compat_unregister(struct class_compat *cls); 434 int class_compat_create_link(struct class_compat *cls, struct device *dev, 435 struct device *device_link); 436 void class_compat_remove_link(struct class_compat *cls, struct device *dev, 437 struct device *device_link); 438 439 extern void class_dev_iter_init(struct class_dev_iter *iter, 440 struct class *class, 441 struct device *start, 442 const struct device_type *type); 443 extern struct device *class_dev_iter_next(struct class_dev_iter *iter); 444 extern void class_dev_iter_exit(struct class_dev_iter *iter); 445 446 extern int class_for_each_device(struct class *class, struct device *start, 447 void *data, 448 int (*fn)(struct device *dev, void *data)); 449 extern struct device *class_find_device(struct class *class, 450 struct device *start, const void *data, 451 int (*match)(struct device *, const void *)); 452 453 struct class_attribute { 454 struct attribute attr; 455 ssize_t (*show)(struct class *class, struct class_attribute *attr, 456 char *buf); 457 ssize_t (*store)(struct class *class, struct class_attribute *attr, 458 const char *buf, size_t count); 459 }; 460 461 #define CLASS_ATTR(_name, _mode, _show, _store) \ 462 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 463 #define CLASS_ATTR_RW(_name) \ 464 struct class_attribute class_attr_##_name = __ATTR_RW(_name) 465 #define CLASS_ATTR_RO(_name) \ 466 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 467 468 extern int __must_check class_create_file_ns(struct class *class, 469 const struct class_attribute *attr, 470 const void *ns); 471 extern void class_remove_file_ns(struct class *class, 472 const struct class_attribute *attr, 473 const void *ns); 474 475 static inline int __must_check class_create_file(struct class *class, 476 const struct class_attribute *attr) 477 { 478 return class_create_file_ns(class, attr, NULL); 479 } 480 481 static inline void class_remove_file(struct class *class, 482 const struct class_attribute *attr) 483 { 484 return class_remove_file_ns(class, attr, NULL); 485 } 486 487 /* Simple class attribute that is just a static string */ 488 struct class_attribute_string { 489 struct class_attribute attr; 490 char *str; 491 }; 492 493 /* Currently read-only only */ 494 #define _CLASS_ATTR_STRING(_name, _mode, _str) \ 495 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str } 496 #define CLASS_ATTR_STRING(_name, _mode, _str) \ 497 struct class_attribute_string class_attr_##_name = \ 498 _CLASS_ATTR_STRING(_name, _mode, _str) 499 500 extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr, 501 char *buf); 502 503 struct class_interface { 504 struct list_head node; 505 struct class *class; 506 507 int (*add_dev) (struct device *, struct class_interface *); 508 void (*remove_dev) (struct device *, struct class_interface *); 509 }; 510 511 extern int __must_check class_interface_register(struct class_interface *); 512 extern void class_interface_unregister(struct class_interface *); 513 514 extern struct class * __must_check __class_create(struct module *owner, 515 const char *name, 516 struct lock_class_key *key); 517 extern void class_destroy(struct class *cls); 518 519 /* This is a #define to keep the compiler from merging different 520 * instances of the __key variable */ 521 #define class_create(owner, name) \ 522 ({ \ 523 static struct lock_class_key __key; \ 524 __class_create(owner, name, &__key); \ 525 }) 526 527 /* 528 * The type of device, "struct device" is embedded in. A class 529 * or bus can contain devices of different types 530 * like "partitions" and "disks", "mouse" and "event". 531 * This identifies the device type and carries type-specific 532 * information, equivalent to the kobj_type of a kobject. 533 * If "name" is specified, the uevent will contain it in 534 * the DEVTYPE variable. 535 */ 536 struct device_type { 537 const char *name; 538 const struct attribute_group **groups; 539 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 540 char *(*devnode)(struct device *dev, umode_t *mode, 541 kuid_t *uid, kgid_t *gid); 542 void (*release)(struct device *dev); 543 544 const struct dev_pm_ops *pm; 545 }; 546 547 /* interface for exporting device attributes */ 548 struct device_attribute { 549 struct attribute attr; 550 ssize_t (*show)(struct device *dev, struct device_attribute *attr, 551 char *buf); 552 ssize_t (*store)(struct device *dev, struct device_attribute *attr, 553 const char *buf, size_t count); 554 }; 555 556 struct dev_ext_attribute { 557 struct device_attribute attr; 558 void *var; 559 }; 560 561 ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, 562 char *buf); 563 ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, 564 const char *buf, size_t count); 565 ssize_t device_show_int(struct device *dev, struct device_attribute *attr, 566 char *buf); 567 ssize_t device_store_int(struct device *dev, struct device_attribute *attr, 568 const char *buf, size_t count); 569 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr, 570 char *buf); 571 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, 572 const char *buf, size_t count); 573 574 #define DEVICE_ATTR(_name, _mode, _show, _store) \ 575 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 576 #define DEVICE_ATTR_RW(_name) \ 577 struct device_attribute dev_attr_##_name = __ATTR_RW(_name) 578 #define DEVICE_ATTR_RO(_name) \ 579 struct device_attribute dev_attr_##_name = __ATTR_RO(_name) 580 #define DEVICE_ATTR_WO(_name) \ 581 struct device_attribute dev_attr_##_name = __ATTR_WO(_name) 582 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 583 struct dev_ext_attribute dev_attr_##_name = \ 584 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 585 #define DEVICE_INT_ATTR(_name, _mode, _var) \ 586 struct dev_ext_attribute dev_attr_##_name = \ 587 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } 588 #define DEVICE_BOOL_ATTR(_name, _mode, _var) \ 589 struct dev_ext_attribute dev_attr_##_name = \ 590 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) } 591 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ 592 struct device_attribute dev_attr_##_name = \ 593 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) 594 595 extern int device_create_file(struct device *device, 596 const struct device_attribute *entry); 597 extern void device_remove_file(struct device *dev, 598 const struct device_attribute *attr); 599 extern bool device_remove_file_self(struct device *dev, 600 const struct device_attribute *attr); 601 extern int __must_check device_create_bin_file(struct device *dev, 602 const struct bin_attribute *attr); 603 extern void device_remove_bin_file(struct device *dev, 604 const struct bin_attribute *attr); 605 606 /* device resource management */ 607 typedef void (*dr_release_t)(struct device *dev, void *res); 608 typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 609 610 #ifdef CONFIG_DEBUG_DEVRES 611 extern void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 612 int nid, const char *name) __malloc; 613 #define devres_alloc(release, size, gfp) \ 614 __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) 615 #define devres_alloc_node(release, size, gfp, nid) \ 616 __devres_alloc_node(release, size, gfp, nid, #release) 617 #else 618 extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, 619 int nid) __malloc; 620 static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) 621 { 622 return devres_alloc_node(release, size, gfp, NUMA_NO_NODE); 623 } 624 #endif 625 626 extern void devres_for_each_res(struct device *dev, dr_release_t release, 627 dr_match_t match, void *match_data, 628 void (*fn)(struct device *, void *, void *), 629 void *data); 630 extern void devres_free(void *res); 631 extern void devres_add(struct device *dev, void *res); 632 extern void *devres_find(struct device *dev, dr_release_t release, 633 dr_match_t match, void *match_data); 634 extern void *devres_get(struct device *dev, void *new_res, 635 dr_match_t match, void *match_data); 636 extern void *devres_remove(struct device *dev, dr_release_t release, 637 dr_match_t match, void *match_data); 638 extern int devres_destroy(struct device *dev, dr_release_t release, 639 dr_match_t match, void *match_data); 640 extern int devres_release(struct device *dev, dr_release_t release, 641 dr_match_t match, void *match_data); 642 643 /* devres group */ 644 extern void * __must_check devres_open_group(struct device *dev, void *id, 645 gfp_t gfp); 646 extern void devres_close_group(struct device *dev, void *id); 647 extern void devres_remove_group(struct device *dev, void *id); 648 extern int devres_release_group(struct device *dev, void *id); 649 650 /* managed devm_k.alloc/kfree for device drivers */ 651 extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; 652 extern __printf(3, 0) 653 char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 654 va_list ap) __malloc; 655 extern __printf(3, 4) 656 char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) __malloc; 657 static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 658 { 659 return devm_kmalloc(dev, size, gfp | __GFP_ZERO); 660 } 661 static inline void *devm_kmalloc_array(struct device *dev, 662 size_t n, size_t size, gfp_t flags) 663 { 664 if (size != 0 && n > SIZE_MAX / size) 665 return NULL; 666 return devm_kmalloc(dev, n * size, flags); 667 } 668 static inline void *devm_kcalloc(struct device *dev, 669 size_t n, size_t size, gfp_t flags) 670 { 671 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 672 } 673 extern void devm_kfree(struct device *dev, void *p); 674 extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; 675 extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, 676 gfp_t gfp); 677 678 extern unsigned long devm_get_free_pages(struct device *dev, 679 gfp_t gfp_mask, unsigned int order); 680 extern void devm_free_pages(struct device *dev, unsigned long addr); 681 682 void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 683 684 /* allows to add/remove a custom action to devres stack */ 685 int devm_add_action(struct device *dev, void (*action)(void *), void *data); 686 void devm_remove_action(struct device *dev, void (*action)(void *), void *data); 687 688 static inline int devm_add_action_or_reset(struct device *dev, 689 void (*action)(void *), void *data) 690 { 691 int ret; 692 693 ret = devm_add_action(dev, action, data); 694 if (ret) 695 action(data); 696 697 return ret; 698 } 699 700 struct device_dma_parameters { 701 /* 702 * a low level driver may set these to teach IOMMU code about 703 * sg limitations. 704 */ 705 unsigned int max_segment_size; 706 unsigned long segment_boundary_mask; 707 }; 708 709 /** 710 * struct device - The basic device structure 711 * @parent: The device's "parent" device, the device to which it is attached. 712 * In most cases, a parent device is some sort of bus or host 713 * controller. If parent is NULL, the device, is a top-level device, 714 * which is not usually what you want. 715 * @p: Holds the private data of the driver core portions of the device. 716 * See the comment of the struct device_private for detail. 717 * @kobj: A top-level, abstract class from which other classes are derived. 718 * @init_name: Initial name of the device. 719 * @type: The type of device. 720 * This identifies the device type and carries type-specific 721 * information. 722 * @mutex: Mutex to synchronize calls to its driver. 723 * @bus: Type of bus device is on. 724 * @driver: Which driver has allocated this 725 * @platform_data: Platform data specific to the device. 726 * Example: For devices on custom boards, as typical of embedded 727 * and SOC based hardware, Linux often uses platform_data to point 728 * to board-specific structures describing devices and how they 729 * are wired. That can include what ports are available, chip 730 * variants, which GPIO pins act in what additional roles, and so 731 * on. This shrinks the "Board Support Packages" (BSPs) and 732 * minimizes board-specific #ifdefs in drivers. 733 * @driver_data: Private pointer for driver specific info. 734 * @power: For device power management. 735 * See Documentation/power/devices.txt for details. 736 * @pm_domain: Provide callbacks that are executed during system suspend, 737 * hibernation, system resume and during runtime PM transitions 738 * along with subsystem-level and driver-level callbacks. 739 * @pins: For device pin management. 740 * See Documentation/pinctrl.txt for details. 741 * @msi_list: Hosts MSI descriptors 742 * @msi_domain: The generic MSI domain this device is using. 743 * @numa_node: NUMA node this device is close to. 744 * @dma_mask: Dma mask (if dma'ble device). 745 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 746 * hardware supports 64-bit addresses for consistent allocations 747 * such descriptors. 748 * @dma_pfn_offset: offset of DMA memory range relatively of RAM 749 * @dma_parms: A low level driver may set these to teach IOMMU code about 750 * segment limitations. 751 * @dma_pools: Dma pools (if dma'ble device). 752 * @dma_mem: Internal for coherent mem override. 753 * @cma_area: Contiguous memory area for dma allocations 754 * @archdata: For arch-specific additions. 755 * @of_node: Associated device tree node. 756 * @fwnode: Associated device node supplied by platform firmware. 757 * @devt: For creating the sysfs "dev". 758 * @id: device instance 759 * @devres_lock: Spinlock to protect the resource of the device. 760 * @devres_head: The resources list of the device. 761 * @knode_class: The node used to add the device to the class list. 762 * @class: The class of the device. 763 * @groups: Optional attribute groups. 764 * @release: Callback to free the device after all references have 765 * gone away. This should be set by the allocator of the 766 * device (i.e. the bus driver that discovered the device). 767 * @iommu_group: IOMMU group the device belongs to. 768 * 769 * @offline_disabled: If set, the device is permanently online. 770 * @offline: Set after successful invocation of bus type's .offline(). 771 * 772 * At the lowest level, every device in a Linux system is represented by an 773 * instance of struct device. The device structure contains the information 774 * that the device model core needs to model the system. Most subsystems, 775 * however, track additional information about the devices they host. As a 776 * result, it is rare for devices to be represented by bare device structures; 777 * instead, that structure, like kobject structures, is usually embedded within 778 * a higher-level representation of the device. 779 */ 780 struct device { 781 struct device *parent; 782 783 struct device_private *p; 784 785 struct kobject kobj; 786 const char *init_name; /* initial name of the device */ 787 const struct device_type *type; 788 789 struct mutex mutex; /* mutex to synchronize calls to 790 * its driver. 791 */ 792 793 struct bus_type *bus; /* type of bus device is on */ 794 struct device_driver *driver; /* which driver has allocated this 795 device */ 796 void *platform_data; /* Platform specific data, device 797 core doesn't touch it */ 798 void *driver_data; /* Driver data, set and get with 799 dev_set/get_drvdata */ 800 struct dev_pm_info power; 801 struct dev_pm_domain *pm_domain; 802 803 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 804 struct irq_domain *msi_domain; 805 #endif 806 #ifdef CONFIG_PINCTRL 807 struct dev_pin_info *pins; 808 #endif 809 #ifdef CONFIG_GENERIC_MSI_IRQ 810 struct list_head msi_list; 811 #endif 812 813 #ifdef CONFIG_NUMA 814 int numa_node; /* NUMA node this device is close to */ 815 #endif 816 u64 *dma_mask; /* dma mask (if dma'able device) */ 817 u64 coherent_dma_mask;/* Like dma_mask, but for 818 alloc_coherent mappings as 819 not all hardware supports 820 64 bit addresses for consistent 821 allocations such descriptors. */ 822 unsigned long dma_pfn_offset; 823 824 struct device_dma_parameters *dma_parms; 825 826 struct list_head dma_pools; /* dma pools (if dma'ble) */ 827 828 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 829 override */ 830 #ifdef CONFIG_DMA_CMA 831 struct cma *cma_area; /* contiguous memory area for dma 832 allocations */ 833 #endif 834 /* arch specific additions */ 835 struct dev_archdata archdata; 836 837 struct device_node *of_node; /* associated device tree node */ 838 struct fwnode_handle *fwnode; /* firmware device node */ 839 840 dev_t devt; /* dev_t, creates the sysfs "dev" */ 841 u32 id; /* device instance */ 842 843 spinlock_t devres_lock; 844 struct list_head devres_head; 845 846 struct klist_node knode_class; 847 struct class *class; 848 const struct attribute_group **groups; /* optional groups */ 849 850 void (*release)(struct device *dev); 851 struct iommu_group *iommu_group; 852 853 bool offline_disabled:1; 854 bool offline:1; 855 }; 856 857 static inline struct device *kobj_to_dev(struct kobject *kobj) 858 { 859 return container_of(kobj, struct device, kobj); 860 } 861 862 /* Get the wakeup routines, which depend on struct device */ 863 #include <linux/pm_wakeup.h> 864 865 static inline const char *dev_name(const struct device *dev) 866 { 867 /* Use the init name until the kobject becomes available */ 868 if (dev->init_name) 869 return dev->init_name; 870 871 return kobject_name(&dev->kobj); 872 } 873 874 extern __printf(2, 3) 875 int dev_set_name(struct device *dev, const char *name, ...); 876 877 #ifdef CONFIG_NUMA 878 static inline int dev_to_node(struct device *dev) 879 { 880 return dev->numa_node; 881 } 882 static inline void set_dev_node(struct device *dev, int node) 883 { 884 dev->numa_node = node; 885 } 886 #else 887 static inline int dev_to_node(struct device *dev) 888 { 889 return -1; 890 } 891 static inline void set_dev_node(struct device *dev, int node) 892 { 893 } 894 #endif 895 896 static inline struct irq_domain *dev_get_msi_domain(const struct device *dev) 897 { 898 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 899 return dev->msi_domain; 900 #else 901 return NULL; 902 #endif 903 } 904 905 static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d) 906 { 907 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN 908 dev->msi_domain = d; 909 #endif 910 } 911 912 static inline void *dev_get_drvdata(const struct device *dev) 913 { 914 return dev->driver_data; 915 } 916 917 static inline void dev_set_drvdata(struct device *dev, void *data) 918 { 919 dev->driver_data = data; 920 } 921 922 static inline struct pm_subsys_data *dev_to_psd(struct device *dev) 923 { 924 return dev ? dev->power.subsys_data : NULL; 925 } 926 927 static inline unsigned int dev_get_uevent_suppress(const struct device *dev) 928 { 929 return dev->kobj.uevent_suppress; 930 } 931 932 static inline void dev_set_uevent_suppress(struct device *dev, int val) 933 { 934 dev->kobj.uevent_suppress = val; 935 } 936 937 static inline int device_is_registered(struct device *dev) 938 { 939 return dev->kobj.state_in_sysfs; 940 } 941 942 static inline void device_enable_async_suspend(struct device *dev) 943 { 944 if (!dev->power.is_prepared) 945 dev->power.async_suspend = true; 946 } 947 948 static inline void device_disable_async_suspend(struct device *dev) 949 { 950 if (!dev->power.is_prepared) 951 dev->power.async_suspend = false; 952 } 953 954 static inline bool device_async_suspend_enabled(struct device *dev) 955 { 956 return !!dev->power.async_suspend; 957 } 958 959 static inline void dev_pm_syscore_device(struct device *dev, bool val) 960 { 961 #ifdef CONFIG_PM_SLEEP 962 dev->power.syscore = val; 963 #endif 964 } 965 966 static inline void device_lock(struct device *dev) 967 { 968 mutex_lock(&dev->mutex); 969 } 970 971 static inline int device_lock_interruptible(struct device *dev) 972 { 973 return mutex_lock_interruptible(&dev->mutex); 974 } 975 976 static inline int device_trylock(struct device *dev) 977 { 978 return mutex_trylock(&dev->mutex); 979 } 980 981 static inline void device_unlock(struct device *dev) 982 { 983 mutex_unlock(&dev->mutex); 984 } 985 986 static inline void device_lock_assert(struct device *dev) 987 { 988 lockdep_assert_held(&dev->mutex); 989 } 990 991 static inline struct device_node *dev_of_node(struct device *dev) 992 { 993 if (!IS_ENABLED(CONFIG_OF)) 994 return NULL; 995 return dev->of_node; 996 } 997 998 void driver_init(void); 999 1000 /* 1001 * High level routines for use by the bus drivers 1002 */ 1003 extern int __must_check device_register(struct device *dev); 1004 extern void device_unregister(struct device *dev); 1005 extern void device_initialize(struct device *dev); 1006 extern int __must_check device_add(struct device *dev); 1007 extern void device_del(struct device *dev); 1008 extern int device_for_each_child(struct device *dev, void *data, 1009 int (*fn)(struct device *dev, void *data)); 1010 extern int device_for_each_child_reverse(struct device *dev, void *data, 1011 int (*fn)(struct device *dev, void *data)); 1012 extern struct device *device_find_child(struct device *dev, void *data, 1013 int (*match)(struct device *dev, void *data)); 1014 extern int device_rename(struct device *dev, const char *new_name); 1015 extern int device_move(struct device *dev, struct device *new_parent, 1016 enum dpm_order dpm_order); 1017 extern const char *device_get_devnode(struct device *dev, 1018 umode_t *mode, kuid_t *uid, kgid_t *gid, 1019 const char **tmp); 1020 1021 static inline bool device_supports_offline(struct device *dev) 1022 { 1023 return dev->bus && dev->bus->offline && dev->bus->online; 1024 } 1025 1026 extern void lock_device_hotplug(void); 1027 extern void unlock_device_hotplug(void); 1028 extern int lock_device_hotplug_sysfs(void); 1029 extern int device_offline(struct device *dev); 1030 extern int device_online(struct device *dev); 1031 extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 1032 extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); 1033 1034 /* 1035 * Root device objects for grouping under /sys/devices 1036 */ 1037 extern struct device *__root_device_register(const char *name, 1038 struct module *owner); 1039 1040 /* This is a macro to avoid include problems with THIS_MODULE */ 1041 #define root_device_register(name) \ 1042 __root_device_register(name, THIS_MODULE) 1043 1044 extern void root_device_unregister(struct device *root); 1045 1046 static inline void *dev_get_platdata(const struct device *dev) 1047 { 1048 return dev->platform_data; 1049 } 1050 1051 /* 1052 * Manual binding of a device to driver. See drivers/base/bus.c 1053 * for information on use. 1054 */ 1055 extern int __must_check device_bind_driver(struct device *dev); 1056 extern void device_release_driver(struct device *dev); 1057 extern int __must_check device_attach(struct device *dev); 1058 extern int __must_check driver_attach(struct device_driver *drv); 1059 extern void device_initial_probe(struct device *dev); 1060 extern int __must_check device_reprobe(struct device *dev); 1061 1062 extern bool device_is_bound(struct device *dev); 1063 1064 /* 1065 * Easy functions for dynamically creating devices on the fly 1066 */ 1067 extern __printf(5, 0) 1068 struct device *device_create_vargs(struct class *cls, struct device *parent, 1069 dev_t devt, void *drvdata, 1070 const char *fmt, va_list vargs); 1071 extern __printf(5, 6) 1072 struct device *device_create(struct class *cls, struct device *parent, 1073 dev_t devt, void *drvdata, 1074 const char *fmt, ...); 1075 extern __printf(6, 7) 1076 struct device *device_create_with_groups(struct class *cls, 1077 struct device *parent, dev_t devt, void *drvdata, 1078 const struct attribute_group **groups, 1079 const char *fmt, ...); 1080 extern void device_destroy(struct class *cls, dev_t devt); 1081 1082 /* 1083 * Platform "fixup" functions - allow the platform to have their say 1084 * about devices and actions that the general device layer doesn't 1085 * know about. 1086 */ 1087 /* Notify platform of device discovery */ 1088 extern int (*platform_notify)(struct device *dev); 1089 1090 extern int (*platform_notify_remove)(struct device *dev); 1091 1092 1093 /* 1094 * get_device - atomically increment the reference count for the device. 1095 * 1096 */ 1097 extern struct device *get_device(struct device *dev); 1098 extern void put_device(struct device *dev); 1099 1100 #ifdef CONFIG_DEVTMPFS 1101 extern int devtmpfs_create_node(struct device *dev); 1102 extern int devtmpfs_delete_node(struct device *dev); 1103 extern int devtmpfs_mount(const char *mntdir); 1104 #else 1105 static inline int devtmpfs_create_node(struct device *dev) { return 0; } 1106 static inline int devtmpfs_delete_node(struct device *dev) { return 0; } 1107 static inline int devtmpfs_mount(const char *mountpoint) { return 0; } 1108 #endif 1109 1110 /* drivers/base/power/shutdown.c */ 1111 extern void device_shutdown(void); 1112 1113 /* debugging and troubleshooting/diagnostic helpers. */ 1114 extern const char *dev_driver_string(const struct device *dev); 1115 1116 1117 #ifdef CONFIG_PRINTK 1118 1119 extern __printf(3, 0) 1120 int dev_vprintk_emit(int level, const struct device *dev, 1121 const char *fmt, va_list args); 1122 extern __printf(3, 4) 1123 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); 1124 1125 extern __printf(3, 4) 1126 void dev_printk(const char *level, const struct device *dev, 1127 const char *fmt, ...); 1128 extern __printf(2, 3) 1129 void dev_emerg(const struct device *dev, const char *fmt, ...); 1130 extern __printf(2, 3) 1131 void dev_alert(const struct device *dev, const char *fmt, ...); 1132 extern __printf(2, 3) 1133 void dev_crit(const struct device *dev, const char *fmt, ...); 1134 extern __printf(2, 3) 1135 void dev_err(const struct device *dev, const char *fmt, ...); 1136 extern __printf(2, 3) 1137 void dev_warn(const struct device *dev, const char *fmt, ...); 1138 extern __printf(2, 3) 1139 void dev_notice(const struct device *dev, const char *fmt, ...); 1140 extern __printf(2, 3) 1141 void _dev_info(const struct device *dev, const char *fmt, ...); 1142 1143 #else 1144 1145 static inline __printf(3, 0) 1146 int dev_vprintk_emit(int level, const struct device *dev, 1147 const char *fmt, va_list args) 1148 { return 0; } 1149 static inline __printf(3, 4) 1150 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...) 1151 { return 0; } 1152 1153 static inline void __dev_printk(const char *level, const struct device *dev, 1154 struct va_format *vaf) 1155 {} 1156 static inline __printf(3, 4) 1157 void dev_printk(const char *level, const struct device *dev, 1158 const char *fmt, ...) 1159 {} 1160 1161 static inline __printf(2, 3) 1162 void dev_emerg(const struct device *dev, const char *fmt, ...) 1163 {} 1164 static inline __printf(2, 3) 1165 void dev_crit(const struct device *dev, const char *fmt, ...) 1166 {} 1167 static inline __printf(2, 3) 1168 void dev_alert(const struct device *dev, const char *fmt, ...) 1169 {} 1170 static inline __printf(2, 3) 1171 void dev_err(const struct device *dev, const char *fmt, ...) 1172 {} 1173 static inline __printf(2, 3) 1174 void dev_warn(const struct device *dev, const char *fmt, ...) 1175 {} 1176 static inline __printf(2, 3) 1177 void dev_notice(const struct device *dev, const char *fmt, ...) 1178 {} 1179 static inline __printf(2, 3) 1180 void _dev_info(const struct device *dev, const char *fmt, ...) 1181 {} 1182 1183 #endif 1184 1185 /* 1186 * Stupid hackaround for existing uses of non-printk uses dev_info 1187 * 1188 * Note that the definition of dev_info below is actually _dev_info 1189 * and a macro is used to avoid redefining dev_info 1190 */ 1191 1192 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) 1193 1194 #if defined(CONFIG_DYNAMIC_DEBUG) 1195 #define dev_dbg(dev, format, ...) \ 1196 do { \ 1197 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 1198 } while (0) 1199 #elif defined(DEBUG) 1200 #define dev_dbg(dev, format, arg...) \ 1201 dev_printk(KERN_DEBUG, dev, format, ##arg) 1202 #else 1203 #define dev_dbg(dev, format, arg...) \ 1204 ({ \ 1205 if (0) \ 1206 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1207 }) 1208 #endif 1209 1210 #ifdef CONFIG_PRINTK 1211 #define dev_level_once(dev_level, dev, fmt, ...) \ 1212 do { \ 1213 static bool __print_once __read_mostly; \ 1214 \ 1215 if (!__print_once) { \ 1216 __print_once = true; \ 1217 dev_level(dev, fmt, ##__VA_ARGS__); \ 1218 } \ 1219 } while (0) 1220 #else 1221 #define dev_level_once(dev_level, dev, fmt, ...) \ 1222 do { \ 1223 if (0) \ 1224 dev_level(dev, fmt, ##__VA_ARGS__); \ 1225 } while (0) 1226 #endif 1227 1228 #define dev_emerg_once(dev, fmt, ...) \ 1229 dev_level_once(dev_emerg, dev, fmt, ##__VA_ARGS__) 1230 #define dev_alert_once(dev, fmt, ...) \ 1231 dev_level_once(dev_alert, dev, fmt, ##__VA_ARGS__) 1232 #define dev_crit_once(dev, fmt, ...) \ 1233 dev_level_once(dev_crit, dev, fmt, ##__VA_ARGS__) 1234 #define dev_err_once(dev, fmt, ...) \ 1235 dev_level_once(dev_err, dev, fmt, ##__VA_ARGS__) 1236 #define dev_warn_once(dev, fmt, ...) \ 1237 dev_level_once(dev_warn, dev, fmt, ##__VA_ARGS__) 1238 #define dev_notice_once(dev, fmt, ...) \ 1239 dev_level_once(dev_notice, dev, fmt, ##__VA_ARGS__) 1240 #define dev_info_once(dev, fmt, ...) \ 1241 dev_level_once(dev_info, dev, fmt, ##__VA_ARGS__) 1242 #define dev_dbg_once(dev, fmt, ...) \ 1243 dev_level_once(dev_dbg, dev, fmt, ##__VA_ARGS__) 1244 1245 #define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 1246 do { \ 1247 static DEFINE_RATELIMIT_STATE(_rs, \ 1248 DEFAULT_RATELIMIT_INTERVAL, \ 1249 DEFAULT_RATELIMIT_BURST); \ 1250 if (__ratelimit(&_rs)) \ 1251 dev_level(dev, fmt, ##__VA_ARGS__); \ 1252 } while (0) 1253 1254 #define dev_emerg_ratelimited(dev, fmt, ...) \ 1255 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) 1256 #define dev_alert_ratelimited(dev, fmt, ...) \ 1257 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) 1258 #define dev_crit_ratelimited(dev, fmt, ...) \ 1259 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) 1260 #define dev_err_ratelimited(dev, fmt, ...) \ 1261 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) 1262 #define dev_warn_ratelimited(dev, fmt, ...) \ 1263 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__) 1264 #define dev_notice_ratelimited(dev, fmt, ...) \ 1265 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1266 #define dev_info_ratelimited(dev, fmt, ...) \ 1267 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1268 #if defined(CONFIG_DYNAMIC_DEBUG) 1269 /* descriptor check is first to prevent flooding with "callbacks suppressed" */ 1270 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1271 do { \ 1272 static DEFINE_RATELIMIT_STATE(_rs, \ 1273 DEFAULT_RATELIMIT_INTERVAL, \ 1274 DEFAULT_RATELIMIT_BURST); \ 1275 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ 1276 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ 1277 __ratelimit(&_rs)) \ 1278 __dynamic_dev_dbg(&descriptor, dev, fmt, \ 1279 ##__VA_ARGS__); \ 1280 } while (0) 1281 #elif defined(DEBUG) 1282 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1283 do { \ 1284 static DEFINE_RATELIMIT_STATE(_rs, \ 1285 DEFAULT_RATELIMIT_INTERVAL, \ 1286 DEFAULT_RATELIMIT_BURST); \ 1287 if (__ratelimit(&_rs)) \ 1288 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1289 } while (0) 1290 #else 1291 #define dev_dbg_ratelimited(dev, fmt, ...) \ 1292 do { \ 1293 if (0) \ 1294 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 1295 } while (0) 1296 #endif 1297 1298 #ifdef VERBOSE_DEBUG 1299 #define dev_vdbg dev_dbg 1300 #else 1301 #define dev_vdbg(dev, format, arg...) \ 1302 ({ \ 1303 if (0) \ 1304 dev_printk(KERN_DEBUG, dev, format, ##arg); \ 1305 }) 1306 #endif 1307 1308 /* 1309 * dev_WARN*() acts like dev_printk(), but with the key difference of 1310 * using WARN/WARN_ONCE to include file/line information and a backtrace. 1311 */ 1312 #define dev_WARN(dev, format, arg...) \ 1313 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg); 1314 1315 #define dev_WARN_ONCE(dev, condition, format, arg...) \ 1316 WARN_ONCE(condition, "%s %s: " format, \ 1317 dev_driver_string(dev), dev_name(dev), ## arg) 1318 1319 /* Create alias, so I can be autoloaded. */ 1320 #define MODULE_ALIAS_CHARDEV(major,minor) \ 1321 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 1322 #define MODULE_ALIAS_CHARDEV_MAJOR(major) \ 1323 MODULE_ALIAS("char-major-" __stringify(major) "-*") 1324 1325 #ifdef CONFIG_SYSFS_DEPRECATED 1326 extern long sysfs_deprecated; 1327 #else 1328 #define sysfs_deprecated 0 1329 #endif 1330 1331 /** 1332 * module_driver() - Helper macro for drivers that don't do anything 1333 * special in module init/exit. This eliminates a lot of boilerplate. 1334 * Each module may only use this macro once, and calling it replaces 1335 * module_init() and module_exit(). 1336 * 1337 * @__driver: driver name 1338 * @__register: register function for this driver type 1339 * @__unregister: unregister function for this driver type 1340 * @...: Additional arguments to be passed to __register and __unregister. 1341 * 1342 * Use this macro to construct bus specific macros for registering 1343 * drivers, and do not use it on its own. 1344 */ 1345 #define module_driver(__driver, __register, __unregister, ...) \ 1346 static int __init __driver##_init(void) \ 1347 { \ 1348 return __register(&(__driver) , ##__VA_ARGS__); \ 1349 } \ 1350 module_init(__driver##_init); \ 1351 static void __exit __driver##_exit(void) \ 1352 { \ 1353 __unregister(&(__driver) , ##__VA_ARGS__); \ 1354 } \ 1355 module_exit(__driver##_exit); 1356 1357 /** 1358 * builtin_driver() - Helper macro for drivers that don't do anything 1359 * special in init and have no exit. This eliminates some boilerplate. 1360 * Each driver may only use this macro once, and calling it replaces 1361 * device_initcall (or in some cases, the legacy __initcall). This is 1362 * meant to be a direct parallel of module_driver() above but without 1363 * the __exit stuff that is not used for builtin cases. 1364 * 1365 * @__driver: driver name 1366 * @__register: register function for this driver type 1367 * @...: Additional arguments to be passed to __register 1368 * 1369 * Use this macro to construct bus specific macros for registering 1370 * drivers, and do not use it on its own. 1371 */ 1372 #define builtin_driver(__driver, __register, ...) \ 1373 static int __init __driver##_init(void) \ 1374 { \ 1375 return __register(&(__driver) , ##__VA_ARGS__); \ 1376 } \ 1377 device_initcall(__driver##_init); 1378 1379 #endif /* _DEVICE_H_ */
1 /* 2 * ioport.h Definitions of routines for detecting, reserving and 3 * allocating system resources. 4 * 5 * Authors: Linus Torvalds 6 */ 7 8 #ifndef _LINUX_IOPORT_H 9 #define _LINUX_IOPORT_H 10 11 #ifndef __ASSEMBLY__ 12 #include <linux/compiler.h> 13 #include <linux/types.h> 14 /* 15 * Resources are tree-like, allowing 16 * nesting etc.. 17 */ 18 struct resource { 19 resource_size_t start; 20 resource_size_t end; 21 const char *name; 22 unsigned long flags; 23 unsigned long desc; 24 struct resource *parent, *sibling, *child; 25 }; 26 27 /* 28 * IO resources have these defined flags. 29 * 30 * PCI devices expose these flags to userspace in the "resource" sysfs file, 31 * so don't move them. 32 */ 33 #define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 34 35 #define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ 36 #define IORESOURCE_IO 0x00000100 /* PCI/ISA I/O ports */ 37 #define IORESOURCE_MEM 0x00000200 38 #define IORESOURCE_REG 0x00000300 /* Register offsets */ 39 #define IORESOURCE_IRQ 0x00000400 40 #define IORESOURCE_DMA 0x00000800 41 #define IORESOURCE_BUS 0x00001000 42 43 #define IORESOURCE_PREFETCH 0x00002000 /* No side effects */ 44 #define IORESOURCE_READONLY 0x00004000 45 #define IORESOURCE_CACHEABLE 0x00008000 46 #define IORESOURCE_RANGELENGTH 0x00010000 47 #define IORESOURCE_SHADOWABLE 0x00020000 48 49 #define IORESOURCE_SIZEALIGN 0x00040000 /* size indicates alignment */ 50 #define IORESOURCE_STARTALIGN 0x00080000 /* start field is alignment */ 51 52 #define IORESOURCE_MEM_64 0x00100000 53 #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ 54 #define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */ 55 56 #define IORESOURCE_EXT_TYPE_BITS 0x01000000 /* Resource extended types */ 57 #define IORESOURCE_SYSRAM 0x01000000 /* System RAM (modifier) */ 58 59 #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 60 61 #define IORESOURCE_DISABLED 0x10000000 62 #define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */ 63 #define IORESOURCE_AUTO 0x40000000 64 #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 65 66 /* I/O resource extended types */ 67 #define IORESOURCE_SYSTEM_RAM (IORESOURCE_MEM|IORESOURCE_SYSRAM) 68 69 /* PnP IRQ specific bits (IORESOURCE_BITS) */ 70 #define IORESOURCE_IRQ_HIGHEDGE (1<<0) 71 #define IORESOURCE_IRQ_LOWEDGE (1<<1) 72 #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 73 #define IORESOURCE_IRQ_LOWLEVEL (1<<3) 74 #define IORESOURCE_IRQ_SHAREABLE (1<<4) 75 #define IORESOURCE_IRQ_OPTIONAL (1<<5) 76 77 /* PnP DMA specific bits (IORESOURCE_BITS) */ 78 #define IORESOURCE_DMA_TYPE_MASK (3<<0) 79 #define IORESOURCE_DMA_8BIT (0<<0) 80 #define IORESOURCE_DMA_8AND16BIT (1<<0) 81 #define IORESOURCE_DMA_16BIT (2<<0) 82 83 #define IORESOURCE_DMA_MASTER (1<<2) 84 #define IORESOURCE_DMA_BYTE (1<<3) 85 #define IORESOURCE_DMA_WORD (1<<4) 86 87 #define IORESOURCE_DMA_SPEED_MASK (3<<6) 88 #define IORESOURCE_DMA_COMPATIBLE (0<<6) 89 #define IORESOURCE_DMA_TYPEA (1<<6) 90 #define IORESOURCE_DMA_TYPEB (2<<6) 91 #define IORESOURCE_DMA_TYPEF (3<<6) 92 93 /* PnP memory I/O specific bits (IORESOURCE_BITS) */ 94 #define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */ 95 #define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */ 96 #define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */ 97 #define IORESOURCE_MEM_TYPE_MASK (3<<3) 98 #define IORESOURCE_MEM_8BIT (0<<3) 99 #define IORESOURCE_MEM_16BIT (1<<3) 100 #define IORESOURCE_MEM_8AND16BIT (2<<3) 101 #define IORESOURCE_MEM_32BIT (3<<3) 102 #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ 103 #define IORESOURCE_MEM_EXPANSIONROM (1<<6) 104 105 /* PnP I/O specific bits (IORESOURCE_BITS) */ 106 #define IORESOURCE_IO_16BIT_ADDR (1<<0) 107 #define IORESOURCE_IO_FIXED (1<<1) 108 #define IORESOURCE_IO_SPARSE (1<<2) 109 110 /* PCI ROM control bits (IORESOURCE_BITS) */ 111 #define IORESOURCE_ROM_ENABLE (1<<0) /* ROM is enabled, same as PCI_ROM_ADDRESS_ENABLE */ 112 #define IORESOURCE_ROM_SHADOW (1<<1) /* Use RAM image, not ROM BAR */ 113 114 /* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ 115 #define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */ 116 #define IORESOURCE_PCI_EA_BEI (1<<5) /* BAR Equivalent Indicator */ 117 118 /* 119 * I/O Resource Descriptors 120 * 121 * Descriptors are used by walk_iomem_res_desc() and region_intersects() 122 * for searching a specific resource range in the iomem table. Assign 123 * a new descriptor when a resource range supports the search interfaces. 124 * Otherwise, resource.desc must be set to IORES_DESC_NONE (0). 125 */ 126 enum { 127 IORES_DESC_NONE = 0, 128 IORES_DESC_CRASH_KERNEL = 1, 129 IORES_DESC_ACPI_TABLES = 2, 130 IORES_DESC_ACPI_NV_STORAGE = 3, 131 IORES_DESC_PERSISTENT_MEMORY = 4, 132 IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, 133 }; 134 135 /* helpers to define resources */ 136 #define DEFINE_RES_NAMED(_start, _size, _name, _flags) \ 137 { \ 138 .start = (_start), \ 139 .end = (_start) + (_size) - 1, \ 140 .name = (_name), \ 141 .flags = (_flags), \ 142 .desc = IORES_DESC_NONE, \ 143 } 144 145 #define DEFINE_RES_IO_NAMED(_start, _size, _name) \ 146 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO) 147 #define DEFINE_RES_IO(_start, _size) \ 148 DEFINE_RES_IO_NAMED((_start), (_size), NULL) 149 150 #define DEFINE_RES_MEM_NAMED(_start, _size, _name) \ 151 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM) 152 #define DEFINE_RES_MEM(_start, _size) \ 153 DEFINE_RES_MEM_NAMED((_start), (_size), NULL) 154 155 #define DEFINE_RES_IRQ_NAMED(_irq, _name) \ 156 DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ) 157 #define DEFINE_RES_IRQ(_irq) \ 158 DEFINE_RES_IRQ_NAMED((_irq), NULL) 159 160 #define DEFINE_RES_DMA_NAMED(_dma, _name) \ 161 DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA) 162 #define DEFINE_RES_DMA(_dma) \ 163 DEFINE_RES_DMA_NAMED((_dma), NULL) 164 165 /* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 166 extern struct resource ioport_resource; 167 extern struct resource iomem_resource; 168 169 extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); 170 extern int request_resource(struct resource *root, struct resource *new); 171 extern int release_resource(struct resource *new); 172 void release_child_resources(struct resource *new); 173 extern void reserve_region_with_split(struct resource *root, 174 resource_size_t start, resource_size_t end, 175 const char *name); 176 extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); 177 extern int insert_resource(struct resource *parent, struct resource *new); 178 extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 179 extern int remove_resource(struct resource *old); 180 extern void arch_remove_reservations(struct resource *avail); 181 extern int allocate_resource(struct resource *root, struct resource *new, 182 resource_size_t size, resource_size_t min, 183 resource_size_t max, resource_size_t align, 184 resource_size_t (*alignf)(void *, 185 const struct resource *, 186 resource_size_t, 187 resource_size_t), 188 void *alignf_data); 189 struct resource *lookup_resource(struct resource *root, resource_size_t start); 190 int adjust_resource(struct resource *res, resource_size_t start, 191 resource_size_t size); 192 resource_size_t resource_alignment(struct resource *res); 193 static inline resource_size_t resource_size(const struct resource *res) 194 { 195 return res->end - res->start + 1; 196 } 197 static inline unsigned long resource_type(const struct resource *res) 198 { 199 return res->flags & IORESOURCE_TYPE_BITS; 200 } 201 static inline unsigned long resource_ext_type(const struct resource *res) 202 { 203 return res->flags & IORESOURCE_EXT_TYPE_BITS; 204 } 205 /* True iff r1 completely contains r2 */ 206 static inline bool resource_contains(struct resource *r1, struct resource *r2) 207 { 208 if (resource_type(r1) != resource_type(r2)) 209 return false; 210 if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET) 211 return false; 212 return r1->start <= r2->start && r1->end >= r2->end; 213 } 214 215 216 /* Convenience shorthand with allocation */ 217 #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 218 #define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED) 219 #define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) 220 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) 221 #define request_mem_region_exclusive(start,n,name) \ 222 __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE) 223 #define rename_region(region, newname) do { (region)->name = (newname); } while (0) 224 225 extern struct resource * __request_region(struct resource *, 226 resource_size_t start, 227 resource_size_t n, 228 const char *name, int flags); 229 230 /* Compatibility cruft */ 231 #define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 232 #define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) 233 234 extern void __release_region(struct resource *, resource_size_t, 235 resource_size_t); 236 #ifdef CONFIG_MEMORY_HOTREMOVE 237 extern int release_mem_region_adjustable(struct resource *, resource_size_t, 238 resource_size_t); 239 #endif 240 241 /* Wrappers for managed devices */ 242 struct device; 243 244 extern int devm_request_resource(struct device *dev, struct resource *root, 245 struct resource *new); 246 extern void devm_release_resource(struct device *dev, struct resource *new); 247 248 #define devm_request_region(dev,start,n,name) \ 249 __devm_request_region(dev, &ioport_resource, (start), (n), (name)) 250 #define devm_request_mem_region(dev,start,n,name) \ 251 __devm_request_region(dev, &iomem_resource, (start), (n), (name)) 252 253 extern struct resource * __devm_request_region(struct device *dev, 254 struct resource *parent, resource_size_t start, 255 resource_size_t n, const char *name); 256 257 #define devm_release_region(dev, start, n) \ 258 __devm_release_region(dev, &ioport_resource, (start), (n)) 259 #define devm_release_mem_region(dev, start, n) \ 260 __devm_release_region(dev, &iomem_resource, (start), (n)) 261 262 extern void __devm_release_region(struct device *dev, struct resource *parent, 263 resource_size_t start, resource_size_t n); 264 extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 265 extern int iomem_is_exclusive(u64 addr); 266 267 extern int 268 walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 269 void *arg, int (*func)(unsigned long, unsigned long, void *)); 270 extern int 271 walk_system_ram_res(u64 start, u64 end, void *arg, 272 int (*func)(u64, u64, void *)); 273 extern int 274 walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end, 275 void *arg, int (*func)(u64, u64, void *)); 276 277 /* True if any part of r1 overlaps r2 */ 278 static inline bool resource_overlaps(struct resource *r1, struct resource *r2) 279 { 280 return (r1->start <= r2->end && r1->end >= r2->start); 281 } 282 283 284 #endif /* __ASSEMBLY__ */ 285 #endif /* _LINUX_IOPORT_H */
1 /* 2 * kobject.h - generic kernel object infrastructure. 3 * 4 * Copyright (c) 2002-2003 Patrick Mochel 5 * Copyright (c) 2002-2003 Open Source Development Labs 6 * Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com> 7 * Copyright (c) 2006-2008 Novell Inc. 8 * 9 * This file is released under the GPLv2. 10 * 11 * Please read Documentation/kobject.txt before using the kobject 12 * interface, ESPECIALLY the parts about reference counts and object 13 * destructors. 14 */ 15 16 #ifndef _KOBJECT_H_ 17 #define _KOBJECT_H_ 18 19 #include <linux/types.h> 20 #include <linux/list.h> 21 #include <linux/sysfs.h> 22 #include <linux/compiler.h> 23 #include <linux/spinlock.h> 24 #include <linux/kref.h> 25 #include <linux/kobject_ns.h> 26 #include <linux/kernel.h> 27 #include <linux/wait.h> 28 #include <linux/atomic.h> 29 #include <linux/workqueue.h> 30 31 #define UEVENT_HELPER_PATH_LEN 256 32 #define UEVENT_NUM_ENVP 32 /* number of env pointers */ 33 #define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ 34 35 #ifdef CONFIG_UEVENT_HELPER 36 /* path to the userspace helper executed on an event */ 37 extern char uevent_helper[]; 38 #endif 39 40 /* counter to tag the uevent, read only except for the kobject core */ 41 extern u64 uevent_seqnum; 42 43 /* 44 * The actions here must match the index to the string array 45 * in lib/kobject_uevent.c 46 * 47 * Do not add new actions here without checking with the driver-core 48 * maintainers. Action strings are not meant to express subsystem 49 * or device specific properties. In most cases you want to send a 50 * kobject_uevent_env(kobj, KOBJ_CHANGE, env) with additional event 51 * specific variables added to the event environment. 52 */ 53 enum kobject_action { 54 KOBJ_ADD, 55 KOBJ_REMOVE, 56 KOBJ_CHANGE, 57 KOBJ_MOVE, 58 KOBJ_ONLINE, 59 KOBJ_OFFLINE, 60 KOBJ_MAX 61 }; 62 63 struct kobject { 64 const char *name; 65 struct list_head entry; 66 struct kobject *parent; 67 struct kset *kset; 68 struct kobj_type *ktype; 69 struct kernfs_node *sd; /* sysfs directory entry */ 70 struct kref kref; 71 #ifdef CONFIG_DEBUG_KOBJECT_RELEASE 72 struct delayed_work release; 73 #endif 74 unsigned int state_initialized:1; 75 unsigned int state_in_sysfs:1; 76 unsigned int state_add_uevent_sent:1; 77 unsigned int state_remove_uevent_sent:1; 78 unsigned int uevent_suppress:1; 79 }; 80 81 extern __printf(2, 3) 82 int kobject_set_name(struct kobject *kobj, const char *name, ...); 83 extern __printf(2, 0) 84 int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, 85 va_list vargs); 86 87 static inline const char *kobject_name(const struct kobject *kobj) 88 { 89 return kobj->name; 90 } 91 92 extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); 93 extern __printf(3, 4) __must_check 94 int kobject_add(struct kobject *kobj, struct kobject *parent, 95 const char *fmt, ...); 96 extern __printf(4, 5) __must_check 97 int kobject_init_and_add(struct kobject *kobj, 98 struct kobj_type *ktype, struct kobject *parent, 99 const char *fmt, ...); 100 101 extern void kobject_del(struct kobject *kobj); 102 103 extern struct kobject * __must_check kobject_create(void); 104 extern struct kobject * __must_check kobject_create_and_add(const char *name, 105 struct kobject *parent); 106 107 extern int __must_check kobject_rename(struct kobject *, const char *new_name); 108 extern int __must_check kobject_move(struct kobject *, struct kobject *); 109 110 extern struct kobject *kobject_get(struct kobject *kobj); 111 extern void kobject_put(struct kobject *kobj); 112 113 extern const void *kobject_namespace(struct kobject *kobj); 114 extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 115 116 struct kobj_type { 117 void (*release)(struct kobject *kobj); 118 const struct sysfs_ops *sysfs_ops; 119 struct attribute **default_attrs; 120 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); 121 const void *(*namespace)(struct kobject *kobj); 122 }; 123 124 struct kobj_uevent_env { 125 char *argv[3]; 126 char *envp[UEVENT_NUM_ENVP]; 127 int envp_idx; 128 char buf[UEVENT_BUFFER_SIZE]; 129 int buflen; 130 }; 131 132 struct kset_uevent_ops { 133 int (* const filter)(struct kset *kset, struct kobject *kobj); 134 const char *(* const name)(struct kset *kset, struct kobject *kobj); 135 int (* const uevent)(struct kset *kset, struct kobject *kobj, 136 struct kobj_uevent_env *env); 137 }; 138 139 struct kobj_attribute { 140 struct attribute attr; 141 ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, 142 char *buf); 143 ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, 144 const char *buf, size_t count); 145 }; 146 147 extern const struct sysfs_ops kobj_sysfs_ops; 148 149 struct sock; 150 151 /** 152 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 153 * 154 * A kset defines a group of kobjects. They can be individually 155 * different "types" but overall these kobjects all want to be grouped 156 * together and operated on in the same manner. ksets are used to 157 * define the attribute callbacks and other common events that happen to 158 * a kobject. 159 * 160 * @list: the list of all kobjects for this kset 161 * @list_lock: a lock for iterating over the kobjects 162 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...) 163 * @uevent_ops: the set of uevent operations for this kset. These are 164 * called whenever a kobject has something happen to it so that the kset 165 * can add new environment variables, or filter out the uevents if so 166 * desired. 167 */ 168 struct kset { 169 struct list_head list; 170 spinlock_t list_lock; 171 struct kobject kobj; 172 const struct kset_uevent_ops *uevent_ops; 173 }; 174 175 extern void kset_init(struct kset *kset); 176 extern int __must_check kset_register(struct kset *kset); 177 extern void kset_unregister(struct kset *kset); 178 extern struct kset * __must_check kset_create_and_add(const char *name, 179 const struct kset_uevent_ops *u, 180 struct kobject *parent_kobj); 181 182 static inline struct kset *to_kset(struct kobject *kobj) 183 { 184 return kobj ? container_of(kobj, struct kset, kobj) : NULL; 185 } 186 187 static inline struct kset *kset_get(struct kset *k) 188 { 189 return k ? to_kset(kobject_get(&k->kobj)) : NULL; 190 } 191 192 static inline void kset_put(struct kset *k) 193 { 194 kobject_put(&k->kobj); 195 } 196 197 static inline struct kobj_type *get_ktype(struct kobject *kobj) 198 { 199 return kobj->ktype; 200 } 201 202 extern struct kobject *kset_find_obj(struct kset *, const char *); 203 204 /* The global /sys/kernel/ kobject for people to chain off of */ 205 extern struct kobject *kernel_kobj; 206 /* The global /sys/kernel/mm/ kobject for people to chain off of */ 207 extern struct kobject *mm_kobj; 208 /* The global /sys/hypervisor/ kobject for people to chain off of */ 209 extern struct kobject *hypervisor_kobj; 210 /* The global /sys/power/ kobject for people to chain off of */ 211 extern struct kobject *power_kobj; 212 /* The global /sys/firmware/ kobject for people to chain off of */ 213 extern struct kobject *firmware_kobj; 214 215 int kobject_uevent(struct kobject *kobj, enum kobject_action action); 216 int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 217 char *envp[]); 218 219 __printf(2, 3) 220 int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...); 221 222 int kobject_action_type(const char *buf, size_t count, 223 enum kobject_action *type); 224 225 #endif /* _KOBJECT_H_ */

Here is an explanation of a rule violation arisen while checking your driver against a corresponding kernel.

Note that it may be false positive, i.e. there isn't a real error indeed. Please analyze a given error trace and related source code to understand whether there is an error in your driver.

Error trace column contains a path on which the given rule is violated. You can expand/collapse some entity classes by clicking on corresponding checkboxes in a main menu or in an advanced Others menu. Also you can expand/collapse each particular entity by clicking on +/-. In hovering on some entities you can see some tips. Also the error trace is bound with related source code. Line numbers may be shown as links on the left. You can click on them to open corresponding lines in source code.

Source code column contains a content of files related with the error trace. There is source code of your driver (note that there are some LDV modifications at the end), kernel headers and rule model. Tabs show a currently opened file and other available files. In hovering on them you can see full file names. On clicking a corresponding file content will be shown.

Kernel Module Rule Verifier Verdict Status Timestamp Bug report
linux-4.8-rc1.tar.xz drivers/net/ethernet/marvell/mvmdio.ko 322_7a CPAchecker Bug Fixed 2017-04-22 22:30:13 L0250

Comment

Reported: 1 Oct 2016

[Home]