Error Trace

[Home]

Bug # 138

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;
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;
259 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;
106 typedef __u8 uint8_t;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_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 *); } ;
131 typedef void (*ctor_fn_t)();
48 struct device ;
432 struct file_operations ;
444 struct completion ;
445 struct pt_regs ;
555 struct task_struct ;
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;
15 struct lockdep_map ;
23 typedef atomic64_t atomic_long_t;
186 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ;
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_37 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_36 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_37 __annonCompField4; } ;
33 struct spinlock { union __anonunion____missing_field_name_36 __annonCompField5; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_38 { 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_38 rwlock_t;
23 struct mm_struct ;
72 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_40 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_41 { 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_39 { struct __anonstruct____missing_field_name_40 __annonCompField6; struct __anonstruct____missing_field_name_41 __annonCompField7; } ;
66 struct desc_struct { union __anonunion____missing_field_name_39 __annonCompField8; } ;
15 typedef unsigned long pgdval_t;
16 typedef unsigned long pgprotval_t;
20 struct pgprot { pgprotval_t pgprot; } ;
250 typedef struct pgprot pgprot_t;
252 struct __anonstruct_pgd_t_43 { pgdval_t pgd; } ;
252 typedef struct __anonstruct_pgd_t_43 pgd_t;
417 struct page ;
417 typedef struct page *pgtable_t;
428 struct file ;
441 struct seq_file ;
479 struct thread_struct ;
481 struct cpumask ;
253 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
338 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
654 typedef struct cpumask *cpumask_var_t;
82 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; } ;
298 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_58 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_59 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_57 { struct __anonstruct____missing_field_name_58 __annonCompField14; struct __anonstruct____missing_field_name_59 __annonCompField15; } ;
26 union __anonunion____missing_field_name_60 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_57 __annonCompField16; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_60 __annonCompField17; } ;
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; } ;
226 struct xstate_header { u64 xfeatures; u64 xcomp_bv; u64 reserved[6U]; } ;
232 struct xregs_state { struct fxregs_state i387; struct xstate_header header; u8 extended_state_area[0U]; } ;
247 union fpregs_state { struct fregs_state fsave; struct fxregs_state fxsave; struct swregs_state soft; struct xregs_state xsave; u8 __padding[4096U]; } ;
264 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 ;
371 struct perf_event ;
372 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; struct fpu fpu; } ;
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 timespec ;
178 struct compat_timespec ;
179 struct __anonstruct_futex_74 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
179 struct __anonstruct_nanosleep_75 { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } ;
179 struct pollfd ;
179 struct __anonstruct_poll_76 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
179 union __anonunion____missing_field_name_73 { struct __anonstruct_futex_74 futex; struct __anonstruct_nanosleep_75 nanosleep; struct __anonstruct_poll_76 poll; } ;
179 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_73 __annonCompField20; } ;
416 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
404 struct __anonstruct_seqlock_t_89 { struct seqcount seqcount; spinlock_t lock; } ;
404 typedef struct __anonstruct_seqlock_t_89 seqlock_t;
38 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
43 typedef struct __wait_queue_head wait_queue_head_t;
1221 struct completion { unsigned int done; wait_queue_head_t wait; } ;
108 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
446 union ktime { s64 tv64; } ;
41 typedef union ktime ktime_t;
1128 union __anonunion____missing_field_name_90 { unsigned long bitmap[4U]; struct callback_head callback_head; } ;
1128 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion____missing_field_name_90 __annonCompField21; } ;
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 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; } ;
98 struct dentry ;
99 struct iattr ;
100 struct vm_area_struct ;
101 struct super_block ;
102 struct file_system_type ;
103 struct kernfs_open_node ;
104 struct kernfs_iattrs ;
127 struct kernfs_root ;
127 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_97 { 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_97 __annonCompField22; 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 vm_operations_struct ;
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; } ;
288 struct inode ;
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 *); } ;
83 struct user_namespace ;
22 struct __anonstruct_kuid_t_100 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_100 kuid_t;
27 struct __anonstruct_kgid_t_101 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_101 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 bin_attribute ;
37 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 ); } ;
7 typedef int MultiMap;
39 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; } ;
282 struct kref { atomic_t refcount; } ;
139 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; int slack; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ;
240 struct hrtimer ;
241 enum hrtimer_restart ;
838 struct nsproxy ;
261 struct workqueue_struct ;
262 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; } ;
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 klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
97 struct __anonstruct_nodemask_t_104 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_104 nodemask_t;
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_132 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_131 { struct __anonstruct____missing_field_name_132 __annonCompField25; } ;
114 struct lockref { union __anonunion____missing_field_name_131 __annonCompField26; } ;
75 struct path ;
76 struct vfsmount ;
77 struct __anonstruct____missing_field_name_134 { u32 hash; u32 len; } ;
77 union __anonunion____missing_field_name_133 { struct __anonstruct____missing_field_name_134 __annonCompField27; u64 hash_len; } ;
77 struct qstr { union __anonunion____missing_field_name_133 __annonCompField28; const unsigned char *name; } ;
65 struct dentry_operations ;
65 union __anonunion____missing_field_name_135 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
65 union __anonunion_d_u_136 { 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_135 __annonCompField29; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_136 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 *, const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool ); struct inode * (*d_select_inode)(struct dentry *, unsigned int); struct dentry * (*d_real)(struct dentry *, struct inode *); } ;
577 struct path { struct vfsmount *mnt; struct dentry *dentry; } ;
19 struct mem_cgroup ;
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; } ;
189 struct llist_node ;
64 struct llist_node { struct llist_node *next; } ;
63 struct __anonstruct____missing_field_name_138 { struct radix_tree_node *parent; void *private_data; } ;
63 union __anonunion____missing_field_name_137 { struct __anonstruct____missing_field_name_138 __annonCompField30; struct callback_head callback_head; } ;
63 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned int count; union __anonunion____missing_field_name_137 __annonCompField31; 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; } ;
521 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
528 struct pid_namespace ;
528 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; } ;
174 struct rw_semaphore ;
175 struct rw_semaphore { long 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; } ;
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 } ;
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_208 { 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_208 mm_context_t;
162 struct notifier_block ;
124 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
130 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; } ;
57 struct block_device ;
58 struct io_context ;
59 struct cgroup_subsys_state ;
268 struct delayed_call { void (*fn)(void *); void *arg; } ;
261 struct backing_dev_info ;
262 struct bdi_writeback ;
263 struct export_operations ;
266 struct kiocb ;
267 struct pipe_inode_info ;
268 struct poll_table_struct ;
269 struct kstatfs ;
270 struct cred ;
271 struct swap_info_struct ;
272 struct iov_iter ;
273 struct fscrypt_info ;
274 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; } ;
53 struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; } ;
213 struct dquot ;
214 struct kqid ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_239 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_239 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_240 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_240 __annonCompField43; enum quota_type type; } ;
184 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; } ;
206 struct quota_format_type ;
207 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; } ;
272 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; } ;
299 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 *); } ;
311 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 *); } ;
328 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; } ;
351 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; } ;
397 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
408 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; } ;
421 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); } ;
437 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; } ;
501 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]; } ;
531 struct address_space ;
532 struct writeback_control ;
533 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; } ;
371 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 ); 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 *); } ;
428 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; } ;
449 struct request_queue ;
450 struct hd_struct ;
450 struct gendisk ;
450 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
566 struct posix_acl ;
592 struct inode_operations ;
592 union __anonunion____missing_field_name_245 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
592 union __anonunion____missing_field_name_246 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
592 struct file_lock_context ;
592 struct cdev ;
592 union __anonunion____missing_field_name_247 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
592 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_245 __annonCompField44; 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; union __anonunion____missing_field_name_246 __annonCompField45; 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_247 __annonCompField46; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
870 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
878 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; } ;
901 union __anonunion_f_u_248 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
901 struct file { union __anonunion_f_u_248 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; } ;
986 typedef void *fl_owner_t;
987 struct file_lock ;
988 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
994 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 **); } ;
1021 struct nlm_lockowner ;
1022 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_250 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_249 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_250 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_249 fl_u; } ;
1074 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1129 struct files_struct ;
1287 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; } ;
1322 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1348 struct super_operations ;
1348 struct xattr_handler ;
1348 struct mtd_info ;
1348 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 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; } ;
1594 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1608 struct dir_context ;
1633 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1640 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 ); } ;
1709 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); } ;
1766 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 *); } ;
2005 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; } ;
2334 struct kmem_cache ;
3176 struct assoc_array_ptr ;
3176 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 user_struct ;
37 struct signal_struct ;
38 struct key_type ;
42 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_251 { struct list_head graveyard_link; struct rb_node serial_node; } ;
128 struct key_user ;
128 union __anonunion____missing_field_name_252 { time_t expiry; time_t revoked_at; } ;
128 struct __anonstruct____missing_field_name_254 { struct key_type *type; char *description; } ;
128 union __anonunion____missing_field_name_253 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_254 __annonCompField49; } ;
128 struct __anonstruct____missing_field_name_256 { struct list_head name_link; struct assoc_array keys; } ;
128 union __anonunion____missing_field_name_255 { union key_payload payload; struct __anonstruct____missing_field_name_256 __annonCompField51; int reject_error; } ;
128 struct key { atomic_t usage; key_serial_t serial; union __anonunion____missing_field_name_251 __annonCompField47; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_252 __annonCompField48; 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_253 __annonCompField50; union __anonunion____missing_field_name_255 __annonCompField52; 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 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; } ;
48 struct dma_map_ops ;
48 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; } ;
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; } ;
659 struct mfd_cell ;
661 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; } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
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_265 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_266 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_264 { struct __anonstruct____missing_field_name_265 __annonCompField55; struct __anonstruct____missing_field_name_266 __annonCompField56; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_264 __annonCompField57; 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 union __anonunion____missing_field_name_267 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
150 union __anonunion____missing_field_name_269 { unsigned long index; void *freelist; } ;
150 struct __anonstruct____missing_field_name_273 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
150 union __anonunion____missing_field_name_272 { atomic_t _mapcount; struct __anonstruct____missing_field_name_273 __annonCompField60; int units; } ;
150 struct __anonstruct____missing_field_name_271 { union __anonunion____missing_field_name_272 __annonCompField61; atomic_t _refcount; } ;
150 union __anonunion____missing_field_name_270 { unsigned long counters; struct __anonstruct____missing_field_name_271 __annonCompField62; unsigned int active; } ;
150 struct __anonstruct____missing_field_name_268 { union __anonunion____missing_field_name_269 __annonCompField59; union __anonunion____missing_field_name_270 __annonCompField63; } ;
150 struct dev_pagemap ;
150 struct __anonstruct____missing_field_name_275 { struct page *next; int pages; int pobjects; } ;
150 struct __anonstruct____missing_field_name_276 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
150 struct __anonstruct____missing_field_name_277 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
150 union __anonunion____missing_field_name_274 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_275 __annonCompField65; struct callback_head callback_head; struct __anonstruct____missing_field_name_276 __annonCompField66; struct __anonstruct____missing_field_name_277 __annonCompField67; } ;
150 union __anonunion____missing_field_name_278 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
150 struct page { unsigned long flags; union __anonunion____missing_field_name_267 __annonCompField58; struct __anonstruct____missing_field_name_268 __annonCompField64; union __anonunion____missing_field_name_274 __annonCompField68; union __anonunion____missing_field_name_278 __annonCompField69; struct mem_cgroup *mem_cgroup; } ;
196 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
281 struct userfaultfd_ctx ;
281 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
288 struct __anonstruct_shared_279 { struct rb_node rb; unsigned long rb_subtree_last; } ;
288 struct anon_vma ;
288 struct mempolicy ;
288 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_279 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; } ;
361 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
366 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
380 struct task_rss_stat { int events; int count[4U]; } ;
388 struct mm_rss_stat { atomic_long_t count[4U]; } ;
393 struct kioctx_table ;
394 struct linux_binfmt ;
394 struct mmu_notifier_mm ;
394 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; } ;
4 typedef unsigned long cputime_t;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
26 struct sysv_shm { struct list_head shm_clist; } ;
24 struct __anonstruct_sigset_t_281 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_281 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_283 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_284 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_285 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_286 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_289 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_288 { struct __anonstruct__addr_bnd_289 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_287 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_288 __annonCompField70; } ;
11 struct __anonstruct__sigpoll_290 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_291 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_282 { int _pad[28U]; struct __anonstruct__kill_283 _kill; struct __anonstruct__timer_284 _timer; struct __anonstruct__rt_285 _rt; struct __anonstruct__sigchld_286 _sigchld; struct __anonstruct__sigfault_287 _sigfault; struct __anonstruct__sigpoll_290 _sigpoll; struct __anonstruct__sigsys_291 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_282 _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 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; } ;
327 struct cgroup ;
328 struct cgroup_root ;
329 struct cgroup_subsys ;
330 struct cgroup_taskset ;
374 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 ;
492 struct sighand_struct { atomic_t count; struct k_sigaction action[64U]; spinlock_t siglock; wait_queue_head_t signalfd_wqh; } ;
534 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; } ;
542 struct cpu_itimer { cputime_t expires; cputime_t incr; u32 error; u32 incr_error; } ;
549 struct prev_cputime { cputime_t utime; cputime_t stime; raw_spinlock_t lock; } ;
574 struct task_cputime { cputime_t utime; cputime_t stime; unsigned long long sum_exec_runtime; } ;
590 struct task_cputime_atomic { atomic64_t utime; atomic64_t stime; atomic64_t sum_exec_runtime; } ;
612 struct thread_group_cputimer { struct task_cputime_atomic cputime_atomic; bool running; bool checking_timer; } ;
657 struct autogroup ;
658 struct tty_struct ;
658 struct taskstats ;
658 struct tty_audit_buf ;
658 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; } ;
833 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; } ;
878 struct reclaim_state ;
879 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
894 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; } ;
951 struct wake_q_node { struct wake_q_node *next; } ;
1218 struct load_weight { unsigned long weight; u32 inv_weight; } ;
1226 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
1284 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; } ;
1319 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; } ;
1356 struct rt_rq ;
1356 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; } ;
1374 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; } ;
1438 struct tlbflush_unmap_batch { struct cpumask cpumask; bool flush_required; bool writable; } ;
1457 struct sched_class ;
1457 struct compat_robust_list_head ;
1457 struct numa_group ;
1457 struct kcov ;
1457 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 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; } ;
3388 enum fwnode_type { FWNODE_INVALID = 0, FWNODE_OF = 1, FWNODE_ACPI = 2, FWNODE_ACPI_DATA = 3, FWNODE_PDATA = 4, FWNODE_IRQCHIP = 5 } ;
3397 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; } ;
737 struct fb_fix_screeninfo { char id[16U]; unsigned long smem_start; __u32 smem_len; __u32 type; __u32 type_aux; __u32 visual; __u16 xpanstep; __u16 ypanstep; __u16 ywrapstep; __u32 line_length; unsigned long mmio_start; __u32 mmio_len; __u32 accel; __u16 capabilities; __u16 reserved[2U]; } ;
176 struct fb_bitfield { __u32 offset; __u32 length; __u32 msb_right; } ;
192 struct fb_var_screeninfo { __u32 xres; __u32 yres; __u32 xres_virtual; __u32 yres_virtual; __u32 xoffset; __u32 yoffset; __u32 bits_per_pixel; __u32 grayscale; struct fb_bitfield red; struct fb_bitfield green; struct fb_bitfield blue; struct fb_bitfield transp; __u32 nonstd; __u32 activate; __u32 height; __u32 width; __u32 accel_flags; __u32 pixclock; __u32 left_margin; __u32 right_margin; __u32 upper_margin; __u32 lower_margin; __u32 hsync_len; __u32 vsync_len; __u32 sync; __u32 vmode; __u32 rotate; __u32 colorspace; __u32 reserved[4U]; } ;
279 struct fb_cmap { __u32 start; __u32 len; __u16 *red; __u16 *green; __u16 *blue; __u16 *transp; } ;
335 struct fb_copyarea { __u32 dx; __u32 dy; __u32 width; __u32 height; __u32 sx; __u32 sy; } ;
348 struct fb_fillrect { __u32 dx; __u32 dy; __u32 width; __u32 height; __u32 color; __u32 rop; } ;
357 struct fb_image { __u32 dx; __u32 dy; __u32 width; __u32 height; __u32 fg_color; __u32 bg_color; __u8 depth; const char *data; struct fb_cmap cmap; } ;
369 struct fbcurpos { __u16 x; __u16 y; } ;
385 struct fb_cursor { __u16 set; __u16 enable; __u16 rop; const char *mask; struct fbcurpos hot; struct fb_image image; } ;
399 enum backlight_type { BACKLIGHT_RAW = 1, BACKLIGHT_PLATFORM = 2, BACKLIGHT_FIRMWARE = 3, BACKLIGHT_TYPE_MAX = 4 } ;
411 struct backlight_device ;
412 struct fb_info ;
413 struct backlight_ops { unsigned int options; int (*update_status)(struct backlight_device *); int (*get_brightness)(struct backlight_device *); int (*check_fb)(struct backlight_device *, struct fb_info *); } ;
65 struct backlight_properties { int brightness; int max_brightness; int power; int fb_blank; enum backlight_type type; unsigned int state; } ;
84 struct backlight_device { struct backlight_properties props; struct mutex update_lock; struct mutex ops_lock; const struct backlight_ops *ops; struct notifier_block fb_notif; struct list_head entry; struct device dev; bool fb_bl_on[32U]; int use_count; } ;
639 struct fb_chroma { __u32 redx; __u32 greenx; __u32 bluex; __u32 whitex; __u32 redy; __u32 greeny; __u32 bluey; __u32 whitey; } ;
61 struct fb_videomode ;
61 struct fb_monspecs { struct fb_chroma chroma; struct fb_videomode *modedb; __u8 manufacturer[4U]; __u8 monitor[14U]; __u8 serial_no[14U]; __u8 ascii[14U]; __u32 modedb_len; __u32 model; __u32 serial; __u32 year; __u32 week; __u32 hfmin; __u32 hfmax; __u32 dclkmin; __u32 dclkmax; __u16 input; __u16 dpms; __u16 signal; __u16 vfmin; __u16 vfmax; __u16 gamma; unsigned char gtf; __u16 misc; __u8 version; __u8 revision; __u8 max_x; __u8 max_y; } ;
170 struct fb_blit_caps { u32 x; u32 y; u32 len; u32 flags; } ;
182 struct fb_pixmap { u8 *addr; u32 size; u32 offset; u32 buf_align; u32 scan_align; u32 access_align; u32 flags; u32 blit_x; u32 blit_y; void (*writeio)(struct fb_info *, void *, void *, unsigned int); void (*readio)(struct fb_info *, void *, void *, unsigned int); } ;
228 struct fb_deferred_io { unsigned long delay; struct mutex lock; struct list_head pagelist; void (*first_io)(struct fb_info *); void (*deferred_io)(struct fb_info *, struct list_head *); } ;
239 struct fb_ops { struct module *owner; int (*fb_open)(struct fb_info *, int); int (*fb_release)(struct fb_info *, int); ssize_t (*fb_read)(struct fb_info *, char *, size_t , loff_t *); ssize_t (*fb_write)(struct fb_info *, const char *, size_t , loff_t *); int (*fb_check_var)(struct fb_var_screeninfo *, struct fb_info *); int (*fb_set_par)(struct fb_info *); int (*fb_setcolreg)(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, struct fb_info *); int (*fb_setcmap)(struct fb_cmap *, struct fb_info *); int (*fb_blank)(int, struct fb_info *); int (*fb_pan_display)(struct fb_var_screeninfo *, struct fb_info *); void (*fb_fillrect)(struct fb_info *, const struct fb_fillrect *); void (*fb_copyarea)(struct fb_info *, const struct fb_copyarea *); void (*fb_imageblit)(struct fb_info *, const struct fb_image *); int (*fb_cursor)(struct fb_info *, struct fb_cursor *); int (*fb_sync)(struct fb_info *); int (*fb_ioctl)(struct fb_info *, unsigned int, unsigned long); int (*fb_compat_ioctl)(struct fb_info *, unsigned int, unsigned long); int (*fb_mmap)(struct fb_info *, struct vm_area_struct *); void (*fb_get_caps)(struct fb_info *, struct fb_blit_caps *, struct fb_var_screeninfo *); void (*fb_destroy)(struct fb_info *); int (*fb_debug_enter)(struct fb_info *); int (*fb_debug_leave)(struct fb_info *); } ;
324 struct fb_tilemap { __u32 width; __u32 height; __u32 depth; __u32 length; const __u8 *data; } ;
340 struct fb_tilerect { __u32 sx; __u32 sy; __u32 width; __u32 height; __u32 index; __u32 fg; __u32 bg; __u32 rop; } ;
352 struct fb_tilearea { __u32 sx; __u32 sy; __u32 dx; __u32 dy; __u32 width; __u32 height; } ;
361 struct fb_tileblit { __u32 sx; __u32 sy; __u32 width; __u32 height; __u32 fg; __u32 bg; __u32 length; __u32 *indices; } ;
372 struct fb_tilecursor { __u32 sx; __u32 sy; __u32 mode; __u32 shape; __u32 fg; __u32 bg; } ;
381 struct fb_tile_ops { void (*fb_settile)(struct fb_info *, struct fb_tilemap *); void (*fb_tilecopy)(struct fb_info *, struct fb_tilearea *); void (*fb_tilefill)(struct fb_info *, struct fb_tilerect *); void (*fb_tileblit)(struct fb_info *, struct fb_tileblit *); void (*fb_tilecursor)(struct fb_info *, struct fb_tilecursor *); int (*fb_get_tilemax)(struct fb_info *); } ;
400 struct aperture { resource_size_t base; resource_size_t size; } ;
522 struct apertures_struct { unsigned int count; struct aperture ranges[0U]; } ;
523 union __anonunion____missing_field_name_321 { char *screen_base; char *screen_buffer; } ;
523 struct fb_info { atomic_t count; int node; int flags; struct mutex lock; struct mutex mm_lock; struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; struct fb_monspecs monspecs; struct work_struct queue; struct fb_pixmap pixmap; struct fb_pixmap sprite; struct fb_cmap cmap; struct list_head modelist; struct fb_videomode *mode; struct backlight_device *bl_dev; struct mutex bl_curve_mutex; u8 bl_curve[128U]; struct delayed_work deferred_work; struct fb_deferred_io *fbdefio; struct fb_ops *fbops; struct device *device; struct device *dev; int class_flag; struct fb_tile_ops *tileops; union __anonunion____missing_field_name_321 __annonCompField77; unsigned long screen_size; void *pseudo_palette; u32 state; void *fbcon_par; void *par; struct apertures_struct *apertures; bool skip_vt_switch; } ;
783 struct fb_videomode { const char *name; u32 refresh; u32 xres; u32 yres; u32 pixclock; u32 left_margin; u32 right_margin; u32 upper_margin; u32 lower_margin; u32 hsync_len; u32 vsync_len; u32 sync; u32 vmode; u32 flag; } ;
203 struct adp5520_backlight_platform_data { u8 fade_in; u8 fade_out; u8 fade_led_law; u8 en_ambl_sens; u8 abml_filt; u8 l1_daylight_max; u8 l1_daylight_dim; u8 l2_office_max; u8 l2_office_dim; u8 l3_dark_max; u8 l3_dark_dim; u8 l2_trip; u8 l2_hyst; u8 l3_trip; u8 l3_hyst; } ;
19 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;
313 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; } ;
325 typedef struct elf64_shdr Elf64_Shdr;
53 struct kernel_param ;
58 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_326 { 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_326 __annonCompField78; } ;
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 latch_tree_node { struct rb_node node[2U]; } ;
211 struct mod_arch_specific { } ;
38 struct module_param_attrs ;
38 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ;
48 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 *); } ;
74 struct exception_table_entry ;
290 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
297 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
304 struct module_layout { void *base; unsigned int size; unsigned int text_size; unsigned int ro_size; struct mod_tree_node mtn; } ;
318 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
332 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
340 struct module_sect_attrs ;
340 struct module_notes_attrs ;
340 struct trace_event_call ;
340 struct trace_enum_map ;
340 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; } ;
820 struct adp5520_bl { struct device *master; struct adp5520_backlight_platform_data *pdata; struct mutex lock; unsigned long cached_daylight_max; int id; int current_brightness; } ;
279 int kstrtoull(const char *, unsigned int, unsigned long long *);
298 int kstrtoul(const char *s, unsigned int base, unsigned long *res);
412 int sprintf(char *, const char *, ...);
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 int ldv_ptr_err(const void *ptr);
32 long int PTR_ERR(const void *ptr);
41 bool IS_ERR(const void *ptr);
56 void * __memset(void *, int, size_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 *);
263 int ldv_sysfs_create_group_5(struct kobject *ldv_func_arg1, const struct attribute_group *ldv_func_arg2);
273 void ldv_sysfs_remove_group_6(struct kobject *ldv_func_arg1, const struct attribute_group *ldv_func_arg2);
10 void ldv_error();
20 void ldv_stop();
25 int ldv_undef_int();
30 int ldv_undef_int_negative();
15 int LDV_SYSFS_GROUPS = 0;
19 int ldv_sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp);
29 void ldv_sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp);
33 void ldv_check_final_state();
651 void * devm_kmalloc(struct device *, size_t , gfp_t );
657 void * devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
912 void * dev_get_drvdata(const struct device *dev);
917 void dev_set_drvdata(struct device *dev, void *data);
1046 void * dev_get_platdata(const struct device *dev);
1135 void dev_err(const struct device *, const char *, ...);
211 void * platform_get_drvdata(const struct platform_device *pdev);
216 void platform_set_drvdata(struct platform_device *pdev, void *data);
120 int backlight_update_status(struct backlight_device *bd);
135 struct backlight_device * devm_backlight_device_register(struct device *, const char *, struct device *, void *, const struct backlight_ops *, const struct backlight_properties *);
151 void * bl_get_data(struct backlight_device *bl_dev);
288 int adp5520_read(struct device *, int, uint8_t *);
289 int adp5520_write(struct device *, int, u8 );
290 int adp5520_clr_bits(struct device *, int, uint8_t );
291 int adp5520_set_bits(struct device *, int, uint8_t );
28 int adp5520_bl_set(struct backlight_device *bl, int brightness);
68 int adp5520_bl_update_status(struct backlight_device *bl);
81 int adp5520_bl_get_brightness(struct backlight_device *bl);
92 const struct backlight_ops adp5520_bl_ops = { 0U, &adp5520_bl_update_status, &adp5520_bl_get_brightness, 0 };
97 int adp5520_bl_setup(struct backlight_device *bl);
145 ssize_t adp5520_show(struct device *dev, char *buf, int reg);
161 ssize_t adp5520_store(struct device *dev, const char *buf, size_t count, int reg);
179 ssize_t adp5520_bl_dark_max_show(struct device *dev, struct device_attribute *attr, char *buf);
185 ssize_t adp5520_bl_dark_max_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
192 struct device_attribute dev_attr_dark_max = { { "dark_max", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_dark_max_show, &adp5520_bl_dark_max_store };
194 ssize_t adp5520_bl_office_max_show(struct device *dev, struct device_attribute *attr, char *buf);
200 ssize_t adp5520_bl_office_max_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
207 struct device_attribute dev_attr_office_max = { { "office_max", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_office_max_show, &adp5520_bl_office_max_store };
209 ssize_t adp5520_bl_daylight_max_show(struct device *dev, struct device_attribute *attr, char *buf);
215 ssize_t adp5520_bl_daylight_max_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
229 struct device_attribute dev_attr_daylight_max = { { "daylight_max", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_daylight_max_show, &adp5520_bl_daylight_max_store };
231 ssize_t adp5520_bl_dark_dim_show(struct device *dev, struct device_attribute *attr, char *buf);
237 ssize_t adp5520_bl_dark_dim_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
244 struct device_attribute dev_attr_dark_dim = { { "dark_dim", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_dark_dim_show, &adp5520_bl_dark_dim_store };
246 ssize_t adp5520_bl_office_dim_show(struct device *dev, struct device_attribute *attr, char *buf);
252 ssize_t adp5520_bl_office_dim_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
259 struct device_attribute dev_attr_office_dim = { { "office_dim", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_office_dim_show, &adp5520_bl_office_dim_store };
261 ssize_t adp5520_bl_daylight_dim_show(struct device *dev, struct device_attribute *attr, char *buf);
267 ssize_t adp5520_bl_daylight_dim_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
274 struct device_attribute dev_attr_daylight_dim = { { "daylight_dim", 436U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &adp5520_bl_daylight_dim_show, &adp5520_bl_daylight_dim_store };
276 struct attribute *adp5520_bl_attributes[7U] = { &(dev_attr_dark_max.attr), &(dev_attr_dark_dim.attr), &(dev_attr_office_max.attr), &(dev_attr_office_dim.attr), &(dev_attr_daylight_max.attr), &(dev_attr_daylight_dim.attr), (struct attribute *)0 };
286 const struct attribute_group adp5520_bl_attr_group = { 0, 0, 0, (struct attribute **)(&adp5520_bl_attributes), 0 };
290 int adp5520_bl_probe(struct platform_device *pdev);
342 int adp5520_bl_remove(struct platform_device *pdev);
411 void ldv_check_return_value(int);
414 void ldv_check_return_value_probe(int);
417 void ldv_initialize();
420 void ldv_handler_precall();
423 int nondet_int();
426 int LDV_IN_INTERRUPT = 0;
429 void ldv_main0_sequence_infinite_withcheck_stateful();
return ;
}
-entry_point
{
431 struct backlight_device *var_group1;
432 struct platform_device *var_group2;
433 int res_adp5520_bl_probe_18;
434 int ldv_s_adp5520_bl_driver_platform_driver;
435 int tmp;
436 int tmp___0;
487 ldv_s_adp5520_bl_driver_platform_driver = 0;
475 LDV_IN_INTERRUPT = 1;
484 ldv_initialize() { /* Function call is skipped due to function is undefined */}
490 goto ldv_29189;
490 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
490 assume(tmp___0 != 0);
493 goto ldv_29188;
491 ldv_29188:;
494 tmp = nondet_int() { /* Function call is skipped due to function is undefined */}
494 switch (tmp);
495 assume(!(tmp == 0));
517 assume(!(tmp == 1));
538 assume(tmp == 2);
541 assume(ldv_s_adp5520_bl_driver_platform_driver == 0);
546 -adp5520_bl_probe(var_group2)
{
292 struct backlight_properties props;
293 struct backlight_device *bl;
294 struct adp5520_bl *data;
295 int ret;
296 void *tmp;
297 void *tmp___0;
298 struct lock_class_key __key;
299 long tmp___1;
300 _Bool tmp___2;
301 int tmp___3;
295 ret = 0;
297 -devm_kzalloc(&(pdev->dev), 192UL, 37748928U)
{
659 void *tmp;
659 tmp = devm_kmalloc(dev, size, gfp | 32768U) { /* Function call is skipped due to function is undefined */}
659 return tmp;;
}
297 data = (struct adp5520_bl *)tmp;
298 assume(!(((unsigned long)data) == ((unsigned long)((struct adp5520_bl *)0))));
301 data->master = pdev->dev.parent;
302 -dev_get_platdata((const struct device *)(&(pdev->dev)))
{
1048 void *__CPAchecker_TMP_0 = (void *)(dev->platform_data);
1048 return __CPAchecker_TMP_0;;
}
302 data->pdata = (struct adp5520_backlight_platform_data *)tmp___0;
304 unsigned long __CPAchecker_TMP_0 = (unsigned long)(data->pdata);
304 assume(!(__CPAchecker_TMP_0 == ((unsigned long)((struct adp5520_backlight_platform_data *)0))));
309 data->id = pdev->id;
310 data->current_brightness = 0;
312 __mutex_init(&(data->lock), "&data->lock", &__key) { /* Function call is skipped due to function is undefined */}
314 __memset((void *)(&props), 0, 24UL) { /* Function call is skipped due to function is undefined */}
315 props.type = 1;
316 props.max_brightness = 127;
317 bl = devm_backlight_device_register(&(pdev->dev), pdev->name, data->master, (void *)data, &adp5520_bl_ops, (const struct backlight_properties *)(&props)) { /* Function call is skipped due to function is undefined */}
320 -IS_ERR((const void *)bl)
{
86 _Bool tmp;
87 -ldv_is_err(ptr)
{
10 return ((unsigned long)ptr) > 2012UL;;
}
87 return tmp;;
}
320 assume(((int)tmp___2) == 0);
325 bl->props.brightness = 127;
326 unsigned int __CPAchecker_TMP_1 = (unsigned int)(data->pdata->en_ambl_sens);
326 assume(__CPAchecker_TMP_1 != 0U);
327 -ldv_sysfs_create_group_5(&(bl->dev.kobj), &adp5520_bl_attr_group)
{
98 int tmp;
99 -ldv_sysfs_create_group(ldv_func_arg1, ldv_func_arg2)
{
21 int tmp;
22 int tmp___0;
21 tmp = ldv_undef_int() { /* Function call is skipped due to function is undefined */}
21 assume(tmp != 0);
22 LDV_SYSFS_GROUPS = LDV_SYSFS_GROUPS + 1;
23 return 0;;
}
99 return tmp;;
}
330 assume(!(ret != 0));
335 -platform_set_drvdata(pdev, (void *)bl)
{
219 -dev_set_drvdata(&(pdev->dev), data)
{
919 dev->driver_data = data;
920 return ;;
}
220 return ;;
}
336 -adp5520_bl_setup(bl)
{
99 struct adp5520_bl *data;
100 void *tmp;
101 struct device *master;
102 struct adp5520_backlight_platform_data *pdata;
103 int ret;
104 int tmp___0;
105 int tmp___1;
106 int tmp___2;
107 int tmp___3;
108 int tmp___4;
109 int tmp___5;
110 int tmp___6;
111 int tmp___7;
112 int tmp___8;
113 int tmp___9;
114 int tmp___10;
115 int tmp___11;
116 int tmp___12;
117 int tmp___13;
99 -bl_get_data(bl)
{
153 void *tmp;
153 -dev_get_drvdata((const struct device *)(&(bl_dev->dev)))
{
914 void *__CPAchecker_TMP_0 = (void *)(dev->driver_data);
914 return __CPAchecker_TMP_0;;
}
153 return tmp;;
}
99 data = (struct adp5520_bl *)tmp;
100 master = data->master;
101 pdata = data->pdata;
102 ret = 0;
104 int __CPAchecker_TMP_0 = (int)(pdata->l1_daylight_max);
104 tmp___0 = adp5520_write(master, 5, __CPAchecker_TMP_0) { /* Function call is skipped due to function is undefined */}
104 ret = tmp___0 | ret;
106 int __CPAchecker_TMP_1 = (int)(pdata->l1_daylight_dim);
106 tmp___1 = adp5520_write(master, 6, __CPAchecker_TMP_1) { /* Function call is skipped due to function is undefined */}
106 ret = tmp___1 | ret;
109 unsigned int __CPAchecker_TMP_2 = (unsigned int)(pdata->en_ambl_sens);
109 assume(__CPAchecker_TMP_2 != 0U);
110 unsigned long __CPAchecker_TMP_3 = (unsigned long)(pdata->l1_daylight_max);
110 data->cached_daylight_max = __CPAchecker_TMP_3;
111 int __CPAchecker_TMP_4 = (int)(pdata->l2_office_max);
111 tmp___2 = adp5520_write(master, 7, __CPAchecker_TMP_4) { /* Function call is skipped due to function is undefined */}
111 ret = tmp___2 | ret;
113 int __CPAchecker_TMP_5 = (int)(pdata->l2_office_dim);
113 tmp___3 = adp5520_write(master, 8, __CPAchecker_TMP_5) { /* Function call is skipped due to function is undefined */}
113 ret = tmp___3 | ret;
115 int __CPAchecker_TMP_6 = (int)(pdata->l3_dark_max);
115 tmp___4 = adp5520_write(master, 9, __CPAchecker_TMP_6) { /* Function call is skipped due to function is undefined */}
115 ret = tmp___4 | ret;
117 int __CPAchecker_TMP_7 = (int)(pdata->l3_dark_dim);
117 tmp___5 = adp5520_write(master, 10, __CPAchecker_TMP_7) { /* Function call is skipped due to function is undefined */}
117 ret = tmp___5 | ret;
119 int __CPAchecker_TMP_8 = (int)(pdata->l2_trip);
119 tmp___6 = adp5520_write(master, 13, __CPAchecker_TMP_8) { /* Function call is skipped due to function is undefined */}
119 ret = tmp___6 | ret;
121 int __CPAchecker_TMP_9 = (int)(pdata->l2_hyst);
121 tmp___7 = adp5520_write(master, 14, __CPAchecker_TMP_9) { /* Function call is skipped due to function is undefined */}
121 ret = tmp___7 | ret;
123 int __CPAchecker_TMP_10 = (int)(pdata->l3_trip);
123 tmp___8 = adp5520_write(master, 15, __CPAchecker_TMP_10) { /* Function call is skipped due to function is undefined */}
123 ret = tmp___8 | ret;
125 int __CPAchecker_TMP_11 = (int)(pdata->l3_hyst);
125 tmp___9 = adp5520_write(master, 16, __CPAchecker_TMP_11) { /* Function call is skipped due to function is undefined */}
125 ret = tmp___9 | ret;
127 int __CPAchecker_TMP_12 = (int)(pdata->abml_filt);
127 tmp___10 = adp5520_write(master, 12, (int)((u8 )(((int)((signed char)(__CPAchecker_TMP_12 << 5))) | 2))) { /* Function call is skipped due to function is undefined */}
127 ret = tmp___10 | ret;
132 int __CPAchecker_TMP_13 = (int)(pdata->en_ambl_sens);
132 int __CPAchecker_TMP_14 = (int)(pdata->fade_led_law);
132 tmp___11 = adp5520_write(master, 2, (int)((u8 )(((int)((signed char)((__CPAchecker_TMP_13 & 1) << 3))) | ((int)((signed char)((__CPAchecker_TMP_14 & 3) << 4)))))) { /* Function call is skipped due to function is undefined */}
132 ret = tmp___11 | ret;
136 signed char __CPAchecker_TMP_15 = (signed char)(pdata->fade_in);
136 int __CPAchecker_TMP_16 = (int)(pdata->fade_out);
136 tmp___12 = adp5520_write(master, 4, (int)((u8 )((((int)__CPAchecker_TMP_15) & 15) | ((int)((signed char)(__CPAchecker_TMP_16 << 4)))))) { /* Function call is skipped due to function is undefined */}
136 ret = tmp___12 | ret;
139 tmp___13 = adp5520_set_bits(master, 0, 96) { /* Function call is skipped due to function is undefined */}
139 ret = tmp___13 | ret;
142 return ret;;
}
336 ret = tmp___3 | ret;
337 -backlight_update_status(bl)
{
122 int ret;
122 ret = -2;
124 mutex_lock_nested(&(bd->update_lock), 0U) { /* Function call is skipped due to function is undefined */}
125 unsigned long __CPAchecker_TMP_0 = (unsigned long)(bd->ops);
125 assume(__CPAchecker_TMP_0 != ((unsigned long)((const struct backlight_ops *)0)));
125 unsigned long __CPAchecker_TMP_1 = (unsigned long)(bd->ops->update_status);
125 assume(__CPAchecker_TMP_1 != ((unsigned long)((int (*)(struct backlight_device *))0)));
126 assume(!((bd->ops->update_status) == (&adp5520_bl_get_brightness)));
126 assume(!((bd->ops->update_status) == (&adp5520_bl_update_status)));
126 ret = (*(bd->ops->update_status))(bd);
127 mutex_unlock(&(bd->update_lock)) { /* Function call is skipped due to function is undefined */}
129 return ret;;
}
339 return ret;;
}
547 ldv_check_return_value(res_adp5520_bl_probe_18) { /* Function call is skipped due to function is undefined */}
548 ldv_check_return_value_probe(res_adp5520_bl_probe_18) { /* Function call is skipped due to function is undefined */}
549 assume(res_adp5520_bl_probe_18 != 0);
550 goto ldv_module_exit;
592 -ldv_check_final_state()
{
34 assume(LDV_SYSFS_GROUPS != 0);
34 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
Source code
1 2 /* 3 * Backlight driver for Analog Devices ADP5520/ADP5501 MFD PMICs 4 * 5 * Copyright 2009 Analog Devices Inc. 6 * 7 * Licensed under the GPL-2 or later. 8 */ 9 10 #include <linux/kernel.h> 11 #include <linux/init.h> 12 #include <linux/platform_device.h> 13 #include <linux/fb.h> 14 #include <linux/backlight.h> 15 #include <linux/mfd/adp5520.h> 16 #include <linux/slab.h> 17 #include <linux/module.h> 18 19 struct adp5520_bl { 20 struct device *master; 21 struct adp5520_backlight_platform_data *pdata; 22 struct mutex lock; 23 unsigned long cached_daylight_max; 24 int id; 25 int current_brightness; 26 }; 27 28 static int adp5520_bl_set(struct backlight_device *bl, int brightness) 29 { 30 struct adp5520_bl *data = bl_get_data(bl); 31 struct device *master = data->master; 32 int ret = 0; 33 34 if (data->pdata->en_ambl_sens) { 35 if ((brightness > 0) && (brightness < ADP5020_MAX_BRIGHTNESS)) { 36 /* Disable Ambient Light auto adjust */ 37 ret |= adp5520_clr_bits(master, ADP5520_BL_CONTROL, 38 ADP5520_BL_AUTO_ADJ); 39 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 40 brightness); 41 } else { 42 /* 43 * MAX_BRIGHTNESS -> Enable Ambient Light auto adjust 44 * restore daylight l3 sysfs brightness 45 */ 46 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 47 data->cached_daylight_max); 48 ret |= adp5520_set_bits(master, ADP5520_BL_CONTROL, 49 ADP5520_BL_AUTO_ADJ); 50 } 51 } else { 52 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, brightness); 53 } 54 55 if (data->current_brightness && brightness == 0) 56 ret |= adp5520_set_bits(master, 57 ADP5520_MODE_STATUS, ADP5520_DIM_EN); 58 else if (data->current_brightness == 0 && brightness) 59 ret |= adp5520_clr_bits(master, 60 ADP5520_MODE_STATUS, ADP5520_DIM_EN); 61 62 if (!ret) 63 data->current_brightness = brightness; 64 65 return ret; 66 } 67 68 static int adp5520_bl_update_status(struct backlight_device *bl) 69 { 70 int brightness = bl->props.brightness; 71 72 if (bl->props.power != FB_BLANK_UNBLANK) 73 brightness = 0; 74 75 if (bl->props.fb_blank != FB_BLANK_UNBLANK) 76 brightness = 0; 77 78 return adp5520_bl_set(bl, brightness); 79 } 80 81 static int adp5520_bl_get_brightness(struct backlight_device *bl) 82 { 83 struct adp5520_bl *data = bl_get_data(bl); 84 int error; 85 uint8_t reg_val; 86 87 error = adp5520_read(data->master, ADP5520_BL_VALUE, &reg_val); 88 89 return error ? data->current_brightness : reg_val; 90 } 91 92 static const struct backlight_ops adp5520_bl_ops = { 93 .update_status = adp5520_bl_update_status, 94 .get_brightness = adp5520_bl_get_brightness, 95 }; 96 97 static int adp5520_bl_setup(struct backlight_device *bl) 98 { 99 struct adp5520_bl *data = bl_get_data(bl); 100 struct device *master = data->master; 101 struct adp5520_backlight_platform_data *pdata = data->pdata; 102 int ret = 0; 103 104 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 105 pdata->l1_daylight_max); 106 ret |= adp5520_write(master, ADP5520_DAYLIGHT_DIM, 107 pdata->l1_daylight_dim); 108 109 if (pdata->en_ambl_sens) { 110 data->cached_daylight_max = pdata->l1_daylight_max; 111 ret |= adp5520_write(master, ADP5520_OFFICE_MAX, 112 pdata->l2_office_max); 113 ret |= adp5520_write(master, ADP5520_OFFICE_DIM, 114 pdata->l2_office_dim); 115 ret |= adp5520_write(master, ADP5520_DARK_MAX, 116 pdata->l3_dark_max); 117 ret |= adp5520_write(master, ADP5520_DARK_DIM, 118 pdata->l3_dark_dim); 119 ret |= adp5520_write(master, ADP5520_L2_TRIP, 120 pdata->l2_trip); 121 ret |= adp5520_write(master, ADP5520_L2_HYS, 122 pdata->l2_hyst); 123 ret |= adp5520_write(master, ADP5520_L3_TRIP, 124 pdata->l3_trip); 125 ret |= adp5520_write(master, ADP5520_L3_HYS, 126 pdata->l3_hyst); 127 ret |= adp5520_write(master, ADP5520_ALS_CMPR_CFG, 128 ALS_CMPR_CFG_VAL(pdata->abml_filt, 129 ADP5520_L3_EN)); 130 } 131 132 ret |= adp5520_write(master, ADP5520_BL_CONTROL, 133 BL_CTRL_VAL(pdata->fade_led_law, 134 pdata->en_ambl_sens)); 135 136 ret |= adp5520_write(master, ADP5520_BL_FADE, FADE_VAL(pdata->fade_in, 137 pdata->fade_out)); 138 139 ret |= adp5520_set_bits(master, ADP5520_MODE_STATUS, 140 ADP5520_BL_EN | ADP5520_DIM_EN); 141 142 return ret; 143 } 144 145 static ssize_t adp5520_show(struct device *dev, char *buf, int reg) 146 { 147 struct adp5520_bl *data = dev_get_drvdata(dev); 148 int ret; 149 uint8_t reg_val; 150 151 mutex_lock(&data->lock); 152 ret = adp5520_read(data->master, reg, &reg_val); 153 mutex_unlock(&data->lock); 154 155 if (ret < 0) 156 return ret; 157 158 return sprintf(buf, "%u\n", reg_val); 159 } 160 161 static ssize_t adp5520_store(struct device *dev, const char *buf, 162 size_t count, int reg) 163 { 164 struct adp5520_bl *data = dev_get_drvdata(dev); 165 unsigned long val; 166 int ret; 167 168 ret = kstrtoul(buf, 10, &val); 169 if (ret) 170 return ret; 171 172 mutex_lock(&data->lock); 173 adp5520_write(data->master, reg, val); 174 mutex_unlock(&data->lock); 175 176 return count; 177 } 178 179 static ssize_t adp5520_bl_dark_max_show(struct device *dev, 180 struct device_attribute *attr, char *buf) 181 { 182 return adp5520_show(dev, buf, ADP5520_DARK_MAX); 183 } 184 185 static ssize_t adp5520_bl_dark_max_store(struct device *dev, 186 struct device_attribute *attr, 187 const char *buf, size_t count) 188 { 189 return adp5520_store(dev, buf, count, ADP5520_DARK_MAX); 190 } 191 static DEVICE_ATTR(dark_max, 0664, adp5520_bl_dark_max_show, 192 adp5520_bl_dark_max_store); 193 194 static ssize_t adp5520_bl_office_max_show(struct device *dev, 195 struct device_attribute *attr, char *buf) 196 { 197 return adp5520_show(dev, buf, ADP5520_OFFICE_MAX); 198 } 199 200 static ssize_t adp5520_bl_office_max_store(struct device *dev, 201 struct device_attribute *attr, 202 const char *buf, size_t count) 203 { 204 return adp5520_store(dev, buf, count, ADP5520_OFFICE_MAX); 205 } 206 static DEVICE_ATTR(office_max, 0664, adp5520_bl_office_max_show, 207 adp5520_bl_office_max_store); 208 209 static ssize_t adp5520_bl_daylight_max_show(struct device *dev, 210 struct device_attribute *attr, char *buf) 211 { 212 return adp5520_show(dev, buf, ADP5520_DAYLIGHT_MAX); 213 } 214 215 static ssize_t adp5520_bl_daylight_max_store(struct device *dev, 216 struct device_attribute *attr, 217 const char *buf, size_t count) 218 { 219 struct adp5520_bl *data = dev_get_drvdata(dev); 220 int ret; 221 222 ret = kstrtoul(buf, 10, &data->cached_daylight_max); 223 if (ret < 0) 224 return ret; 225 226 return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX); 227 } 228 static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show, 229 adp5520_bl_daylight_max_store); 230 231 static ssize_t adp5520_bl_dark_dim_show(struct device *dev, 232 struct device_attribute *attr, char *buf) 233 { 234 return adp5520_show(dev, buf, ADP5520_DARK_DIM); 235 } 236 237 static ssize_t adp5520_bl_dark_dim_store(struct device *dev, 238 struct device_attribute *attr, 239 const char *buf, size_t count) 240 { 241 return adp5520_store(dev, buf, count, ADP5520_DARK_DIM); 242 } 243 static DEVICE_ATTR(dark_dim, 0664, adp5520_bl_dark_dim_show, 244 adp5520_bl_dark_dim_store); 245 246 static ssize_t adp5520_bl_office_dim_show(struct device *dev, 247 struct device_attribute *attr, char *buf) 248 { 249 return adp5520_show(dev, buf, ADP5520_OFFICE_DIM); 250 } 251 252 static ssize_t adp5520_bl_office_dim_store(struct device *dev, 253 struct device_attribute *attr, 254 const char *buf, size_t count) 255 { 256 return adp5520_store(dev, buf, count, ADP5520_OFFICE_DIM); 257 } 258 static DEVICE_ATTR(office_dim, 0664, adp5520_bl_office_dim_show, 259 adp5520_bl_office_dim_store); 260 261 static ssize_t adp5520_bl_daylight_dim_show(struct device *dev, 262 struct device_attribute *attr, char *buf) 263 { 264 return adp5520_show(dev, buf, ADP5520_DAYLIGHT_DIM); 265 } 266 267 static ssize_t adp5520_bl_daylight_dim_store(struct device *dev, 268 struct device_attribute *attr, 269 const char *buf, size_t count) 270 { 271 return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_DIM); 272 } 273 static DEVICE_ATTR(daylight_dim, 0664, adp5520_bl_daylight_dim_show, 274 adp5520_bl_daylight_dim_store); 275 276 static struct attribute *adp5520_bl_attributes[] = { 277 &dev_attr_dark_max.attr, 278 &dev_attr_dark_dim.attr, 279 &dev_attr_office_max.attr, 280 &dev_attr_office_dim.attr, 281 &dev_attr_daylight_max.attr, 282 &dev_attr_daylight_dim.attr, 283 NULL 284 }; 285 286 static const struct attribute_group adp5520_bl_attr_group = { 287 .attrs = adp5520_bl_attributes, 288 }; 289 290 static int adp5520_bl_probe(struct platform_device *pdev) 291 { 292 struct backlight_properties props; 293 struct backlight_device *bl; 294 struct adp5520_bl *data; 295 int ret = 0; 296 297 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 298 if (data == NULL) 299 return -ENOMEM; 300 301 data->master = pdev->dev.parent; 302 data->pdata = dev_get_platdata(&pdev->dev); 303 304 if (data->pdata == NULL) { 305 dev_err(&pdev->dev, "missing platform data\n"); 306 return -ENODEV; 307 } 308 309 data->id = pdev->id; 310 data->current_brightness = 0; 311 312 mutex_init(&data->lock); 313 314 memset(&props, 0, sizeof(struct backlight_properties)); 315 props.type = BACKLIGHT_RAW; 316 props.max_brightness = ADP5020_MAX_BRIGHTNESS; 317 bl = devm_backlight_device_register(&pdev->dev, pdev->name, 318 data->master, data, &adp5520_bl_ops, 319 &props); 320 if (IS_ERR(bl)) { 321 dev_err(&pdev->dev, "failed to register backlight\n"); 322 return PTR_ERR(bl); 323 } 324 325 bl->props.brightness = ADP5020_MAX_BRIGHTNESS; 326 if (data->pdata->en_ambl_sens) 327 ret = sysfs_create_group(&bl->dev.kobj, 328 &adp5520_bl_attr_group); 329 330 if (ret) { 331 dev_err(&pdev->dev, "failed to register sysfs\n"); 332 return ret; 333 } 334 335 platform_set_drvdata(pdev, bl); 336 ret |= adp5520_bl_setup(bl); 337 backlight_update_status(bl); 338 339 return ret; 340 } 341 342 static int adp5520_bl_remove(struct platform_device *pdev) 343 { 344 struct backlight_device *bl = platform_get_drvdata(pdev); 345 struct adp5520_bl *data = bl_get_data(bl); 346 347 adp5520_clr_bits(data->master, ADP5520_MODE_STATUS, ADP5520_BL_EN); 348 349 if (data->pdata->en_ambl_sens) 350 sysfs_remove_group(&bl->dev.kobj, 351 &adp5520_bl_attr_group); 352 353 return 0; 354 } 355 356 #ifdef CONFIG_PM_SLEEP 357 static int adp5520_bl_suspend(struct device *dev) 358 { 359 struct backlight_device *bl = dev_get_drvdata(dev); 360 361 return adp5520_bl_set(bl, 0); 362 } 363 364 static int adp5520_bl_resume(struct device *dev) 365 { 366 struct backlight_device *bl = dev_get_drvdata(dev); 367 368 backlight_update_status(bl); 369 return 0; 370 } 371 #endif 372 373 static SIMPLE_DEV_PM_OPS(adp5520_bl_pm_ops, adp5520_bl_suspend, 374 adp5520_bl_resume); 375 376 static struct platform_driver adp5520_bl_driver = { 377 .driver = { 378 .name = "adp5520-backlight", 379 .pm = &adp5520_bl_pm_ops, 380 }, 381 .probe = adp5520_bl_probe, 382 .remove = adp5520_bl_remove, 383 }; 384 385 module_platform_driver(adp5520_bl_driver); 386 387 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 388 MODULE_DESCRIPTION("ADP5520(01) Backlight Driver"); 389 MODULE_LICENSE("GPL"); 390 MODULE_ALIAS("platform:adp5520-backlight"); 391 392 393 394 395 396 /* LDV_COMMENT_BEGIN_MAIN */ 397 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 398 399 /*###########################################################################*/ 400 401 /*############## Driver Environment Generator 0.2 output ####################*/ 402 403 /*###########################################################################*/ 404 405 406 407 /* 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. */ 408 void ldv_check_final_state(void); 409 410 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 411 void ldv_check_return_value(int res); 412 413 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 414 void ldv_check_return_value_probe(int res); 415 416 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 417 void ldv_initialize(void); 418 419 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 420 void ldv_handler_precall(void); 421 422 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 423 int nondet_int(void); 424 425 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 426 int LDV_IN_INTERRUPT; 427 428 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 429 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 430 431 432 433 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 434 /*============================= VARIABLE DECLARATION PART =============================*/ 435 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 436 /* content: static int adp5520_bl_update_status(struct backlight_device *bl)*/ 437 /* LDV_COMMENT_END_PREP */ 438 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "adp5520_bl_update_status" */ 439 struct backlight_device * var_group1; 440 /* LDV_COMMENT_BEGIN_PREP */ 441 #ifdef CONFIG_PM_SLEEP 442 #endif 443 /* LDV_COMMENT_END_PREP */ 444 /* content: static int adp5520_bl_get_brightness(struct backlight_device *bl)*/ 445 /* LDV_COMMENT_END_PREP */ 446 /* LDV_COMMENT_BEGIN_PREP */ 447 #ifdef CONFIG_PM_SLEEP 448 #endif 449 /* LDV_COMMENT_END_PREP */ 450 451 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 452 /* content: static int adp5520_bl_probe(struct platform_device *pdev)*/ 453 /* LDV_COMMENT_END_PREP */ 454 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "adp5520_bl_probe" */ 455 struct platform_device * var_group2; 456 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "adp5520_bl_probe" */ 457 static int res_adp5520_bl_probe_18; 458 /* LDV_COMMENT_BEGIN_PREP */ 459 #ifdef CONFIG_PM_SLEEP 460 #endif 461 /* LDV_COMMENT_END_PREP */ 462 /* content: static int adp5520_bl_remove(struct platform_device *pdev)*/ 463 /* LDV_COMMENT_END_PREP */ 464 /* LDV_COMMENT_BEGIN_PREP */ 465 #ifdef CONFIG_PM_SLEEP 466 #endif 467 /* LDV_COMMENT_END_PREP */ 468 469 470 471 472 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 473 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 474 /*============================= VARIABLE INITIALIZING PART =============================*/ 475 LDV_IN_INTERRUPT=1; 476 477 478 479 480 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 481 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 482 /*============================= FUNCTION CALL SECTION =============================*/ 483 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 484 ldv_initialize(); 485 486 487 int ldv_s_adp5520_bl_driver_platform_driver = 0; 488 489 490 while( nondet_int() 491 || !(ldv_s_adp5520_bl_driver_platform_driver == 0) 492 ) { 493 494 switch(nondet_int()) { 495 496 case 0: { 497 498 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 499 500 501 /* content: static int adp5520_bl_update_status(struct backlight_device *bl)*/ 502 /* LDV_COMMENT_END_PREP */ 503 /* LDV_COMMENT_FUNCTION_CALL Function from field "update_status" from driver structure with callbacks "adp5520_bl_ops" */ 504 ldv_handler_precall(); 505 adp5520_bl_update_status( var_group1); 506 /* LDV_COMMENT_BEGIN_PREP */ 507 #ifdef CONFIG_PM_SLEEP 508 #endif 509 /* LDV_COMMENT_END_PREP */ 510 511 512 513 514 } 515 516 break; 517 case 1: { 518 519 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 520 521 522 /* content: static int adp5520_bl_get_brightness(struct backlight_device *bl)*/ 523 /* LDV_COMMENT_END_PREP */ 524 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_brightness" from driver structure with callbacks "adp5520_bl_ops" */ 525 ldv_handler_precall(); 526 adp5520_bl_get_brightness( var_group1); 527 /* LDV_COMMENT_BEGIN_PREP */ 528 #ifdef CONFIG_PM_SLEEP 529 #endif 530 /* LDV_COMMENT_END_PREP */ 531 532 533 534 535 } 536 537 break; 538 case 2: { 539 540 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 541 if(ldv_s_adp5520_bl_driver_platform_driver==0) { 542 543 /* content: static int adp5520_bl_probe(struct platform_device *pdev)*/ 544 /* LDV_COMMENT_END_PREP */ 545 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "adp5520_bl_driver". Standart function test for correct return result. */ 546 res_adp5520_bl_probe_18 = adp5520_bl_probe( var_group2); 547 ldv_check_return_value(res_adp5520_bl_probe_18); 548 ldv_check_return_value_probe(res_adp5520_bl_probe_18); 549 if(res_adp5520_bl_probe_18) 550 goto ldv_module_exit; 551 /* LDV_COMMENT_BEGIN_PREP */ 552 #ifdef CONFIG_PM_SLEEP 553 #endif 554 /* LDV_COMMENT_END_PREP */ 555 ldv_s_adp5520_bl_driver_platform_driver++; 556 557 } 558 559 } 560 561 break; 562 case 3: { 563 564 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 565 if(ldv_s_adp5520_bl_driver_platform_driver==1) { 566 567 /* content: static int adp5520_bl_remove(struct platform_device *pdev)*/ 568 /* LDV_COMMENT_END_PREP */ 569 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "adp5520_bl_driver" */ 570 ldv_handler_precall(); 571 adp5520_bl_remove( var_group2); 572 /* LDV_COMMENT_BEGIN_PREP */ 573 #ifdef CONFIG_PM_SLEEP 574 #endif 575 /* LDV_COMMENT_END_PREP */ 576 ldv_s_adp5520_bl_driver_platform_driver=0; 577 578 } 579 580 } 581 582 break; 583 default: break; 584 585 } 586 587 } 588 589 ldv_module_exit: 590 591 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 592 ldv_final: ldv_check_final_state(); 593 594 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 595 return; 596 597 } 598 #endif 599 600 /* 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 9 #include <linux/sysfs.h> 10 #include <verifier/rcv.h> 11 #include <verifier/multimap.h> 12 13 # 1 "/home/ubuntu/inst/kernel-rules/kernel-model/ERR.inc" 1 14 #ifndef _LDV_ERR_ 15 #define _LDV_ERR_ 16 17 #include <linux/kernel.h> 18 19 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err') This function return result of checking if pointer is impossible. */ 20 bool ldv_is_err(const void *ptr) 21 { 22 /*LDV_COMMENT_RETURN Return value of function ldv_is_err_val().*/ 23 return ((unsigned long)ptr > LDV_PTR_MAX); 24 } 25 26 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_err_ptr') This function return pointer. */ 27 void* ldv_err_ptr(long error) 28 { 29 /*LDV_COMMENT_RETURN Return error pointer.*/ 30 return (void *)(LDV_PTR_MAX - error); 31 } 32 33 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_ptr_err') This function return error if pointer is impossible. */ 34 long ldv_ptr_err(const void *ptr) 35 { 36 /*LDV_COMMENT_RETURN Return error code.*/ 37 return (long)(LDV_PTR_MAX - (unsigned long)ptr); 38 } 39 40 /* LDV_COMMENT_MODEL_FUNCTION_DEFENITION(name='ldv_is_err_or_null') This function check if pointer is impossible or null. */ 41 bool ldv_is_err_or_null(const void *ptr) 42 { 43 /*LDV_COMMENT_RETURN Return 0 if pointer is possible and not zero, and 1 in other cases*/ 44 return !ptr || ldv_is_err((unsigned long)ptr); 45 } 46 47 #endif /* _LDV_ERR_ */ 48 # 11 "/home/ubuntu/inst/kernel-rules/models/0151.aspect" 2 49 50 MultiMap LDV_SYSFS_GROUPS = ldv_multimap_init(LDV_SYSFS_GROUPS); 51 52 53 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_sysfs_create_group') Create some sysfs group for specified kernel object */ 54 int ldv_sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) { 55 ldv_assert(ldv_multimap_not_contains_key_value(LDV_SYSFS_GROUPS, kobj, grp)); 56 if (ldv_undef_int()) { 57 ldv_multimap_put(LDV_SYSFS_GROUPS, kobj, grp); 58 return 0; 59 } 60 return ldv_undef_int_negative(); 61 } 62 63 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_sysfs_remove_group') Remove some sysfs group from specified kernel object */ 64 void ldv_sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { 65 ldv_multimap_remove_value(LDV_SYSFS_GROUPS, kobj, grp); 66 } 67 68 void ldv_check_final_state(void) { 69 ldv_assert(ldv_multimap_is_empty(LDV_SYSFS_GROUPS)); 70 } 71 #line 1 "/home/ubuntu/launches/work/current--X--drivers--X--defaultlinux-4.7-rc1.tar.xz--X--151_1a--X--cpachecker/linux-4.7-rc1.tar.xz/csd_deg_dscv/11729/dscv_tempdir/dscv/ri/151_1a/drivers/video/backlight/adp5520_bl.c" 72 73 /* 74 * Backlight driver for Analog Devices ADP5520/ADP5501 MFD PMICs 75 * 76 * Copyright 2009 Analog Devices Inc. 77 * 78 * Licensed under the GPL-2 or later. 79 */ 80 81 #include <linux/kernel.h> 82 #include <linux/init.h> 83 #include <linux/platform_device.h> 84 #include <linux/fb.h> 85 #include <linux/backlight.h> 86 #include <linux/mfd/adp5520.h> 87 #include <linux/slab.h> 88 #include <linux/module.h> 89 90 struct adp5520_bl { 91 struct device *master; 92 struct adp5520_backlight_platform_data *pdata; 93 struct mutex lock; 94 unsigned long cached_daylight_max; 95 int id; 96 int current_brightness; 97 }; 98 99 static int adp5520_bl_set(struct backlight_device *bl, int brightness) 100 { 101 struct adp5520_bl *data = bl_get_data(bl); 102 struct device *master = data->master; 103 int ret = 0; 104 105 if (data->pdata->en_ambl_sens) { 106 if ((brightness > 0) && (brightness < ADP5020_MAX_BRIGHTNESS)) { 107 /* Disable Ambient Light auto adjust */ 108 ret |= adp5520_clr_bits(master, ADP5520_BL_CONTROL, 109 ADP5520_BL_AUTO_ADJ); 110 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 111 brightness); 112 } else { 113 /* 114 * MAX_BRIGHTNESS -> Enable Ambient Light auto adjust 115 * restore daylight l3 sysfs brightness 116 */ 117 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 118 data->cached_daylight_max); 119 ret |= adp5520_set_bits(master, ADP5520_BL_CONTROL, 120 ADP5520_BL_AUTO_ADJ); 121 } 122 } else { 123 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, brightness); 124 } 125 126 if (data->current_brightness && brightness == 0) 127 ret |= adp5520_set_bits(master, 128 ADP5520_MODE_STATUS, ADP5520_DIM_EN); 129 else if (data->current_brightness == 0 && brightness) 130 ret |= adp5520_clr_bits(master, 131 ADP5520_MODE_STATUS, ADP5520_DIM_EN); 132 133 if (!ret) 134 data->current_brightness = brightness; 135 136 return ret; 137 } 138 139 static int adp5520_bl_update_status(struct backlight_device *bl) 140 { 141 int brightness = bl->props.brightness; 142 143 if (bl->props.power != FB_BLANK_UNBLANK) 144 brightness = 0; 145 146 if (bl->props.fb_blank != FB_BLANK_UNBLANK) 147 brightness = 0; 148 149 return adp5520_bl_set(bl, brightness); 150 } 151 152 static int adp5520_bl_get_brightness(struct backlight_device *bl) 153 { 154 struct adp5520_bl *data = bl_get_data(bl); 155 int error; 156 uint8_t reg_val; 157 158 error = adp5520_read(data->master, ADP5520_BL_VALUE, &reg_val); 159 160 return error ? data->current_brightness : reg_val; 161 } 162 163 static const struct backlight_ops adp5520_bl_ops = { 164 .update_status = adp5520_bl_update_status, 165 .get_brightness = adp5520_bl_get_brightness, 166 }; 167 168 static int adp5520_bl_setup(struct backlight_device *bl) 169 { 170 struct adp5520_bl *data = bl_get_data(bl); 171 struct device *master = data->master; 172 struct adp5520_backlight_platform_data *pdata = data->pdata; 173 int ret = 0; 174 175 ret |= adp5520_write(master, ADP5520_DAYLIGHT_MAX, 176 pdata->l1_daylight_max); 177 ret |= adp5520_write(master, ADP5520_DAYLIGHT_DIM, 178 pdata->l1_daylight_dim); 179 180 if (pdata->en_ambl_sens) { 181 data->cached_daylight_max = pdata->l1_daylight_max; 182 ret |= adp5520_write(master, ADP5520_OFFICE_MAX, 183 pdata->l2_office_max); 184 ret |= adp5520_write(master, ADP5520_OFFICE_DIM, 185 pdata->l2_office_dim); 186 ret |= adp5520_write(master, ADP5520_DARK_MAX, 187 pdata->l3_dark_max); 188 ret |= adp5520_write(master, ADP5520_DARK_DIM, 189 pdata->l3_dark_dim); 190 ret |= adp5520_write(master, ADP5520_L2_TRIP, 191 pdata->l2_trip); 192 ret |= adp5520_write(master, ADP5520_L2_HYS, 193 pdata->l2_hyst); 194 ret |= adp5520_write(master, ADP5520_L3_TRIP, 195 pdata->l3_trip); 196 ret |= adp5520_write(master, ADP5520_L3_HYS, 197 pdata->l3_hyst); 198 ret |= adp5520_write(master, ADP5520_ALS_CMPR_CFG, 199 ALS_CMPR_CFG_VAL(pdata->abml_filt, 200 ADP5520_L3_EN)); 201 } 202 203 ret |= adp5520_write(master, ADP5520_BL_CONTROL, 204 BL_CTRL_VAL(pdata->fade_led_law, 205 pdata->en_ambl_sens)); 206 207 ret |= adp5520_write(master, ADP5520_BL_FADE, FADE_VAL(pdata->fade_in, 208 pdata->fade_out)); 209 210 ret |= adp5520_set_bits(master, ADP5520_MODE_STATUS, 211 ADP5520_BL_EN | ADP5520_DIM_EN); 212 213 return ret; 214 } 215 216 static ssize_t adp5520_show(struct device *dev, char *buf, int reg) 217 { 218 struct adp5520_bl *data = dev_get_drvdata(dev); 219 int ret; 220 uint8_t reg_val; 221 222 mutex_lock(&data->lock); 223 ret = adp5520_read(data->master, reg, &reg_val); 224 mutex_unlock(&data->lock); 225 226 if (ret < 0) 227 return ret; 228 229 return sprintf(buf, "%u\n", reg_val); 230 } 231 232 static ssize_t adp5520_store(struct device *dev, const char *buf, 233 size_t count, int reg) 234 { 235 struct adp5520_bl *data = dev_get_drvdata(dev); 236 unsigned long val; 237 int ret; 238 239 ret = kstrtoul(buf, 10, &val); 240 if (ret) 241 return ret; 242 243 mutex_lock(&data->lock); 244 adp5520_write(data->master, reg, val); 245 mutex_unlock(&data->lock); 246 247 return count; 248 } 249 250 static ssize_t adp5520_bl_dark_max_show(struct device *dev, 251 struct device_attribute *attr, char *buf) 252 { 253 return adp5520_show(dev, buf, ADP5520_DARK_MAX); 254 } 255 256 static ssize_t adp5520_bl_dark_max_store(struct device *dev, 257 struct device_attribute *attr, 258 const char *buf, size_t count) 259 { 260 return adp5520_store(dev, buf, count, ADP5520_DARK_MAX); 261 } 262 static DEVICE_ATTR(dark_max, 0664, adp5520_bl_dark_max_show, 263 adp5520_bl_dark_max_store); 264 265 static ssize_t adp5520_bl_office_max_show(struct device *dev, 266 struct device_attribute *attr, char *buf) 267 { 268 return adp5520_show(dev, buf, ADP5520_OFFICE_MAX); 269 } 270 271 static ssize_t adp5520_bl_office_max_store(struct device *dev, 272 struct device_attribute *attr, 273 const char *buf, size_t count) 274 { 275 return adp5520_store(dev, buf, count, ADP5520_OFFICE_MAX); 276 } 277 static DEVICE_ATTR(office_max, 0664, adp5520_bl_office_max_show, 278 adp5520_bl_office_max_store); 279 280 static ssize_t adp5520_bl_daylight_max_show(struct device *dev, 281 struct device_attribute *attr, char *buf) 282 { 283 return adp5520_show(dev, buf, ADP5520_DAYLIGHT_MAX); 284 } 285 286 static ssize_t adp5520_bl_daylight_max_store(struct device *dev, 287 struct device_attribute *attr, 288 const char *buf, size_t count) 289 { 290 struct adp5520_bl *data = dev_get_drvdata(dev); 291 int ret; 292 293 ret = kstrtoul(buf, 10, &data->cached_daylight_max); 294 if (ret < 0) 295 return ret; 296 297 return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX); 298 } 299 static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show, 300 adp5520_bl_daylight_max_store); 301 302 static ssize_t adp5520_bl_dark_dim_show(struct device *dev, 303 struct device_attribute *attr, char *buf) 304 { 305 return adp5520_show(dev, buf, ADP5520_DARK_DIM); 306 } 307 308 static ssize_t adp5520_bl_dark_dim_store(struct device *dev, 309 struct device_attribute *attr, 310 const char *buf, size_t count) 311 { 312 return adp5520_store(dev, buf, count, ADP5520_DARK_DIM); 313 } 314 static DEVICE_ATTR(dark_dim, 0664, adp5520_bl_dark_dim_show, 315 adp5520_bl_dark_dim_store); 316 317 static ssize_t adp5520_bl_office_dim_show(struct device *dev, 318 struct device_attribute *attr, char *buf) 319 { 320 return adp5520_show(dev, buf, ADP5520_OFFICE_DIM); 321 } 322 323 static ssize_t adp5520_bl_office_dim_store(struct device *dev, 324 struct device_attribute *attr, 325 const char *buf, size_t count) 326 { 327 return adp5520_store(dev, buf, count, ADP5520_OFFICE_DIM); 328 } 329 static DEVICE_ATTR(office_dim, 0664, adp5520_bl_office_dim_show, 330 adp5520_bl_office_dim_store); 331 332 static ssize_t adp5520_bl_daylight_dim_show(struct device *dev, 333 struct device_attribute *attr, char *buf) 334 { 335 return adp5520_show(dev, buf, ADP5520_DAYLIGHT_DIM); 336 } 337 338 static ssize_t adp5520_bl_daylight_dim_store(struct device *dev, 339 struct device_attribute *attr, 340 const char *buf, size_t count) 341 { 342 return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_DIM); 343 } 344 static DEVICE_ATTR(daylight_dim, 0664, adp5520_bl_daylight_dim_show, 345 adp5520_bl_daylight_dim_store); 346 347 static struct attribute *adp5520_bl_attributes[] = { 348 &dev_attr_dark_max.attr, 349 &dev_attr_dark_dim.attr, 350 &dev_attr_office_max.attr, 351 &dev_attr_office_dim.attr, 352 &dev_attr_daylight_max.attr, 353 &dev_attr_daylight_dim.attr, 354 NULL 355 }; 356 357 static const struct attribute_group adp5520_bl_attr_group = { 358 .attrs = adp5520_bl_attributes, 359 }; 360 361 static int adp5520_bl_probe(struct platform_device *pdev) 362 { 363 struct backlight_properties props; 364 struct backlight_device *bl; 365 struct adp5520_bl *data; 366 int ret = 0; 367 368 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 369 if (data == NULL) 370 return -ENOMEM; 371 372 data->master = pdev->dev.parent; 373 data->pdata = dev_get_platdata(&pdev->dev); 374 375 if (data->pdata == NULL) { 376 dev_err(&pdev->dev, "missing platform data\n"); 377 return -ENODEV; 378 } 379 380 data->id = pdev->id; 381 data->current_brightness = 0; 382 383 mutex_init(&data->lock); 384 385 memset(&props, 0, sizeof(struct backlight_properties)); 386 props.type = BACKLIGHT_RAW; 387 props.max_brightness = ADP5020_MAX_BRIGHTNESS; 388 bl = devm_backlight_device_register(&pdev->dev, pdev->name, 389 data->master, data, &adp5520_bl_ops, 390 &props); 391 if (IS_ERR(bl)) { 392 dev_err(&pdev->dev, "failed to register backlight\n"); 393 return PTR_ERR(bl); 394 } 395 396 bl->props.brightness = ADP5020_MAX_BRIGHTNESS; 397 if (data->pdata->en_ambl_sens) 398 ret = sysfs_create_group(&bl->dev.kobj, 399 &adp5520_bl_attr_group); 400 401 if (ret) { 402 dev_err(&pdev->dev, "failed to register sysfs\n"); 403 return ret; 404 } 405 406 platform_set_drvdata(pdev, bl); 407 ret |= adp5520_bl_setup(bl); 408 backlight_update_status(bl); 409 410 return ret; 411 } 412 413 static int adp5520_bl_remove(struct platform_device *pdev) 414 { 415 struct backlight_device *bl = platform_get_drvdata(pdev); 416 struct adp5520_bl *data = bl_get_data(bl); 417 418 adp5520_clr_bits(data->master, ADP5520_MODE_STATUS, ADP5520_BL_EN); 419 420 if (data->pdata->en_ambl_sens) 421 sysfs_remove_group(&bl->dev.kobj, 422 &adp5520_bl_attr_group); 423 424 return 0; 425 } 426 427 #ifdef CONFIG_PM_SLEEP 428 static int adp5520_bl_suspend(struct device *dev) 429 { 430 struct backlight_device *bl = dev_get_drvdata(dev); 431 432 return adp5520_bl_set(bl, 0); 433 } 434 435 static int adp5520_bl_resume(struct device *dev) 436 { 437 struct backlight_device *bl = dev_get_drvdata(dev); 438 439 backlight_update_status(bl); 440 return 0; 441 } 442 #endif 443 444 static SIMPLE_DEV_PM_OPS(adp5520_bl_pm_ops, adp5520_bl_suspend, 445 adp5520_bl_resume); 446 447 static struct platform_driver adp5520_bl_driver = { 448 .driver = { 449 .name = "adp5520-backlight", 450 .pm = &adp5520_bl_pm_ops, 451 }, 452 .probe = adp5520_bl_probe, 453 .remove = adp5520_bl_remove, 454 }; 455 456 module_platform_driver(adp5520_bl_driver); 457 458 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); 459 MODULE_DESCRIPTION("ADP5520(01) Backlight Driver"); 460 MODULE_LICENSE("GPL"); 461 MODULE_ALIAS("platform:adp5520-backlight"); 462 463 464 465 466 467 /* LDV_COMMENT_BEGIN_MAIN */ 468 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 469 470 /*###########################################################################*/ 471 472 /*############## Driver Environment Generator 0.2 output ####################*/ 473 474 /*###########################################################################*/ 475 476 477 478 /* 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. */ 479 void ldv_check_final_state(void); 480 481 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 482 void ldv_check_return_value(int res); 483 484 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 485 void ldv_check_return_value_probe(int res); 486 487 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 488 void ldv_initialize(void); 489 490 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 491 void ldv_handler_precall(void); 492 493 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 494 int nondet_int(void); 495 496 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 497 int LDV_IN_INTERRUPT; 498 499 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 500 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 501 502 503 504 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 505 /*============================= VARIABLE DECLARATION PART =============================*/ 506 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 507 /* content: static int adp5520_bl_update_status(struct backlight_device *bl)*/ 508 /* LDV_COMMENT_END_PREP */ 509 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "adp5520_bl_update_status" */ 510 struct backlight_device * var_group1; 511 /* LDV_COMMENT_BEGIN_PREP */ 512 #ifdef CONFIG_PM_SLEEP 513 #endif 514 /* LDV_COMMENT_END_PREP */ 515 /* content: static int adp5520_bl_get_brightness(struct backlight_device *bl)*/ 516 /* LDV_COMMENT_END_PREP */ 517 /* LDV_COMMENT_BEGIN_PREP */ 518 #ifdef CONFIG_PM_SLEEP 519 #endif 520 /* LDV_COMMENT_END_PREP */ 521 522 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 523 /* content: static int adp5520_bl_probe(struct platform_device *pdev)*/ 524 /* LDV_COMMENT_END_PREP */ 525 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "adp5520_bl_probe" */ 526 struct platform_device * var_group2; 527 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "adp5520_bl_probe" */ 528 static int res_adp5520_bl_probe_18; 529 /* LDV_COMMENT_BEGIN_PREP */ 530 #ifdef CONFIG_PM_SLEEP 531 #endif 532 /* LDV_COMMENT_END_PREP */ 533 /* content: static int adp5520_bl_remove(struct platform_device *pdev)*/ 534 /* LDV_COMMENT_END_PREP */ 535 /* LDV_COMMENT_BEGIN_PREP */ 536 #ifdef CONFIG_PM_SLEEP 537 #endif 538 /* LDV_COMMENT_END_PREP */ 539 540 541 542 543 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 544 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 545 /*============================= VARIABLE INITIALIZING PART =============================*/ 546 LDV_IN_INTERRUPT=1; 547 548 549 550 551 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 552 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 553 /*============================= FUNCTION CALL SECTION =============================*/ 554 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 555 ldv_initialize(); 556 557 558 int ldv_s_adp5520_bl_driver_platform_driver = 0; 559 560 561 while( nondet_int() 562 || !(ldv_s_adp5520_bl_driver_platform_driver == 0) 563 ) { 564 565 switch(nondet_int()) { 566 567 case 0: { 568 569 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 570 571 572 /* content: static int adp5520_bl_update_status(struct backlight_device *bl)*/ 573 /* LDV_COMMENT_END_PREP */ 574 /* LDV_COMMENT_FUNCTION_CALL Function from field "update_status" from driver structure with callbacks "adp5520_bl_ops" */ 575 ldv_handler_precall(); 576 adp5520_bl_update_status( var_group1); 577 /* LDV_COMMENT_BEGIN_PREP */ 578 #ifdef CONFIG_PM_SLEEP 579 #endif 580 /* LDV_COMMENT_END_PREP */ 581 582 583 584 585 } 586 587 break; 588 case 1: { 589 590 /** STRUCT: struct type: backlight_ops, struct name: adp5520_bl_ops **/ 591 592 593 /* content: static int adp5520_bl_get_brightness(struct backlight_device *bl)*/ 594 /* LDV_COMMENT_END_PREP */ 595 /* LDV_COMMENT_FUNCTION_CALL Function from field "get_brightness" from driver structure with callbacks "adp5520_bl_ops" */ 596 ldv_handler_precall(); 597 adp5520_bl_get_brightness( var_group1); 598 /* LDV_COMMENT_BEGIN_PREP */ 599 #ifdef CONFIG_PM_SLEEP 600 #endif 601 /* LDV_COMMENT_END_PREP */ 602 603 604 605 606 } 607 608 break; 609 case 2: { 610 611 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 612 if(ldv_s_adp5520_bl_driver_platform_driver==0) { 613 614 /* content: static int adp5520_bl_probe(struct platform_device *pdev)*/ 615 /* LDV_COMMENT_END_PREP */ 616 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "adp5520_bl_driver". Standart function test for correct return result. */ 617 res_adp5520_bl_probe_18 = adp5520_bl_probe( var_group2); 618 ldv_check_return_value(res_adp5520_bl_probe_18); 619 ldv_check_return_value_probe(res_adp5520_bl_probe_18); 620 if(res_adp5520_bl_probe_18) 621 goto ldv_module_exit; 622 /* LDV_COMMENT_BEGIN_PREP */ 623 #ifdef CONFIG_PM_SLEEP 624 #endif 625 /* LDV_COMMENT_END_PREP */ 626 ldv_s_adp5520_bl_driver_platform_driver++; 627 628 } 629 630 } 631 632 break; 633 case 3: { 634 635 /** STRUCT: struct type: platform_driver, struct name: adp5520_bl_driver **/ 636 if(ldv_s_adp5520_bl_driver_platform_driver==1) { 637 638 /* content: static int adp5520_bl_remove(struct platform_device *pdev)*/ 639 /* LDV_COMMENT_END_PREP */ 640 /* LDV_COMMENT_FUNCTION_CALL Function from field "remove" from driver structure with callbacks "adp5520_bl_driver" */ 641 ldv_handler_precall(); 642 adp5520_bl_remove( var_group2); 643 /* LDV_COMMENT_BEGIN_PREP */ 644 #ifdef CONFIG_PM_SLEEP 645 #endif 646 /* LDV_COMMENT_END_PREP */ 647 ldv_s_adp5520_bl_driver_platform_driver=0; 648 649 } 650 651 } 652 653 break; 654 default: break; 655 656 } 657 658 } 659 660 ldv_module_exit: 661 662 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 663 ldv_final: ldv_check_final_state(); 664 665 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 666 return; 667 668 } 669 #endif 670 671 /* LDV_COMMENT_END_MAIN */ 672 673 #line 71 "/home/ubuntu/launches/work/current--X--drivers--X--defaultlinux-4.7-rc1.tar.xz--X--151_1a--X--cpachecker/linux-4.7-rc1.tar.xz/csd_deg_dscv/11729/dscv_tempdir/dscv/ri/151_1a/drivers/video/backlight/adp5520_bl.o.c.prepared"
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 * Backlight Lowlevel Control Abstraction 3 * 4 * Copyright (C) 2003,2004 Hewlett-Packard Company 5 * 6 */ 7 8 #ifndef _LINUX_BACKLIGHT_H 9 #define _LINUX_BACKLIGHT_H 10 11 #include <linux/device.h> 12 #include <linux/fb.h> 13 #include <linux/mutex.h> 14 #include <linux/notifier.h> 15 16 /* Notes on locking: 17 * 18 * backlight_device->ops_lock is an internal backlight lock protecting the 19 * ops pointer and no code outside the core should need to touch it. 20 * 21 * Access to update_status() is serialised by the update_lock mutex since 22 * most drivers seem to need this and historically get it wrong. 23 * 24 * Most drivers don't need locking on their get_brightness() method. 25 * If yours does, you need to implement it in the driver. You can use the 26 * update_lock mutex if appropriate. 27 * 28 * Any other use of the locks below is probably wrong. 29 */ 30 31 enum backlight_update_reason { 32 BACKLIGHT_UPDATE_HOTKEY, 33 BACKLIGHT_UPDATE_SYSFS, 34 }; 35 36 enum backlight_type { 37 BACKLIGHT_RAW = 1, 38 BACKLIGHT_PLATFORM, 39 BACKLIGHT_FIRMWARE, 40 BACKLIGHT_TYPE_MAX, 41 }; 42 43 enum backlight_notification { 44 BACKLIGHT_REGISTERED, 45 BACKLIGHT_UNREGISTERED, 46 }; 47 48 struct backlight_device; 49 struct fb_info; 50 51 struct backlight_ops { 52 unsigned int options; 53 54 #define BL_CORE_SUSPENDRESUME (1 << 0) 55 56 /* Notify the backlight driver some property has changed */ 57 int (*update_status)(struct backlight_device *); 58 /* Return the current backlight brightness (accounting for power, 59 fb_blank etc.) */ 60 int (*get_brightness)(struct backlight_device *); 61 /* Check if given framebuffer device is the one bound to this backlight; 62 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 63 int (*check_fb)(struct backlight_device *, struct fb_info *); 64 }; 65 66 /* This structure defines all the properties of a backlight */ 67 struct backlight_properties { 68 /* Current User requested brightness (0 - max_brightness) */ 69 int brightness; 70 /* Maximal value for brightness (read-only) */ 71 int max_brightness; 72 /* Current FB Power mode (0: full on, 1..3: power saving 73 modes; 4: full off), see FB_BLANK_XXX */ 74 int power; 75 /* FB Blanking active? (values as for power) */ 76 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ 77 int fb_blank; 78 /* Backlight type */ 79 enum backlight_type type; 80 /* Flags used to signal drivers of state changes */ 81 /* Upper 4 bits are reserved for driver internal use */ 82 unsigned int state; 83 84 #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ 85 #define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */ 86 #define BL_CORE_DRIVER4 (1 << 28) /* reserved for driver specific use */ 87 #define BL_CORE_DRIVER3 (1 << 29) /* reserved for driver specific use */ 88 #define BL_CORE_DRIVER2 (1 << 30) /* reserved for driver specific use */ 89 #define BL_CORE_DRIVER1 (1 << 31) /* reserved for driver specific use */ 90 91 }; 92 93 struct backlight_device { 94 /* Backlight properties */ 95 struct backlight_properties props; 96 97 /* Serialise access to update_status method */ 98 struct mutex update_lock; 99 100 /* This protects the 'ops' field. If 'ops' is NULL, the driver that 101 registered this device has been unloaded, and if class_get_devdata() 102 points to something in the body of that driver, it is also invalid. */ 103 struct mutex ops_lock; 104 const struct backlight_ops *ops; 105 106 /* The framebuffer notifier block */ 107 struct notifier_block fb_notif; 108 109 /* list entry of all registered backlight devices */ 110 struct list_head entry; 111 112 struct device dev; 113 114 /* Multiple framebuffers may share one backlight device */ 115 bool fb_bl_on[FB_MAX]; 116 117 int use_count; 118 }; 119 120 static inline int backlight_update_status(struct backlight_device *bd) 121 { 122 int ret = -ENOENT; 123 124 mutex_lock(&bd->update_lock); 125 if (bd->ops && bd->ops->update_status) 126 ret = bd->ops->update_status(bd); 127 mutex_unlock(&bd->update_lock); 128 129 return ret; 130 } 131 132 extern struct backlight_device *backlight_device_register(const char *name, 133 struct device *dev, void *devdata, const struct backlight_ops *ops, 134 const struct backlight_properties *props); 135 extern struct backlight_device *devm_backlight_device_register( 136 struct device *dev, const char *name, struct device *parent, 137 void *devdata, const struct backlight_ops *ops, 138 const struct backlight_properties *props); 139 extern void backlight_device_unregister(struct backlight_device *bd); 140 extern void devm_backlight_device_unregister(struct device *dev, 141 struct backlight_device *bd); 142 extern void backlight_force_update(struct backlight_device *bd, 143 enum backlight_update_reason reason); 144 extern int backlight_register_notifier(struct notifier_block *nb); 145 extern int backlight_unregister_notifier(struct notifier_block *nb); 146 extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type); 147 extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); 148 149 #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 150 151 static inline void * bl_get_data(struct backlight_device *bl_dev) 152 { 153 return dev_get_drvdata(&bl_dev->dev); 154 } 155 156 struct generic_bl_info { 157 const char *name; 158 int max_intensity; 159 int default_intensity; 160 int limit_mask; 161 void (*set_bl_intensity)(int intensity); 162 void (*kick_battery)(void); 163 }; 164 165 #ifdef CONFIG_OF 166 struct backlight_device *of_find_backlight_by_node(struct device_node *node); 167 #else 168 static inline struct backlight_device * 169 of_find_backlight_by_node(struct device_node *node) 170 { 171 return NULL; 172 } 173 #endif 174 175 #endif
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 * platform_device.h - generic, centralized driver model 3 * 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 5 * 6 * This file is released under the GPLv2 7 * 8 * See Documentation/driver-model/ for more information. 9 */ 10 11 #ifndef _PLATFORM_DEVICE_H_ 12 #define _PLATFORM_DEVICE_H_ 13 14 #include <linux/device.h> 15 #include <linux/mod_devicetable.h> 16 17 #define PLATFORM_DEVID_NONE (-1) 18 #define PLATFORM_DEVID_AUTO (-2) 19 20 struct mfd_cell; 21 struct property_entry; 22 23 struct platform_device { 24 const char *name; 25 int id; 26 bool id_auto; 27 struct device dev; 28 u32 num_resources; 29 struct resource *resource; 30 31 const struct platform_device_id *id_entry; 32 char *driver_override; /* Driver name to force a match */ 33 34 /* MFD cell pointer */ 35 struct mfd_cell *mfd_cell; 36 37 /* arch specific additions */ 38 struct pdev_archdata archdata; 39 }; 40 41 #define platform_get_device_id(pdev) ((pdev)->id_entry) 42 43 #define to_platform_device(x) container_of((x), struct platform_device, dev) 44 45 extern int platform_device_register(struct platform_device *); 46 extern void platform_device_unregister(struct platform_device *); 47 48 extern struct bus_type platform_bus_type; 49 extern struct device platform_bus; 50 51 extern void arch_setup_pdev_archdata(struct platform_device *); 52 extern struct resource *platform_get_resource(struct platform_device *, 53 unsigned int, unsigned int); 54 extern int platform_get_irq(struct platform_device *, unsigned int); 55 extern int platform_irq_count(struct platform_device *); 56 extern struct resource *platform_get_resource_byname(struct platform_device *, 57 unsigned int, 58 const char *); 59 extern int platform_get_irq_byname(struct platform_device *, const char *); 60 extern int platform_add_devices(struct platform_device **, int); 61 62 struct platform_device_info { 63 struct device *parent; 64 struct fwnode_handle *fwnode; 65 66 const char *name; 67 int id; 68 69 const struct resource *res; 70 unsigned int num_res; 71 72 const void *data; 73 size_t size_data; 74 u64 dma_mask; 75 76 struct property_entry *properties; 77 }; 78 extern struct platform_device *platform_device_register_full( 79 const struct platform_device_info *pdevinfo); 80 81 /** 82 * platform_device_register_resndata - add a platform-level device with 83 * resources and platform-specific data 84 * 85 * @parent: parent device for the device we're adding 86 * @name: base name of the device we're adding 87 * @id: instance id 88 * @res: set of resources that needs to be allocated for the device 89 * @num: number of resources 90 * @data: platform specific data for this platform device 91 * @size: size of platform specific data 92 * 93 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 94 */ 95 static inline struct platform_device *platform_device_register_resndata( 96 struct device *parent, const char *name, int id, 97 const struct resource *res, unsigned int num, 98 const void *data, size_t size) { 99 100 struct platform_device_info pdevinfo = { 101 .parent = parent, 102 .name = name, 103 .id = id, 104 .res = res, 105 .num_res = num, 106 .data = data, 107 .size_data = size, 108 .dma_mask = 0, 109 }; 110 111 return platform_device_register_full(&pdevinfo); 112 } 113 114 /** 115 * platform_device_register_simple - add a platform-level device and its resources 116 * @name: base name of the device we're adding 117 * @id: instance id 118 * @res: set of resources that needs to be allocated for the device 119 * @num: number of resources 120 * 121 * This function creates a simple platform device that requires minimal 122 * resource and memory management. Canned release function freeing memory 123 * allocated for the device allows drivers using such devices to be 124 * unloaded without waiting for the last reference to the device to be 125 * dropped. 126 * 127 * This interface is primarily intended for use with legacy drivers which 128 * probe hardware directly. Because such drivers create sysfs device nodes 129 * themselves, rather than letting system infrastructure handle such device 130 * enumeration tasks, they don't fully conform to the Linux driver model. 131 * In particular, when such drivers are built as modules, they can't be 132 * "hotplugged". 133 * 134 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 135 */ 136 static inline struct platform_device *platform_device_register_simple( 137 const char *name, int id, 138 const struct resource *res, unsigned int num) 139 { 140 return platform_device_register_resndata(NULL, name, id, 141 res, num, NULL, 0); 142 } 143 144 /** 145 * platform_device_register_data - add a platform-level device with platform-specific data 146 * @parent: parent device for the device we're adding 147 * @name: base name of the device we're adding 148 * @id: instance id 149 * @data: platform specific data for this platform device 150 * @size: size of platform specific data 151 * 152 * This function creates a simple platform device that requires minimal 153 * resource and memory management. Canned release function freeing memory 154 * allocated for the device allows drivers using such devices to be 155 * unloaded without waiting for the last reference to the device to be 156 * dropped. 157 * 158 * Returns &struct platform_device pointer on success, or ERR_PTR() on error. 159 */ 160 static inline struct platform_device *platform_device_register_data( 161 struct device *parent, const char *name, int id, 162 const void *data, size_t size) 163 { 164 return platform_device_register_resndata(parent, name, id, 165 NULL, 0, data, size); 166 } 167 168 extern struct platform_device *platform_device_alloc(const char *name, int id); 169 extern int platform_device_add_resources(struct platform_device *pdev, 170 const struct resource *res, 171 unsigned int num); 172 extern int platform_device_add_data(struct platform_device *pdev, 173 const void *data, size_t size); 174 extern int platform_device_add_properties(struct platform_device *pdev, 175 struct property_entry *properties); 176 extern int platform_device_add(struct platform_device *pdev); 177 extern void platform_device_del(struct platform_device *pdev); 178 extern void platform_device_put(struct platform_device *pdev); 179 180 struct platform_driver { 181 int (*probe)(struct platform_device *); 182 int (*remove)(struct platform_device *); 183 void (*shutdown)(struct platform_device *); 184 int (*suspend)(struct platform_device *, pm_message_t state); 185 int (*resume)(struct platform_device *); 186 struct device_driver driver; 187 const struct platform_device_id *id_table; 188 bool prevent_deferred_probe; 189 }; 190 191 #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ 192 driver)) 193 194 /* 195 * use a macro to avoid include chaining to get THIS_MODULE 196 */ 197 #define platform_driver_register(drv) \ 198 __platform_driver_register(drv, THIS_MODULE) 199 extern int __platform_driver_register(struct platform_driver *, 200 struct module *); 201 extern void platform_driver_unregister(struct platform_driver *); 202 203 /* non-hotpluggable platform devices may use this so that probe() and 204 * its support may live in __init sections, conserving runtime memory. 205 */ 206 #define platform_driver_probe(drv, probe) \ 207 __platform_driver_probe(drv, probe, THIS_MODULE) 208 extern int __platform_driver_probe(struct platform_driver *driver, 209 int (*probe)(struct platform_device *), struct module *module); 210 211 static inline void *platform_get_drvdata(const struct platform_device *pdev) 212 { 213 return dev_get_drvdata(&pdev->dev); 214 } 215 216 static inline void platform_set_drvdata(struct platform_device *pdev, 217 void *data) 218 { 219 dev_set_drvdata(&pdev->dev, data); 220 } 221 222 /* module_platform_driver() - Helper macro for drivers that don't do 223 * anything special in module init/exit. This eliminates a lot of 224 * boilerplate. Each module may only use this macro once, and 225 * calling it replaces module_init() and module_exit() 226 */ 227 #define module_platform_driver(__platform_driver) \ 228 module_driver(__platform_driver, platform_driver_register, \ 229 platform_driver_unregister) 230 231 /* builtin_platform_driver() - Helper macro for builtin drivers that 232 * don't do anything special in driver init. This eliminates some 233 * boilerplate. Each driver may only use this macro once, and 234 * calling it replaces device_initcall(). Note this is meant to be 235 * a parallel of module_platform_driver() above, but w/o _exit stuff. 236 */ 237 #define builtin_platform_driver(__platform_driver) \ 238 builtin_driver(__platform_driver, platform_driver_register) 239 240 /* module_platform_driver_probe() - Helper macro for drivers that don't do 241 * anything special in module init/exit. This eliminates a lot of 242 * boilerplate. Each module may only use this macro once, and 243 * calling it replaces module_init() and module_exit() 244 */ 245 #define module_platform_driver_probe(__platform_driver, __platform_probe) \ 246 static int __init __platform_driver##_init(void) \ 247 { \ 248 return platform_driver_probe(&(__platform_driver), \ 249 __platform_probe); \ 250 } \ 251 module_init(__platform_driver##_init); \ 252 static void __exit __platform_driver##_exit(void) \ 253 { \ 254 platform_driver_unregister(&(__platform_driver)); \ 255 } \ 256 module_exit(__platform_driver##_exit); 257 258 /* builtin_platform_driver_probe() - Helper macro for drivers that don't do 259 * anything special in device init. This eliminates some boilerplate. Each 260 * driver may only use this macro once, and using it replaces device_initcall. 261 * This is meant to be a parallel of module_platform_driver_probe above, but 262 * without the __exit parts. 263 */ 264 #define builtin_platform_driver_probe(__platform_driver, __platform_probe) \ 265 static int __init __platform_driver##_init(void) \ 266 { \ 267 return platform_driver_probe(&(__platform_driver), \ 268 __platform_probe); \ 269 } \ 270 device_initcall(__platform_driver##_init); \ 271 272 #define platform_create_bundle(driver, probe, res, n_res, data, size) \ 273 __platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE) 274 extern struct platform_device *__platform_create_bundle( 275 struct platform_driver *driver, int (*probe)(struct platform_device *), 276 struct resource *res, unsigned int n_res, 277 const void *data, size_t size, struct module *module); 278 279 int __platform_register_drivers(struct platform_driver * const *drivers, 280 unsigned int count, struct module *owner); 281 void platform_unregister_drivers(struct platform_driver * const *drivers, 282 unsigned int count); 283 284 #define platform_register_drivers(drivers, count) \ 285 __platform_register_drivers(drivers, count, THIS_MODULE) 286 287 /* early platform driver interface */ 288 struct early_platform_driver { 289 const char *class_str; 290 struct platform_driver *pdrv; 291 struct list_head list; 292 int requested_id; 293 char *buffer; 294 int bufsize; 295 }; 296 297 #define EARLY_PLATFORM_ID_UNSET -2 298 #define EARLY_PLATFORM_ID_ERROR -3 299 300 extern int early_platform_driver_register(struct early_platform_driver *epdrv, 301 char *buf); 302 extern void early_platform_add_devices(struct platform_device **devs, int num); 303 304 static inline int is_early_platform_device(struct platform_device *pdev) 305 { 306 return !pdev->dev.driver; 307 } 308 309 extern void early_platform_driver_register_all(char *class_str); 310 extern int early_platform_driver_probe(char *class_str, 311 int nr_probe, int user_only); 312 extern void early_platform_cleanup(void); 313 314 #define early_platform_init(class_string, platdrv) \ 315 early_platform_init_buffer(class_string, platdrv, NULL, 0) 316 317 #ifndef MODULE 318 #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ 319 static __initdata struct early_platform_driver early_driver = { \ 320 .class_str = class_string, \ 321 .buffer = buf, \ 322 .bufsize = bufsiz, \ 323 .pdrv = platdrv, \ 324 .requested_id = EARLY_PLATFORM_ID_UNSET, \ 325 }; \ 326 static int __init early_platform_driver_setup_func(char *buffer) \ 327 { \ 328 return early_platform_driver_register(&early_driver, buffer); \ 329 } \ 330 early_param(class_string, early_platform_driver_setup_func) 331 #else /* MODULE */ 332 #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \ 333 static inline char *early_platform_driver_setup_func(void) \ 334 { \ 335 return bufsiz ? buf : NULL; \ 336 } 337 #endif /* MODULE */ 338 339 #ifdef CONFIG_SUSPEND 340 extern int platform_pm_suspend(struct device *dev); 341 extern int platform_pm_resume(struct device *dev); 342 #else 343 #define platform_pm_suspend NULL 344 #define platform_pm_resume NULL 345 #endif 346 347 #ifdef CONFIG_HIBERNATE_CALLBACKS 348 extern int platform_pm_freeze(struct device *dev); 349 extern int platform_pm_thaw(struct device *dev); 350 extern int platform_pm_poweroff(struct device *dev); 351 extern int platform_pm_restore(struct device *dev); 352 #else 353 #define platform_pm_freeze NULL 354 #define platform_pm_thaw NULL 355 #define platform_pm_poweroff NULL 356 #define platform_pm_restore NULL 357 #endif 358 359 #ifdef CONFIG_PM_SLEEP 360 #define USE_PLATFORM_PM_SLEEP_OPS \ 361 .suspend = platform_pm_suspend, \ 362 .resume = platform_pm_resume, \ 363 .freeze = platform_pm_freeze, \ 364 .thaw = platform_pm_thaw, \ 365 .poweroff = platform_pm_poweroff, \ 366 .restore = platform_pm_restore, 367 #else 368 #define USE_PLATFORM_PM_SLEEP_OPS 369 #endif 370 371 #endif /* _PLATFORM_DEVICE_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.7-rc1.tar.xz drivers/video/backlight/adp5520_bl.ko 151_1a CPAchecker Bug Fixed 2016-07-09 01:20:47 L0261

Comment

Reported: 9 Jul 2016

[Home]