Error Trace

[Home]

Bug # 182

Show/hide error trace
Error trace
Function bodies
Blocks
  • Others...
    Function bodies without model function calls
    Initialization function calls
    Initialization function bodies
    Entry point
    Entry point body
    Function calls
    Skipped function calls
    Formal parameter names
    Declarations
    Assumes
    Assume conditions
    Returns
    Return values
    DEG initialization
    DEG function calls
    Model function calls
    Model function bodies
    Model asserts
    Model state changes
    Model function function calls
    Model function function bodies
    Model returns
    Model others
    Identation
    Line numbers
    Expand signs
-__CPAchecker_initialize()
{
20 typedef unsigned char __u8;
23 typedef unsigned short __u16;
25 typedef int __s32;
26 typedef unsigned int __u32;
29 typedef long long __s64;
30 typedef unsigned long long __u64;
15 typedef signed char s8;
16 typedef unsigned char u8;
18 typedef short s16;
19 typedef unsigned short u16;
21 typedef int s32;
22 typedef unsigned int u32;
24 typedef long long s64;
25 typedef unsigned long long u64;
14 typedef long __kernel_long_t;
15 typedef unsigned long __kernel_ulong_t;
27 typedef int __kernel_pid_t;
48 typedef unsigned int __kernel_uid32_t;
49 typedef unsigned int __kernel_gid32_t;
71 typedef __kernel_ulong_t __kernel_size_t;
72 typedef __kernel_long_t __kernel_ssize_t;
87 typedef long long __kernel_loff_t;
88 typedef __kernel_long_t __kernel_time_t;
89 typedef __kernel_long_t __kernel_clock_t;
90 typedef int __kernel_timer_t;
91 typedef int __kernel_clockid_t;
291 struct kernel_symbol { unsigned long value; const char *name; } ;
34 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;
36 typedef unsigned long uintptr_t;
45 typedef __kernel_loff_t loff_t;
54 typedef __kernel_size_t size_t;
59 typedef __kernel_ssize_t ssize_t;
69 typedef __kernel_time_t time_t;
102 typedef __s32 int32_t;
108 typedef __u32 uint32_t;
133 typedef unsigned long sector_t;
134 typedef unsigned long blkcnt_t;
157 typedef unsigned int gfp_t;
158 typedef unsigned int fmode_t;
172 typedef unsigned long irq_hw_number_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 *); } ;
117 typedef void (*ctor_fn_t)();
58 struct device ;
474 struct file_operations ;
486 struct completion ;
487 struct pt_regs ;
546 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;
242 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; } ;
30 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; } ;
596 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_39 { u8 __padding[24U]; struct lockdep_map dep_map; } ;
33 union __anonunion____missing_field_name_38 { struct raw_spinlock rlock; struct __anonstruct____missing_field_name_39 __annonCompField4; } ;
33 struct spinlock { union __anonunion____missing_field_name_38 __annonCompField5; } ;
76 typedef struct spinlock spinlock_t;
23 struct __anonstruct_rwlock_t_40 { 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_40 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_42 { unsigned int a; unsigned int b; } ;
66 struct __anonstruct____missing_field_name_43 { 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_41 { struct __anonstruct____missing_field_name_42 __annonCompField6; struct __anonstruct____missing_field_name_43 __annonCompField7; } ;
66 struct desc_struct { union __anonunion____missing_field_name_41 __annonCompField8; } ;
17 typedef unsigned long pgdval_t;
18 typedef unsigned long pgprotval_t;
22 struct pgprot { pgprotval_t pgprot; } ;
256 typedef struct pgprot pgprot_t;
258 struct __anonstruct_pgd_t_45 { pgdval_t pgd; } ;
258 typedef struct __anonstruct_pgd_t_45 pgd_t;
460 struct page ;
460 typedef struct page *pgtable_t;
471 struct file ;
482 struct seq_file ;
519 struct thread_struct ;
521 struct cpumask ;
247 struct math_emu_info { long ___orig_eip; struct pt_regs *regs; } ;
83 struct static_key { atomic_t enabled; } ;
359 struct cpumask { unsigned long bits[128U]; } ;
15 typedef struct cpumask cpumask_t;
657 typedef struct cpumask *cpumask_var_t;
22 struct tracepoint_func { void *func; void *data; int prio; } ;
28 struct tracepoint { const char *name; struct static_key key; int (*regfunc)(); void (*unregfunc)(); struct tracepoint_func *funcs; } ;
233 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_61 { u64 rip; u64 rdp; } ;
26 struct __anonstruct____missing_field_name_62 { u32 fip; u32 fcs; u32 foo; u32 fos; } ;
26 union __anonunion____missing_field_name_60 { struct __anonstruct____missing_field_name_61 __annonCompField14; struct __anonstruct____missing_field_name_62 __annonCompField15; } ;
26 union __anonunion____missing_field_name_63 { u32 padding1[12U]; u32 sw_reserved[12U]; } ;
26 struct fxregs_state { u16 cwd; u16 swd; u16 twd; u16 fop; union __anonunion____missing_field_name_60 __annonCompField16; u32 mxcsr; u32 mxcsr_mask; u32 st_space[32U]; u32 xmm_space[64U]; u32 padding[12U]; union __anonunion____missing_field_name_63 __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; } ;
227 struct xstate_header { u64 xfeatures; u64 xcomp_bv; u64 reserved[6U]; } ;
233 struct xregs_state { struct fxregs_state i387; struct xstate_header header; u8 extended_state_area[0U]; } ;
254 union fpregs_state { struct fregs_state fsave; struct fxregs_state fxsave; struct swregs_state soft; struct xregs_state xsave; u8 __padding[4096U]; } ;
271 struct fpu { unsigned int last_cpu; unsigned char fpstate_active; unsigned char fpregs_active; union fpregs_state state; } ;
174 struct seq_operations ;
408 struct perf_event ;
413 struct __anonstruct_mm_segment_t_75 { unsigned long seg; } ;
413 typedef struct __anonstruct_mm_segment_t_75 mm_segment_t;
414 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; u32 status; unsigned long fsbase; unsigned long gsbase; struct perf_event *ptrace_bps[4U]; unsigned long debugreg6; unsigned long ptrace_dr7; unsigned long cr2; unsigned long trap_nr; unsigned long error_code; unsigned long *io_bitmap_ptr; unsigned long iopl; unsigned int io_bitmap_max; mm_segment_t addr_limit; unsigned char sig_on_uaccess_err; unsigned char uaccess_err; struct fpu fpu; } ;
13 struct optimistic_spin_queue { atomic_t tail; } ;
39 struct ww_acquire_ctx ;
40 struct mutex { atomic_long_t owner; spinlock_t wait_lock; struct optimistic_spin_queue osq; struct list_head wait_list; void *magic; struct lockdep_map dep_map; } ;
72 struct mutex_waiter { struct list_head list; struct task_struct *task; struct ww_acquire_ctx *ww_ctx; void *magic; } ;
82 struct timespec ;
83 struct compat_timespec ;
84 struct pollfd ;
85 struct __anonstruct_futex_77 { u32 *uaddr; u32 val; u32 flags; u32 bitset; u64 time; u32 *uaddr2; } ;
85 struct __anonstruct_nanosleep_78 { clockid_t clockid; struct timespec *rmtp; struct compat_timespec *compat_rmtp; u64 expires; } ;
85 struct __anonstruct_poll_79 { struct pollfd *ufds; int nfds; int has_timeout; unsigned long tv_sec; unsigned long tv_nsec; } ;
85 union __anonunion____missing_field_name_76 { struct __anonstruct_futex_77 futex; struct __anonstruct_nanosleep_78 nanosleep; struct __anonstruct_poll_79 poll; } ;
85 struct restart_block { long int (*fn)(struct restart_block *); union __anonunion____missing_field_name_76 __annonCompField20; } ;
48 struct thread_info { unsigned long flags; } ;
324 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ;
16 typedef enum irqreturn irqreturn_t;
8 struct irq_desc ;
34 struct vm_area_struct ;
15 struct llist_node ;
69 struct llist_node { struct llist_node *next; } ;
97 struct __anonstruct_nodemask_t_144 { unsigned long bits[16U]; } ;
97 typedef struct __anonstruct_nodemask_t_144 nodemask_t;
38 struct ldt_struct ;
38 struct vdso_image ;
38 struct __anonstruct_mm_context_t_151 { struct ldt_struct *ldt; unsigned short ia32_compat; struct mutex lock; void *vdso; const struct vdso_image *vdso_image; atomic_t perf_rdpmc_allowed; u16 pkey_allocation_map; s16 execute_only_pkey; void *bd_addr; } ;
38 typedef struct __anonstruct_mm_context_t_151 mm_context_t;
39 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ;
44 typedef struct __wait_queue_head wait_queue_head_t;
1215 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ;
52 typedef struct seqcount seqcount_t;
253 typedef unsigned int isolate_mode_t;
750 struct rw_semaphore ;
751 struct rw_semaphore { atomic_long_t count; struct list_head wait_list; raw_spinlock_t wait_lock; struct optimistic_spin_queue osq; struct task_struct *owner; struct lockdep_map dep_map; } ;
108 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ;
7 typedef __s64 time64_t;
28 typedef s64 ktime_t;
1119 struct timer_list { struct hlist_node entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; u32 flags; struct lockdep_map lockdep_map; } ;
211 struct hrtimer ;
212 enum hrtimer_restart ;
235 struct workqueue_struct ;
236 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; } ;
567 struct irq_data ;
30 struct msi_msg ;
31 enum irqchip_irq_state ;
63 struct msi_desc ;
64 struct irq_domain ;
65 struct irq_common_data { unsigned int state_use_accessors; unsigned int node; void *handler_data; struct msi_desc *msi_desc; cpumask_var_t affinity; } ;
151 struct irq_chip ;
151 struct irq_data { u32 mask; unsigned int irq; unsigned long hwirq; struct irq_common_data *common; struct irq_chip *chip; struct irq_domain *domain; struct irq_data *parent_data; void *chip_data; } ;
338 struct irq_chip { struct device *parent_device; const char *name; unsigned int (*irq_startup)(struct irq_data *); void (*irq_shutdown)(struct irq_data *); void (*irq_enable)(struct irq_data *); void (*irq_disable)(struct irq_data *); void (*irq_ack)(struct irq_data *); void (*irq_mask)(struct irq_data *); void (*irq_mask_ack)(struct irq_data *); void (*irq_unmask)(struct irq_data *); void (*irq_eoi)(struct irq_data *); int (*irq_set_affinity)(struct irq_data *, const struct cpumask *, bool ); int (*irq_retrigger)(struct irq_data *); int (*irq_set_type)(struct irq_data *, unsigned int); int (*irq_set_wake)(struct irq_data *, unsigned int); void (*irq_bus_lock)(struct irq_data *); void (*irq_bus_sync_unlock)(struct irq_data *); void (*irq_cpu_online)(struct irq_data *); void (*irq_cpu_offline)(struct irq_data *); void (*irq_suspend)(struct irq_data *); void (*irq_resume)(struct irq_data *); void (*irq_pm_shutdown)(struct irq_data *); void (*irq_calc_mask)(struct irq_data *); void (*irq_print_chip)(struct irq_data *, struct seq_file *); int (*irq_request_resources)(struct irq_data *); void (*irq_release_resources)(struct irq_data *); void (*irq_compose_msi_msg)(struct irq_data *, struct msi_msg *); void (*irq_write_msi_msg)(struct irq_data *, struct msi_msg *); int (*irq_get_irqchip_state)(struct irq_data *, enum irqchip_irq_state , bool *); int (*irq_set_irqchip_state)(struct irq_data *, enum irqchip_irq_state , bool ); int (*irq_set_vcpu_affinity)(struct irq_data *, void *); void (*ipi_send_single)(struct irq_data *, unsigned int); void (*ipi_send_mask)(struct irq_data *, const struct cpumask *); unsigned long flags; } ;
65 struct radix_tree_root ;
65 union __anonunion____missing_field_name_202 { struct list_head private_list; struct callback_head callback_head; } ;
65 struct radix_tree_node { unsigned char shift; unsigned char offset; unsigned char count; unsigned char exceptional; struct radix_tree_node *parent; struct radix_tree_root *root; union __anonunion____missing_field_name_202 __annonCompField31; void *slots[64U]; unsigned long tags[3U][1U]; } ;
107 struct radix_tree_root { gfp_t gfp_mask; struct radix_tree_node *rnode; } ;
176 struct ida { struct radix_tree_root ida_rt; } ;
216 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; } ;
100 struct dentry ;
101 struct iattr ;
102 struct super_block ;
103 struct file_system_type ;
104 struct kernfs_open_node ;
105 struct kernfs_iattrs ;
129 struct kernfs_root ;
129 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ;
86 struct kernfs_node ;
86 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ;
90 struct kernfs_ops ;
90 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; struct kernfs_node *notify_next; } ;
97 union __anonunion____missing_field_name_215 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ;
97 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_215 __annonCompField32; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ;
139 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 *); } ;
158 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; } ;
174 struct vm_operations_struct ;
174 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; struct seq_file *seq_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; bool released; const struct vm_operations_struct *vm_ops; } ;
194 struct kernfs_ops { int (*open)(struct kernfs_open_file *); void (*release)(struct kernfs_open_file *); 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; } ;
296 struct inode ;
521 struct sock ;
522 struct kobject ;
523 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ;
529 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_218 { uid_t val; } ;
22 typedef struct __anonstruct_kuid_t_218 kuid_t;
27 struct __anonstruct_kgid_t_219 { gid_t val; } ;
27 typedef struct __anonstruct_kgid_t_219 kgid_t;
139 struct kstat { u32 result_mask; umode_t mode; unsigned int nlink; uint32_t blksize; u64 attributes; u64 attributes_mask; u64 ino; dev_t dev; dev_t rdev; kuid_t uid; kgid_t gid; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; struct timespec btime; u64 blocks; } ;
49 struct bin_attribute ;
50 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ;
37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); umode_t (*is_bin_visible)(struct kobject *, struct bin_attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ;
92 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ;
165 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ;
530 struct refcount_struct { atomic_t refs; } ;
19 typedef struct refcount_struct refcount_t;
60 struct kref { refcount_t refcount; } ;
52 struct kset ;
52 struct kobj_type ;
52 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ;
117 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 *); } ;
125 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ;
133 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 *); } ;
150 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ;
225 struct irq_affinity_notify ;
226 struct proc_dir_entry ;
227 struct irqaction ;
227 struct irq_desc { struct irq_common_data irq_common_data; struct irq_data irq_data; unsigned int *kstat_irqs; void (*handle_irq)(struct irq_desc *); struct irqaction *action; unsigned int status_use_accessors; unsigned int core_internal_state__do_not_mess_with_it; unsigned int depth; unsigned int wake_depth; unsigned int irq_count; unsigned long last_unhandled; unsigned int irqs_unhandled; atomic_t threads_handled; int threads_handled_last; raw_spinlock_t lock; struct cpumask *percpu_enabled; const struct cpumask *percpu_affinity; const struct cpumask *affinity_hint; struct irq_affinity_notify *affinity_notify; cpumask_var_t pending_mask; unsigned long threads_oneshot; atomic_t threads_active; wait_queue_head_t wait_for_threads; unsigned int nr_actions; unsigned int no_suspend_depth; unsigned int cond_suspend_depth; unsigned int force_resume_depth; struct proc_dir_entry *dir; struct callback_head rcu; struct kobject kobj; int parent_irq; struct module *owner; const char *name; } ;
133 struct exception_table_entry { int insn; int fixup; int handler; } ;
775 struct irq_chip_regs { unsigned long enable; unsigned long disable; unsigned long mask; unsigned long ack; unsigned long eoi; unsigned long type; unsigned long polarity; } ;
814 struct irq_chip_type { struct irq_chip chip; struct irq_chip_regs regs; void (*handler)(struct irq_desc *); u32 type; u32 mask_cache_priv; u32 *mask_cache; } ;
836 struct irq_chip_generic { raw_spinlock_t lock; void *reg_base; u32 (*reg_readl)(void *); void (*reg_writel)(u32 , void *); void (*suspend)(struct irq_chip_generic *); void (*resume)(struct irq_chip_generic *); unsigned int irq_base; unsigned int irq_cnt; u32 mask_cache; u32 type_cache; u32 polarity_cache; u32 wake_enabled; u32 wake_active; unsigned int num_ct; void *private; unsigned long installed; unsigned long unused; struct irq_domain *domain; struct list_head list; struct irq_chip_type chip_types[0U]; } ;
892 enum irq_gc_flags { IRQ_GC_INIT_MASK_CACHE = 1, IRQ_GC_INIT_NESTED_LOCK = 2, IRQ_GC_MASK_CACHE_PER_TYPE = 4, IRQ_GC_NO_MASK = 8, IRQ_GC_BE_IO = 16 } ;
900 struct irq_domain_chip_generic { unsigned int irqs_per_chip; unsigned int num_chips; unsigned int irq_flags_to_clear; unsigned int irq_flags_to_set; enum irq_gc_flags gc_flags; struct irq_chip_generic *gc[0U]; } ;
61 struct timerqueue_node { struct rb_node node; ktime_t expires; } ;
12 struct timerqueue_head { struct rb_root head; struct timerqueue_node *next; } ;
50 struct hrtimer_clock_base ;
51 struct hrtimer_cpu_base ;
60 enum hrtimer_restart { HRTIMER_NORESTART = 0, HRTIMER_RESTART = 1 } ;
65 struct hrtimer { struct timerqueue_node node; ktime_t _softexpires; enum hrtimer_restart (*function)(struct hrtimer *); struct hrtimer_clock_base *base; u8 state; u8 is_rel; } ;
113 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; } ;
146 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]; } ;
93 struct irqaction { irqreturn_t (*handler)(int, void *); void *dev_id; void *percpu_dev_id; struct irqaction *next; irqreturn_t (*thread_fn)(int, void *); struct task_struct *thread; struct irqaction *secondary; unsigned int irq; unsigned int flags; unsigned long thread_flags; unsigned long thread_mask; const char *name; struct proc_dir_entry *dir; } ;
214 struct irq_affinity_notify { unsigned int irq; struct kref kref; struct work_struct work; void (*notify)(struct irq_affinity_notify *, const cpumask_t *); void (*release)(struct kref *); } ;
404 enum irqchip_irq_state { IRQCHIP_STATE_PENDING = 0, IRQCHIP_STATE_ACTIVE = 1, IRQCHIP_STATE_MASKED = 2, IRQCHIP_STATE_LINE_LEVEL = 3 } ;
282 struct klist_node ;
37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ;
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_276 { spinlock_t lock; int count; } ;
114 union __anonunion____missing_field_name_275 { struct __anonstruct____missing_field_name_276 __annonCompField41; } ;
114 struct lockref { union __anonunion____missing_field_name_275 __annonCompField42; } ;
77 struct path ;
78 struct vfsmount ;
79 struct __anonstruct____missing_field_name_278 { u32 hash; u32 len; } ;
79 union __anonunion____missing_field_name_277 { struct __anonstruct____missing_field_name_278 __annonCompField43; u64 hash_len; } ;
79 struct qstr { union __anonunion____missing_field_name_277 __annonCompField44; const unsigned char *name; } ;
66 struct dentry_operations ;
66 union __anonunion____missing_field_name_279 { struct list_head d_lru; wait_queue_head_t *d_wait; } ;
66 union __anonunion_d_u_280 { struct hlist_node d_alias; struct hlist_bl_node d_in_lookup_hash; struct callback_head d_rcu; } ;
66 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_279 __annonCompField45; struct list_head d_child; struct list_head d_subdirs; union __anonunion_d_u_280 d_u; } ;
122 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); int (*d_init)(struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(const struct path *, bool ); struct dentry * (*d_real)(struct dentry *, const struct inode *, unsigned int); } ;
593 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 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ;
196 struct pid_namespace ;
196 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ;
56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ;
68 struct pid_link { struct hlist_node node; struct pid *pid; } ;
22 struct kernel_cap_struct { __u32 cap[2U]; } ;
25 typedef struct kernel_cap_struct kernel_cap_t;
45 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ;
38 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ;
44 struct rcuwait { struct task_struct *task; } ;
32 enum rcu_sync_type { RCU_SYNC = 0, RCU_SCHED_SYNC = 1, RCU_BH_SYNC = 2 } ;
38 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; } ;
66 struct percpu_rw_semaphore { struct rcu_sync rss; unsigned int *read_count; struct rw_semaphore rw_sem; struct rcuwait writer; int readers_block; } ;
144 struct delayed_call { void (*fn)(void *); void *arg; } ;
300 struct backing_dev_info ;
301 struct bdi_writeback ;
303 struct export_operations ;
306 struct kiocb ;
307 struct pipe_inode_info ;
308 struct poll_table_struct ;
309 struct kstatfs ;
310 struct cred ;
311 struct swap_info_struct ;
312 struct iov_iter ;
313 struct fscrypt_info ;
314 struct fscrypt_operations ;
75 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ;
213 struct dquot ;
214 struct kqid ;
19 typedef __kernel_uid32_t projid_t;
23 struct __anonstruct_kprojid_t_282 { projid_t val; } ;
23 typedef struct __anonstruct_kprojid_t_282 kprojid_t;
181 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ;
66 typedef long long qsize_t;
67 union __anonunion____missing_field_name_283 { kuid_t uid; kgid_t gid; kprojid_t projid; } ;
67 struct kqid { union __anonunion____missing_field_name_283 __annonCompField46; enum quota_type type; } ;
194 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time64_t dqb_btime; time64_t dqb_itime; } ;
216 struct quota_format_type ;
217 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_max_spc_limit; qsize_t dqi_max_ino_limit; void *dqi_priv; } ;
282 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ;
309 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
321 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); int (*get_projid)(struct inode *, kprojid_t *); int (*get_next_id)(struct super_block *, struct kqid *); } ;
338 struct qc_dqblk { int d_fieldmask; u64 d_spc_hardlimit; u64 d_spc_softlimit; u64 d_ino_hardlimit; u64 d_ino_softlimit; u64 d_space; u64 d_ino_count; s64 d_ino_timer; s64 d_spc_timer; int d_ino_warns; int d_spc_warns; u64 d_rt_spc_hardlimit; u64 d_rt_spc_softlimit; u64 d_rt_space; s64 d_rt_spc_timer; int d_rt_spc_warns; } ;
361 struct qc_type_state { unsigned int flags; unsigned int spc_timelimit; unsigned int ino_timelimit; unsigned int rt_spc_timelimit; unsigned int spc_warnlimit; unsigned int ino_warnlimit; unsigned int rt_spc_warnlimit; unsigned long long ino; blkcnt_t blocks; blkcnt_t nextents; } ;
407 struct qc_state { unsigned int s_incoredqs; struct qc_type_state s_state[3U]; } ;
418 struct qc_info { int i_fieldmask; unsigned int i_flags; unsigned int i_spc_timelimit; unsigned int i_ino_timelimit; unsigned int i_rt_spc_timelimit; unsigned int i_spc_warnlimit; unsigned int i_ino_warnlimit; unsigned int i_rt_spc_warnlimit; } ;
431 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, const struct path *); int (*quota_off)(struct super_block *, int); int (*quota_enable)(struct super_block *, unsigned int); int (*quota_disable)(struct super_block *, unsigned int); int (*quota_sync)(struct super_block *, int); int (*set_info)(struct super_block *, int, struct qc_info *); int (*get_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_nextdqblk)(struct super_block *, struct kqid *, struct qc_dqblk *); int (*set_dqblk)(struct super_block *, struct kqid , struct qc_dqblk *); int (*get_state)(struct super_block *, struct qc_state *); int (*rm_xquota)(struct super_block *, unsigned int); } ;
447 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ;
511 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct inode *files[3U]; struct mem_dqinfo info[3U]; const struct quota_format_ops *ops[3U]; } ;
540 struct address_space ;
541 struct writeback_control ;
542 struct kiocb { struct file *ki_filp; loff_t ki_pos; void (*ki_complete)(struct kiocb *, long, long); void *private; int ki_flags; } ;
315 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); bool (*isolate_page)(struct page *, isolate_mode_t ); void (*putback_page)(struct page *); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ;
374 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; gfp_t gfp_mask; struct list_head private_list; void *private_data; } ;
396 struct request_queue ;
397 struct hd_struct ;
397 struct gendisk ;
397 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct backing_dev_info *bd_bdi; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ;
513 struct posix_acl ;
540 struct fsnotify_mark_connector ;
541 struct inode_operations ;
541 union __anonunion____missing_field_name_288 { const unsigned int i_nlink; unsigned int __i_nlink; } ;
541 union __anonunion____missing_field_name_289 { struct hlist_head i_dentry; struct callback_head i_rcu; } ;
541 struct file_lock_context ;
541 struct cdev ;
541 union __anonunion____missing_field_name_290 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; char *i_link; unsigned int i_dir_seq; } ;
541 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_288 __annonCompField47; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks; unsigned long i_state; struct rw_semaphore i_rwsem; unsigned long dirtied_when; unsigned long dirtied_time_when; struct hlist_node i_hash; struct list_head i_io_list; struct bdi_writeback *i_wb; int i_wb_frn_winner; u16 i_wb_frn_avg_time; u16 i_wb_frn_history; struct list_head i_lru; struct list_head i_sb_list; struct list_head i_wb_list; union __anonunion____missing_field_name_289 __annonCompField48; 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_290 __annonCompField49; __u32 i_generation; __u32 i_fsnotify_mask; struct fsnotify_mark_connector *i_fsnotify_marks; struct fscrypt_info *i_crypt_info; void *i_private; } ;
803 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ;
811 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; } ;
834 union __anonunion_f_u_291 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ;
834 struct file { union __anonunion_f_u_291 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; } ;
921 typedef void *fl_owner_t;
922 struct file_lock ;
923 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ;
929 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 **); } ;
956 struct nlm_lockowner ;
957 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_293 { struct list_head link; int state; } ;
19 union __anonunion_fl_u_292 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_293 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_292 fl_u; } ;
1009 struct file_lock_context { spinlock_t flc_lock; struct list_head flc_flock; struct list_head flc_posix; struct list_head flc_lease; } ;
1076 struct files_struct ;
1229 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; } ;
1264 struct sb_writers { int frozen; wait_queue_head_t wait_unfrozen; struct percpu_rw_semaphore rw_sem[3U]; } ;
1294 struct super_operations ;
1294 struct xattr_handler ;
1294 struct mtd_info ;
1294 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_iflags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; const struct fscrypt_operations *s_cop; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; unsigned int s_quota_types; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; u8 s_uuid[16U]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct hlist_head s_pins; struct user_namespace *s_user_ns; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; struct work_struct destroy_work; struct mutex s_sync_lock; int s_stack_depth; spinlock_t s_inode_list_lock; struct list_head s_inodes; spinlock_t s_inode_wblist_lock; struct list_head s_inodes_wb; } ;
1580 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ;
1593 struct dir_context ;
1618 struct dir_context { int (*actor)(struct dir_context *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ;
1625 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 (*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 ); } ;
1693 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 *, unsigned int); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(const struct path *, struct kstat *, u32 , unsigned int); ssize_t (*listxattr)(struct dentry *, char *, size_t ); 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); } ;
1772 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 *); } ;
2015 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; } ;
2360 struct kmem_cache ;
836 struct nsproxy ;
225 struct assoc_array_ptr ;
225 struct assoc_array { struct assoc_array_ptr *root; unsigned long nr_leaves_on_tree; } ;
32 typedef int32_t key_serial_t;
35 typedef uint32_t key_perm_t;
36 struct key ;
37 struct user_struct ;
38 struct signal_struct ;
39 struct key_type ;
43 struct keyring_index_key { struct key_type *type; const char *description; size_t desc_len; } ;
92 union key_payload { void *rcu_data0; void *data[4U]; } ;
131 struct key_restriction { int (*check)(struct key *, const struct key_type *, const union key_payload *, struct key *); struct key *key; struct key_type *keytype; } ;
140 union __anonunion____missing_field_name_296 { struct list_head graveyard_link; struct rb_node serial_node; } ;
140 struct key_user ;
140 union __anonunion____missing_field_name_297 { time_t expiry; time_t revoked_at; } ;
140 struct __anonstruct____missing_field_name_299 { struct key_type *type; char *description; } ;
140 union __anonunion____missing_field_name_298 { struct keyring_index_key index_key; struct __anonstruct____missing_field_name_299 __annonCompField54; } ;
140 struct __anonstruct____missing_field_name_301 { struct list_head name_link; struct assoc_array keys; } ;
140 union __anonunion____missing_field_name_300 { union key_payload payload; struct __anonstruct____missing_field_name_301 __annonCompField56; int reject_error; } ;
140 struct key { refcount_t usage; key_serial_t serial; union __anonunion____missing_field_name_296 __annonCompField52; struct rw_semaphore sem; struct key_user *user; void *security; union __anonunion____missing_field_name_297 __annonCompField53; 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_298 __annonCompField55; union __anonunion____missing_field_name_300 __annonCompField57; struct key_restriction *restrict_link; } ;
391 struct audit_context ;
25 struct sem_undo_list ;
25 struct sysv_sem { struct sem_undo_list *undo_list; } ;
26 struct sysv_shm { struct list_head shm_clist; } ;
12 enum kcov_mode { KCOV_MODE_DISABLED = 0, KCOV_MODE_TRACE = 1 } ;
84 struct plist_node { int prio; struct list_head prio_list; struct list_head node_list; } ;
43 struct seccomp_filter ;
44 struct seccomp { int mode; struct seccomp_filter *filter; } ;
11 struct latency_record { unsigned long backtrace[12U]; unsigned int count; unsigned long time; unsigned long max; } ;
24 struct __anonstruct_sigset_t_302 { unsigned long sig[1U]; } ;
24 typedef struct __anonstruct_sigset_t_302 sigset_t;
25 struct siginfo ;
38 union sigval { int sival_int; void *sival_ptr; } ;
10 typedef union sigval sigval_t;
11 struct __anonstruct__kill_304 { __kernel_pid_t _pid; __kernel_uid32_t _uid; } ;
11 struct __anonstruct__timer_305 { __kernel_timer_t _tid; int _overrun; char _pad[0U]; sigval_t _sigval; int _sys_private; } ;
11 struct __anonstruct__rt_306 { __kernel_pid_t _pid; __kernel_uid32_t _uid; sigval_t _sigval; } ;
11 struct __anonstruct__sigchld_307 { __kernel_pid_t _pid; __kernel_uid32_t _uid; int _status; __kernel_clock_t _utime; __kernel_clock_t _stime; } ;
11 struct __anonstruct__addr_bnd_310 { void *_lower; void *_upper; } ;
11 union __anonunion____missing_field_name_309 { struct __anonstruct__addr_bnd_310 _addr_bnd; __u32 _pkey; } ;
11 struct __anonstruct__sigfault_308 { void *_addr; short _addr_lsb; union __anonunion____missing_field_name_309 __annonCompField58; } ;
11 struct __anonstruct__sigpoll_311 { long _band; int _fd; } ;
11 struct __anonstruct__sigsys_312 { void *_call_addr; int _syscall; unsigned int _arch; } ;
11 union __anonunion__sifields_303 { int _pad[28U]; struct __anonstruct__kill_304 _kill; struct __anonstruct__timer_305 _timer; struct __anonstruct__rt_306 _rt; struct __anonstruct__sigchld_307 _sigchld; struct __anonstruct__sigfault_308 _sigfault; struct __anonstruct__sigpoll_311 _sigpoll; struct __anonstruct__sigsys_312 _sigsys; } ;
11 struct siginfo { int si_signo; int si_errno; int si_code; union __anonunion__sifields_303 _sifields; } ;
118 typedef struct siginfo siginfo_t;
21 struct sigpending { struct list_head list; sigset_t signal; } ;
65 struct vmacache { u32 seqnum; struct vm_area_struct *vmas[4U]; } ;
41 struct task_rss_stat { int events; int count[4U]; } ;
49 struct mm_rss_stat { atomic_long_t count[4U]; } ;
54 struct page_frag { struct page *page; __u32 offset; __u32 size; } ;
61 struct tlbflush_unmap_batch { struct cpumask cpumask; bool flush_required; bool writable; } ;
85 struct task_io_accounting { u64 rchar; u64 wchar; u64 syscr; u64 syscw; u64 read_bytes; u64 write_bytes; u64 cancelled_write_bytes; } ;
45 struct bio_list ;
46 struct blk_plug ;
47 struct cfs_rq ;
48 struct fs_struct ;
49 struct futex_pi_state ;
50 struct io_context ;
51 struct mempolicy ;
52 struct nameidata ;
53 struct perf_event_context ;
55 struct reclaim_state ;
56 struct robust_list_head ;
59 struct sighand_struct ;
60 struct task_delay_info ;
61 struct task_group ;
187 struct prev_cputime { u64 utime; u64 stime; raw_spinlock_t lock; } ;
203 struct task_cputime { u64 utime; u64 stime; unsigned long long sum_exec_runtime; } ;
220 struct sched_info { unsigned long pcount; unsigned long long run_delay; unsigned long long last_arrival; unsigned long long last_queued; } ;
244 struct load_weight { unsigned long weight; u32 inv_weight; } ;
261 struct sched_avg { u64 last_update_time; u64 load_sum; u32 util_sum; u32 period_contrib; unsigned long load_avg; unsigned long util_avg; } ;
322 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; } ;
357 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; } ;
393 struct rt_rq ;
393 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; } ;
411 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; } ;
478 struct wake_q_node { struct wake_q_node *next; } ;
482 struct sched_class ;
482 struct rt_mutex_waiter ;
482 struct css_set ;
482 struct compat_robust_list_head ;
482 struct numa_group ;
482 struct kcov ;
482 struct uprobe_task ;
482 struct task_struct { struct thread_info thread_info; volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; struct llist_node wake_entry; int on_cpu; unsigned int 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; struct vmacache vmacache; struct task_rss_stat rss_stat; int exit_state; int exit_code; int exit_signal; int pdeath_signal; unsigned long jobctl; unsigned int personality; unsigned char sched_reset_on_fork; unsigned char sched_contributes_to_load; unsigned char sched_migrated; unsigned char sched_remote_wakeup; unsigned char; unsigned char in_execve; unsigned char in_iowait; unsigned char restore_sigmask; unsigned char memcg_may_oom; unsigned char memcg_kmem_skip_account; unsigned char brk_randomized; unsigned char no_cgroup_migration; 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; u64 utime; u64 stime; u64 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 *ptracer_cred; 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 task_struct *pi_top_task; 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; u64 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; int closid; 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; atomic_t stack_refcount; int patch_state; void *security; struct thread_struct thread; } ;
1571 struct user_struct { atomic_t __count; atomic_t processes; atomic_t sigpending; 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; } ;
60 struct group_info { atomic_t usage; int ngroups; kgid_t gid[0U]; } ;
86 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; } ;
369 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 ;
200 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; } ;
43 struct completion { unsigned int done; wait_queue_head_t wait; } ;
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 *); } ;
315 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ;
322 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ;
330 struct wakeup_source ;
331 struct wake_irq ;
332 struct pm_domain_data ;
333 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; struct pm_domain_data *domain_data; } ;
551 struct dev_pm_qos ;
551 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool in_dpm_list; 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; unsigned int links_count; 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; } ;
613 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 *); } ;
76 struct dev_archdata { void *iommu; } ;
8 struct dma_map_ops ;
21 struct device_private ;
22 struct device_driver ;
23 struct driver_private ;
24 struct class ;
25 struct subsys_private ;
26 struct bus_type ;
27 struct device_node ;
28 struct fwnode_handle ;
29 struct iommu_ops ;
30 struct iommu_group ;
31 struct iommu_fwspec ;
62 struct device_attribute ;
62 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 *); int (*num_vf)(struct device *); const struct dev_pm_ops *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ;
147 struct device_type ;
206 enum probe_type { PROBE_DEFAULT_STRATEGY = 0, PROBE_PREFER_ASYNCHRONOUS = 1, PROBE_FORCE_SYNCHRONOUS = 2 } ;
212 struct of_device_id ;
212 struct acpi_device_id ;
212 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; } ;
362 struct class_attribute ;
362 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; const struct attribute_group **class_groups; 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; } ;
457 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 ); } ;
527 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; } ;
555 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 ); } ;
727 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ;
790 enum dl_dev_state { DL_DEV_NO_DRIVER = 0, DL_DEV_PROBING = 1, DL_DEV_DRIVER_BOUND = 2, DL_DEV_UNBINDING = 3 } ;
797 struct dev_links_info { struct list_head suppliers; struct list_head consumers; enum dl_dev_state status; } ;
817 struct dma_coherent_mem ;
817 struct cma ;
817 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_links_info links; 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; const struct dma_map_ops *dma_ops; 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; struct iommu_fwspec *iommu_fwspec; bool offline_disabled; bool offline; } ;
976 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; } ;
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_329 { struct arch_uprobe_task autask; unsigned long vaddr; } ;
73 struct __anonstruct____missing_field_name_330 { struct callback_head dup_xol_work; unsigned long dup_xol_addr; } ;
73 union __anonunion____missing_field_name_328 { struct __anonstruct____missing_field_name_329 __annonCompField61; struct __anonstruct____missing_field_name_330 __annonCompField62; } ;
73 struct uprobe ;
73 struct return_instance ;
73 struct uprobe_task { enum uprobe_task_state state; union __anonunion____missing_field_name_328 __annonCompField63; struct uprobe *active_uprobe; unsigned long xol_vaddr; struct return_instance *return_instances; unsigned int depth; } ;
95 struct return_instance { struct uprobe *uprobe; unsigned long func; unsigned long stack; unsigned long orig_ret_vaddr; bool chained; struct return_instance *next; } ;
111 struct xol_area ;
112 struct uprobes_state { struct xol_area *xol_area; } ;
151 union __anonunion____missing_field_name_331 { struct address_space *mapping; void *s_mem; atomic_t compound_mapcount; } ;
151 union __anonunion____missing_field_name_332 { unsigned long index; void *freelist; } ;
151 struct __anonstruct____missing_field_name_336 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ;
151 union __anonunion____missing_field_name_335 { atomic_t _mapcount; unsigned int active; struct __anonstruct____missing_field_name_336 __annonCompField66; int units; } ;
151 struct __anonstruct____missing_field_name_334 { union __anonunion____missing_field_name_335 __annonCompField67; atomic_t _refcount; } ;
151 union __anonunion____missing_field_name_333 { unsigned long counters; struct __anonstruct____missing_field_name_334 __annonCompField68; } ;
151 struct dev_pagemap ;
151 struct __anonstruct____missing_field_name_338 { struct page *next; int pages; int pobjects; } ;
151 struct __anonstruct____missing_field_name_339 { unsigned long compound_head; unsigned int compound_dtor; unsigned int compound_order; } ;
151 struct __anonstruct____missing_field_name_340 { unsigned long __pad; pgtable_t pmd_huge_pte; } ;
151 union __anonunion____missing_field_name_337 { struct list_head lru; struct dev_pagemap *pgmap; struct __anonstruct____missing_field_name_338 __annonCompField70; struct callback_head callback_head; struct __anonstruct____missing_field_name_339 __annonCompField71; struct __anonstruct____missing_field_name_340 __annonCompField72; } ;
151 union __anonunion____missing_field_name_341 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; } ;
151 struct page { unsigned long flags; union __anonunion____missing_field_name_331 __annonCompField64; union __anonunion____missing_field_name_332 __annonCompField65; union __anonunion____missing_field_name_333 __annonCompField69; union __anonunion____missing_field_name_337 __annonCompField73; union __anonunion____missing_field_name_341 __annonCompField74; struct mem_cgroup *mem_cgroup; } ;
266 struct userfaultfd_ctx ;
266 struct vm_userfaultfd_ctx { struct userfaultfd_ctx *ctx; } ;
273 struct __anonstruct_shared_342 { struct rb_node rb; unsigned long rb_subtree_last; } ;
273 struct anon_vma ;
273 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_342 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; } ;
346 struct core_thread { struct task_struct *task; struct core_thread *next; } ;
351 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ;
357 struct kioctx_table ;
358 struct linux_binfmt ;
358 struct mmu_notifier_mm ;
358 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 mmap_compat_base; unsigned long mmap_compat_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 user_namespace *user_ns; 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; atomic_long_t hugetlb_usage; struct work_struct async_put_work; } ;
13 typedef unsigned long kernel_ulong_t;
187 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; __u32 cls; __u32 cls_msk; } ;
230 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ;
420 struct i2c_device_id { char name[20U]; kernel_ulong_t driver_data; } ;
20 struct rt_mutex { raw_spinlock_t wait_lock; struct rb_root waiters; struct rb_node *waiters_leftmost; struct task_struct *owner; int save_state; const char *name; const char *file; int line; void *magic; } ;
100 enum fwnode_type { FWNODE_INVALID = 0, FWNODE_OF = 1, FWNODE_ACPI = 2, FWNODE_ACPI_DATA = 3, FWNODE_ACPI_STATIC = 4, FWNODE_PDATA = 5, FWNODE_IRQCHIP = 6 } ;
110 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; } ;
65 struct of_phandle_args { struct device_node *np; int args_count; uint32_t args[16U]; } ;
1298 struct irq_fwspec { struct fwnode_handle *fwnode; int param_count; u32 param[16U]; } ;
64 enum irq_domain_bus_token { DOMAIN_BUS_ANY = 0, DOMAIN_BUS_WIRED = 1, DOMAIN_BUS_PCI_MSI = 2, DOMAIN_BUS_PLATFORM_MSI = 3, DOMAIN_BUS_NEXUS = 4, DOMAIN_BUS_IPI = 5, DOMAIN_BUS_FSL_MC_MSI = 6 } ;
74 struct irq_domain_ops { int (*match)(struct irq_domain *, struct device_node *, enum irq_domain_bus_token ); int (*select)(struct irq_domain *, struct irq_fwspec *, enum irq_domain_bus_token ); int (*map)(struct irq_domain *, unsigned int, irq_hw_number_t ); void (*unmap)(struct irq_domain *, unsigned int); int (*xlate)(struct irq_domain *, struct device_node *, const u32 *, unsigned int, unsigned long *, unsigned int *); int (*alloc)(struct irq_domain *, unsigned int, unsigned int, void *); void (*free)(struct irq_domain *, unsigned int, unsigned int); void (*activate)(struct irq_domain *, struct irq_data *); void (*deactivate)(struct irq_domain *, struct irq_data *); int (*translate)(struct irq_domain *, struct irq_fwspec *, unsigned long *, unsigned int *); } ;
122 struct irq_domain { struct list_head link; const char *name; const struct irq_domain_ops *ops; void *host_data; unsigned int flags; struct fwnode_handle *fwnode; enum irq_domain_bus_token bus_token; struct irq_domain_chip_generic *gc; struct irq_domain *parent; irq_hw_number_t hwirq_max; unsigned int revmap_direct_max_irq; unsigned int revmap_size; struct radix_tree_root revmap_tree; unsigned int linear_revmap[]; } ;
468 struct i2c_msg { __u16 addr; __u16 flags; __u16 len; __u8 *buf; } ;
83 union i2c_smbus_data { __u8 byte; __u16 word; __u8 block[34U]; } ;
42 struct i2c_algorithm ;
43 struct i2c_adapter ;
44 struct i2c_client ;
47 enum i2c_slave_event ;
220 struct i2c_client { unsigned short flags; unsigned short addr; char name[20U]; struct i2c_adapter *adapter; struct device dev; int irq; struct list_head detected; int (*slave_cb)(struct i2c_client *, enum i2c_slave_event , u8 *); } ;
277 enum i2c_slave_event { I2C_SLAVE_READ_REQUESTED = 0, I2C_SLAVE_WRITE_REQUESTED = 1, I2C_SLAVE_READ_PROCESSED = 2, I2C_SLAVE_WRITE_RECEIVED = 3, I2C_SLAVE_STOP = 4 } ;
397 struct i2c_algorithm { int (*master_xfer)(struct i2c_adapter *, struct i2c_msg *, int); int (*smbus_xfer)(struct i2c_adapter *, u16 , unsigned short, char, u8 , int, union i2c_smbus_data *); u32 (*functionality)(struct i2c_adapter *); int (*reg_slave)(struct i2c_client *); int (*unreg_slave)(struct i2c_client *); } ;
449 struct i2c_lock_operations { void (*lock_bus)(struct i2c_adapter *, unsigned int); int (*trylock_bus)(struct i2c_adapter *, unsigned int); void (*unlock_bus)(struct i2c_adapter *, unsigned int); } ;
480 struct i2c_bus_recovery_info { int (*recover_bus)(struct i2c_adapter *); int (*get_scl)(struct i2c_adapter *); void (*set_scl)(struct i2c_adapter *, int); int (*get_sda)(struct i2c_adapter *); void (*prepare_recovery)(struct i2c_adapter *); void (*unprepare_recovery)(struct i2c_adapter *); int scl_gpio; int sda_gpio; } ;
519 struct i2c_adapter_quirks { u64 flags; int max_num_msgs; u16 max_write_len; u16 max_read_len; u16 max_comb_1st_msg_len; u16 max_comb_2nd_msg_len; } ;
549 struct i2c_adapter { struct module *owner; unsigned int class; const struct i2c_algorithm *algo; void *algo_data; const struct i2c_lock_operations *lock_ops; struct rt_mutex bus_lock; struct rt_mutex mux_lock; int timeout; int retries; struct device dev; int nr; char name[48U]; struct completion dev_released; struct mutex userspace_clients_lock; struct list_head userspace_clients; struct i2c_bus_recovery_info *bus_recovery_info; const struct i2c_adapter_quirks *quirks; struct irq_domain *host_notify_domain; } ;
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_hvclock_page; long sym_VDSO32_NOTE_MASK; long sym___kernel_sigreturn; long sym___kernel_rt_sigreturn; long sym___kernel_vsyscall; long sym_int80_landing_pad; } ;
15 typedef __u64 Elf64_Addr;
16 typedef __u16 Elf64_Half;
18 typedef __u64 Elf64_Off;
20 typedef __u32 Elf64_Word;
21 typedef __u64 Elf64_Xword;
190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ;
198 typedef struct elf64_sym Elf64_Sym;
219 struct elf64_hdr { unsigned char e_ident[16U]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } ;
235 typedef struct elf64_hdr Elf64_Ehdr;
314 struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } ;
326 typedef struct elf64_shdr Elf64_Shdr;
55 struct kernel_param ;
60 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 *); } ;
63 struct kparam_string ;
63 struct kparam_array ;
63 union __anonunion____missing_field_name_358 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ;
63 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_358 __annonCompField80; } ;
85 struct kparam_string { unsigned int maxlen; char *string; } ;
91 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ;
533 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; } ;
49 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 *); } ;
276 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ;
283 struct mod_tree_node { struct module *mod; struct latch_tree_node node; } ;
288 struct module_layout { void *base; unsigned int size; unsigned int text_size; unsigned int ro_size; unsigned int ro_after_init_size; struct mod_tree_node mtn; } ;
304 struct mod_kallsyms { Elf64_Sym *symtab; unsigned int num_symtab; char *strtab; } ;
318 struct klp_modinfo { Elf64_Ehdr hdr; Elf64_Shdr *sechdrs; char *secstrings; unsigned int symndx; } ;
326 struct module_sect_attrs ;
326 struct module_notes_attrs ;
326 struct trace_event_call ;
326 struct trace_enum_map ;
326 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 s32 *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 s32 *gpl_crcs; const struct kernel_symbol *unused_syms; const s32 *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const s32 *unused_gpl_crcs; bool sig_ok; bool async_probe_requested; const struct kernel_symbol *gpl_future_syms; const s32 *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 long 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; } ;
65 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count; } ;
37 enum iio_chan_type { IIO_VOLTAGE = 0, IIO_CURRENT = 1, IIO_POWER = 2, IIO_ACCEL = 3, IIO_ANGL_VEL = 4, IIO_MAGN = 5, IIO_LIGHT = 6, IIO_INTENSITY = 7, IIO_PROXIMITY = 8, IIO_TEMP = 9, IIO_INCLI = 10, IIO_ROT = 11, IIO_ANGL = 12, IIO_TIMESTAMP = 13, IIO_CAPACITANCE = 14, IIO_ALTVOLTAGE = 15, IIO_CCT = 16, IIO_PRESSURE = 17, IIO_HUMIDITYRELATIVE = 18, IIO_ACTIVITY = 19, IIO_STEPS = 20, IIO_ENERGY = 21, IIO_DISTANCE = 22, IIO_VELOCITY = 23, IIO_CONCENTRATION = 24, IIO_RESISTANCE = 25, IIO_PH = 26, IIO_UVINDEX = 27, IIO_ELECTRICALCONDUCTIVITY = 28, IIO_COUNT = 29, IIO_INDEX = 30, IIO_GRAVITY = 31 } ;
112 enum iio_event_type { IIO_EV_TYPE_THRESH = 0, IIO_EV_TYPE_MAG = 1, IIO_EV_TYPE_ROC = 2, IIO_EV_TYPE_THRESH_ADAPTIVE = 3, IIO_EV_TYPE_MAG_ADAPTIVE = 4, IIO_EV_TYPE_CHANGE = 5 } ;
121 enum iio_event_direction { IIO_EV_DIR_EITHER = 0, IIO_EV_DIR_RISING = 1, IIO_EV_DIR_FALLING = 2, IIO_EV_DIR_NONE = 3 } ;
128 enum iio_event_info { IIO_EV_INFO_ENABLE = 0, IIO_EV_INFO_VALUE = 1, IIO_EV_INFO_HYSTERESIS = 2, IIO_EV_INFO_PERIOD = 3, IIO_EV_INFO_HIGH_PASS_FILTER_3DB = 4, IIO_EV_INFO_LOW_PASS_FILTER_3DB = 5 } ;
170 enum iio_shared_by { IIO_SEPARATE = 0, IIO_SHARED_BY_TYPE = 1, IIO_SHARED_BY_DIR = 2, IIO_SHARED_BY_ALL = 3 } ;
177 enum iio_endian { IIO_CPU = 0, IIO_BE = 1, IIO_LE = 2 } ;
183 struct iio_chan_spec ;
184 struct iio_dev ;
185 struct iio_chan_spec_ext_info { const char *name; enum iio_shared_by shared; ssize_t (*read)(struct iio_dev *, uintptr_t , const struct iio_chan_spec *, char *); ssize_t (*write)(struct iio_dev *, uintptr_t , const struct iio_chan_spec *, const char *, size_t ); uintptr_t private; } ;
166 struct iio_event_spec { enum iio_event_type type; enum iio_event_direction dir; unsigned long mask_separate; unsigned long mask_shared_by_type; unsigned long mask_shared_by_dir; unsigned long mask_shared_by_all; } ;
203 struct __anonstruct_scan_type_365 { char sign; u8 realbits; u8 storagebits; u8 shift; u8 repeat; enum iio_endian endianness; } ;
203 struct iio_chan_spec { enum iio_chan_type type; int channel; int channel2; unsigned long address; int scan_index; struct __anonstruct_scan_type_365 scan_type; long info_mask_separate; long info_mask_separate_available; long info_mask_shared_by_type; long info_mask_shared_by_type_available; long info_mask_shared_by_dir; long info_mask_shared_by_dir_available; long info_mask_shared_by_all; long info_mask_shared_by_all_available; const struct iio_event_spec *event_spec; unsigned int num_event_specs; const struct iio_chan_spec_ext_info *ext_info; const char *extend_name; const char *datasheet_name; unsigned char modified; unsigned char indexed; unsigned char output; unsigned char differential; } ;
348 struct iio_trigger ;
349 struct iio_info { struct module *driver_module; const struct attribute_group *event_attrs; const struct attribute_group *attrs; int (*read_raw)(struct iio_dev *, const struct iio_chan_spec *, int *, int *, long); int (*read_raw_multi)(struct iio_dev *, const struct iio_chan_spec *, int, int *, int *, long); int (*read_avail)(struct iio_dev *, const struct iio_chan_spec *, const int **, int *, int *, long); int (*write_raw)(struct iio_dev *, const struct iio_chan_spec *, int, int, long); int (*write_raw_get_fmt)(struct iio_dev *, const struct iio_chan_spec *, long); int (*read_event_config)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type , enum iio_event_direction ); int (*write_event_config)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type , enum iio_event_direction , int); int (*read_event_value)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type , enum iio_event_direction , enum iio_event_info , int *, int *); int (*write_event_value)(struct iio_dev *, const struct iio_chan_spec *, enum iio_event_type , enum iio_event_direction , enum iio_event_info , int, int); int (*validate_trigger)(struct iio_dev *, struct iio_trigger *); int (*update_scan_mode)(struct iio_dev *, const unsigned long *); int (*debugfs_reg_access)(struct iio_dev *, unsigned int, unsigned int, unsigned int *); int (*of_xlate)(struct iio_dev *, const struct of_phandle_args *); int (*hwfifo_set_watermark)(struct iio_dev *, unsigned int); int (*hwfifo_flush_to_buffer)(struct iio_dev *, unsigned int); } ;
491 struct iio_buffer_setup_ops { int (*preenable)(struct iio_dev *); int (*postenable)(struct iio_dev *); int (*predisable)(struct iio_dev *); int (*postdisable)(struct iio_dev *); bool (*validate_scan_mask)(struct iio_dev *, const unsigned long *); } ;
510 struct iio_event_interface ;
510 struct iio_buffer ;
510 struct iio_poll_func ;
510 struct iio_dev { int id; int modes; int currentmode; struct device dev; struct iio_event_interface *event_interface; struct iio_buffer *buffer; struct list_head buffer_list; int scan_bytes; struct mutex mlock; const unsigned long *available_scan_masks; unsigned int masklength; const unsigned long *active_scan_mask; bool scan_timestamp; unsigned int scan_index_timestamp; struct iio_trigger *trig; bool trig_readonly; struct iio_poll_func *pollfunc; struct iio_poll_func *pollfunc_event; const struct iio_chan_spec *channels; int num_channels; struct list_head channel_attr_list; struct attribute_group chan_attr_group; const char *name; const struct iio_info *info; clockid_t clock_id; struct mutex info_exist_lock; const struct iio_buffer_setup_ops *setup_ops; struct cdev chrdev; const struct attribute_group *groups[7U]; int groupcounter; unsigned long flags; struct dentry *debugfs_dentry; unsigned int cached_reg_addr; } ;
730 struct iio_dev_attr { struct device_attribute dev_attr; u64 address; struct list_head l; const struct iio_chan_spec *c; } ;
35 struct iio_const_attr { const char *string; struct device_attribute dev_attr; } ;
55 struct ad7152_chip_info { struct i2c_client *client; u8 filter_rate_setup; u8 setup[2U]; struct mutex state_lock; } ;
85 typedef int ldv_func_ret_type;
104 typedef int ldv_func_ret_type___0;
115 typedef int ldv_func_ret_type___1;
34 extern struct module __this_module;
46 __u16 __fswab16(__u16 val);
371 int kstrtobool(const char *, bool *);
140 int strtobool(const char *s, bool *res);
133 void __mutex_init(struct mutex *, const char *, struct lock_class_key *);
194 int mutex_trylock(struct mutex *);
197 int ldv_mutex_trylock_5(struct mutex *ldv_func_arg1);
201 int ldv_mutex_trylock_8(struct mutex *ldv_func_arg1);
203 void mutex_unlock(struct mutex *);
206 void ldv_mutex_unlock_9(struct mutex *ldv_func_arg1);
210 void ldv_mutex_unlock_11(struct mutex *ldv_func_arg1);
214 void ldv_mutex_unlock_12(struct mutex *ldv_func_arg1);
218 void ldv_mutex_unlock_13(struct mutex *ldv_func_arg1);
222 void ldv_mutex_unlock_15(struct mutex *ldv_func_arg1);
226 void ldv_mutex_unlock_16(struct mutex *ldv_func_arg1);
230 void ldv_mutex_unlock_18(struct mutex *ldv_func_arg1);
234 void ldv_mutex_unlock_20(struct mutex *ldv_func_arg1);
16 int mutex_lock_interruptible(struct mutex *);
19 int ldv_mutex_lock_interruptible_7(struct mutex *ldv_func_arg1);
22 void mutex_lock(struct mutex *);
25 void ldv_mutex_lock_6(struct mutex *ldv_func_arg1);
29 void ldv_mutex_lock_10(struct mutex *ldv_func_arg1);
33 void ldv_mutex_lock_14(struct mutex *ldv_func_arg1);
37 void ldv_mutex_lock_17(struct mutex *ldv_func_arg1);
41 void ldv_mutex_lock_19(struct mutex *ldv_func_arg1);
47 int ldv_mutex_trylock_lock(struct mutex *lock);
56 int ldv_mutex_lock_interruptible_mutex_of_device(struct mutex *lock);
59 void ldv_mutex_lock_mutex_of_device(struct mutex *lock);
60 int ldv_mutex_trylock_mutex_of_device(struct mutex *lock);
63 void ldv_mutex_unlock_mutex_of_device(struct mutex *lock);
72 void ldv_mutex_lock_state_lock_of_ad7152_chip_info(struct mutex *lock);
76 void ldv_mutex_unlock_state_lock_of_ad7152_chip_info(struct mutex *lock);
1031 void dev_set_drvdata(struct device *dev, void *data);
1260 void dev_err(const struct device *, const char *, ...);
93 s32 i2c_smbus_read_byte_data(const struct i2c_client *, u8 );
95 s32 i2c_smbus_write_byte_data(const struct i2c_client *, u8 , u8 );
97 s32 i2c_smbus_read_word_data(const struct i2c_client *, u8 );
99 s32 i2c_smbus_write_word_data(const struct i2c_client *, u8 , u16 );
273 void i2c_set_clientdata(struct i2c_client *dev, void *data);
10 void __const_udelay(unsigned long);
57 void msleep(unsigned int);
603 int devm_iio_device_register(struct device *, struct iio_dev *);
636 struct iio_dev * dev_to_iio_dev(struct device *dev);
681 void * iio_priv(const struct iio_dev *indio_dev);
694 struct iio_dev * devm_iio_device_alloc(struct device *, int);
34 ssize_t iio_read_const_attr(struct device *, struct device_attribute *, char *);
96 ssize_t ad7152_start_calib(struct device *dev, struct device_attribute *attr, const char *buf, size_t len, u8 regval);
140 ssize_t ad7152_start_offset_calib(struct device *dev, struct device_attribute *attr, const char *buf, size_t len);
149 ssize_t ad7152_start_gain_calib(struct device *dev, struct device_attribute *attr, const char *buf, size_t len);
159 struct iio_dev_attr iio_dev_attr_in_capacitance0_calibbias_calibration = { { { "in_capacitance0_calibbias_calibration", 128U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, (ssize_t (*)(struct device *, struct device_attribute *, char *))0, &ad7152_start_offset_calib }, 0ULL, { 0, 0 }, 0 };
161 struct iio_dev_attr iio_dev_attr_in_capacitance1_calibbias_calibration = { { { "in_capacitance1_calibbias_calibration", 128U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, (ssize_t (*)(struct device *, struct device_attribute *, char *))0, &ad7152_start_offset_calib }, 1ULL, { 0, 0 }, 0 };
163 struct iio_dev_attr iio_dev_attr_in_capacitance0_calibscale_calibration = { { { "in_capacitance0_calibscale_calibration", 128U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, (ssize_t (*)(struct device *, struct device_attribute *, char *))0, &ad7152_start_gain_calib }, 0ULL, { 0, 0 }, 0 };
165 struct iio_dev_attr iio_dev_attr_in_capacitance1_calibscale_calibration = { { { "in_capacitance1_calibscale_calibration", 128U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, (ssize_t (*)(struct device *, struct device_attribute *, char *))0, &ad7152_start_gain_calib }, 1ULL, { 0, 0 }, 0 };
168 const unsigned char ad7152_filter_rate_table[4U][2U] = { { 200U, 6U }, { 50U, 21U }, { 20U, 51U }, { 17U, 61U } };
172 struct iio_const_attr iio_const_attr_sampling_frequency_available = { "200 50 20 17", { { "sampling_frequency_available", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &iio_read_const_attr, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 } };
175 struct iio_const_attr iio_const_attr_in_capacitance_scale_available = { "0.000061050 0.000030525 0.000015263 0.000007631", { { "in_capacitance_scale_available", 292U, (_Bool)0, 0, { { { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 } } } }, &iio_read_const_attr, (ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t ))0 } };
177 struct attribute *ad7152_attributes[7U] = { &(iio_dev_attr_in_capacitance0_calibbias_calibration.dev_attr.attr), &(iio_dev_attr_in_capacitance1_calibbias_calibration.dev_attr.attr), &(iio_dev_attr_in_capacitance0_calibscale_calibration.dev_attr.attr), &(iio_dev_attr_in_capacitance1_calibscale_calibration.dev_attr.attr), &(iio_const_attr_in_capacitance_scale_available.dev_attr.attr), &(iio_const_attr_sampling_frequency_available.dev_attr.attr), (struct attribute *)0 };
187 const struct attribute_group ad7152_attribute_group = { 0, 0, 0, (struct attribute **)(&ad7152_attributes), 0 };
191 const u8 ad7152_addresses[2U][4U] = { { 1U, 5U, 9U, 11U }, { 3U, 7U, 12U, 14U } };
199 const int ad7152_scale_table[4U] = { 30525, 7631, 15263, 61050 };
208 int ad7152_read_raw_samp_freq(struct device *dev, int *val);
222 int ad7152_write_raw_samp_freq(struct device *dev, int val);
249 int ad7152_write_raw(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int val, int val2, long mask);
331 int ad7152_read_raw(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *val, int *val2, long mask);
432 int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, long mask);
444 const struct iio_info ad7152_info = { &__this_module, 0, &ad7152_attribute_group, &ad7152_read_raw, 0, 0, &ad7152_write_raw, &ad7152_write_raw_get_fmt, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
452 const struct iio_chan_spec ad7152_channels[4U] = { { 14, 0, 0, 0UL, 0, { 0, 0U, 0U, 0U, 0U, 0 }, 53L, 0L, 0L, 0L, 0L, 0L, 4096L, 0L, 0, 0U, 0, 0, 0, 0U, 1U, 0U, 0U }, { 14, 0, 2, 0UL, 0, { 0, 0U, 0U, 0U, 0U, 0 }, 53L, 0L, 0L, 0L, 0L, 0L, 4096L, 0L, 0, 0U, 0, 0, 0, 0U, 1U, 0U, 1U }, { 14, 1, 0, 0UL, 0, { 0, 0U, 0U, 0U, 0U, 0 }, 53L, 0L, 0L, 0L, 0L, 0L, 4096L, 0L, 0, 0U, 0, 0, 0, 0U, 1U, 0U, 0U }, { 14, 1, 3, 0UL, 0, { 0, 0U, 0U, 0U, 0U, 0 }, 53L, 0L, 0L, 0L, 0L, 0L, 4096L, 0L, 0, 0U, 0, 0, 0, 0U, 1U, 0U, 1U } };
500 int ad7152_probe(struct i2c_client *client, const struct i2c_device_id *id);
544 const struct i2c_device_id __mod_i2c__ad7152_id_device_table[3U] = { };
575 void ldv_check_final_state();
578 void ldv_check_return_value(int);
581 void ldv_check_return_value_probe(int);
584 void ldv_initialize();
587 void ldv_handler_precall();
590 int nondet_int();
593 int LDV_IN_INTERRUPT = 0;
596 void ldv_main0_sequence_infinite_withcheck_stateful();
10 void ldv_error();
20 void ldv_stop();
25 int ldv_undef_int();
30 int ldv_undef_int_negative();
7 bool ldv_is_err(const void *ptr);
14 void * ldv_err_ptr(long error);
21 long int ldv_ptr_err(const void *ptr);
28 bool ldv_is_err_or_null(const void *ptr);
8 int ldv_mutex_lock = 1;
11 int ldv_mutex_lock_interruptible_lock(struct mutex *lock);
37 int ldv_mutex_lock_killable_lock(struct mutex *lock);
63 void ldv_mutex_lock_lock(struct mutex *lock);
98 int ldv_atomic_dec_and_mutex_lock_lock(atomic_t *cnt, struct mutex *lock);
123 int ldv_mutex_is_locked_lock(struct mutex *lock);
152 void ldv_mutex_unlock_lock(struct mutex *lock);
163 void ldv_usb_lock_device_lock();
170 int ldv_usb_trylock_device_lock();
176 int ldv_usb_lock_device_for_reset_lock();
189 void ldv_usb_unlock_device_lock();
194 int ldv_mutex_mutex_of_device = 1;
223 int ldv_mutex_lock_killable_mutex_of_device(struct mutex *lock);
284 int ldv_atomic_dec_and_mutex_lock_mutex_of_device(atomic_t *cnt, struct mutex *lock);
309 int ldv_mutex_is_locked_mutex_of_device(struct mutex *lock);
349 void ldv_usb_lock_device_mutex_of_device();
356 int ldv_usb_trylock_device_mutex_of_device();
362 int ldv_usb_lock_device_for_reset_mutex_of_device();
375 void ldv_usb_unlock_device_mutex_of_device();
380 int ldv_mutex_state_lock_of_ad7152_chip_info = 1;
383 int ldv_mutex_lock_interruptible_state_lock_of_ad7152_chip_info(struct mutex *lock);
409 int ldv_mutex_lock_killable_state_lock_of_ad7152_chip_info(struct mutex *lock);
444 int ldv_mutex_trylock_state_lock_of_ad7152_chip_info(struct mutex *lock);
470 int ldv_atomic_dec_and_mutex_lock_state_lock_of_ad7152_chip_info(atomic_t *cnt, struct mutex *lock);
495 int ldv_mutex_is_locked_state_lock_of_ad7152_chip_info(struct mutex *lock);
535 void ldv_usb_lock_device_state_lock_of_ad7152_chip_info();
542 int ldv_usb_trylock_device_state_lock_of_ad7152_chip_info();
548 int ldv_usb_lock_device_for_reset_state_lock_of_ad7152_chip_info();
561 void ldv_usb_unlock_device_state_lock_of_ad7152_chip_info();
return ;
}
-entry_point
{
598 struct iio_dev *var_group1;
599 const struct iio_chan_spec *var_ad7152_read_raw_6_p1;
600 int *var_ad7152_read_raw_6_p2;
601 int *var_ad7152_read_raw_6_p3;
602 long var_ad7152_read_raw_6_p4;
603 const struct iio_chan_spec *var_ad7152_write_raw_5_p1;
604 int var_ad7152_write_raw_5_p2;
605 int var_ad7152_write_raw_5_p3;
606 long var_ad7152_write_raw_5_p4;
607 const struct iio_chan_spec *var_ad7152_write_raw_get_fmt_7_p1;
608 long var_ad7152_write_raw_get_fmt_7_p2;
609 struct i2c_client *var_group2;
610 const struct i2c_device_id *var_ad7152_probe_8_p1;
611 int res_ad7152_probe_8;
612 int ldv_s_ad7152_driver_i2c_driver;
613 int tmp;
614 int tmp___0;
800 ldv_s_ad7152_driver_i2c_driver = 0;
788 LDV_IN_INTERRUPT = 1;
797 ldv_initialize() { /* Function call is skipped due to function is undefined */}
803 goto ldv_30615;
803 tmp___0 = nondet_int() { /* Function call is skipped due to function is undefined */}
803 assume(tmp___0 != 0);
806 goto ldv_30614;
804 ldv_30614:;
807 tmp = nondet_int() { /* Function call is skipped due to function is undefined */}
807 switch (tmp);
808 assume(!(tmp == 0));
861 assume(tmp == 1);
904 ldv_handler_precall() { /* Function call is skipped due to function is undefined */}
905 -ad7152_write_raw(var_group1, var_ad7152_write_raw_5_p1, var_ad7152_write_raw_5_p2, var_ad7152_write_raw_5_p3, var_ad7152_write_raw_5_p4)
{
252 struct ad7152_chip_info *chip;
253 void *tmp;
254 int ret;
255 int i;
256 unsigned short tmp___0;
257 unsigned short tmp___1;
255 -iio_priv((const struct iio_dev *)indio_dev)
{
683 return ((void *)indio_dev) + 2368U;;
}
255 chip = (struct ad7152_chip_info *)tmp;
258 -ldv_mutex_lock_17(&(chip->state_lock))
{
191 -ldv_mutex_lock_state_lock_of_ad7152_chip_info(ldv_func_arg1)
{
438 assume(!(ldv_mutex_state_lock_of_ad7152_chip_info != 1));
440 ldv_mutex_state_lock_of_ad7152_chip_info = 2;
441 return ;;
}
193 mutex_lock(ldv_func_arg1) { /* Function call is skipped due to function is undefined */}
194 return ;;
}
260 switch (mask);
261 assume(!(mask == 4L));
277 assume(!(mask == 5L));
291 assume(!(mask == 2L));
311 assume(mask == 12L);
312 assume(!(val2 != 0));
316 -ad7152_write_raw_samp_freq(&(indio_dev->dev), val)
{
224 struct iio_dev *indio_dev;
225 struct iio_dev *tmp;
226 struct ad7152_chip_info *chip;
227 void *tmp___0;
228 int ret;
229 int i;
224 -dev_to_iio_dev(dev)
{
638 const struct device *__mptr;
638 __mptr = (const struct device *)dev;
638 return ((struct iio_dev *)__mptr) + 18446744073709551600UL;;
}
224 indio_dev = tmp;
225 -iio_priv((const struct iio_dev *)indio_dev)
{
683 return ((void *)indio_dev) + 2368U;;
}
225 chip = (struct ad7152_chip_info *)tmp___0;
228 i = 0;
228 goto ldv_30488;
228 assume(((unsigned int)i) <= 3U);
230 goto ldv_30487;
229 ldv_30487:;
229 assume(((int)(ad7152_filter_rate_table[i][0])) <= val);
230 goto ldv_30486;
232 assume(!(((unsigned int)i) > 3U));
235 -ldv_mutex_lock_14(&(chip->state_lock))
{
167 -ldv_mutex_lock_state_lock_of_ad7152_chip_info(ldv_func_arg1)
{
438 assume(ldv_mutex_state_lock_of_ad7152_chip_info != 1);
438 -ldv_error()
{
15 LDV_ERROR:;
}
}
}
}
}
}
Source code
1 2 /* 3 * AD7152 capacitive sensor driver supporting AD7152/3 4 * 5 * Copyright 2010-2011a Analog Devices Inc. 6 * 7 * Licensed under the GPL-2 or later. 8 */ 9 10 #include <linux/interrupt.h> 11 #include <linux/device.h> 12 #include <linux/kernel.h> 13 #include <linux/slab.h> 14 #include <linux/sysfs.h> 15 #include <linux/i2c.h> 16 #include <linux/module.h> 17 #include <linux/delay.h> 18 19 #include <linux/iio/iio.h> 20 #include <linux/iio/sysfs.h> 21 22 /* 23 * TODO: Check compliance of calibbias with abi (units) 24 */ 25 /* 26 * AD7152 registers definition 27 */ 28 29 #define AD7152_REG_STATUS 0 30 #define AD7152_REG_CH1_DATA_HIGH 1 31 #define AD7152_REG_CH2_DATA_HIGH 3 32 #define AD7152_REG_CH1_OFFS_HIGH 5 33 #define AD7152_REG_CH2_OFFS_HIGH 7 34 #define AD7152_REG_CH1_GAIN_HIGH 9 35 #define AD7152_REG_CH1_SETUP 11 36 #define AD7152_REG_CH2_GAIN_HIGH 12 37 #define AD7152_REG_CH2_SETUP 14 38 #define AD7152_REG_CFG 15 39 #define AD7152_REG_RESEVERD 16 40 #define AD7152_REG_CAPDAC_POS 17 41 #define AD7152_REG_CAPDAC_NEG 18 42 #define AD7152_REG_CFG2 26 43 44 /* Status Register Bit Designations (AD7152_REG_STATUS) */ 45 #define AD7152_STATUS_RDY1 BIT(0) 46 #define AD7152_STATUS_RDY2 BIT(1) 47 #define AD7152_STATUS_C1C2 BIT(2) 48 #define AD7152_STATUS_PWDN BIT(7) 49 50 /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */ 51 #define AD7152_SETUP_CAPDIFF (1 << 5) 52 #define AD7152_SETUP_RANGE_2pF (0 << 6) 53 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 54 #define AD7152_SETUP_RANGE_1pF (2 << 6) 55 #define AD7152_SETUP_RANGE_4pF (3 << 6) 56 #define AD7152_SETUP_RANGE(x) ((x) << 6) 57 58 /* Config Register Bit Designations (AD7152_REG_CFG) */ 59 #define AD7152_CONF_CH2EN (1 << 3) 60 #define AD7152_CONF_CH1EN (1 << 4) 61 #define AD7152_CONF_MODE_IDLE (0 << 0) 62 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 63 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 64 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 65 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 66 67 /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */ 68 #define AD7152_CAPDAC_DACEN (1 << 7) 69 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 70 71 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */ 72 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 73 74 enum { 75 AD7152_DATA, 76 AD7152_OFFS, 77 AD7152_GAIN, 78 AD7152_SETUP 79 }; 80 81 /* 82 * struct ad7152_chip_info - chip specific information 83 */ 84 85 struct ad7152_chip_info { 86 struct i2c_client *client; 87 /* 88 * Capacitive channel digital filter setup; 89 * conversion time/update rate setup per channel 90 */ 91 u8 filter_rate_setup; 92 u8 setup[2]; 93 struct mutex state_lock; /* protect hardware state */ 94 }; 95 96 static inline ssize_t ad7152_start_calib(struct device *dev, 97 struct device_attribute *attr, 98 const char *buf, 99 size_t len, 100 u8 regval) 101 { 102 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 103 struct ad7152_chip_info *chip = iio_priv(indio_dev); 104 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 105 bool doit; 106 int ret, timeout = 10; 107 108 ret = strtobool(buf, &doit); 109 if (ret < 0) 110 return ret; 111 112 if (!doit) 113 return 0; 114 115 if (this_attr->address == 0) 116 regval |= AD7152_CONF_CH1EN; 117 else 118 regval |= AD7152_CONF_CH2EN; 119 120 mutex_lock(&chip->state_lock); 121 ret = i2c_smbus_write_byte_data(chip->client, AD7152_REG_CFG, regval); 122 if (ret < 0) { 123 mutex_unlock(&chip->state_lock); 124 return ret; 125 } 126 127 do { 128 mdelay(20); 129 ret = i2c_smbus_read_byte_data(chip->client, AD7152_REG_CFG); 130 if (ret < 0) { 131 mutex_unlock(&chip->state_lock); 132 return ret; 133 } 134 } while ((ret == regval) && timeout--); 135 136 mutex_unlock(&chip->state_lock); 137 return len; 138 } 139 140 static ssize_t ad7152_start_offset_calib(struct device *dev, 141 struct device_attribute *attr, 142 const char *buf, 143 size_t len) 144 { 145 return ad7152_start_calib(dev, attr, buf, len, 146 AD7152_CONF_MODE_OFFS_CAL); 147 } 148 149 static ssize_t ad7152_start_gain_calib(struct device *dev, 150 struct device_attribute *attr, 151 const char *buf, 152 size_t len) 153 { 154 return ad7152_start_calib(dev, attr, buf, len, 155 AD7152_CONF_MODE_GAIN_CAL); 156 } 157 158 static IIO_DEVICE_ATTR(in_capacitance0_calibbias_calibration, 159 0200, NULL, ad7152_start_offset_calib, 0); 160 static IIO_DEVICE_ATTR(in_capacitance1_calibbias_calibration, 161 0200, NULL, ad7152_start_offset_calib, 1); 162 static IIO_DEVICE_ATTR(in_capacitance0_calibscale_calibration, 163 0200, NULL, ad7152_start_gain_calib, 0); 164 static IIO_DEVICE_ATTR(in_capacitance1_calibscale_calibration, 165 0200, NULL, ad7152_start_gain_calib, 1); 166 167 /* Values are Update Rate (Hz), Conversion Time (ms) + 1*/ 168 static const unsigned char ad7152_filter_rate_table[][2] = { 169 {200, 5 + 1}, {50, 20 + 1}, {20, 50 + 1}, {17, 60 + 1}, 170 }; 171 172 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("200 50 20 17"); 173 174 static IIO_CONST_ATTR(in_capacitance_scale_available, 175 "0.000061050 0.000030525 0.000015263 0.000007631"); 176 177 static struct attribute *ad7152_attributes[] = { 178 &iio_dev_attr_in_capacitance0_calibbias_calibration.dev_attr.attr, 179 &iio_dev_attr_in_capacitance1_calibbias_calibration.dev_attr.attr, 180 &iio_dev_attr_in_capacitance0_calibscale_calibration.dev_attr.attr, 181 &iio_dev_attr_in_capacitance1_calibscale_calibration.dev_attr.attr, 182 &iio_const_attr_in_capacitance_scale_available.dev_attr.attr, 183 &iio_const_attr_sampling_frequency_available.dev_attr.attr, 184 NULL, 185 }; 186 187 static const struct attribute_group ad7152_attribute_group = { 188 .attrs = ad7152_attributes, 189 }; 190 191 static const u8 ad7152_addresses[][4] = { 192 { AD7152_REG_CH1_DATA_HIGH, AD7152_REG_CH1_OFFS_HIGH, 193 AD7152_REG_CH1_GAIN_HIGH, AD7152_REG_CH1_SETUP }, 194 { AD7152_REG_CH2_DATA_HIGH, AD7152_REG_CH2_OFFS_HIGH, 195 AD7152_REG_CH2_GAIN_HIGH, AD7152_REG_CH2_SETUP }, 196 }; 197 198 /* Values are nano relative to pf base. */ 199 static const int ad7152_scale_table[] = { 200 30525, 7631, 15263, 61050 201 }; 202 203 /** 204 * read_raw handler for IIO_CHAN_INFO_SAMP_FREQ 205 * 206 * lock must be held 207 **/ 208 static int ad7152_read_raw_samp_freq(struct device *dev, int *val) 209 { 210 struct ad7152_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); 211 212 *val = ad7152_filter_rate_table[chip->filter_rate_setup][0]; 213 214 return 0; 215 } 216 217 /** 218 * write_raw handler for IIO_CHAN_INFO_SAMP_FREQ 219 * 220 * lock must be held 221 **/ 222 static int ad7152_write_raw_samp_freq(struct device *dev, int val) 223 { 224 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 225 struct ad7152_chip_info *chip = iio_priv(indio_dev); 226 int ret, i; 227 228 for (i = 0; i < ARRAY_SIZE(ad7152_filter_rate_table); i++) 229 if (val >= ad7152_filter_rate_table[i][0]) 230 break; 231 232 if (i >= ARRAY_SIZE(ad7152_filter_rate_table)) 233 i = ARRAY_SIZE(ad7152_filter_rate_table) - 1; 234 235 mutex_lock(&chip->state_lock); 236 ret = i2c_smbus_write_byte_data(chip->client, 237 AD7152_REG_CFG2, AD7152_CFG2_OSR(i)); 238 if (ret < 0) { 239 mutex_unlock(&chip->state_lock); 240 return ret; 241 } 242 243 chip->filter_rate_setup = i; 244 mutex_unlock(&chip->state_lock); 245 246 return ret; 247 } 248 249 static int ad7152_write_raw(struct iio_dev *indio_dev, 250 struct iio_chan_spec const *chan, 251 int val, 252 int val2, 253 long mask) 254 { 255 struct ad7152_chip_info *chip = iio_priv(indio_dev); 256 int ret, i; 257 258 mutex_lock(&chip->state_lock); 259 260 switch (mask) { 261 case IIO_CHAN_INFO_CALIBSCALE: 262 if (val != 1) { 263 ret = -EINVAL; 264 goto out; 265 } 266 267 val = (val2 * 1024) / 15625; 268 269 ret = i2c_smbus_write_word_data(chip->client, 270 ad7152_addresses[chan->channel][AD7152_GAIN], 271 swab16(val)); 272 if (ret < 0) 273 goto out; 274 275 ret = 0; 276 break; 277 278 case IIO_CHAN_INFO_CALIBBIAS: 279 if ((val < 0) | (val > 0xFFFF)) { 280 ret = -EINVAL; 281 goto out; 282 } 283 ret = i2c_smbus_write_word_data(chip->client, 284 ad7152_addresses[chan->channel][AD7152_OFFS], 285 swab16(val)); 286 if (ret < 0) 287 goto out; 288 289 ret = 0; 290 break; 291 case IIO_CHAN_INFO_SCALE: 292 if (val) { 293 ret = -EINVAL; 294 goto out; 295 } 296 for (i = 0; i < ARRAY_SIZE(ad7152_scale_table); i++) 297 if (val2 == ad7152_scale_table[i]) 298 break; 299 300 chip->setup[chan->channel] &= ~AD7152_SETUP_RANGE_4pF; 301 chip->setup[chan->channel] |= AD7152_SETUP_RANGE(i); 302 303 ret = i2c_smbus_write_byte_data(chip->client, 304 ad7152_addresses[chan->channel][AD7152_SETUP], 305 chip->setup[chan->channel]); 306 if (ret < 0) 307 goto out; 308 309 ret = 0; 310 break; 311 case IIO_CHAN_INFO_SAMP_FREQ: 312 if (val2) { 313 ret = -EINVAL; 314 goto out; 315 } 316 ret = ad7152_write_raw_samp_freq(&indio_dev->dev, val); 317 if (ret < 0) 318 goto out; 319 320 ret = 0; 321 break; 322 default: 323 ret = -EINVAL; 324 } 325 326 out: 327 mutex_unlock(&chip->state_lock); 328 return ret; 329 } 330 331 static int ad7152_read_raw(struct iio_dev *indio_dev, 332 struct iio_chan_spec const *chan, 333 int *val, int *val2, 334 long mask) 335 { 336 struct ad7152_chip_info *chip = iio_priv(indio_dev); 337 int ret; 338 u8 regval = 0; 339 340 mutex_lock(&chip->state_lock); 341 342 switch (mask) { 343 case IIO_CHAN_INFO_RAW: 344 /* First set whether in differential mode */ 345 346 regval = chip->setup[chan->channel]; 347 348 if (chan->differential) 349 chip->setup[chan->channel] |= AD7152_SETUP_CAPDIFF; 350 else 351 chip->setup[chan->channel] &= ~AD7152_SETUP_CAPDIFF; 352 353 if (regval != chip->setup[chan->channel]) { 354 ret = i2c_smbus_write_byte_data(chip->client, 355 ad7152_addresses[chan->channel][AD7152_SETUP], 356 chip->setup[chan->channel]); 357 if (ret < 0) 358 goto out; 359 } 360 /* Make sure the channel is enabled */ 361 if (chan->channel == 0) 362 regval = AD7152_CONF_CH1EN; 363 else 364 regval = AD7152_CONF_CH2EN; 365 366 /* Trigger a single read */ 367 regval |= AD7152_CONF_MODE_SINGLE_CONV; 368 ret = i2c_smbus_write_byte_data(chip->client, AD7152_REG_CFG, 369 regval); 370 if (ret < 0) 371 goto out; 372 373 msleep(ad7152_filter_rate_table[chip->filter_rate_setup][1]); 374 /* Now read the actual register */ 375 ret = i2c_smbus_read_word_data(chip->client, 376 ad7152_addresses[chan->channel][AD7152_DATA]); 377 if (ret < 0) 378 goto out; 379 *val = swab16(ret); 380 381 if (chan->differential) 382 *val -= 0x8000; 383 384 ret = IIO_VAL_INT; 385 break; 386 case IIO_CHAN_INFO_CALIBSCALE: 387 388 ret = i2c_smbus_read_word_data(chip->client, 389 ad7152_addresses[chan->channel][AD7152_GAIN]); 390 if (ret < 0) 391 goto out; 392 /* 1 + gain_val / 2^16 */ 393 *val = 1; 394 *val2 = (15625 * swab16(ret)) / 1024; 395 396 ret = IIO_VAL_INT_PLUS_MICRO; 397 break; 398 case IIO_CHAN_INFO_CALIBBIAS: 399 ret = i2c_smbus_read_word_data(chip->client, 400 ad7152_addresses[chan->channel][AD7152_OFFS]); 401 if (ret < 0) 402 goto out; 403 *val = swab16(ret); 404 405 ret = IIO_VAL_INT; 406 break; 407 case IIO_CHAN_INFO_SCALE: 408 ret = i2c_smbus_read_byte_data(chip->client, 409 ad7152_addresses[chan->channel][AD7152_SETUP]); 410 if (ret < 0) 411 goto out; 412 *val = 0; 413 *val2 = ad7152_scale_table[ret >> 6]; 414 415 ret = IIO_VAL_INT_PLUS_NANO; 416 break; 417 case IIO_CHAN_INFO_SAMP_FREQ: 418 ret = ad7152_read_raw_samp_freq(&indio_dev->dev, val); 419 if (ret < 0) 420 goto out; 421 422 ret = IIO_VAL_INT; 423 break; 424 default: 425 ret = -EINVAL; 426 } 427 out: 428 mutex_unlock(&chip->state_lock); 429 return ret; 430 } 431 432 static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, 433 struct iio_chan_spec const *chan, 434 long mask) 435 { 436 switch (mask) { 437 case IIO_CHAN_INFO_SCALE: 438 return IIO_VAL_INT_PLUS_NANO; 439 default: 440 return IIO_VAL_INT_PLUS_MICRO; 441 } 442 } 443 444 static const struct iio_info ad7152_info = { 445 .attrs = &ad7152_attribute_group, 446 .read_raw = ad7152_read_raw, 447 .write_raw = ad7152_write_raw, 448 .write_raw_get_fmt = ad7152_write_raw_get_fmt, 449 .driver_module = THIS_MODULE, 450 }; 451 452 static const struct iio_chan_spec ad7152_channels[] = { 453 { 454 .type = IIO_CAPACITANCE, 455 .indexed = 1, 456 .channel = 0, 457 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 458 BIT(IIO_CHAN_INFO_CALIBSCALE) | 459 BIT(IIO_CHAN_INFO_CALIBBIAS) | 460 BIT(IIO_CHAN_INFO_SCALE), 461 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 462 }, { 463 .type = IIO_CAPACITANCE, 464 .differential = 1, 465 .indexed = 1, 466 .channel = 0, 467 .channel2 = 2, 468 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 469 BIT(IIO_CHAN_INFO_CALIBSCALE) | 470 BIT(IIO_CHAN_INFO_CALIBBIAS) | 471 BIT(IIO_CHAN_INFO_SCALE), 472 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 473 }, { 474 .type = IIO_CAPACITANCE, 475 .indexed = 1, 476 .channel = 1, 477 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 478 BIT(IIO_CHAN_INFO_CALIBSCALE) | 479 BIT(IIO_CHAN_INFO_CALIBBIAS) | 480 BIT(IIO_CHAN_INFO_SCALE), 481 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 482 }, { 483 .type = IIO_CAPACITANCE, 484 .differential = 1, 485 .indexed = 1, 486 .channel = 1, 487 .channel2 = 3, 488 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 489 BIT(IIO_CHAN_INFO_CALIBSCALE) | 490 BIT(IIO_CHAN_INFO_CALIBBIAS) | 491 BIT(IIO_CHAN_INFO_SCALE), 492 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 493 } 494 }; 495 496 /* 497 * device probe and remove 498 */ 499 500 static int ad7152_probe(struct i2c_client *client, 501 const struct i2c_device_id *id) 502 { 503 int ret = 0; 504 struct ad7152_chip_info *chip; 505 struct iio_dev *indio_dev; 506 507 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 508 if (!indio_dev) 509 return -ENOMEM; 510 chip = iio_priv(indio_dev); 511 /* this is only used for device removal purposes */ 512 i2c_set_clientdata(client, indio_dev); 513 514 chip->client = client; 515 mutex_init(&chip->state_lock); 516 517 /* Establish that the iio_dev is a child of the i2c device */ 518 indio_dev->name = id->name; 519 indio_dev->dev.parent = &client->dev; 520 indio_dev->info = &ad7152_info; 521 indio_dev->channels = ad7152_channels; 522 if (id->driver_data == 0) 523 indio_dev->num_channels = ARRAY_SIZE(ad7152_channels); 524 else 525 indio_dev->num_channels = 2; 526 indio_dev->num_channels = ARRAY_SIZE(ad7152_channels); 527 indio_dev->modes = INDIO_DIRECT_MODE; 528 529 ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); 530 if (ret) 531 return ret; 532 533 dev_err(&client->dev, "%s capacitive sensor registered\n", id->name); 534 535 return 0; 536 } 537 538 static const struct i2c_device_id ad7152_id[] = { 539 { "ad7152", 0 }, 540 { "ad7153", 1 }, 541 {} 542 }; 543 544 MODULE_DEVICE_TABLE(i2c, ad7152_id); 545 546 static struct i2c_driver ad7152_driver = { 547 .driver = { 548 .name = KBUILD_MODNAME, 549 }, 550 .probe = ad7152_probe, 551 .id_table = ad7152_id, 552 }; 553 module_i2c_driver(ad7152_driver); 554 555 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 556 MODULE_DESCRIPTION("Analog Devices AD7152/3 capacitive sensor driver"); 557 MODULE_LICENSE("GPL v2"); 558 559 560 561 562 563 /* LDV_COMMENT_BEGIN_MAIN */ 564 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 565 566 /*###########################################################################*/ 567 568 /*############## Driver Environment Generator 0.2 output ####################*/ 569 570 /*###########################################################################*/ 571 572 573 574 /* 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. */ 575 void ldv_check_final_state(void); 576 577 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 578 void ldv_check_return_value(int res); 579 580 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 581 void ldv_check_return_value_probe(int res); 582 583 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 584 void ldv_initialize(void); 585 586 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 587 void ldv_handler_precall(void); 588 589 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 590 int nondet_int(void); 591 592 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 593 int LDV_IN_INTERRUPT; 594 595 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 596 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 597 598 599 600 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 601 /*============================= VARIABLE DECLARATION PART =============================*/ 602 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 603 /* content: static int ad7152_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)*/ 604 /* LDV_COMMENT_BEGIN_PREP */ 605 #define AD7152_REG_STATUS 0 606 #define AD7152_REG_CH1_DATA_HIGH 1 607 #define AD7152_REG_CH2_DATA_HIGH 3 608 #define AD7152_REG_CH1_OFFS_HIGH 5 609 #define AD7152_REG_CH2_OFFS_HIGH 7 610 #define AD7152_REG_CH1_GAIN_HIGH 9 611 #define AD7152_REG_CH1_SETUP 11 612 #define AD7152_REG_CH2_GAIN_HIGH 12 613 #define AD7152_REG_CH2_SETUP 14 614 #define AD7152_REG_CFG 15 615 #define AD7152_REG_RESEVERD 16 616 #define AD7152_REG_CAPDAC_POS 17 617 #define AD7152_REG_CAPDAC_NEG 18 618 #define AD7152_REG_CFG2 26 619 #define AD7152_STATUS_RDY1 BIT(0) 620 #define AD7152_STATUS_RDY2 BIT(1) 621 #define AD7152_STATUS_C1C2 BIT(2) 622 #define AD7152_STATUS_PWDN BIT(7) 623 #define AD7152_SETUP_CAPDIFF (1 << 5) 624 #define AD7152_SETUP_RANGE_2pF (0 << 6) 625 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 626 #define AD7152_SETUP_RANGE_1pF (2 << 6) 627 #define AD7152_SETUP_RANGE_4pF (3 << 6) 628 #define AD7152_SETUP_RANGE(x) ((x) << 6) 629 #define AD7152_CONF_CH2EN (1 << 3) 630 #define AD7152_CONF_CH1EN (1 << 4) 631 #define AD7152_CONF_MODE_IDLE (0 << 0) 632 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 633 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 634 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 635 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 636 #define AD7152_CAPDAC_DACEN (1 << 7) 637 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 638 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 639 /* LDV_COMMENT_END_PREP */ 640 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 641 struct iio_dev * var_group1; 642 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 643 struct iio_chan_spec const * var_ad7152_read_raw_6_p1; 644 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 645 int * var_ad7152_read_raw_6_p2; 646 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 647 int * var_ad7152_read_raw_6_p3; 648 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 649 long var_ad7152_read_raw_6_p4; 650 /* content: static int ad7152_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask)*/ 651 /* LDV_COMMENT_BEGIN_PREP */ 652 #define AD7152_REG_STATUS 0 653 #define AD7152_REG_CH1_DATA_HIGH 1 654 #define AD7152_REG_CH2_DATA_HIGH 3 655 #define AD7152_REG_CH1_OFFS_HIGH 5 656 #define AD7152_REG_CH2_OFFS_HIGH 7 657 #define AD7152_REG_CH1_GAIN_HIGH 9 658 #define AD7152_REG_CH1_SETUP 11 659 #define AD7152_REG_CH2_GAIN_HIGH 12 660 #define AD7152_REG_CH2_SETUP 14 661 #define AD7152_REG_CFG 15 662 #define AD7152_REG_RESEVERD 16 663 #define AD7152_REG_CAPDAC_POS 17 664 #define AD7152_REG_CAPDAC_NEG 18 665 #define AD7152_REG_CFG2 26 666 #define AD7152_STATUS_RDY1 BIT(0) 667 #define AD7152_STATUS_RDY2 BIT(1) 668 #define AD7152_STATUS_C1C2 BIT(2) 669 #define AD7152_STATUS_PWDN BIT(7) 670 #define AD7152_SETUP_CAPDIFF (1 << 5) 671 #define AD7152_SETUP_RANGE_2pF (0 << 6) 672 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 673 #define AD7152_SETUP_RANGE_1pF (2 << 6) 674 #define AD7152_SETUP_RANGE_4pF (3 << 6) 675 #define AD7152_SETUP_RANGE(x) ((x) << 6) 676 #define AD7152_CONF_CH2EN (1 << 3) 677 #define AD7152_CONF_CH1EN (1 << 4) 678 #define AD7152_CONF_MODE_IDLE (0 << 0) 679 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 680 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 681 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 682 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 683 #define AD7152_CAPDAC_DACEN (1 << 7) 684 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 685 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 686 /* LDV_COMMENT_END_PREP */ 687 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 688 struct iio_chan_spec const * var_ad7152_write_raw_5_p1; 689 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 690 int var_ad7152_write_raw_5_p2; 691 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 692 int var_ad7152_write_raw_5_p3; 693 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 694 long var_ad7152_write_raw_5_p4; 695 /* content: static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, long mask)*/ 696 /* LDV_COMMENT_BEGIN_PREP */ 697 #define AD7152_REG_STATUS 0 698 #define AD7152_REG_CH1_DATA_HIGH 1 699 #define AD7152_REG_CH2_DATA_HIGH 3 700 #define AD7152_REG_CH1_OFFS_HIGH 5 701 #define AD7152_REG_CH2_OFFS_HIGH 7 702 #define AD7152_REG_CH1_GAIN_HIGH 9 703 #define AD7152_REG_CH1_SETUP 11 704 #define AD7152_REG_CH2_GAIN_HIGH 12 705 #define AD7152_REG_CH2_SETUP 14 706 #define AD7152_REG_CFG 15 707 #define AD7152_REG_RESEVERD 16 708 #define AD7152_REG_CAPDAC_POS 17 709 #define AD7152_REG_CAPDAC_NEG 18 710 #define AD7152_REG_CFG2 26 711 #define AD7152_STATUS_RDY1 BIT(0) 712 #define AD7152_STATUS_RDY2 BIT(1) 713 #define AD7152_STATUS_C1C2 BIT(2) 714 #define AD7152_STATUS_PWDN BIT(7) 715 #define AD7152_SETUP_CAPDIFF (1 << 5) 716 #define AD7152_SETUP_RANGE_2pF (0 << 6) 717 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 718 #define AD7152_SETUP_RANGE_1pF (2 << 6) 719 #define AD7152_SETUP_RANGE_4pF (3 << 6) 720 #define AD7152_SETUP_RANGE(x) ((x) << 6) 721 #define AD7152_CONF_CH2EN (1 << 3) 722 #define AD7152_CONF_CH1EN (1 << 4) 723 #define AD7152_CONF_MODE_IDLE (0 << 0) 724 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 725 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 726 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 727 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 728 #define AD7152_CAPDAC_DACEN (1 << 7) 729 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 730 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 731 /* LDV_COMMENT_END_PREP */ 732 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw_get_fmt" */ 733 struct iio_chan_spec const * var_ad7152_write_raw_get_fmt_7_p1; 734 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw_get_fmt" */ 735 long var_ad7152_write_raw_get_fmt_7_p2; 736 737 /** STRUCT: struct type: i2c_driver, struct name: ad7152_driver **/ 738 /* content: static int ad7152_probe(struct i2c_client *client, const struct i2c_device_id *id)*/ 739 /* LDV_COMMENT_BEGIN_PREP */ 740 #define AD7152_REG_STATUS 0 741 #define AD7152_REG_CH1_DATA_HIGH 1 742 #define AD7152_REG_CH2_DATA_HIGH 3 743 #define AD7152_REG_CH1_OFFS_HIGH 5 744 #define AD7152_REG_CH2_OFFS_HIGH 7 745 #define AD7152_REG_CH1_GAIN_HIGH 9 746 #define AD7152_REG_CH1_SETUP 11 747 #define AD7152_REG_CH2_GAIN_HIGH 12 748 #define AD7152_REG_CH2_SETUP 14 749 #define AD7152_REG_CFG 15 750 #define AD7152_REG_RESEVERD 16 751 #define AD7152_REG_CAPDAC_POS 17 752 #define AD7152_REG_CAPDAC_NEG 18 753 #define AD7152_REG_CFG2 26 754 #define AD7152_STATUS_RDY1 BIT(0) 755 #define AD7152_STATUS_RDY2 BIT(1) 756 #define AD7152_STATUS_C1C2 BIT(2) 757 #define AD7152_STATUS_PWDN BIT(7) 758 #define AD7152_SETUP_CAPDIFF (1 << 5) 759 #define AD7152_SETUP_RANGE_2pF (0 << 6) 760 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 761 #define AD7152_SETUP_RANGE_1pF (2 << 6) 762 #define AD7152_SETUP_RANGE_4pF (3 << 6) 763 #define AD7152_SETUP_RANGE(x) ((x) << 6) 764 #define AD7152_CONF_CH2EN (1 << 3) 765 #define AD7152_CONF_CH1EN (1 << 4) 766 #define AD7152_CONF_MODE_IDLE (0 << 0) 767 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 768 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 769 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 770 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 771 #define AD7152_CAPDAC_DACEN (1 << 7) 772 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 773 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 774 /* LDV_COMMENT_END_PREP */ 775 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_probe" */ 776 struct i2c_client * var_group2; 777 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_probe" */ 778 const struct i2c_device_id * var_ad7152_probe_8_p1; 779 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ad7152_probe" */ 780 static int res_ad7152_probe_8; 781 782 783 784 785 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 786 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 787 /*============================= VARIABLE INITIALIZING PART =============================*/ 788 LDV_IN_INTERRUPT=1; 789 790 791 792 793 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 794 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 795 /*============================= FUNCTION CALL SECTION =============================*/ 796 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 797 ldv_initialize(); 798 799 800 int ldv_s_ad7152_driver_i2c_driver = 0; 801 802 803 while( nondet_int() 804 || !(ldv_s_ad7152_driver_i2c_driver == 0) 805 ) { 806 807 switch(nondet_int()) { 808 809 case 0: { 810 811 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 812 813 814 /* content: static int ad7152_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)*/ 815 /* LDV_COMMENT_BEGIN_PREP */ 816 #define AD7152_REG_STATUS 0 817 #define AD7152_REG_CH1_DATA_HIGH 1 818 #define AD7152_REG_CH2_DATA_HIGH 3 819 #define AD7152_REG_CH1_OFFS_HIGH 5 820 #define AD7152_REG_CH2_OFFS_HIGH 7 821 #define AD7152_REG_CH1_GAIN_HIGH 9 822 #define AD7152_REG_CH1_SETUP 11 823 #define AD7152_REG_CH2_GAIN_HIGH 12 824 #define AD7152_REG_CH2_SETUP 14 825 #define AD7152_REG_CFG 15 826 #define AD7152_REG_RESEVERD 16 827 #define AD7152_REG_CAPDAC_POS 17 828 #define AD7152_REG_CAPDAC_NEG 18 829 #define AD7152_REG_CFG2 26 830 #define AD7152_STATUS_RDY1 BIT(0) 831 #define AD7152_STATUS_RDY2 BIT(1) 832 #define AD7152_STATUS_C1C2 BIT(2) 833 #define AD7152_STATUS_PWDN BIT(7) 834 #define AD7152_SETUP_CAPDIFF (1 << 5) 835 #define AD7152_SETUP_RANGE_2pF (0 << 6) 836 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 837 #define AD7152_SETUP_RANGE_1pF (2 << 6) 838 #define AD7152_SETUP_RANGE_4pF (3 << 6) 839 #define AD7152_SETUP_RANGE(x) ((x) << 6) 840 #define AD7152_CONF_CH2EN (1 << 3) 841 #define AD7152_CONF_CH1EN (1 << 4) 842 #define AD7152_CONF_MODE_IDLE (0 << 0) 843 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 844 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 845 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 846 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 847 #define AD7152_CAPDAC_DACEN (1 << 7) 848 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 849 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 850 /* LDV_COMMENT_END_PREP */ 851 /* LDV_COMMENT_FUNCTION_CALL Function from field "read_raw" from driver structure with callbacks "ad7152_info" */ 852 ldv_handler_precall(); 853 ad7152_read_raw( var_group1, var_ad7152_read_raw_6_p1, var_ad7152_read_raw_6_p2, var_ad7152_read_raw_6_p3, var_ad7152_read_raw_6_p4); 854 855 856 857 858 } 859 860 break; 861 case 1: { 862 863 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 864 865 866 /* content: static int ad7152_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask)*/ 867 /* LDV_COMMENT_BEGIN_PREP */ 868 #define AD7152_REG_STATUS 0 869 #define AD7152_REG_CH1_DATA_HIGH 1 870 #define AD7152_REG_CH2_DATA_HIGH 3 871 #define AD7152_REG_CH1_OFFS_HIGH 5 872 #define AD7152_REG_CH2_OFFS_HIGH 7 873 #define AD7152_REG_CH1_GAIN_HIGH 9 874 #define AD7152_REG_CH1_SETUP 11 875 #define AD7152_REG_CH2_GAIN_HIGH 12 876 #define AD7152_REG_CH2_SETUP 14 877 #define AD7152_REG_CFG 15 878 #define AD7152_REG_RESEVERD 16 879 #define AD7152_REG_CAPDAC_POS 17 880 #define AD7152_REG_CAPDAC_NEG 18 881 #define AD7152_REG_CFG2 26 882 #define AD7152_STATUS_RDY1 BIT(0) 883 #define AD7152_STATUS_RDY2 BIT(1) 884 #define AD7152_STATUS_C1C2 BIT(2) 885 #define AD7152_STATUS_PWDN BIT(7) 886 #define AD7152_SETUP_CAPDIFF (1 << 5) 887 #define AD7152_SETUP_RANGE_2pF (0 << 6) 888 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 889 #define AD7152_SETUP_RANGE_1pF (2 << 6) 890 #define AD7152_SETUP_RANGE_4pF (3 << 6) 891 #define AD7152_SETUP_RANGE(x) ((x) << 6) 892 #define AD7152_CONF_CH2EN (1 << 3) 893 #define AD7152_CONF_CH1EN (1 << 4) 894 #define AD7152_CONF_MODE_IDLE (0 << 0) 895 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 896 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 897 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 898 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 899 #define AD7152_CAPDAC_DACEN (1 << 7) 900 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 901 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 902 /* LDV_COMMENT_END_PREP */ 903 /* LDV_COMMENT_FUNCTION_CALL Function from field "write_raw" from driver structure with callbacks "ad7152_info" */ 904 ldv_handler_precall(); 905 ad7152_write_raw( var_group1, var_ad7152_write_raw_5_p1, var_ad7152_write_raw_5_p2, var_ad7152_write_raw_5_p3, var_ad7152_write_raw_5_p4); 906 907 908 909 910 } 911 912 break; 913 case 2: { 914 915 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 916 917 918 /* content: static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, long mask)*/ 919 /* LDV_COMMENT_BEGIN_PREP */ 920 #define AD7152_REG_STATUS 0 921 #define AD7152_REG_CH1_DATA_HIGH 1 922 #define AD7152_REG_CH2_DATA_HIGH 3 923 #define AD7152_REG_CH1_OFFS_HIGH 5 924 #define AD7152_REG_CH2_OFFS_HIGH 7 925 #define AD7152_REG_CH1_GAIN_HIGH 9 926 #define AD7152_REG_CH1_SETUP 11 927 #define AD7152_REG_CH2_GAIN_HIGH 12 928 #define AD7152_REG_CH2_SETUP 14 929 #define AD7152_REG_CFG 15 930 #define AD7152_REG_RESEVERD 16 931 #define AD7152_REG_CAPDAC_POS 17 932 #define AD7152_REG_CAPDAC_NEG 18 933 #define AD7152_REG_CFG2 26 934 #define AD7152_STATUS_RDY1 BIT(0) 935 #define AD7152_STATUS_RDY2 BIT(1) 936 #define AD7152_STATUS_C1C2 BIT(2) 937 #define AD7152_STATUS_PWDN BIT(7) 938 #define AD7152_SETUP_CAPDIFF (1 << 5) 939 #define AD7152_SETUP_RANGE_2pF (0 << 6) 940 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 941 #define AD7152_SETUP_RANGE_1pF (2 << 6) 942 #define AD7152_SETUP_RANGE_4pF (3 << 6) 943 #define AD7152_SETUP_RANGE(x) ((x) << 6) 944 #define AD7152_CONF_CH2EN (1 << 3) 945 #define AD7152_CONF_CH1EN (1 << 4) 946 #define AD7152_CONF_MODE_IDLE (0 << 0) 947 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 948 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 949 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 950 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 951 #define AD7152_CAPDAC_DACEN (1 << 7) 952 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 953 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 954 /* LDV_COMMENT_END_PREP */ 955 /* LDV_COMMENT_FUNCTION_CALL Function from field "write_raw_get_fmt" from driver structure with callbacks "ad7152_info" */ 956 ldv_handler_precall(); 957 ad7152_write_raw_get_fmt( var_group1, var_ad7152_write_raw_get_fmt_7_p1, var_ad7152_write_raw_get_fmt_7_p2); 958 959 960 961 962 } 963 964 break; 965 case 3: { 966 967 /** STRUCT: struct type: i2c_driver, struct name: ad7152_driver **/ 968 if(ldv_s_ad7152_driver_i2c_driver==0) { 969 970 /* content: static int ad7152_probe(struct i2c_client *client, const struct i2c_device_id *id)*/ 971 /* LDV_COMMENT_BEGIN_PREP */ 972 #define AD7152_REG_STATUS 0 973 #define AD7152_REG_CH1_DATA_HIGH 1 974 #define AD7152_REG_CH2_DATA_HIGH 3 975 #define AD7152_REG_CH1_OFFS_HIGH 5 976 #define AD7152_REG_CH2_OFFS_HIGH 7 977 #define AD7152_REG_CH1_GAIN_HIGH 9 978 #define AD7152_REG_CH1_SETUP 11 979 #define AD7152_REG_CH2_GAIN_HIGH 12 980 #define AD7152_REG_CH2_SETUP 14 981 #define AD7152_REG_CFG 15 982 #define AD7152_REG_RESEVERD 16 983 #define AD7152_REG_CAPDAC_POS 17 984 #define AD7152_REG_CAPDAC_NEG 18 985 #define AD7152_REG_CFG2 26 986 #define AD7152_STATUS_RDY1 BIT(0) 987 #define AD7152_STATUS_RDY2 BIT(1) 988 #define AD7152_STATUS_C1C2 BIT(2) 989 #define AD7152_STATUS_PWDN BIT(7) 990 #define AD7152_SETUP_CAPDIFF (1 << 5) 991 #define AD7152_SETUP_RANGE_2pF (0 << 6) 992 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 993 #define AD7152_SETUP_RANGE_1pF (2 << 6) 994 #define AD7152_SETUP_RANGE_4pF (3 << 6) 995 #define AD7152_SETUP_RANGE(x) ((x) << 6) 996 #define AD7152_CONF_CH2EN (1 << 3) 997 #define AD7152_CONF_CH1EN (1 << 4) 998 #define AD7152_CONF_MODE_IDLE (0 << 0) 999 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 1000 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 1001 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 1002 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 1003 #define AD7152_CAPDAC_DACEN (1 << 7) 1004 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 1005 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 1006 /* LDV_COMMENT_END_PREP */ 1007 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "ad7152_driver". Standart function test for correct return result. */ 1008 res_ad7152_probe_8 = ad7152_probe( var_group2, var_ad7152_probe_8_p1); 1009 ldv_check_return_value(res_ad7152_probe_8); 1010 ldv_check_return_value_probe(res_ad7152_probe_8); 1011 if(res_ad7152_probe_8) 1012 goto ldv_module_exit; 1013 ldv_s_ad7152_driver_i2c_driver=0; 1014 1015 } 1016 1017 } 1018 1019 break; 1020 default: break; 1021 1022 } 1023 1024 } 1025 1026 ldv_module_exit: 1027 1028 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 1029 ldv_final: ldv_check_final_state(); 1030 1031 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 1032 return; 1033 1034 } 1035 #endif 1036 1037 /* LDV_COMMENT_END_MAIN */
1 2 #include <linux/kernel.h> 3 bool ldv_is_err(const void *ptr); 4 bool ldv_is_err_or_null(const void *ptr); 5 void* ldv_err_ptr(long error); 6 long ldv_ptr_err(const void *ptr); 7 8 #include <linux/mutex.h> 9 #include <verifier/rcv.h> 10 11 struct usb_device; 12 extern void __ldv_usb_lock_device(struct usb_device *udev); 13 extern void __ldv_usb_unlock_device(struct usb_device *udev); 14 extern int __ldv_usb_trylock_device(struct usb_device *udev); 15 16 extern int mutex_lock_interruptible(struct mutex *lock); 17 extern int mutex_lock_killable(struct mutex *lock); 18 extern void mutex_lock(struct mutex *lock); 19 extern int ldv_mutex_lock_interruptible_lock(struct mutex *lock); 20 extern int ldv_mutex_lock_killable_lock(struct mutex *lock); 21 extern void ldv_mutex_lock_nested_lock(struct mutex *lock, unsigned int subclass); 22 extern void ldv_mutex_lock_lock(struct mutex *lock); 23 extern int ldv_mutex_trylock_lock(struct mutex *lock); 24 extern int ldv_atomic_dec_and_mutex_lock_lock(atomic_t *cnt, struct mutex *lock); 25 extern int ldv_mutex_is_locked_lock(struct mutex *lock); 26 extern void ldv_mutex_unlock_lock(struct mutex *lock); 27 28 extern void ldv_usb_lock_device_lock(void); 29 extern void ldv_usb_unlock_device_lock(void); 30 extern int ldv_usb_trylock_device_lock(void); 31 extern int ldv_usb_lock_device_for_reset_lock(void); 32 extern int ldv_mutex_lock_interruptible_mutex_of_device(struct mutex *lock); 33 extern int ldv_mutex_lock_killable_mutex_of_device(struct mutex *lock); 34 extern void ldv_mutex_lock_nested_mutex_of_device(struct mutex *lock, unsigned int subclass); 35 extern void ldv_mutex_lock_mutex_of_device(struct mutex *lock); 36 extern int ldv_mutex_trylock_mutex_of_device(struct mutex *lock); 37 extern int ldv_atomic_dec_and_mutex_lock_mutex_of_device(atomic_t *cnt, struct mutex *lock); 38 extern int ldv_mutex_is_locked_mutex_of_device(struct mutex *lock); 39 extern void ldv_mutex_unlock_mutex_of_device(struct mutex *lock); 40 41 extern void ldv_usb_lock_device_mutex_of_device(void); 42 extern void ldv_usb_unlock_device_mutex_of_device(void); 43 extern int ldv_usb_trylock_device_mutex_of_device(void); 44 extern int ldv_usb_lock_device_for_reset_mutex_of_device(void); 45 extern int ldv_mutex_lock_interruptible_state_lock_of_ad7152_chip_info(struct mutex *lock); 46 extern int ldv_mutex_lock_killable_state_lock_of_ad7152_chip_info(struct mutex *lock); 47 extern void ldv_mutex_lock_nested_state_lock_of_ad7152_chip_info(struct mutex *lock, unsigned int subclass); 48 extern void ldv_mutex_lock_state_lock_of_ad7152_chip_info(struct mutex *lock); 49 extern int ldv_mutex_trylock_state_lock_of_ad7152_chip_info(struct mutex *lock); 50 extern int ldv_atomic_dec_and_mutex_lock_state_lock_of_ad7152_chip_info(atomic_t *cnt, struct mutex *lock); 51 extern int ldv_mutex_is_locked_state_lock_of_ad7152_chip_info(struct mutex *lock); 52 extern void ldv_mutex_unlock_state_lock_of_ad7152_chip_info(struct mutex *lock); 53 54 extern void ldv_usb_lock_device_state_lock_of_ad7152_chip_info(void); 55 extern void ldv_usb_unlock_device_state_lock_of_ad7152_chip_info(void); 56 extern int ldv_usb_trylock_device_state_lock_of_ad7152_chip_info(void); 57 extern int ldv_usb_lock_device_for_reset_state_lock_of_ad7152_chip_info(void); 58 #line 1 "/home/vitaly/ldv-launches/work/current--X--.--X--defaultlinux-4.12-rc1--X--32_7a--X--cpachecker/linux-4.12-rc1/csd_deg_dscv/16237/dscv_tempdir/dscv/ri/32_7a/drivers/staging/iio/cdc/ad7152.c" 59 60 /* 61 * AD7152 capacitive sensor driver supporting AD7152/3 62 * 63 * Copyright 2010-2011a Analog Devices Inc. 64 * 65 * Licensed under the GPL-2 or later. 66 */ 67 68 #include <linux/interrupt.h> 69 #include <linux/device.h> 70 #include <linux/kernel.h> 71 #include <linux/slab.h> 72 #include <linux/sysfs.h> 73 #include <linux/i2c.h> 74 #include <linux/module.h> 75 #include <linux/delay.h> 76 77 #include <linux/iio/iio.h> 78 #include <linux/iio/sysfs.h> 79 80 /* 81 * TODO: Check compliance of calibbias with abi (units) 82 */ 83 /* 84 * AD7152 registers definition 85 */ 86 87 #define AD7152_REG_STATUS 0 88 #define AD7152_REG_CH1_DATA_HIGH 1 89 #define AD7152_REG_CH2_DATA_HIGH 3 90 #define AD7152_REG_CH1_OFFS_HIGH 5 91 #define AD7152_REG_CH2_OFFS_HIGH 7 92 #define AD7152_REG_CH1_GAIN_HIGH 9 93 #define AD7152_REG_CH1_SETUP 11 94 #define AD7152_REG_CH2_GAIN_HIGH 12 95 #define AD7152_REG_CH2_SETUP 14 96 #define AD7152_REG_CFG 15 97 #define AD7152_REG_RESEVERD 16 98 #define AD7152_REG_CAPDAC_POS 17 99 #define AD7152_REG_CAPDAC_NEG 18 100 #define AD7152_REG_CFG2 26 101 102 /* Status Register Bit Designations (AD7152_REG_STATUS) */ 103 #define AD7152_STATUS_RDY1 BIT(0) 104 #define AD7152_STATUS_RDY2 BIT(1) 105 #define AD7152_STATUS_C1C2 BIT(2) 106 #define AD7152_STATUS_PWDN BIT(7) 107 108 /* Setup Register Bit Designations (AD7152_REG_CHx_SETUP) */ 109 #define AD7152_SETUP_CAPDIFF (1 << 5) 110 #define AD7152_SETUP_RANGE_2pF (0 << 6) 111 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 112 #define AD7152_SETUP_RANGE_1pF (2 << 6) 113 #define AD7152_SETUP_RANGE_4pF (3 << 6) 114 #define AD7152_SETUP_RANGE(x) ((x) << 6) 115 116 /* Config Register Bit Designations (AD7152_REG_CFG) */ 117 #define AD7152_CONF_CH2EN (1 << 3) 118 #define AD7152_CONF_CH1EN (1 << 4) 119 #define AD7152_CONF_MODE_IDLE (0 << 0) 120 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 121 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 122 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 123 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 124 125 /* Capdac Register Bit Designations (AD7152_REG_CAPDAC_XXX) */ 126 #define AD7152_CAPDAC_DACEN (1 << 7) 127 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 128 129 /* CFG2 Register Bit Designations (AD7152_REG_CFG2) */ 130 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 131 132 enum { 133 AD7152_DATA, 134 AD7152_OFFS, 135 AD7152_GAIN, 136 AD7152_SETUP 137 }; 138 139 /* 140 * struct ad7152_chip_info - chip specific information 141 */ 142 143 struct ad7152_chip_info { 144 struct i2c_client *client; 145 /* 146 * Capacitive channel digital filter setup; 147 * conversion time/update rate setup per channel 148 */ 149 u8 filter_rate_setup; 150 u8 setup[2]; 151 struct mutex state_lock; /* protect hardware state */ 152 }; 153 154 static inline ssize_t ad7152_start_calib(struct device *dev, 155 struct device_attribute *attr, 156 const char *buf, 157 size_t len, 158 u8 regval) 159 { 160 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 161 struct ad7152_chip_info *chip = iio_priv(indio_dev); 162 struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); 163 bool doit; 164 int ret, timeout = 10; 165 166 ret = strtobool(buf, &doit); 167 if (ret < 0) 168 return ret; 169 170 if (!doit) 171 return 0; 172 173 if (this_attr->address == 0) 174 regval |= AD7152_CONF_CH1EN; 175 else 176 regval |= AD7152_CONF_CH2EN; 177 178 mutex_lock(&chip->state_lock); 179 ret = i2c_smbus_write_byte_data(chip->client, AD7152_REG_CFG, regval); 180 if (ret < 0) { 181 mutex_unlock(&chip->state_lock); 182 return ret; 183 } 184 185 do { 186 mdelay(20); 187 ret = i2c_smbus_read_byte_data(chip->client, AD7152_REG_CFG); 188 if (ret < 0) { 189 mutex_unlock(&chip->state_lock); 190 return ret; 191 } 192 } while ((ret == regval) && timeout--); 193 194 mutex_unlock(&chip->state_lock); 195 return len; 196 } 197 198 static ssize_t ad7152_start_offset_calib(struct device *dev, 199 struct device_attribute *attr, 200 const char *buf, 201 size_t len) 202 { 203 return ad7152_start_calib(dev, attr, buf, len, 204 AD7152_CONF_MODE_OFFS_CAL); 205 } 206 207 static ssize_t ad7152_start_gain_calib(struct device *dev, 208 struct device_attribute *attr, 209 const char *buf, 210 size_t len) 211 { 212 return ad7152_start_calib(dev, attr, buf, len, 213 AD7152_CONF_MODE_GAIN_CAL); 214 } 215 216 static IIO_DEVICE_ATTR(in_capacitance0_calibbias_calibration, 217 0200, NULL, ad7152_start_offset_calib, 0); 218 static IIO_DEVICE_ATTR(in_capacitance1_calibbias_calibration, 219 0200, NULL, ad7152_start_offset_calib, 1); 220 static IIO_DEVICE_ATTR(in_capacitance0_calibscale_calibration, 221 0200, NULL, ad7152_start_gain_calib, 0); 222 static IIO_DEVICE_ATTR(in_capacitance1_calibscale_calibration, 223 0200, NULL, ad7152_start_gain_calib, 1); 224 225 /* Values are Update Rate (Hz), Conversion Time (ms) + 1*/ 226 static const unsigned char ad7152_filter_rate_table[][2] = { 227 {200, 5 + 1}, {50, 20 + 1}, {20, 50 + 1}, {17, 60 + 1}, 228 }; 229 230 static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("200 50 20 17"); 231 232 static IIO_CONST_ATTR(in_capacitance_scale_available, 233 "0.000061050 0.000030525 0.000015263 0.000007631"); 234 235 static struct attribute *ad7152_attributes[] = { 236 &iio_dev_attr_in_capacitance0_calibbias_calibration.dev_attr.attr, 237 &iio_dev_attr_in_capacitance1_calibbias_calibration.dev_attr.attr, 238 &iio_dev_attr_in_capacitance0_calibscale_calibration.dev_attr.attr, 239 &iio_dev_attr_in_capacitance1_calibscale_calibration.dev_attr.attr, 240 &iio_const_attr_in_capacitance_scale_available.dev_attr.attr, 241 &iio_const_attr_sampling_frequency_available.dev_attr.attr, 242 NULL, 243 }; 244 245 static const struct attribute_group ad7152_attribute_group = { 246 .attrs = ad7152_attributes, 247 }; 248 249 static const u8 ad7152_addresses[][4] = { 250 { AD7152_REG_CH1_DATA_HIGH, AD7152_REG_CH1_OFFS_HIGH, 251 AD7152_REG_CH1_GAIN_HIGH, AD7152_REG_CH1_SETUP }, 252 { AD7152_REG_CH2_DATA_HIGH, AD7152_REG_CH2_OFFS_HIGH, 253 AD7152_REG_CH2_GAIN_HIGH, AD7152_REG_CH2_SETUP }, 254 }; 255 256 /* Values are nano relative to pf base. */ 257 static const int ad7152_scale_table[] = { 258 30525, 7631, 15263, 61050 259 }; 260 261 /** 262 * read_raw handler for IIO_CHAN_INFO_SAMP_FREQ 263 * 264 * lock must be held 265 **/ 266 static int ad7152_read_raw_samp_freq(struct device *dev, int *val) 267 { 268 struct ad7152_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); 269 270 *val = ad7152_filter_rate_table[chip->filter_rate_setup][0]; 271 272 return 0; 273 } 274 275 /** 276 * write_raw handler for IIO_CHAN_INFO_SAMP_FREQ 277 * 278 * lock must be held 279 **/ 280 static int ad7152_write_raw_samp_freq(struct device *dev, int val) 281 { 282 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 283 struct ad7152_chip_info *chip = iio_priv(indio_dev); 284 int ret, i; 285 286 for (i = 0; i < ARRAY_SIZE(ad7152_filter_rate_table); i++) 287 if (val >= ad7152_filter_rate_table[i][0]) 288 break; 289 290 if (i >= ARRAY_SIZE(ad7152_filter_rate_table)) 291 i = ARRAY_SIZE(ad7152_filter_rate_table) - 1; 292 293 mutex_lock(&chip->state_lock); 294 ret = i2c_smbus_write_byte_data(chip->client, 295 AD7152_REG_CFG2, AD7152_CFG2_OSR(i)); 296 if (ret < 0) { 297 mutex_unlock(&chip->state_lock); 298 return ret; 299 } 300 301 chip->filter_rate_setup = i; 302 mutex_unlock(&chip->state_lock); 303 304 return ret; 305 } 306 307 static int ad7152_write_raw(struct iio_dev *indio_dev, 308 struct iio_chan_spec const *chan, 309 int val, 310 int val2, 311 long mask) 312 { 313 struct ad7152_chip_info *chip = iio_priv(indio_dev); 314 int ret, i; 315 316 mutex_lock(&chip->state_lock); 317 318 switch (mask) { 319 case IIO_CHAN_INFO_CALIBSCALE: 320 if (val != 1) { 321 ret = -EINVAL; 322 goto out; 323 } 324 325 val = (val2 * 1024) / 15625; 326 327 ret = i2c_smbus_write_word_data(chip->client, 328 ad7152_addresses[chan->channel][AD7152_GAIN], 329 swab16(val)); 330 if (ret < 0) 331 goto out; 332 333 ret = 0; 334 break; 335 336 case IIO_CHAN_INFO_CALIBBIAS: 337 if ((val < 0) | (val > 0xFFFF)) { 338 ret = -EINVAL; 339 goto out; 340 } 341 ret = i2c_smbus_write_word_data(chip->client, 342 ad7152_addresses[chan->channel][AD7152_OFFS], 343 swab16(val)); 344 if (ret < 0) 345 goto out; 346 347 ret = 0; 348 break; 349 case IIO_CHAN_INFO_SCALE: 350 if (val) { 351 ret = -EINVAL; 352 goto out; 353 } 354 for (i = 0; i < ARRAY_SIZE(ad7152_scale_table); i++) 355 if (val2 == ad7152_scale_table[i]) 356 break; 357 358 chip->setup[chan->channel] &= ~AD7152_SETUP_RANGE_4pF; 359 chip->setup[chan->channel] |= AD7152_SETUP_RANGE(i); 360 361 ret = i2c_smbus_write_byte_data(chip->client, 362 ad7152_addresses[chan->channel][AD7152_SETUP], 363 chip->setup[chan->channel]); 364 if (ret < 0) 365 goto out; 366 367 ret = 0; 368 break; 369 case IIO_CHAN_INFO_SAMP_FREQ: 370 if (val2) { 371 ret = -EINVAL; 372 goto out; 373 } 374 ret = ad7152_write_raw_samp_freq(&indio_dev->dev, val); 375 if (ret < 0) 376 goto out; 377 378 ret = 0; 379 break; 380 default: 381 ret = -EINVAL; 382 } 383 384 out: 385 mutex_unlock(&chip->state_lock); 386 return ret; 387 } 388 389 static int ad7152_read_raw(struct iio_dev *indio_dev, 390 struct iio_chan_spec const *chan, 391 int *val, int *val2, 392 long mask) 393 { 394 struct ad7152_chip_info *chip = iio_priv(indio_dev); 395 int ret; 396 u8 regval = 0; 397 398 mutex_lock(&chip->state_lock); 399 400 switch (mask) { 401 case IIO_CHAN_INFO_RAW: 402 /* First set whether in differential mode */ 403 404 regval = chip->setup[chan->channel]; 405 406 if (chan->differential) 407 chip->setup[chan->channel] |= AD7152_SETUP_CAPDIFF; 408 else 409 chip->setup[chan->channel] &= ~AD7152_SETUP_CAPDIFF; 410 411 if (regval != chip->setup[chan->channel]) { 412 ret = i2c_smbus_write_byte_data(chip->client, 413 ad7152_addresses[chan->channel][AD7152_SETUP], 414 chip->setup[chan->channel]); 415 if (ret < 0) 416 goto out; 417 } 418 /* Make sure the channel is enabled */ 419 if (chan->channel == 0) 420 regval = AD7152_CONF_CH1EN; 421 else 422 regval = AD7152_CONF_CH2EN; 423 424 /* Trigger a single read */ 425 regval |= AD7152_CONF_MODE_SINGLE_CONV; 426 ret = i2c_smbus_write_byte_data(chip->client, AD7152_REG_CFG, 427 regval); 428 if (ret < 0) 429 goto out; 430 431 msleep(ad7152_filter_rate_table[chip->filter_rate_setup][1]); 432 /* Now read the actual register */ 433 ret = i2c_smbus_read_word_data(chip->client, 434 ad7152_addresses[chan->channel][AD7152_DATA]); 435 if (ret < 0) 436 goto out; 437 *val = swab16(ret); 438 439 if (chan->differential) 440 *val -= 0x8000; 441 442 ret = IIO_VAL_INT; 443 break; 444 case IIO_CHAN_INFO_CALIBSCALE: 445 446 ret = i2c_smbus_read_word_data(chip->client, 447 ad7152_addresses[chan->channel][AD7152_GAIN]); 448 if (ret < 0) 449 goto out; 450 /* 1 + gain_val / 2^16 */ 451 *val = 1; 452 *val2 = (15625 * swab16(ret)) / 1024; 453 454 ret = IIO_VAL_INT_PLUS_MICRO; 455 break; 456 case IIO_CHAN_INFO_CALIBBIAS: 457 ret = i2c_smbus_read_word_data(chip->client, 458 ad7152_addresses[chan->channel][AD7152_OFFS]); 459 if (ret < 0) 460 goto out; 461 *val = swab16(ret); 462 463 ret = IIO_VAL_INT; 464 break; 465 case IIO_CHAN_INFO_SCALE: 466 ret = i2c_smbus_read_byte_data(chip->client, 467 ad7152_addresses[chan->channel][AD7152_SETUP]); 468 if (ret < 0) 469 goto out; 470 *val = 0; 471 *val2 = ad7152_scale_table[ret >> 6]; 472 473 ret = IIO_VAL_INT_PLUS_NANO; 474 break; 475 case IIO_CHAN_INFO_SAMP_FREQ: 476 ret = ad7152_read_raw_samp_freq(&indio_dev->dev, val); 477 if (ret < 0) 478 goto out; 479 480 ret = IIO_VAL_INT; 481 break; 482 default: 483 ret = -EINVAL; 484 } 485 out: 486 mutex_unlock(&chip->state_lock); 487 return ret; 488 } 489 490 static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, 491 struct iio_chan_spec const *chan, 492 long mask) 493 { 494 switch (mask) { 495 case IIO_CHAN_INFO_SCALE: 496 return IIO_VAL_INT_PLUS_NANO; 497 default: 498 return IIO_VAL_INT_PLUS_MICRO; 499 } 500 } 501 502 static const struct iio_info ad7152_info = { 503 .attrs = &ad7152_attribute_group, 504 .read_raw = ad7152_read_raw, 505 .write_raw = ad7152_write_raw, 506 .write_raw_get_fmt = ad7152_write_raw_get_fmt, 507 .driver_module = THIS_MODULE, 508 }; 509 510 static const struct iio_chan_spec ad7152_channels[] = { 511 { 512 .type = IIO_CAPACITANCE, 513 .indexed = 1, 514 .channel = 0, 515 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 516 BIT(IIO_CHAN_INFO_CALIBSCALE) | 517 BIT(IIO_CHAN_INFO_CALIBBIAS) | 518 BIT(IIO_CHAN_INFO_SCALE), 519 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 520 }, { 521 .type = IIO_CAPACITANCE, 522 .differential = 1, 523 .indexed = 1, 524 .channel = 0, 525 .channel2 = 2, 526 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 527 BIT(IIO_CHAN_INFO_CALIBSCALE) | 528 BIT(IIO_CHAN_INFO_CALIBBIAS) | 529 BIT(IIO_CHAN_INFO_SCALE), 530 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 531 }, { 532 .type = IIO_CAPACITANCE, 533 .indexed = 1, 534 .channel = 1, 535 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 536 BIT(IIO_CHAN_INFO_CALIBSCALE) | 537 BIT(IIO_CHAN_INFO_CALIBBIAS) | 538 BIT(IIO_CHAN_INFO_SCALE), 539 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 540 }, { 541 .type = IIO_CAPACITANCE, 542 .differential = 1, 543 .indexed = 1, 544 .channel = 1, 545 .channel2 = 3, 546 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | 547 BIT(IIO_CHAN_INFO_CALIBSCALE) | 548 BIT(IIO_CHAN_INFO_CALIBBIAS) | 549 BIT(IIO_CHAN_INFO_SCALE), 550 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 551 } 552 }; 553 554 /* 555 * device probe and remove 556 */ 557 558 static int ad7152_probe(struct i2c_client *client, 559 const struct i2c_device_id *id) 560 { 561 int ret = 0; 562 struct ad7152_chip_info *chip; 563 struct iio_dev *indio_dev; 564 565 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); 566 if (!indio_dev) 567 return -ENOMEM; 568 chip = iio_priv(indio_dev); 569 /* this is only used for device removal purposes */ 570 i2c_set_clientdata(client, indio_dev); 571 572 chip->client = client; 573 mutex_init(&chip->state_lock); 574 575 /* Establish that the iio_dev is a child of the i2c device */ 576 indio_dev->name = id->name; 577 indio_dev->dev.parent = &client->dev; 578 indio_dev->info = &ad7152_info; 579 indio_dev->channels = ad7152_channels; 580 if (id->driver_data == 0) 581 indio_dev->num_channels = ARRAY_SIZE(ad7152_channels); 582 else 583 indio_dev->num_channels = 2; 584 indio_dev->num_channels = ARRAY_SIZE(ad7152_channels); 585 indio_dev->modes = INDIO_DIRECT_MODE; 586 587 ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); 588 if (ret) 589 return ret; 590 591 dev_err(&client->dev, "%s capacitive sensor registered\n", id->name); 592 593 return 0; 594 } 595 596 static const struct i2c_device_id ad7152_id[] = { 597 { "ad7152", 0 }, 598 { "ad7153", 1 }, 599 {} 600 }; 601 602 MODULE_DEVICE_TABLE(i2c, ad7152_id); 603 604 static struct i2c_driver ad7152_driver = { 605 .driver = { 606 .name = KBUILD_MODNAME, 607 }, 608 .probe = ad7152_probe, 609 .id_table = ad7152_id, 610 }; 611 module_i2c_driver(ad7152_driver); 612 613 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); 614 MODULE_DESCRIPTION("Analog Devices AD7152/3 capacitive sensor driver"); 615 MODULE_LICENSE("GPL v2"); 616 617 618 619 620 621 /* LDV_COMMENT_BEGIN_MAIN */ 622 #ifdef LDV_MAIN0_sequence_infinite_withcheck_stateful 623 624 /*###########################################################################*/ 625 626 /*############## Driver Environment Generator 0.2 output ####################*/ 627 628 /*###########################################################################*/ 629 630 631 632 /* 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. */ 633 void ldv_check_final_state(void); 634 635 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result. */ 636 void ldv_check_return_value(int res); 637 638 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Test correct return result of probe() function. */ 639 void ldv_check_return_value_probe(int res); 640 641 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Initializes the model. */ 642 void ldv_initialize(void); 643 644 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Reinitializes the model between distinct model function calls. */ 645 void ldv_handler_precall(void); 646 647 /* LDV_COMMENT_FUNCTION_DECLARE_LDV Special function for LDV verifier. Returns arbitrary interger value. */ 648 int nondet_int(void); 649 650 /* LDV_COMMENT_VAR_DECLARE_LDV Special variable for LDV verifier. */ 651 int LDV_IN_INTERRUPT; 652 653 /* LDV_COMMENT_FUNCTION_MAIN Main function for LDV verifier. */ 654 void ldv_main0_sequence_infinite_withcheck_stateful(void) { 655 656 657 658 /* LDV_COMMENT_BEGIN_VARIABLE_DECLARATION_PART */ 659 /*============================= VARIABLE DECLARATION PART =============================*/ 660 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 661 /* content: static int ad7152_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)*/ 662 /* LDV_COMMENT_BEGIN_PREP */ 663 #define AD7152_REG_STATUS 0 664 #define AD7152_REG_CH1_DATA_HIGH 1 665 #define AD7152_REG_CH2_DATA_HIGH 3 666 #define AD7152_REG_CH1_OFFS_HIGH 5 667 #define AD7152_REG_CH2_OFFS_HIGH 7 668 #define AD7152_REG_CH1_GAIN_HIGH 9 669 #define AD7152_REG_CH1_SETUP 11 670 #define AD7152_REG_CH2_GAIN_HIGH 12 671 #define AD7152_REG_CH2_SETUP 14 672 #define AD7152_REG_CFG 15 673 #define AD7152_REG_RESEVERD 16 674 #define AD7152_REG_CAPDAC_POS 17 675 #define AD7152_REG_CAPDAC_NEG 18 676 #define AD7152_REG_CFG2 26 677 #define AD7152_STATUS_RDY1 BIT(0) 678 #define AD7152_STATUS_RDY2 BIT(1) 679 #define AD7152_STATUS_C1C2 BIT(2) 680 #define AD7152_STATUS_PWDN BIT(7) 681 #define AD7152_SETUP_CAPDIFF (1 << 5) 682 #define AD7152_SETUP_RANGE_2pF (0 << 6) 683 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 684 #define AD7152_SETUP_RANGE_1pF (2 << 6) 685 #define AD7152_SETUP_RANGE_4pF (3 << 6) 686 #define AD7152_SETUP_RANGE(x) ((x) << 6) 687 #define AD7152_CONF_CH2EN (1 << 3) 688 #define AD7152_CONF_CH1EN (1 << 4) 689 #define AD7152_CONF_MODE_IDLE (0 << 0) 690 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 691 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 692 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 693 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 694 #define AD7152_CAPDAC_DACEN (1 << 7) 695 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 696 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 697 /* LDV_COMMENT_END_PREP */ 698 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 699 struct iio_dev * var_group1; 700 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 701 struct iio_chan_spec const * var_ad7152_read_raw_6_p1; 702 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 703 int * var_ad7152_read_raw_6_p2; 704 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 705 int * var_ad7152_read_raw_6_p3; 706 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_read_raw" */ 707 long var_ad7152_read_raw_6_p4; 708 /* content: static int ad7152_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask)*/ 709 /* LDV_COMMENT_BEGIN_PREP */ 710 #define AD7152_REG_STATUS 0 711 #define AD7152_REG_CH1_DATA_HIGH 1 712 #define AD7152_REG_CH2_DATA_HIGH 3 713 #define AD7152_REG_CH1_OFFS_HIGH 5 714 #define AD7152_REG_CH2_OFFS_HIGH 7 715 #define AD7152_REG_CH1_GAIN_HIGH 9 716 #define AD7152_REG_CH1_SETUP 11 717 #define AD7152_REG_CH2_GAIN_HIGH 12 718 #define AD7152_REG_CH2_SETUP 14 719 #define AD7152_REG_CFG 15 720 #define AD7152_REG_RESEVERD 16 721 #define AD7152_REG_CAPDAC_POS 17 722 #define AD7152_REG_CAPDAC_NEG 18 723 #define AD7152_REG_CFG2 26 724 #define AD7152_STATUS_RDY1 BIT(0) 725 #define AD7152_STATUS_RDY2 BIT(1) 726 #define AD7152_STATUS_C1C2 BIT(2) 727 #define AD7152_STATUS_PWDN BIT(7) 728 #define AD7152_SETUP_CAPDIFF (1 << 5) 729 #define AD7152_SETUP_RANGE_2pF (0 << 6) 730 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 731 #define AD7152_SETUP_RANGE_1pF (2 << 6) 732 #define AD7152_SETUP_RANGE_4pF (3 << 6) 733 #define AD7152_SETUP_RANGE(x) ((x) << 6) 734 #define AD7152_CONF_CH2EN (1 << 3) 735 #define AD7152_CONF_CH1EN (1 << 4) 736 #define AD7152_CONF_MODE_IDLE (0 << 0) 737 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 738 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 739 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 740 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 741 #define AD7152_CAPDAC_DACEN (1 << 7) 742 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 743 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 744 /* LDV_COMMENT_END_PREP */ 745 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 746 struct iio_chan_spec const * var_ad7152_write_raw_5_p1; 747 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 748 int var_ad7152_write_raw_5_p2; 749 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 750 int var_ad7152_write_raw_5_p3; 751 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw" */ 752 long var_ad7152_write_raw_5_p4; 753 /* content: static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, long mask)*/ 754 /* LDV_COMMENT_BEGIN_PREP */ 755 #define AD7152_REG_STATUS 0 756 #define AD7152_REG_CH1_DATA_HIGH 1 757 #define AD7152_REG_CH2_DATA_HIGH 3 758 #define AD7152_REG_CH1_OFFS_HIGH 5 759 #define AD7152_REG_CH2_OFFS_HIGH 7 760 #define AD7152_REG_CH1_GAIN_HIGH 9 761 #define AD7152_REG_CH1_SETUP 11 762 #define AD7152_REG_CH2_GAIN_HIGH 12 763 #define AD7152_REG_CH2_SETUP 14 764 #define AD7152_REG_CFG 15 765 #define AD7152_REG_RESEVERD 16 766 #define AD7152_REG_CAPDAC_POS 17 767 #define AD7152_REG_CAPDAC_NEG 18 768 #define AD7152_REG_CFG2 26 769 #define AD7152_STATUS_RDY1 BIT(0) 770 #define AD7152_STATUS_RDY2 BIT(1) 771 #define AD7152_STATUS_C1C2 BIT(2) 772 #define AD7152_STATUS_PWDN BIT(7) 773 #define AD7152_SETUP_CAPDIFF (1 << 5) 774 #define AD7152_SETUP_RANGE_2pF (0 << 6) 775 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 776 #define AD7152_SETUP_RANGE_1pF (2 << 6) 777 #define AD7152_SETUP_RANGE_4pF (3 << 6) 778 #define AD7152_SETUP_RANGE(x) ((x) << 6) 779 #define AD7152_CONF_CH2EN (1 << 3) 780 #define AD7152_CONF_CH1EN (1 << 4) 781 #define AD7152_CONF_MODE_IDLE (0 << 0) 782 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 783 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 784 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 785 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 786 #define AD7152_CAPDAC_DACEN (1 << 7) 787 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 788 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 789 /* LDV_COMMENT_END_PREP */ 790 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw_get_fmt" */ 791 struct iio_chan_spec const * var_ad7152_write_raw_get_fmt_7_p1; 792 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_write_raw_get_fmt" */ 793 long var_ad7152_write_raw_get_fmt_7_p2; 794 795 /** STRUCT: struct type: i2c_driver, struct name: ad7152_driver **/ 796 /* content: static int ad7152_probe(struct i2c_client *client, const struct i2c_device_id *id)*/ 797 /* LDV_COMMENT_BEGIN_PREP */ 798 #define AD7152_REG_STATUS 0 799 #define AD7152_REG_CH1_DATA_HIGH 1 800 #define AD7152_REG_CH2_DATA_HIGH 3 801 #define AD7152_REG_CH1_OFFS_HIGH 5 802 #define AD7152_REG_CH2_OFFS_HIGH 7 803 #define AD7152_REG_CH1_GAIN_HIGH 9 804 #define AD7152_REG_CH1_SETUP 11 805 #define AD7152_REG_CH2_GAIN_HIGH 12 806 #define AD7152_REG_CH2_SETUP 14 807 #define AD7152_REG_CFG 15 808 #define AD7152_REG_RESEVERD 16 809 #define AD7152_REG_CAPDAC_POS 17 810 #define AD7152_REG_CAPDAC_NEG 18 811 #define AD7152_REG_CFG2 26 812 #define AD7152_STATUS_RDY1 BIT(0) 813 #define AD7152_STATUS_RDY2 BIT(1) 814 #define AD7152_STATUS_C1C2 BIT(2) 815 #define AD7152_STATUS_PWDN BIT(7) 816 #define AD7152_SETUP_CAPDIFF (1 << 5) 817 #define AD7152_SETUP_RANGE_2pF (0 << 6) 818 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 819 #define AD7152_SETUP_RANGE_1pF (2 << 6) 820 #define AD7152_SETUP_RANGE_4pF (3 << 6) 821 #define AD7152_SETUP_RANGE(x) ((x) << 6) 822 #define AD7152_CONF_CH2EN (1 << 3) 823 #define AD7152_CONF_CH1EN (1 << 4) 824 #define AD7152_CONF_MODE_IDLE (0 << 0) 825 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 826 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 827 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 828 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 829 #define AD7152_CAPDAC_DACEN (1 << 7) 830 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 831 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 832 /* LDV_COMMENT_END_PREP */ 833 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_probe" */ 834 struct i2c_client * var_group2; 835 /* LDV_COMMENT_VAR_DECLARE Variable declaration for function "ad7152_probe" */ 836 const struct i2c_device_id * var_ad7152_probe_8_p1; 837 /* LDV_COMMENT_VAR_DECLARE Variable declaration for test return result from function call "ad7152_probe" */ 838 static int res_ad7152_probe_8; 839 840 841 842 843 /* LDV_COMMENT_END_VARIABLE_DECLARATION_PART */ 844 /* LDV_COMMENT_BEGIN_VARIABLE_INITIALIZING_PART */ 845 /*============================= VARIABLE INITIALIZING PART =============================*/ 846 LDV_IN_INTERRUPT=1; 847 848 849 850 851 /* LDV_COMMENT_END_VARIABLE_INITIALIZING_PART */ 852 /* LDV_COMMENT_BEGIN_FUNCTION_CALL_SECTION */ 853 /*============================= FUNCTION CALL SECTION =============================*/ 854 /* LDV_COMMENT_FUNCTION_CALL Initialize LDV model. */ 855 ldv_initialize(); 856 857 858 int ldv_s_ad7152_driver_i2c_driver = 0; 859 860 861 while( nondet_int() 862 || !(ldv_s_ad7152_driver_i2c_driver == 0) 863 ) { 864 865 switch(nondet_int()) { 866 867 case 0: { 868 869 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 870 871 872 /* content: static int ad7152_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask)*/ 873 /* LDV_COMMENT_BEGIN_PREP */ 874 #define AD7152_REG_STATUS 0 875 #define AD7152_REG_CH1_DATA_HIGH 1 876 #define AD7152_REG_CH2_DATA_HIGH 3 877 #define AD7152_REG_CH1_OFFS_HIGH 5 878 #define AD7152_REG_CH2_OFFS_HIGH 7 879 #define AD7152_REG_CH1_GAIN_HIGH 9 880 #define AD7152_REG_CH1_SETUP 11 881 #define AD7152_REG_CH2_GAIN_HIGH 12 882 #define AD7152_REG_CH2_SETUP 14 883 #define AD7152_REG_CFG 15 884 #define AD7152_REG_RESEVERD 16 885 #define AD7152_REG_CAPDAC_POS 17 886 #define AD7152_REG_CAPDAC_NEG 18 887 #define AD7152_REG_CFG2 26 888 #define AD7152_STATUS_RDY1 BIT(0) 889 #define AD7152_STATUS_RDY2 BIT(1) 890 #define AD7152_STATUS_C1C2 BIT(2) 891 #define AD7152_STATUS_PWDN BIT(7) 892 #define AD7152_SETUP_CAPDIFF (1 << 5) 893 #define AD7152_SETUP_RANGE_2pF (0 << 6) 894 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 895 #define AD7152_SETUP_RANGE_1pF (2 << 6) 896 #define AD7152_SETUP_RANGE_4pF (3 << 6) 897 #define AD7152_SETUP_RANGE(x) ((x) << 6) 898 #define AD7152_CONF_CH2EN (1 << 3) 899 #define AD7152_CONF_CH1EN (1 << 4) 900 #define AD7152_CONF_MODE_IDLE (0 << 0) 901 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 902 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 903 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 904 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 905 #define AD7152_CAPDAC_DACEN (1 << 7) 906 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 907 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 908 /* LDV_COMMENT_END_PREP */ 909 /* LDV_COMMENT_FUNCTION_CALL Function from field "read_raw" from driver structure with callbacks "ad7152_info" */ 910 ldv_handler_precall(); 911 ad7152_read_raw( var_group1, var_ad7152_read_raw_6_p1, var_ad7152_read_raw_6_p2, var_ad7152_read_raw_6_p3, var_ad7152_read_raw_6_p4); 912 913 914 915 916 } 917 918 break; 919 case 1: { 920 921 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 922 923 924 /* content: static int ad7152_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, int val2, long mask)*/ 925 /* LDV_COMMENT_BEGIN_PREP */ 926 #define AD7152_REG_STATUS 0 927 #define AD7152_REG_CH1_DATA_HIGH 1 928 #define AD7152_REG_CH2_DATA_HIGH 3 929 #define AD7152_REG_CH1_OFFS_HIGH 5 930 #define AD7152_REG_CH2_OFFS_HIGH 7 931 #define AD7152_REG_CH1_GAIN_HIGH 9 932 #define AD7152_REG_CH1_SETUP 11 933 #define AD7152_REG_CH2_GAIN_HIGH 12 934 #define AD7152_REG_CH2_SETUP 14 935 #define AD7152_REG_CFG 15 936 #define AD7152_REG_RESEVERD 16 937 #define AD7152_REG_CAPDAC_POS 17 938 #define AD7152_REG_CAPDAC_NEG 18 939 #define AD7152_REG_CFG2 26 940 #define AD7152_STATUS_RDY1 BIT(0) 941 #define AD7152_STATUS_RDY2 BIT(1) 942 #define AD7152_STATUS_C1C2 BIT(2) 943 #define AD7152_STATUS_PWDN BIT(7) 944 #define AD7152_SETUP_CAPDIFF (1 << 5) 945 #define AD7152_SETUP_RANGE_2pF (0 << 6) 946 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 947 #define AD7152_SETUP_RANGE_1pF (2 << 6) 948 #define AD7152_SETUP_RANGE_4pF (3 << 6) 949 #define AD7152_SETUP_RANGE(x) ((x) << 6) 950 #define AD7152_CONF_CH2EN (1 << 3) 951 #define AD7152_CONF_CH1EN (1 << 4) 952 #define AD7152_CONF_MODE_IDLE (0 << 0) 953 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 954 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 955 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 956 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 957 #define AD7152_CAPDAC_DACEN (1 << 7) 958 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 959 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 960 /* LDV_COMMENT_END_PREP */ 961 /* LDV_COMMENT_FUNCTION_CALL Function from field "write_raw" from driver structure with callbacks "ad7152_info" */ 962 ldv_handler_precall(); 963 ad7152_write_raw( var_group1, var_ad7152_write_raw_5_p1, var_ad7152_write_raw_5_p2, var_ad7152_write_raw_5_p3, var_ad7152_write_raw_5_p4); 964 965 966 967 968 } 969 970 break; 971 case 2: { 972 973 /** STRUCT: struct type: iio_info, struct name: ad7152_info **/ 974 975 976 /* content: static int ad7152_write_raw_get_fmt(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, long mask)*/ 977 /* LDV_COMMENT_BEGIN_PREP */ 978 #define AD7152_REG_STATUS 0 979 #define AD7152_REG_CH1_DATA_HIGH 1 980 #define AD7152_REG_CH2_DATA_HIGH 3 981 #define AD7152_REG_CH1_OFFS_HIGH 5 982 #define AD7152_REG_CH2_OFFS_HIGH 7 983 #define AD7152_REG_CH1_GAIN_HIGH 9 984 #define AD7152_REG_CH1_SETUP 11 985 #define AD7152_REG_CH2_GAIN_HIGH 12 986 #define AD7152_REG_CH2_SETUP 14 987 #define AD7152_REG_CFG 15 988 #define AD7152_REG_RESEVERD 16 989 #define AD7152_REG_CAPDAC_POS 17 990 #define AD7152_REG_CAPDAC_NEG 18 991 #define AD7152_REG_CFG2 26 992 #define AD7152_STATUS_RDY1 BIT(0) 993 #define AD7152_STATUS_RDY2 BIT(1) 994 #define AD7152_STATUS_C1C2 BIT(2) 995 #define AD7152_STATUS_PWDN BIT(7) 996 #define AD7152_SETUP_CAPDIFF (1 << 5) 997 #define AD7152_SETUP_RANGE_2pF (0 << 6) 998 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 999 #define AD7152_SETUP_RANGE_1pF (2 << 6) 1000 #define AD7152_SETUP_RANGE_4pF (3 << 6) 1001 #define AD7152_SETUP_RANGE(x) ((x) << 6) 1002 #define AD7152_CONF_CH2EN (1 << 3) 1003 #define AD7152_CONF_CH1EN (1 << 4) 1004 #define AD7152_CONF_MODE_IDLE (0 << 0) 1005 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 1006 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 1007 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 1008 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 1009 #define AD7152_CAPDAC_DACEN (1 << 7) 1010 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 1011 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 1012 /* LDV_COMMENT_END_PREP */ 1013 /* LDV_COMMENT_FUNCTION_CALL Function from field "write_raw_get_fmt" from driver structure with callbacks "ad7152_info" */ 1014 ldv_handler_precall(); 1015 ad7152_write_raw_get_fmt( var_group1, var_ad7152_write_raw_get_fmt_7_p1, var_ad7152_write_raw_get_fmt_7_p2); 1016 1017 1018 1019 1020 } 1021 1022 break; 1023 case 3: { 1024 1025 /** STRUCT: struct type: i2c_driver, struct name: ad7152_driver **/ 1026 if(ldv_s_ad7152_driver_i2c_driver==0) { 1027 1028 /* content: static int ad7152_probe(struct i2c_client *client, const struct i2c_device_id *id)*/ 1029 /* LDV_COMMENT_BEGIN_PREP */ 1030 #define AD7152_REG_STATUS 0 1031 #define AD7152_REG_CH1_DATA_HIGH 1 1032 #define AD7152_REG_CH2_DATA_HIGH 3 1033 #define AD7152_REG_CH1_OFFS_HIGH 5 1034 #define AD7152_REG_CH2_OFFS_HIGH 7 1035 #define AD7152_REG_CH1_GAIN_HIGH 9 1036 #define AD7152_REG_CH1_SETUP 11 1037 #define AD7152_REG_CH2_GAIN_HIGH 12 1038 #define AD7152_REG_CH2_SETUP 14 1039 #define AD7152_REG_CFG 15 1040 #define AD7152_REG_RESEVERD 16 1041 #define AD7152_REG_CAPDAC_POS 17 1042 #define AD7152_REG_CAPDAC_NEG 18 1043 #define AD7152_REG_CFG2 26 1044 #define AD7152_STATUS_RDY1 BIT(0) 1045 #define AD7152_STATUS_RDY2 BIT(1) 1046 #define AD7152_STATUS_C1C2 BIT(2) 1047 #define AD7152_STATUS_PWDN BIT(7) 1048 #define AD7152_SETUP_CAPDIFF (1 << 5) 1049 #define AD7152_SETUP_RANGE_2pF (0 << 6) 1050 #define AD7152_SETUP_RANGE_0_5pF (1 << 6) 1051 #define AD7152_SETUP_RANGE_1pF (2 << 6) 1052 #define AD7152_SETUP_RANGE_4pF (3 << 6) 1053 #define AD7152_SETUP_RANGE(x) ((x) << 6) 1054 #define AD7152_CONF_CH2EN (1 << 3) 1055 #define AD7152_CONF_CH1EN (1 << 4) 1056 #define AD7152_CONF_MODE_IDLE (0 << 0) 1057 #define AD7152_CONF_MODE_CONT_CONV (1 << 0) 1058 #define AD7152_CONF_MODE_SINGLE_CONV (2 << 0) 1059 #define AD7152_CONF_MODE_OFFS_CAL (5 << 0) 1060 #define AD7152_CONF_MODE_GAIN_CAL (6 << 0) 1061 #define AD7152_CAPDAC_DACEN (1 << 7) 1062 #define AD7152_CAPDAC_DACP(x) ((x) & 0x1F) 1063 #define AD7152_CFG2_OSR(x) (((x) & 0x3) << 4) 1064 /* LDV_COMMENT_END_PREP */ 1065 /* LDV_COMMENT_FUNCTION_CALL Function from field "probe" from driver structure with callbacks "ad7152_driver". Standart function test for correct return result. */ 1066 res_ad7152_probe_8 = ad7152_probe( var_group2, var_ad7152_probe_8_p1); 1067 ldv_check_return_value(res_ad7152_probe_8); 1068 ldv_check_return_value_probe(res_ad7152_probe_8); 1069 if(res_ad7152_probe_8) 1070 goto ldv_module_exit; 1071 ldv_s_ad7152_driver_i2c_driver=0; 1072 1073 } 1074 1075 } 1076 1077 break; 1078 default: break; 1079 1080 } 1081 1082 } 1083 1084 ldv_module_exit: 1085 1086 /* LDV_COMMENT_FUNCTION_CALL Checks that all resources and locks are correctly released before the driver will be unloaded. */ 1087 ldv_final: ldv_check_final_state(); 1088 1089 /* LDV_COMMENT_END_FUNCTION_CALL_SECTION */ 1090 return; 1091 1092 } 1093 #endif 1094 1095 /* LDV_COMMENT_END_MAIN */ 1096 1097 #line 58 "/home/vitaly/ldv-launches/work/current--X--.--X--defaultlinux-4.12-rc1--X--32_7a--X--cpachecker/linux-4.12-rc1/csd_deg_dscv/16237/dscv_tempdir/dscv/ri/32_7a/drivers/staging/iio/cdc/ad7152.o.c.prepared"
1 2 3 #include <linux/mutex.h> 4 #include <linux/errno.h> 5 #include <verifier/rcv.h> 6 #include <kernel-model/ERR.inc> 7 8 static int ldv_mutex_lock = 1; 9 10 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_interruptible_lock') Check that mutex 'lock' was unlocked and nondeterministically lock it. Return the corresponding error code on fails */ 11 int ldv_mutex_lock_interruptible_lock(struct mutex *lock) 12 { 13 int nondetermined; 14 15 /* LDV_COMMENT_ASSERT Mutex 'lock' must be unlocked */ 16 ldv_assert(ldv_mutex_lock == 1); 17 18 /* LDV_COMMENT_OTHER Construct nondetermined result*/ 19 nondetermined = ldv_undef_int(); 20 21 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'lock' */ 22 if (nondetermined) 23 { 24 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock' */ 25 ldv_mutex_lock = 2; 26 /* LDV_COMMENT_RETURN Finish with success */ 27 return 0; 28 } 29 else 30 { 31 /* LDV_COMMENT_RETURN Finish with fail. Mutex 'lock' is keeped unlocked */ 32 return -EINTR; 33 } 34 } 35 36 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_killable_lock') Check that mutex 'lock' wasn unlocked and nondeterministically lock it. Return the corresponding error code on fails*/ 37 int ldv_mutex_lock_killable_lock(struct mutex *lock) 38 { 39 int nondetermined; 40 41 /* LDV_COMMENT_ASSERT Mutex 'lock' must be unlocked */ 42 ldv_assert(ldv_mutex_lock == 1); 43 44 /* LDV_COMMENT_OTHER Construct nondetermined result */ 45 nondetermined = ldv_undef_int(); 46 47 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'lock' */ 48 if (nondetermined) 49 { 50 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock' */ 51 ldv_mutex_lock = 2; 52 /* LDV_COMMENT_RETURN Finish with success*/ 53 return 0; 54 } 55 else 56 { 57 /* LDV_COMMENT_RETURN Finish with the fail. Mutex 'lock' is keeped unlocked */ 58 return -EINTR; 59 } 60 } 61 62 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_lock') Check that mutex 'lock' was not locked and lock it */ 63 void ldv_mutex_lock_lock(struct mutex *lock) 64 { 65 /* LDV_COMMENT_ASSERT Mutex 'lock' must be unlocked */ 66 ldv_assert(ldv_mutex_lock == 1); 67 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock' */ 68 ldv_mutex_lock = 2; 69 } 70 71 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_trylock_lock') Check that mutex 'lock' was not locked and nondeterministically lock it. Return 0 on fails */ 72 int ldv_mutex_trylock_lock(struct mutex *lock) 73 { 74 int is_mutex_held_by_another_thread; 75 76 /* LDV_COMMENT_ASSERT It may be an error if mutex 'lock' is locked at this point */ 77 ldv_assert(ldv_mutex_lock == 1); 78 79 /* LDV_COMMENT_OTHER Construct nondetermined result */ 80 is_mutex_held_by_another_thread = ldv_undef_int(); 81 82 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'lock' */ 83 if (is_mutex_held_by_another_thread) 84 { 85 /* LDV_COMMENT_RETURN Finish with fail */ 86 return 0; 87 } 88 else 89 { 90 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock' */ 91 ldv_mutex_lock = 2; 92 /* LDV_COMMENT_RETURN Finish with success */ 93 return 1; 94 } 95 } 96 97 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_atomic_dec_and_mutex_lock_lock') Lock mutex 'lock' if atomic decrement result is zero */ 98 int ldv_atomic_dec_and_mutex_lock_lock(atomic_t *cnt, struct mutex *lock) 99 { 100 int atomic_value_after_dec; 101 102 /* LDV_COMMENT_ASSERT Mutex 'lock' must be unlocked (since we may lock it in this function) */ 103 ldv_assert(ldv_mutex_lock == 1); 104 105 /* LDV_COMMENT_OTHER Assign the result of atomic decrement */ 106 atomic_value_after_dec = ldv_undef_int(); 107 108 /* LDV_COMMENT_ASSERT Check if atomic decrement returns zero */ 109 if (atomic_value_after_dec == 0) 110 { 111 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock', as atomic has decremented to zero */ 112 ldv_mutex_lock = 2; 113 /* LDV_COMMENT_RETURN Return 1 with locked mutex 'lock' */ 114 return 1; 115 } 116 117 /* LDV_COMMENT_RETURN Atomic decrement is still not zero, return 0 without locking mutex 'lock' */ 118 return 0; 119 } 120 121 /* TODO Syncronize with 39_7a ldv_spin_is_locked! */ 122 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_is_locked_lock') Check whether mutex 'lock' was locked */ 123 int ldv_mutex_is_locked_lock(struct mutex *lock) 124 { 125 int nondetermined; 126 127 if(ldv_mutex_lock == 1) 128 { 129 /* LDV_COMMENT_OTHER Construct nondetermined result */ 130 nondetermined = ldv_undef_int(); 131 132 /* LDV_COMMENT_ASSERT Nondeterministically understand whether mutex 'lock' was locked */ 133 if(nondetermined) 134 { 135 /* LDV_COMMENT_RETURN Mutex 'lock' was unlocked */ 136 return 0; 137 } 138 else 139 { 140 /* LDV_COMMENT_RETURN Mutex 'lock' was locked */ 141 return 1; 142 } 143 } 144 else 145 { 146 /* LDV_COMMENT_RETURN Mutex 'lock' was locked */ 147 return 1; 148 } 149 } 150 151 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_unlock_lock') Check that mutex 'lock' was locked and unlock it */ 152 void ldv_mutex_unlock_lock(struct mutex *lock) 153 { 154 /* LDV_COMMENT_ASSERT Mutex 'lock' must be locked */ 155 ldv_assert(ldv_mutex_lock == 2); 156 /* LDV_COMMENT_CHANGE_STATE Unlock mutex 'lock' */ 157 ldv_mutex_lock = 1; 158 } 159 160 161 162 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device') Acquires the usb lock and checks for double usb lock*/ 163 void ldv_usb_lock_device_lock(void) 164 { 165 /* LDV_COMMENT_CHANGE_STATE Lock usb_lock 'lock' */ 166 ldv_mutex_lock_lock(NULL); 167 } 168 169 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_trylock_device') Tries to acquire the usb lock and returns 1 if successful*/ 170 int ldv_usb_trylock_device_lock(void) 171 { 172 return ldv_mutex_trylock_lock(NULL); 173 } 174 175 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device_for_reset') Tries to acquire the usb lock and returns 0 if successful*/ 176 int ldv_usb_lock_device_for_reset_lock(void) 177 { 178 if(ldv_undef_int()) { 179 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'lock' */ 180 ldv_mutex_lock_lock(NULL); 181 /* LDV_COMMENT_RETURN Finish with success */ 182 return 0; 183 } else 184 /* LDV_COMMENT_RETURN Usb lock is not acquired*/ 185 return ldv_undef_int_negative(); 186 } 187 188 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_unlock_device') Releases the usb lock and checks that usb lock was acquired before*/ 189 void ldv_usb_unlock_device_lock(void) { 190 /* LDV_COMMENT_CHANGE_STATE Unlock usb_lock 'lock' */ 191 ldv_mutex_unlock_lock(NULL); 192 } 193 194 static int ldv_mutex_mutex_of_device = 1; 195 196 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_interruptible_mutex_of_device') Check that mutex 'mutex_of_device' was unlocked and nondeterministically lock it. Return the corresponding error code on fails */ 197 int ldv_mutex_lock_interruptible_mutex_of_device(struct mutex *lock) 198 { 199 int nondetermined; 200 201 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be unlocked */ 202 ldv_assert(ldv_mutex_mutex_of_device == 1); 203 204 /* LDV_COMMENT_OTHER Construct nondetermined result*/ 205 nondetermined = ldv_undef_int(); 206 207 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'mutex_of_device' */ 208 if (nondetermined) 209 { 210 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device' */ 211 ldv_mutex_mutex_of_device = 2; 212 /* LDV_COMMENT_RETURN Finish with success */ 213 return 0; 214 } 215 else 216 { 217 /* LDV_COMMENT_RETURN Finish with fail. Mutex 'mutex_of_device' is keeped unlocked */ 218 return -EINTR; 219 } 220 } 221 222 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_killable_mutex_of_device') Check that mutex 'mutex_of_device' wasn unlocked and nondeterministically lock it. Return the corresponding error code on fails*/ 223 int ldv_mutex_lock_killable_mutex_of_device(struct mutex *lock) 224 { 225 int nondetermined; 226 227 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be unlocked */ 228 ldv_assert(ldv_mutex_mutex_of_device == 1); 229 230 /* LDV_COMMENT_OTHER Construct nondetermined result */ 231 nondetermined = ldv_undef_int(); 232 233 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'mutex_of_device' */ 234 if (nondetermined) 235 { 236 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device' */ 237 ldv_mutex_mutex_of_device = 2; 238 /* LDV_COMMENT_RETURN Finish with success*/ 239 return 0; 240 } 241 else 242 { 243 /* LDV_COMMENT_RETURN Finish with the fail. Mutex 'mutex_of_device' is keeped unlocked */ 244 return -EINTR; 245 } 246 } 247 248 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_mutex_of_device') Check that mutex 'mutex_of_device' was not locked and lock it */ 249 void ldv_mutex_lock_mutex_of_device(struct mutex *lock) 250 { 251 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be unlocked */ 252 ldv_assert(ldv_mutex_mutex_of_device == 1); 253 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device' */ 254 ldv_mutex_mutex_of_device = 2; 255 } 256 257 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_trylock_mutex_of_device') Check that mutex 'mutex_of_device' was not locked and nondeterministically lock it. Return 0 on fails */ 258 int ldv_mutex_trylock_mutex_of_device(struct mutex *lock) 259 { 260 int is_mutex_held_by_another_thread; 261 262 /* LDV_COMMENT_ASSERT It may be an error if mutex 'mutex_of_device' is locked at this point */ 263 ldv_assert(ldv_mutex_mutex_of_device == 1); 264 265 /* LDV_COMMENT_OTHER Construct nondetermined result */ 266 is_mutex_held_by_another_thread = ldv_undef_int(); 267 268 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'mutex_of_device' */ 269 if (is_mutex_held_by_another_thread) 270 { 271 /* LDV_COMMENT_RETURN Finish with fail */ 272 return 0; 273 } 274 else 275 { 276 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device' */ 277 ldv_mutex_mutex_of_device = 2; 278 /* LDV_COMMENT_RETURN Finish with success */ 279 return 1; 280 } 281 } 282 283 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_atomic_dec_and_mutex_lock_mutex_of_device') Lock mutex 'mutex_of_device' if atomic decrement result is zero */ 284 int ldv_atomic_dec_and_mutex_lock_mutex_of_device(atomic_t *cnt, struct mutex *lock) 285 { 286 int atomic_value_after_dec; 287 288 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be unlocked (since we may lock it in this function) */ 289 ldv_assert(ldv_mutex_mutex_of_device == 1); 290 291 /* LDV_COMMENT_OTHER Assign the result of atomic decrement */ 292 atomic_value_after_dec = ldv_undef_int(); 293 294 /* LDV_COMMENT_ASSERT Check if atomic decrement returns zero */ 295 if (atomic_value_after_dec == 0) 296 { 297 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device', as atomic has decremented to zero */ 298 ldv_mutex_mutex_of_device = 2; 299 /* LDV_COMMENT_RETURN Return 1 with locked mutex 'mutex_of_device' */ 300 return 1; 301 } 302 303 /* LDV_COMMENT_RETURN Atomic decrement is still not zero, return 0 without locking mutex 'mutex_of_device' */ 304 return 0; 305 } 306 307 /* TODO Syncronize with 39_7a ldv_spin_is_locked! */ 308 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_is_locked_mutex_of_device') Check whether mutex 'mutex_of_device' was locked */ 309 int ldv_mutex_is_locked_mutex_of_device(struct mutex *lock) 310 { 311 int nondetermined; 312 313 if(ldv_mutex_mutex_of_device == 1) 314 { 315 /* LDV_COMMENT_OTHER Construct nondetermined result */ 316 nondetermined = ldv_undef_int(); 317 318 /* LDV_COMMENT_ASSERT Nondeterministically understand whether mutex 'mutex_of_device' was locked */ 319 if(nondetermined) 320 { 321 /* LDV_COMMENT_RETURN Mutex 'mutex_of_device' was unlocked */ 322 return 0; 323 } 324 else 325 { 326 /* LDV_COMMENT_RETURN Mutex 'mutex_of_device' was locked */ 327 return 1; 328 } 329 } 330 else 331 { 332 /* LDV_COMMENT_RETURN Mutex 'mutex_of_device' was locked */ 333 return 1; 334 } 335 } 336 337 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_unlock_mutex_of_device') Check that mutex 'mutex_of_device' was locked and unlock it */ 338 void ldv_mutex_unlock_mutex_of_device(struct mutex *lock) 339 { 340 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be locked */ 341 ldv_assert(ldv_mutex_mutex_of_device == 2); 342 /* LDV_COMMENT_CHANGE_STATE Unlock mutex 'mutex_of_device' */ 343 ldv_mutex_mutex_of_device = 1; 344 } 345 346 347 348 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device') Acquires the usb lock and checks for double usb lock*/ 349 void ldv_usb_lock_device_mutex_of_device(void) 350 { 351 /* LDV_COMMENT_CHANGE_STATE Lock usb_lock 'mutex_of_device' */ 352 ldv_mutex_lock_mutex_of_device(NULL); 353 } 354 355 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_trylock_device') Tries to acquire the usb lock and returns 1 if successful*/ 356 int ldv_usb_trylock_device_mutex_of_device(void) 357 { 358 return ldv_mutex_trylock_mutex_of_device(NULL); 359 } 360 361 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device_for_reset') Tries to acquire the usb lock and returns 0 if successful*/ 362 int ldv_usb_lock_device_for_reset_mutex_of_device(void) 363 { 364 if(ldv_undef_int()) { 365 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'mutex_of_device' */ 366 ldv_mutex_lock_mutex_of_device(NULL); 367 /* LDV_COMMENT_RETURN Finish with success */ 368 return 0; 369 } else 370 /* LDV_COMMENT_RETURN Usb lock is not acquired*/ 371 return ldv_undef_int_negative(); 372 } 373 374 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_unlock_device') Releases the usb lock and checks that usb lock was acquired before*/ 375 void ldv_usb_unlock_device_mutex_of_device(void) { 376 /* LDV_COMMENT_CHANGE_STATE Unlock usb_lock 'mutex_of_device' */ 377 ldv_mutex_unlock_mutex_of_device(NULL); 378 } 379 380 static int ldv_mutex_state_lock_of_ad7152_chip_info = 1; 381 382 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_interruptible_state_lock_of_ad7152_chip_info') Check that mutex 'state_lock_of_ad7152_chip_info' was unlocked and nondeterministically lock it. Return the corresponding error code on fails */ 383 int ldv_mutex_lock_interruptible_state_lock_of_ad7152_chip_info(struct mutex *lock) 384 { 385 int nondetermined; 386 387 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be unlocked */ 388 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 389 390 /* LDV_COMMENT_OTHER Construct nondetermined result*/ 391 nondetermined = ldv_undef_int(); 392 393 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'state_lock_of_ad7152_chip_info' */ 394 if (nondetermined) 395 { 396 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info' */ 397 ldv_mutex_state_lock_of_ad7152_chip_info = 2; 398 /* LDV_COMMENT_RETURN Finish with success */ 399 return 0; 400 } 401 else 402 { 403 /* LDV_COMMENT_RETURN Finish with fail. Mutex 'state_lock_of_ad7152_chip_info' is keeped unlocked */ 404 return -EINTR; 405 } 406 } 407 408 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_killable_state_lock_of_ad7152_chip_info') Check that mutex 'state_lock_of_ad7152_chip_info' wasn unlocked and nondeterministically lock it. Return the corresponding error code on fails*/ 409 int ldv_mutex_lock_killable_state_lock_of_ad7152_chip_info(struct mutex *lock) 410 { 411 int nondetermined; 412 413 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be unlocked */ 414 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 415 416 /* LDV_COMMENT_OTHER Construct nondetermined result */ 417 nondetermined = ldv_undef_int(); 418 419 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'state_lock_of_ad7152_chip_info' */ 420 if (nondetermined) 421 { 422 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info' */ 423 ldv_mutex_state_lock_of_ad7152_chip_info = 2; 424 /* LDV_COMMENT_RETURN Finish with success*/ 425 return 0; 426 } 427 else 428 { 429 /* LDV_COMMENT_RETURN Finish with the fail. Mutex 'state_lock_of_ad7152_chip_info' is keeped unlocked */ 430 return -EINTR; 431 } 432 } 433 434 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_lock_state_lock_of_ad7152_chip_info') Check that mutex 'state_lock_of_ad7152_chip_info' was not locked and lock it */ 435 void ldv_mutex_lock_state_lock_of_ad7152_chip_info(struct mutex *lock) 436 { 437 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be unlocked */ 438 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 439 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info' */ 440 ldv_mutex_state_lock_of_ad7152_chip_info = 2; 441 } 442 443 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_trylock_state_lock_of_ad7152_chip_info') Check that mutex 'state_lock_of_ad7152_chip_info' was not locked and nondeterministically lock it. Return 0 on fails */ 444 int ldv_mutex_trylock_state_lock_of_ad7152_chip_info(struct mutex *lock) 445 { 446 int is_mutex_held_by_another_thread; 447 448 /* LDV_COMMENT_ASSERT It may be an error if mutex 'state_lock_of_ad7152_chip_info' is locked at this point */ 449 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 450 451 /* LDV_COMMENT_OTHER Construct nondetermined result */ 452 is_mutex_held_by_another_thread = ldv_undef_int(); 453 454 /* LDV_COMMENT_ASSERT Nondeterministically lock mutex 'state_lock_of_ad7152_chip_info' */ 455 if (is_mutex_held_by_another_thread) 456 { 457 /* LDV_COMMENT_RETURN Finish with fail */ 458 return 0; 459 } 460 else 461 { 462 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info' */ 463 ldv_mutex_state_lock_of_ad7152_chip_info = 2; 464 /* LDV_COMMENT_RETURN Finish with success */ 465 return 1; 466 } 467 } 468 469 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_atomic_dec_and_mutex_lock_state_lock_of_ad7152_chip_info') Lock mutex 'state_lock_of_ad7152_chip_info' if atomic decrement result is zero */ 470 int ldv_atomic_dec_and_mutex_lock_state_lock_of_ad7152_chip_info(atomic_t *cnt, struct mutex *lock) 471 { 472 int atomic_value_after_dec; 473 474 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be unlocked (since we may lock it in this function) */ 475 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 476 477 /* LDV_COMMENT_OTHER Assign the result of atomic decrement */ 478 atomic_value_after_dec = ldv_undef_int(); 479 480 /* LDV_COMMENT_ASSERT Check if atomic decrement returns zero */ 481 if (atomic_value_after_dec == 0) 482 { 483 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info', as atomic has decremented to zero */ 484 ldv_mutex_state_lock_of_ad7152_chip_info = 2; 485 /* LDV_COMMENT_RETURN Return 1 with locked mutex 'state_lock_of_ad7152_chip_info' */ 486 return 1; 487 } 488 489 /* LDV_COMMENT_RETURN Atomic decrement is still not zero, return 0 without locking mutex 'state_lock_of_ad7152_chip_info' */ 490 return 0; 491 } 492 493 /* TODO Syncronize with 39_7a ldv_spin_is_locked! */ 494 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_is_locked_state_lock_of_ad7152_chip_info') Check whether mutex 'state_lock_of_ad7152_chip_info' was locked */ 495 int ldv_mutex_is_locked_state_lock_of_ad7152_chip_info(struct mutex *lock) 496 { 497 int nondetermined; 498 499 if(ldv_mutex_state_lock_of_ad7152_chip_info == 1) 500 { 501 /* LDV_COMMENT_OTHER Construct nondetermined result */ 502 nondetermined = ldv_undef_int(); 503 504 /* LDV_COMMENT_ASSERT Nondeterministically understand whether mutex 'state_lock_of_ad7152_chip_info' was locked */ 505 if(nondetermined) 506 { 507 /* LDV_COMMENT_RETURN Mutex 'state_lock_of_ad7152_chip_info' was unlocked */ 508 return 0; 509 } 510 else 511 { 512 /* LDV_COMMENT_RETURN Mutex 'state_lock_of_ad7152_chip_info' was locked */ 513 return 1; 514 } 515 } 516 else 517 { 518 /* LDV_COMMENT_RETURN Mutex 'state_lock_of_ad7152_chip_info' was locked */ 519 return 1; 520 } 521 } 522 523 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_mutex_unlock_state_lock_of_ad7152_chip_info') Check that mutex 'state_lock_of_ad7152_chip_info' was locked and unlock it */ 524 void ldv_mutex_unlock_state_lock_of_ad7152_chip_info(struct mutex *lock) 525 { 526 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be locked */ 527 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 2); 528 /* LDV_COMMENT_CHANGE_STATE Unlock mutex 'state_lock_of_ad7152_chip_info' */ 529 ldv_mutex_state_lock_of_ad7152_chip_info = 1; 530 } 531 532 533 534 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device') Acquires the usb lock and checks for double usb lock*/ 535 void ldv_usb_lock_device_state_lock_of_ad7152_chip_info(void) 536 { 537 /* LDV_COMMENT_CHANGE_STATE Lock usb_lock 'state_lock_of_ad7152_chip_info' */ 538 ldv_mutex_lock_state_lock_of_ad7152_chip_info(NULL); 539 } 540 541 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_trylock_device') Tries to acquire the usb lock and returns 1 if successful*/ 542 int ldv_usb_trylock_device_state_lock_of_ad7152_chip_info(void) 543 { 544 return ldv_mutex_trylock_state_lock_of_ad7152_chip_info(NULL); 545 } 546 547 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_lock_device_for_reset') Tries to acquire the usb lock and returns 0 if successful*/ 548 int ldv_usb_lock_device_for_reset_state_lock_of_ad7152_chip_info(void) 549 { 550 if(ldv_undef_int()) { 551 /* LDV_COMMENT_CHANGE_STATE Lock mutex 'state_lock_of_ad7152_chip_info' */ 552 ldv_mutex_lock_state_lock_of_ad7152_chip_info(NULL); 553 /* LDV_COMMENT_RETURN Finish with success */ 554 return 0; 555 } else 556 /* LDV_COMMENT_RETURN Usb lock is not acquired*/ 557 return ldv_undef_int_negative(); 558 } 559 560 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_usb_unlock_device') Releases the usb lock and checks that usb lock was acquired before*/ 561 void ldv_usb_unlock_device_state_lock_of_ad7152_chip_info(void) { 562 /* LDV_COMMENT_CHANGE_STATE Unlock usb_lock 'state_lock_of_ad7152_chip_info' */ 563 ldv_mutex_unlock_state_lock_of_ad7152_chip_info(NULL); 564 } 565 566 567 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_check_final_state') Check that all mutexes are unlocked at the end */ 568 void ldv_check_final_state(void) 569 { 570 /* LDV_COMMENT_ASSERT Mutex 'lock' must be unlocked at the end */ 571 ldv_assert(ldv_mutex_lock == 1); 572 /* LDV_COMMENT_ASSERT Mutex 'mutex_of_device' must be unlocked at the end */ 573 ldv_assert(ldv_mutex_mutex_of_device == 1); 574 /* LDV_COMMENT_ASSERT Mutex 'state_lock_of_ad7152_chip_info' must be unlocked at the end */ 575 ldv_assert(ldv_mutex_state_lock_of_ad7152_chip_info == 1); 576 }
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 /* The industrial I/O core 3 * 4 * Copyright (c) 2008 Jonathan Cameron 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. 9 */ 10 #ifndef _INDUSTRIAL_IO_H_ 11 #define _INDUSTRIAL_IO_H_ 12 13 #include <linux/device.h> 14 #include <linux/cdev.h> 15 #include <linux/iio/types.h> 16 #include <linux/of.h> 17 /* IIO TODO LIST */ 18 /* 19 * Provide means of adjusting timer accuracy. 20 * Currently assumes nano seconds. 21 */ 22 23 enum iio_chan_info_enum { 24 IIO_CHAN_INFO_RAW = 0, 25 IIO_CHAN_INFO_PROCESSED, 26 IIO_CHAN_INFO_SCALE, 27 IIO_CHAN_INFO_OFFSET, 28 IIO_CHAN_INFO_CALIBSCALE, 29 IIO_CHAN_INFO_CALIBBIAS, 30 IIO_CHAN_INFO_PEAK, 31 IIO_CHAN_INFO_PEAK_SCALE, 32 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW, 33 IIO_CHAN_INFO_AVERAGE_RAW, 34 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY, 35 IIO_CHAN_INFO_HIGH_PASS_FILTER_3DB_FREQUENCY, 36 IIO_CHAN_INFO_SAMP_FREQ, 37 IIO_CHAN_INFO_FREQUENCY, 38 IIO_CHAN_INFO_PHASE, 39 IIO_CHAN_INFO_HARDWAREGAIN, 40 IIO_CHAN_INFO_HYSTERESIS, 41 IIO_CHAN_INFO_INT_TIME, 42 IIO_CHAN_INFO_ENABLE, 43 IIO_CHAN_INFO_CALIBHEIGHT, 44 IIO_CHAN_INFO_CALIBWEIGHT, 45 IIO_CHAN_INFO_DEBOUNCE_COUNT, 46 IIO_CHAN_INFO_DEBOUNCE_TIME, 47 IIO_CHAN_INFO_CALIBEMISSIVITY, 48 IIO_CHAN_INFO_OVERSAMPLING_RATIO, 49 }; 50 51 enum iio_shared_by { 52 IIO_SEPARATE, 53 IIO_SHARED_BY_TYPE, 54 IIO_SHARED_BY_DIR, 55 IIO_SHARED_BY_ALL 56 }; 57 58 enum iio_endian { 59 IIO_CPU, 60 IIO_BE, 61 IIO_LE, 62 }; 63 64 struct iio_chan_spec; 65 struct iio_dev; 66 67 /** 68 * struct iio_chan_spec_ext_info - Extended channel info attribute 69 * @name: Info attribute name 70 * @shared: Whether this attribute is shared between all channels. 71 * @read: Read callback for this info attribute, may be NULL. 72 * @write: Write callback for this info attribute, may be NULL. 73 * @private: Data private to the driver. 74 */ 75 struct iio_chan_spec_ext_info { 76 const char *name; 77 enum iio_shared_by shared; 78 ssize_t (*read)(struct iio_dev *, uintptr_t private, 79 struct iio_chan_spec const *, char *buf); 80 ssize_t (*write)(struct iio_dev *, uintptr_t private, 81 struct iio_chan_spec const *, const char *buf, 82 size_t len); 83 uintptr_t private; 84 }; 85 86 /** 87 * struct iio_enum - Enum channel info attribute 88 * @items: An array of strings. 89 * @num_items: Length of the item array. 90 * @set: Set callback function, may be NULL. 91 * @get: Get callback function, may be NULL. 92 * 93 * The iio_enum struct can be used to implement enum style channel attributes. 94 * Enum style attributes are those which have a set of strings which map to 95 * unsigned integer values. The IIO enum helper code takes care of mapping 96 * between value and string as well as generating a "_available" file which 97 * contains a list of all available items. The set callback will be called when 98 * the attribute is updated. The last parameter is the index to the newly 99 * activated item. The get callback will be used to query the currently active 100 * item and is supposed to return the index for it. 101 */ 102 struct iio_enum { 103 const char * const *items; 104 unsigned int num_items; 105 int (*set)(struct iio_dev *, const struct iio_chan_spec *, unsigned int); 106 int (*get)(struct iio_dev *, const struct iio_chan_spec *); 107 }; 108 109 ssize_t iio_enum_available_read(struct iio_dev *indio_dev, 110 uintptr_t priv, const struct iio_chan_spec *chan, char *buf); 111 ssize_t iio_enum_read(struct iio_dev *indio_dev, 112 uintptr_t priv, const struct iio_chan_spec *chan, char *buf); 113 ssize_t iio_enum_write(struct iio_dev *indio_dev, 114 uintptr_t priv, const struct iio_chan_spec *chan, const char *buf, 115 size_t len); 116 117 /** 118 * IIO_ENUM() - Initialize enum extended channel attribute 119 * @_name: Attribute name 120 * @_shared: Whether the attribute is shared between all channels 121 * @_e: Pointer to an iio_enum struct 122 * 123 * This should usually be used together with IIO_ENUM_AVAILABLE() 124 */ 125 #define IIO_ENUM(_name, _shared, _e) \ 126 { \ 127 .name = (_name), \ 128 .shared = (_shared), \ 129 .read = iio_enum_read, \ 130 .write = iio_enum_write, \ 131 .private = (uintptr_t)(_e), \ 132 } 133 134 /** 135 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute 136 * @_name: Attribute name ("_available" will be appended to the name) 137 * @_e: Pointer to an iio_enum struct 138 * 139 * Creates a read only attribute which lists all the available enum items in a 140 * space separated list. This should usually be used together with IIO_ENUM() 141 */ 142 #define IIO_ENUM_AVAILABLE(_name, _e) \ 143 { \ 144 .name = (_name "_available"), \ 145 .shared = IIO_SHARED_BY_TYPE, \ 146 .read = iio_enum_available_read, \ 147 .private = (uintptr_t)(_e), \ 148 } 149 150 /** 151 * struct iio_mount_matrix - iio mounting matrix 152 * @rotation: 3 dimensional space rotation matrix defining sensor alignment with 153 * main hardware 154 */ 155 struct iio_mount_matrix { 156 const char *rotation[9]; 157 }; 158 159 ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, 160 const struct iio_chan_spec *chan, char *buf); 161 int of_iio_read_mount_matrix(const struct device *dev, const char *propname, 162 struct iio_mount_matrix *matrix); 163 164 typedef const struct iio_mount_matrix * 165 (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev, 166 const struct iio_chan_spec *chan); 167 168 /** 169 * IIO_MOUNT_MATRIX() - Initialize mount matrix extended channel attribute 170 * @_shared: Whether the attribute is shared between all channels 171 * @_get: Pointer to an iio_get_mount_matrix_t accessor 172 */ 173 #define IIO_MOUNT_MATRIX(_shared, _get) \ 174 { \ 175 .name = "mount_matrix", \ 176 .shared = (_shared), \ 177 .read = iio_show_mount_matrix, \ 178 .private = (uintptr_t)(_get), \ 179 } 180 181 /** 182 * struct iio_event_spec - specification for a channel event 183 * @type: Type of the event 184 * @dir: Direction of the event 185 * @mask_separate: Bit mask of enum iio_event_info values. Attributes 186 * set in this mask will be registered per channel. 187 * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes 188 * set in this mask will be shared by channel type. 189 * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes 190 * set in this mask will be shared by channel type and 191 * direction. 192 * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes 193 * set in this mask will be shared by all channels. 194 */ 195 struct iio_event_spec { 196 enum iio_event_type type; 197 enum iio_event_direction dir; 198 unsigned long mask_separate; 199 unsigned long mask_shared_by_type; 200 unsigned long mask_shared_by_dir; 201 unsigned long mask_shared_by_all; 202 }; 203 204 /** 205 * struct iio_chan_spec - specification of a single channel 206 * @type: What type of measurement is the channel making. 207 * @channel: What number do we wish to assign the channel. 208 * @channel2: If there is a second number for a differential 209 * channel then this is it. If modified is set then the 210 * value here specifies the modifier. 211 * @address: Driver specific identifier. 212 * @scan_index: Monotonic index to give ordering in scans when read 213 * from a buffer. 214 * @scan_type: sign: 's' or 'u' to specify signed or unsigned 215 * realbits: Number of valid bits of data 216 * storagebits: Realbits + padding 217 * shift: Shift right by this before masking out 218 * realbits. 219 * repeat: Number of times real/storage bits 220 * repeats. When the repeat element is 221 * more than 1, then the type element in 222 * sysfs will show a repeat value. 223 * Otherwise, the number of repetitions is 224 * omitted. 225 * endianness: little or big endian 226 * @info_mask_separate: What information is to be exported that is specific to 227 * this channel. 228 * @info_mask_separate_available: What availability information is to be 229 * exported that is specific to this channel. 230 * @info_mask_shared_by_type: What information is to be exported that is shared 231 * by all channels of the same type. 232 * @info_mask_shared_by_type_available: What availability information is to be 233 * exported that is shared by all channels of the same 234 * type. 235 * @info_mask_shared_by_dir: What information is to be exported that is shared 236 * by all channels of the same direction. 237 * @info_mask_shared_by_dir_available: What availability information is to be 238 * exported that is shared by all channels of the same 239 * direction. 240 * @info_mask_shared_by_all: What information is to be exported that is shared 241 * by all channels. 242 * @info_mask_shared_by_all_available: What availability information is to be 243 * exported that is shared by all channels. 244 * @event_spec: Array of events which should be registered for this 245 * channel. 246 * @num_event_specs: Size of the event_spec array. 247 * @ext_info: Array of extended info attributes for this channel. 248 * The array is NULL terminated, the last element should 249 * have its name field set to NULL. 250 * @extend_name: Allows labeling of channel attributes with an 251 * informative name. Note this has no effect codes etc, 252 * unlike modifiers. 253 * @datasheet_name: A name used in in-kernel mapping of channels. It should 254 * correspond to the first name that the channel is referred 255 * to by in the datasheet (e.g. IND), or the nearest 256 * possible compound name (e.g. IND-INC). 257 * @modified: Does a modifier apply to this channel. What these are 258 * depends on the channel type. Modifier is set in 259 * channel2. Examples are IIO_MOD_X for axial sensors about 260 * the 'x' axis. 261 * @indexed: Specify the channel has a numerical index. If not, 262 * the channel index number will be suppressed for sysfs 263 * attributes but not for event codes. 264 * @output: Channel is output. 265 * @differential: Channel is differential. 266 */ 267 struct iio_chan_spec { 268 enum iio_chan_type type; 269 int channel; 270 int channel2; 271 unsigned long address; 272 int scan_index; 273 struct { 274 char sign; 275 u8 realbits; 276 u8 storagebits; 277 u8 shift; 278 u8 repeat; 279 enum iio_endian endianness; 280 } scan_type; 281 long info_mask_separate; 282 long info_mask_separate_available; 283 long info_mask_shared_by_type; 284 long info_mask_shared_by_type_available; 285 long info_mask_shared_by_dir; 286 long info_mask_shared_by_dir_available; 287 long info_mask_shared_by_all; 288 long info_mask_shared_by_all_available; 289 const struct iio_event_spec *event_spec; 290 unsigned int num_event_specs; 291 const struct iio_chan_spec_ext_info *ext_info; 292 const char *extend_name; 293 const char *datasheet_name; 294 unsigned modified:1; 295 unsigned indexed:1; 296 unsigned output:1; 297 unsigned differential:1; 298 }; 299 300 301 /** 302 * iio_channel_has_info() - Checks whether a channel supports a info attribute 303 * @chan: The channel to be queried 304 * @type: Type of the info attribute to be checked 305 * 306 * Returns true if the channels supports reporting values for the given info 307 * attribute type, false otherwise. 308 */ 309 static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 310 enum iio_chan_info_enum type) 311 { 312 return (chan->info_mask_separate & BIT(type)) | 313 (chan->info_mask_shared_by_type & BIT(type)) | 314 (chan->info_mask_shared_by_dir & BIT(type)) | 315 (chan->info_mask_shared_by_all & BIT(type)); 316 } 317 318 /** 319 * iio_channel_has_available() - Checks if a channel has an available attribute 320 * @chan: The channel to be queried 321 * @type: Type of the available attribute to be checked 322 * 323 * Returns true if the channel supports reporting available values for the 324 * given attribute type, false otherwise. 325 */ 326 static inline bool iio_channel_has_available(const struct iio_chan_spec *chan, 327 enum iio_chan_info_enum type) 328 { 329 return (chan->info_mask_separate_available & BIT(type)) | 330 (chan->info_mask_shared_by_type_available & BIT(type)) | 331 (chan->info_mask_shared_by_dir_available & BIT(type)) | 332 (chan->info_mask_shared_by_all_available & BIT(type)); 333 } 334 335 #define IIO_CHAN_SOFT_TIMESTAMP(_si) { \ 336 .type = IIO_TIMESTAMP, \ 337 .channel = -1, \ 338 .scan_index = _si, \ 339 .scan_type = { \ 340 .sign = 's', \ 341 .realbits = 64, \ 342 .storagebits = 64, \ 343 }, \ 344 } 345 346 s64 iio_get_time_ns(const struct iio_dev *indio_dev); 347 unsigned int iio_get_time_res(const struct iio_dev *indio_dev); 348 349 /* Device operating modes */ 350 #define INDIO_DIRECT_MODE 0x01 351 #define INDIO_BUFFER_TRIGGERED 0x02 352 #define INDIO_BUFFER_SOFTWARE 0x04 353 #define INDIO_BUFFER_HARDWARE 0x08 354 #define INDIO_EVENT_TRIGGERED 0x10 355 356 #define INDIO_ALL_BUFFER_MODES \ 357 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE) 358 359 #define INDIO_MAX_RAW_ELEMENTS 4 360 361 struct iio_trigger; /* forward declaration */ 362 struct iio_dev; 363 364 /** 365 * struct iio_info - constant information about device 366 * @driver_module: module structure used to ensure correct 367 * ownership of chrdevs etc 368 * @event_attrs: event control attributes 369 * @attrs: general purpose device attributes 370 * @read_raw: function to request a value from the device. 371 * mask specifies which value. Note 0 means a reading of 372 * the channel in question. Return value will specify the 373 * type of value returned by the device. val and val2 will 374 * contain the elements making up the returned value. 375 * @read_raw_multi: function to return values from the device. 376 * mask specifies which value. Note 0 means a reading of 377 * the channel in question. Return value will specify the 378 * type of value returned by the device. vals pointer 379 * contain the elements making up the returned value. 380 * max_len specifies maximum number of elements 381 * vals pointer can contain. val_len is used to return 382 * length of valid elements in vals. 383 * @read_avail: function to return the available values from the device. 384 * mask specifies which value. Note 0 means the available 385 * values for the channel in question. Return value 386 * specifies if a IIO_AVAIL_LIST or a IIO_AVAIL_RANGE is 387 * returned in vals. The type of the vals are returned in 388 * type and the number of vals is returned in length. For 389 * ranges, there are always three vals returned; min, step 390 * and max. For lists, all possible values are enumerated. 391 * @write_raw: function to write a value to the device. 392 * Parameters are the same as for read_raw. 393 * @write_raw_get_fmt: callback function to query the expected 394 * format/precision. If not set by the driver, write_raw 395 * returns IIO_VAL_INT_PLUS_MICRO. 396 * @read_event_config: find out if the event is enabled. 397 * @write_event_config: set if the event is enabled. 398 * @read_event_value: read a configuration value associated with the event. 399 * @write_event_value: write a configuration value for the event. 400 * @validate_trigger: function to validate the trigger when the 401 * current trigger gets changed. 402 * @update_scan_mode: function to configure device and scan buffer when 403 * channels have changed 404 * @debugfs_reg_access: function to read or write register value of device 405 * @of_xlate: function pointer to obtain channel specifier index. 406 * When #iio-cells is greater than '0', the driver could 407 * provide a custom of_xlate function that reads the 408 * *args* and returns the appropriate index in registered 409 * IIO channels array. 410 * @hwfifo_set_watermark: function pointer to set the current hardware 411 * fifo watermark level; see hwfifo_* entries in 412 * Documentation/ABI/testing/sysfs-bus-iio for details on 413 * how the hardware fifo operates 414 * @hwfifo_flush_to_buffer: function pointer to flush the samples stored 415 * in the hardware fifo to the device buffer. The driver 416 * should not flush more than count samples. The function 417 * must return the number of samples flushed, 0 if no 418 * samples were flushed or a negative integer if no samples 419 * were flushed and there was an error. 420 **/ 421 struct iio_info { 422 struct module *driver_module; 423 const struct attribute_group *event_attrs; 424 const struct attribute_group *attrs; 425 426 int (*read_raw)(struct iio_dev *indio_dev, 427 struct iio_chan_spec const *chan, 428 int *val, 429 int *val2, 430 long mask); 431 432 int (*read_raw_multi)(struct iio_dev *indio_dev, 433 struct iio_chan_spec const *chan, 434 int max_len, 435 int *vals, 436 int *val_len, 437 long mask); 438 439 int (*read_avail)(struct iio_dev *indio_dev, 440 struct iio_chan_spec const *chan, 441 const int **vals, 442 int *type, 443 int *length, 444 long mask); 445 446 int (*write_raw)(struct iio_dev *indio_dev, 447 struct iio_chan_spec const *chan, 448 int val, 449 int val2, 450 long mask); 451 452 int (*write_raw_get_fmt)(struct iio_dev *indio_dev, 453 struct iio_chan_spec const *chan, 454 long mask); 455 456 int (*read_event_config)(struct iio_dev *indio_dev, 457 const struct iio_chan_spec *chan, 458 enum iio_event_type type, 459 enum iio_event_direction dir); 460 461 int (*write_event_config)(struct iio_dev *indio_dev, 462 const struct iio_chan_spec *chan, 463 enum iio_event_type type, 464 enum iio_event_direction dir, 465 int state); 466 467 int (*read_event_value)(struct iio_dev *indio_dev, 468 const struct iio_chan_spec *chan, 469 enum iio_event_type type, 470 enum iio_event_direction dir, 471 enum iio_event_info info, int *val, int *val2); 472 473 int (*write_event_value)(struct iio_dev *indio_dev, 474 const struct iio_chan_spec *chan, 475 enum iio_event_type type, 476 enum iio_event_direction dir, 477 enum iio_event_info info, int val, int val2); 478 479 int (*validate_trigger)(struct iio_dev *indio_dev, 480 struct iio_trigger *trig); 481 int (*update_scan_mode)(struct iio_dev *indio_dev, 482 const unsigned long *scan_mask); 483 int (*debugfs_reg_access)(struct iio_dev *indio_dev, 484 unsigned reg, unsigned writeval, 485 unsigned *readval); 486 int (*of_xlate)(struct iio_dev *indio_dev, 487 const struct of_phandle_args *iiospec); 488 int (*hwfifo_set_watermark)(struct iio_dev *indio_dev, unsigned val); 489 int (*hwfifo_flush_to_buffer)(struct iio_dev *indio_dev, 490 unsigned count); 491 }; 492 493 /** 494 * struct iio_buffer_setup_ops - buffer setup related callbacks 495 * @preenable: [DRIVER] function to run prior to marking buffer enabled 496 * @postenable: [DRIVER] function to run after marking buffer enabled 497 * @predisable: [DRIVER] function to run prior to marking buffer 498 * disabled 499 * @postdisable: [DRIVER] function to run after marking buffer disabled 500 * @validate_scan_mask: [DRIVER] function callback to check whether a given 501 * scan mask is valid for the device. 502 */ 503 struct iio_buffer_setup_ops { 504 int (*preenable)(struct iio_dev *); 505 int (*postenable)(struct iio_dev *); 506 int (*predisable)(struct iio_dev *); 507 int (*postdisable)(struct iio_dev *); 508 bool (*validate_scan_mask)(struct iio_dev *indio_dev, 509 const unsigned long *scan_mask); 510 }; 511 512 /** 513 * struct iio_dev - industrial I/O device 514 * @id: [INTERN] used to identify device internally 515 * @modes: [DRIVER] operating modes supported by device 516 * @currentmode: [DRIVER] current operating mode 517 * @dev: [DRIVER] device structure, should be assigned a parent 518 * and owner 519 * @event_interface: [INTERN] event chrdevs associated with interrupt lines 520 * @buffer: [DRIVER] any buffer present 521 * @buffer_list: [INTERN] list of all buffers currently attached 522 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux 523 * @mlock: [DRIVER] lock used to prevent simultaneous device state 524 * changes 525 * @available_scan_masks: [DRIVER] optional array of allowed bitmasks 526 * @masklength: [INTERN] the length of the mask established from 527 * channels 528 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers 529 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp 530 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp 531 * @trig: [INTERN] current device trigger (buffer modes) 532 * @trig_readonly [INTERN] mark the current trigger immutable 533 * @pollfunc: [DRIVER] function run on trigger being received 534 * @pollfunc_event: [DRIVER] function run on events trigger being received 535 * @channels: [DRIVER] channel specification structure table 536 * @num_channels: [DRIVER] number of channels specified in @channels. 537 * @channel_attr_list: [INTERN] keep track of automatically created channel 538 * attributes 539 * @chan_attr_group: [INTERN] group for all attrs in base directory 540 * @name: [DRIVER] name of the device. 541 * @info: [DRIVER] callbacks and constant info from driver 542 * @clock_id: [INTERN] timestamping clock posix identifier 543 * @info_exist_lock: [INTERN] lock to prevent use during removal 544 * @setup_ops: [DRIVER] callbacks to call before and after buffer 545 * enable/disable 546 * @chrdev: [INTERN] associated character device 547 * @groups: [INTERN] attribute groups 548 * @groupcounter: [INTERN] index of next attribute group 549 * @flags: [INTERN] file ops related flags including busy flag. 550 * @debugfs_dentry: [INTERN] device specific debugfs dentry. 551 * @cached_reg_addr: [INTERN] cached register address for debugfs reads. 552 */ 553 struct iio_dev { 554 int id; 555 556 int modes; 557 int currentmode; 558 struct device dev; 559 560 struct iio_event_interface *event_interface; 561 562 struct iio_buffer *buffer; 563 struct list_head buffer_list; 564 int scan_bytes; 565 struct mutex mlock; 566 567 const unsigned long *available_scan_masks; 568 unsigned masklength; 569 const unsigned long *active_scan_mask; 570 bool scan_timestamp; 571 unsigned scan_index_timestamp; 572 struct iio_trigger *trig; 573 bool trig_readonly; 574 struct iio_poll_func *pollfunc; 575 struct iio_poll_func *pollfunc_event; 576 577 struct iio_chan_spec const *channels; 578 int num_channels; 579 580 struct list_head channel_attr_list; 581 struct attribute_group chan_attr_group; 582 const char *name; 583 const struct iio_info *info; 584 clockid_t clock_id; 585 struct mutex info_exist_lock; 586 const struct iio_buffer_setup_ops *setup_ops; 587 struct cdev chrdev; 588 #define IIO_MAX_GROUPS 6 589 const struct attribute_group *groups[IIO_MAX_GROUPS + 1]; 590 int groupcounter; 591 592 unsigned long flags; 593 #if defined(CONFIG_DEBUG_FS) 594 struct dentry *debugfs_dentry; 595 unsigned cached_reg_addr; 596 #endif 597 }; 598 599 const struct iio_chan_spec 600 *iio_find_channel_from_si(struct iio_dev *indio_dev, int si); 601 int iio_device_register(struct iio_dev *indio_dev); 602 void iio_device_unregister(struct iio_dev *indio_dev); 603 int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev); 604 void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); 605 int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); 606 int iio_device_claim_direct_mode(struct iio_dev *indio_dev); 607 void iio_device_release_direct_mode(struct iio_dev *indio_dev); 608 609 extern struct bus_type iio_bus_type; 610 611 /** 612 * iio_device_put() - reference counted deallocation of struct device 613 * @indio_dev: IIO device structure containing the device 614 **/ 615 static inline void iio_device_put(struct iio_dev *indio_dev) 616 { 617 if (indio_dev) 618 put_device(&indio_dev->dev); 619 } 620 621 /** 622 * iio_device_get_clock() - Retrieve current timestamping clock for the device 623 * @indio_dev: IIO device structure containing the device 624 */ 625 static inline clockid_t iio_device_get_clock(const struct iio_dev *indio_dev) 626 { 627 return indio_dev->clock_id; 628 } 629 630 /** 631 * dev_to_iio_dev() - Get IIO device struct from a device struct 632 * @dev: The device embedded in the IIO device 633 * 634 * Note: The device must be a IIO device, otherwise the result is undefined. 635 */ 636 static inline struct iio_dev *dev_to_iio_dev(struct device *dev) 637 { 638 return container_of(dev, struct iio_dev, dev); 639 } 640 641 /** 642 * iio_device_get() - increment reference count for the device 643 * @indio_dev: IIO device structure 644 * 645 * Returns: The passed IIO device 646 **/ 647 static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev) 648 { 649 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL; 650 } 651 652 653 /** 654 * iio_device_set_drvdata() - Set device driver data 655 * @indio_dev: IIO device structure 656 * @data: Driver specific data 657 * 658 * Allows to attach an arbitrary pointer to an IIO device, which can later be 659 * retrieved by iio_device_get_drvdata(). 660 */ 661 static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data) 662 { 663 dev_set_drvdata(&indio_dev->dev, data); 664 } 665 666 /** 667 * iio_device_get_drvdata() - Get device driver data 668 * @indio_dev: IIO device structure 669 * 670 * Returns the data previously set with iio_device_set_drvdata() 671 */ 672 static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev) 673 { 674 return dev_get_drvdata(&indio_dev->dev); 675 } 676 677 /* Can we make this smaller? */ 678 #define IIO_ALIGN L1_CACHE_BYTES 679 struct iio_dev *iio_device_alloc(int sizeof_priv); 680 681 static inline void *iio_priv(const struct iio_dev *indio_dev) 682 { 683 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN); 684 } 685 686 static inline struct iio_dev *iio_priv_to_dev(void *priv) 687 { 688 return (struct iio_dev *)((char *)priv - 689 ALIGN(sizeof(struct iio_dev), IIO_ALIGN)); 690 } 691 692 void iio_device_free(struct iio_dev *indio_dev); 693 int devm_iio_device_match(struct device *dev, void *res, void *data); 694 struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv); 695 void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev); 696 struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, 697 const char *fmt, ...); 698 void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig); 699 700 /** 701 * iio_buffer_enabled() - helper function to test if the buffer is enabled 702 * @indio_dev: IIO device structure for device 703 **/ 704 static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) 705 { 706 return indio_dev->currentmode 707 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | 708 INDIO_BUFFER_SOFTWARE); 709 } 710 711 /** 712 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry 713 * @indio_dev: IIO device structure for device 714 **/ 715 #if defined(CONFIG_DEBUG_FS) 716 static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 717 { 718 return indio_dev->debugfs_dentry; 719 } 720 #else 721 static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 722 { 723 return NULL; 724 } 725 #endif 726 727 ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals); 728 729 int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, 730 int *fract); 731 732 /** 733 * IIO_DEGREE_TO_RAD() - Convert degree to rad 734 * @deg: A value in degree 735 * 736 * Returns the given value converted from degree to rad 737 */ 738 #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL) 739 740 /** 741 * IIO_RAD_TO_DEGREE() - Convert rad to degree 742 * @rad: A value in rad 743 * 744 * Returns the given value converted from rad to degree 745 */ 746 #define IIO_RAD_TO_DEGREE(rad) \ 747 (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL) 748 749 /** 750 * IIO_G_TO_M_S_2() - Convert g to meter / second**2 751 * @g: A value in g 752 * 753 * Returns the given value converted from g to meter / second**2 754 */ 755 #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL) 756 757 /** 758 * IIO_M_S_2_TO_G() - Convert meter / second**2 to g 759 * @ms2: A value in meter / second**2 760 * 761 * Returns the given value converted from meter / second**2 to g 762 */ 763 #define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL) 764 765 #endif /* _INDUSTRIAL_IO_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.12-rc1 drivers/staging/iio/cdc/ad7152.ko 32_7a CPAchecker Bug Fixed 2017-05-27 01:54:24 L0275

Comment

Reported: 27 May 2017

[Home]