Bug
[В начало]
Ошибка # 59
Показать/спрятать трассу ошибок Error trace
{ 95 struct kernel_symbol { unsigned long value; const char *name; } ; 33 struct module ; 19 typedef signed char __s8; 20 typedef unsigned char __u8; 22 typedef short __s16; 23 typedef unsigned short __u16; 25 typedef int __s32; 26 typedef unsigned int __u32; 30 typedef unsigned long long __u64; 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; 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; 12 typedef __u32 __kernel_dev_t; 15 typedef __kernel_dev_t dev_t; 18 typedef unsigned short umode_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; 133 typedef unsigned long sector_t; 134 typedef unsigned long blkcnt_t; 158 typedef unsigned int gfp_t; 159 typedef unsigned int fmode_t; 163 typedef u64 phys_addr_t; 168 typedef phys_addr_t resource_size_t; 178 struct __anonstruct_atomic_t_6 { int counter; } ; 178 typedef struct __anonstruct_atomic_t_6 atomic_t; 183 struct __anonstruct_atomic64_t_7 { long counter; } ; 183 typedef struct __anonstruct_atomic64_t_7 atomic64_t; 184 struct list_head { struct list_head *next; struct list_head *prev; } ; 189 struct hlist_node ; 189 struct hlist_head { struct hlist_node *first; } ; 193 struct hlist_node { struct hlist_node *next; struct hlist_node **pprev; } ; 204 struct callback_head { struct callback_head *next; void (*func)(struct callback_head *); } ; 15 typedef unsigned long pgdval_t; 16 typedef unsigned long pgprotval_t; 20 struct pgprot { pgprotval_t pgprot; } ; 242 typedef struct pgprot pgprot_t; 244 struct __anonstruct_pgd_t_12 { pgdval_t pgd; } ; 244 typedef struct __anonstruct_pgd_t_12 pgd_t; 332 struct page ; 332 typedef struct page *pgtable_t; 340 struct file ; 353 struct seq_file ; 392 struct mm_struct ; 393 struct task_struct ; 394 struct cpumask ; 327 struct arch_spinlock ; 18 typedef u16 __ticket_t; 19 typedef u32 __ticketpair_t; 20 struct __raw_tickets { __ticket_t head; __ticket_t tail; } ; 32 union __anonunion_ldv_1452_15 { __ticketpair_t head_tail; struct __raw_tickets tickets; } ; 32 struct arch_spinlock { union __anonunion_ldv_1452_15 ldv_1452; } ; 33 typedef struct arch_spinlock arch_spinlock_t; 34 struct qrwlock { atomic_t cnts; arch_spinlock_t lock; } ; 14 typedef struct qrwlock arch_rwlock_t; 142 typedef void (*ctor_fn_t)(); 222 struct _ddebug { const char *modname; const char *function; const char *filename; const char *format; unsigned int lineno; unsigned char flags; } ; 48 struct device ; 403 struct file_operations ; 415 struct completion ; 416 struct pid ; 526 struct bug_entry { int bug_addr_disp; int file_disp; unsigned short line; unsigned short flags; } ; 102 struct timespec ; 306 struct cpumask { unsigned long bits[128U]; } ; 671 typedef struct cpumask *cpumask_var_t; 161 struct seq_operations ; 464 struct kmem_cache ; 23 typedef atomic64_t atomic_long_t; 34 struct lockdep_map ; 55 struct stack_trace { unsigned int nr_entries; unsigned int max_entries; unsigned long *entries; int skip; } ; 26 struct lockdep_subclass_key { char __one_byte; } ; 53 struct lock_class_key { struct lockdep_subclass_key subkeys[8U]; } ; 59 struct lock_class { struct list_head hash_entry; struct list_head lock_entry; struct lockdep_subclass_key *key; unsigned int subclass; unsigned int dep_gen_id; unsigned long usage_mask; struct stack_trace usage_traces[13U]; struct list_head locks_after; struct list_head locks_before; unsigned int version; unsigned long ops; const char *name; int name_version; unsigned long contention_point[4U]; unsigned long contending_point[4U]; } ; 144 struct lockdep_map { struct lock_class_key *key; struct lock_class *class_cache[2U]; const char *name; int cpu; unsigned long ip; } ; 530 struct raw_spinlock { arch_spinlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ; 32 typedef struct raw_spinlock raw_spinlock_t; 33 struct __anonstruct_ldv_6418_31 { u8 __padding[24U]; struct lockdep_map dep_map; } ; 33 union __anonunion_ldv_6419_30 { struct raw_spinlock rlock; struct __anonstruct_ldv_6418_31 ldv_6418; } ; 33 struct spinlock { union __anonunion_ldv_6419_30 ldv_6419; } ; 76 typedef struct spinlock spinlock_t; 23 struct __anonstruct_rwlock_t_32 { arch_rwlock_t raw_lock; unsigned int magic; unsigned int owner_cpu; void *owner; struct lockdep_map dep_map; } ; 23 typedef struct __anonstruct_rwlock_t_32 rwlock_t; 35 struct __wait_queue_head { spinlock_t lock; struct list_head task_list; } ; 40 typedef struct __wait_queue_head wait_queue_head_t; 1029 struct seqcount { unsigned int sequence; struct lockdep_map dep_map; } ; 51 typedef struct seqcount seqcount_t; 98 struct __anonstruct_nodemask_t_34 { unsigned long bits[16U]; } ; 98 typedef struct __anonstruct_nodemask_t_34 nodemask_t; 825 struct optimistic_spin_queue { atomic_t tail; } ; 26 struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; struct task_struct *owner; const char *name; void *magic; struct lockdep_map dep_map; } ; 178 struct rw_semaphore ; 179 struct rw_semaphore { long count; struct list_head wait_list; raw_spinlock_t wait_lock; struct optimistic_spin_queue osq; struct task_struct *owner; struct lockdep_map dep_map; } ; 172 struct completion { unsigned int done; wait_queue_head_t wait; } ; 1112 struct timespec { __kernel_time_t tv_sec; long tv_nsec; } ; 323 union ktime { s64 tv64; } ; 41 typedef union ktime ktime_t; 207 struct tvec_base ; 208 struct timer_list { struct list_head entry; unsigned long expires; struct tvec_base *base; void (*function)(unsigned long); unsigned long data; int slack; int start_pid; void *start_site; char start_comm[16U]; struct lockdep_map lockdep_map; } ; 266 struct workqueue_struct ; 267 struct work_struct ; 53 struct work_struct { atomic_long_t data; struct list_head entry; void (*func)(struct work_struct *); struct lockdep_map lockdep_map; } ; 106 struct delayed_work { struct work_struct work; struct timer_list timer; struct workqueue_struct *wq; int cpu; } ; 72 struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; struct resource *parent; struct resource *sibling; struct resource *child; } ; 174 struct msi_desc ; 191 struct irq_data ; 58 struct pm_message { int event; } ; 64 typedef struct pm_message pm_message_t; 65 struct dev_pm_ops { int (*prepare)(struct device *); void (*complete)(struct device *); int (*suspend)(struct device *); int (*resume)(struct device *); int (*freeze)(struct device *); int (*thaw)(struct device *); int (*poweroff)(struct device *); int (*restore)(struct device *); int (*suspend_late)(struct device *); int (*resume_early)(struct device *); int (*freeze_late)(struct device *); int (*thaw_early)(struct device *); int (*poweroff_late)(struct device *); int (*restore_early)(struct device *); int (*suspend_noirq)(struct device *); int (*resume_noirq)(struct device *); int (*freeze_noirq)(struct device *); int (*thaw_noirq)(struct device *); int (*poweroff_noirq)(struct device *); int (*restore_noirq)(struct device *); int (*runtime_suspend)(struct device *); int (*runtime_resume)(struct device *); int (*runtime_idle)(struct device *); } ; 320 enum rpm_status { RPM_ACTIVE = 0, RPM_RESUMING = 1, RPM_SUSPENDED = 2, RPM_SUSPENDING = 3 } ; 327 enum rpm_request { RPM_REQ_NONE = 0, RPM_REQ_IDLE = 1, RPM_REQ_SUSPEND = 2, RPM_REQ_AUTOSUSPEND = 3, RPM_REQ_RESUME = 4 } ; 335 struct wakeup_source ; 546 struct pm_subsys_data { spinlock_t lock; unsigned int refcount; struct list_head clock_list; } ; 553 struct dev_pm_qos ; 553 struct dev_pm_info { pm_message_t power_state; unsigned char can_wakeup; unsigned char async_suspend; bool is_prepared; bool is_suspended; bool is_noirq_suspended; bool is_late_suspended; bool ignore_children; bool early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source *wakeup; bool wakeup_path; bool syscore; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; atomic_t usage_count; atomic_t child_count; unsigned char disable_depth; unsigned char idle_notification; unsigned char request_pending; unsigned char deferred_resume; unsigned char run_wake; unsigned char runtime_auto; unsigned char no_callbacks; unsigned char irq_safe; unsigned char use_autosuspend; unsigned char timer_autosuspends; unsigned char memalloc_noio; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; void (*set_latency_tolerance)(struct device *, s32 ); struct dev_pm_qos *qos; } ; 614 struct dev_pm_domain { struct dev_pm_ops ops; } ; 22 struct __anonstruct_mm_context_t_99 { void *ldt; int size; unsigned short ia32_compat; struct mutex lock; void *vdso; } ; 22 typedef struct __anonstruct_mm_context_t_99 mm_context_t; 18 struct rb_node { unsigned long __rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; } ; 40 struct rb_root { struct rb_node *rb_node; } ; 87 struct vm_area_struct ; 169 struct device_node ; 170 struct irq_domain ; 1304 struct llist_node ; 64 struct llist_node { struct llist_node *next; } ; 57 struct mem_cgroup ; 338 union __anonunion_ldv_13039_126 { unsigned long bitmap[4U]; struct callback_head callback_head; } ; 338 struct idr_layer { int prefix; int layer; struct idr_layer *ary[256U]; int count; union __anonunion_ldv_13039_126 ldv_13039; } ; 41 struct idr { struct idr_layer *hint; struct idr_layer *top; int layers; int cur; spinlock_t lock; int id_free_cnt; struct idr_layer *id_free; } ; 124 struct ida_bitmap { long nr_busy; unsigned long bitmap[15U]; } ; 153 struct ida { struct idr idr; struct ida_bitmap *free_bitmap; } ; 185 struct dentry ; 186 struct iattr ; 187 struct super_block ; 188 struct file_system_type ; 189 struct kernfs_open_node ; 190 struct kernfs_iattrs ; 213 struct kernfs_root ; 213 struct kernfs_elem_dir { unsigned long subdirs; struct rb_root children; struct kernfs_root *root; } ; 85 struct kernfs_node ; 85 struct kernfs_elem_symlink { struct kernfs_node *target_kn; } ; 89 struct kernfs_ops ; 89 struct kernfs_elem_attr { const struct kernfs_ops *ops; struct kernfs_open_node *open; loff_t size; struct kernfs_node *notify_next; } ; 96 union __anonunion_ldv_13184_127 { struct kernfs_elem_dir dir; struct kernfs_elem_symlink symlink; struct kernfs_elem_attr attr; } ; 96 struct kernfs_node { atomic_t count; atomic_t active; struct lockdep_map dep_map; struct kernfs_node *parent; const char *name; struct rb_node rb; const void *ns; unsigned int hash; union __anonunion_ldv_13184_127 ldv_13184; void *priv; unsigned short flags; umode_t mode; unsigned int ino; struct kernfs_iattrs *iattr; } ; 138 struct kernfs_syscall_ops { int (*remount_fs)(struct kernfs_root *, int *, char *); int (*show_options)(struct seq_file *, struct kernfs_root *); int (*mkdir)(struct kernfs_node *, const char *, umode_t ); int (*rmdir)(struct kernfs_node *); int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); } ; 155 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; } ; 171 struct vm_operations_struct ; 171 struct kernfs_open_file { struct kernfs_node *kn; struct file *file; void *priv; struct mutex mutex; int event; struct list_head list; size_t atomic_write_len; bool mmapped; const struct vm_operations_struct *vm_ops; } ; 187 struct kernfs_ops { int (*seq_show)(struct seq_file *, void *); void * (*seq_start)(struct seq_file *, loff_t *); void * (*seq_next)(struct seq_file *, void *, loff_t *); void (*seq_stop)(struct seq_file *, void *); ssize_t (*read)(struct kernfs_open_file *, char *, size_t , loff_t ); size_t atomic_write_len; ssize_t (*write)(struct kernfs_open_file *, char *, size_t , loff_t ); int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); struct lock_class_key lockdep_key; } ; 464 struct sock ; 465 struct kobject ; 466 enum kobj_ns_type { KOBJ_NS_TYPE_NONE = 0, KOBJ_NS_TYPE_NET = 1, KOBJ_NS_TYPES = 2 } ; 472 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_128 { uid_t val; } ; 22 typedef struct __anonstruct_kuid_t_128 kuid_t; 27 struct __anonstruct_kgid_t_129 { gid_t val; } ; 27 typedef struct __anonstruct_kgid_t_129 kgid_t; 127 struct kstat { u64 ino; dev_t dev; umode_t mode; unsigned int nlink; kuid_t uid; kgid_t gid; dev_t rdev; loff_t size; struct timespec atime; struct timespec mtime; struct timespec ctime; unsigned long blksize; unsigned long long blocks; } ; 36 struct bin_attribute ; 37 struct attribute { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ; 37 struct attribute_group { const char *name; umode_t (*is_visible)(struct kobject *, struct attribute *, int); struct attribute **attrs; struct bin_attribute **bin_attrs; } ; 67 struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); } ; 131 struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *, char *); ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t ); } ; 470 struct kref { atomic_t refcount; } ; 52 struct kset ; 52 struct kobj_type ; 52 struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned char state_initialized; unsigned char state_in_sysfs; unsigned char state_add_uevent_sent; unsigned char state_remove_uevent_sent; unsigned char uevent_suppress; } ; 114 struct kobj_type { void (*release)(struct kobject *); const struct sysfs_ops *sysfs_ops; struct attribute **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); const void * (*namespace)(struct kobject *); } ; 122 struct kobj_uevent_env { char *argv[3U]; char *envp[32U]; int envp_idx; char buf[2048U]; int buflen; } ; 130 struct kset_uevent_ops { const int (*filter)(struct kset *, struct kobject *); const const char * (*name)(struct kset *, struct kobject *); const int (*uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); } ; 147 struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; } ; 252 struct kmem_cache_cpu { void **freelist; unsigned long tid; struct page *page; struct page *partial; unsigned int stat[26U]; } ; 48 struct kmem_cache_order_objects { unsigned long x; } ; 58 struct memcg_cache_params ; 58 struct kmem_cache_node ; 58 struct kmem_cache { struct kmem_cache_cpu *cpu_slab; unsigned long flags; unsigned long min_partial; int size; int object_size; int offset; int cpu_partial; struct kmem_cache_order_objects oo; struct kmem_cache_order_objects max; struct kmem_cache_order_objects min; gfp_t allocflags; int refcount; void (*ctor)(void *); int inuse; int align; int reserved; const char *name; struct list_head list; struct kobject kobj; struct memcg_cache_params *memcg_params; int max_attr_size; struct kset *memcg_kset; int remote_node_defrag_ratio; struct kmem_cache_node *node[1024U]; } ; 505 struct __anonstruct_ldv_14089_131 { struct callback_head callback_head; struct kmem_cache *memcg_caches[0U]; } ; 505 struct __anonstruct_ldv_14095_132 { struct mem_cgroup *memcg; struct list_head list; struct kmem_cache *root_cache; atomic_t nr_pages; } ; 505 union __anonunion_ldv_14096_130 { struct __anonstruct_ldv_14089_131 ldv_14089; struct __anonstruct_ldv_14095_132 ldv_14095; } ; 505 struct memcg_cache_params { bool is_root_cache; union __anonunion_ldv_14096_130 ldv_14096; } ; 34 struct iio_chan_spec ; 38 struct iio_dev ; 42 struct platform_device ; 47 struct klist_node ; 37 struct klist_node { void *n_klist; struct list_head n_node; struct kref n_ref; } ; 67 struct path ; 68 struct inode ; 69 struct seq_file { char *buf; size_t size; size_t from; size_t count; size_t pad_until; loff_t index; loff_t read_pos; u64 version; struct mutex lock; const struct seq_operations *op; int poll_event; struct user_namespace *user_ns; void *private; } ; 35 struct seq_operations { void * (*start)(struct seq_file *, loff_t *); void (*stop)(struct seq_file *, void *); void * (*next)(struct seq_file *, void *, loff_t *); int (*show)(struct seq_file *, void *); } ; 196 struct pinctrl ; 197 struct pinctrl_state ; 194 struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; } ; 42 struct dma_map_ops ; 42 struct dev_archdata { struct dma_map_ops *dma_ops; void *iommu; } ; 11 struct pdev_archdata { } ; 14 struct device_private ; 15 struct device_driver ; 16 struct driver_private ; 17 struct class ; 18 struct subsys_private ; 19 struct bus_type ; 20 struct iommu_ops ; 21 struct iommu_group ; 60 struct device_attribute ; 60 struct bus_type { const char *name; const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; const struct attribute_group **bus_groups; const struct attribute_group **dev_groups; const struct attribute_group **drv_groups; int (*match)(struct device *, struct device_driver *); int (*uevent)(struct device *, struct kobj_uevent_env *); int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*online)(struct device *); int (*offline)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct dev_pm_ops *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ; 138 struct device_type ; 195 struct of_device_id ; 195 struct acpi_device_id ; 195 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device *); int (*remove)(struct device *); void (*shutdown)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct attribute_group **groups; const struct dev_pm_ops *pm; struct driver_private *p; } ; 321 struct class_attribute ; 321 struct class { const char *name; struct module *owner; struct class_attribute *class_attrs; const struct attribute_group **dev_groups; struct kobject *dev_kobj; int (*dev_uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *); void (*class_release)(struct class *); void (*dev_release)(struct device *); int (*suspend)(struct device *, pm_message_t ); int (*resume)(struct device *); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device *); const struct dev_pm_ops *pm; struct subsys_private *p; } ; 414 struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, struct class_attribute *, char *); ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t ); } ; 482 struct device_type { const char *name; const struct attribute_group **groups; int (*uevent)(struct device *, struct kobj_uevent_env *); char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); void (*release)(struct device *); const struct dev_pm_ops *pm; } ; 510 struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *, struct device_attribute *, char *); ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t ); } ; 642 struct device_dma_parameters { unsigned int max_segment_size; unsigned long segment_boundary_mask; } ; 651 struct acpi_device ; 652 struct acpi_dev_node { struct acpi_device *companion; } ; 658 struct dma_coherent_mem ; 658 struct cma ; 658 struct device { struct device *parent; struct device_private *p; struct kobject kobj; const char *init_name; const struct device_type *type; struct mutex mutex; struct bus_type *bus; struct device_driver *driver; void *platform_data; void *driver_data; struct dev_pm_info power; struct dev_pm_domain *pm_domain; struct dev_pin_info *pins; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct cma *cma_area; struct dev_archdata archdata; struct device_node *of_node; struct acpi_dev_node acpi_node; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class *class; const struct attribute_group **groups; void (*release)(struct device *); struct iommu_group *iommu_group; bool offline_disabled; bool offline; } ; 805 struct wakeup_source { const char *name; struct list_head entry; spinlock_t lock; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ; 13 typedef unsigned long kernel_ulong_t; 127 struct hid_device_id { __u16 bus; __u16 group; __u32 vendor; __u32 product; kernel_ulong_t driver_data; } ; 186 struct acpi_device_id { __u8 id[9U]; kernel_ulong_t driver_data; } ; 219 struct of_device_id { char name[32U]; char type[32U]; char compatible[128U]; const void *data; } ; 262 struct input_device_id { kernel_ulong_t flags; __u16 bustype; __u16 vendor; __u16 product; __u16 version; kernel_ulong_t evbit[1U]; kernel_ulong_t keybit[12U]; kernel_ulong_t relbit[1U]; kernel_ulong_t absbit[1U]; kernel_ulong_t mscbit[1U]; kernel_ulong_t ledbit[1U]; kernel_ulong_t sndbit[1U]; kernel_ulong_t ffbit[2U]; kernel_ulong_t swbit[1U]; kernel_ulong_t driver_info; } ; 479 struct platform_device_id { char name[20U]; kernel_ulong_t driver_data; } ; 628 struct mfd_cell ; 629 struct platform_device { const char *name; int id; bool id_auto; struct device dev; u32 num_resources; struct resource *resource; const struct platform_device_id *id_entry; char *driver_override; struct mfd_cell *mfd_cell; struct pdev_archdata archdata; } ; 173 struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); void (*shutdown)(struct platform_device *); int (*suspend)(struct platform_device *, pm_message_t ); int (*resume)(struct platform_device *); struct device_driver driver; const struct platform_device_id *id_table; bool prevent_deferred_probe; } ; 37 struct cred ; 94 struct xol_area ; 95 struct uprobes_state { struct xol_area *xol_area; } ; 133 struct address_space ; 134 union __anonunion_ldv_16911_146 { struct address_space *mapping; void *s_mem; } ; 134 union __anonunion_ldv_16917_148 { unsigned long index; void *freelist; bool pfmemalloc; } ; 134 struct __anonstruct_ldv_16927_152 { unsigned short inuse; unsigned short objects; unsigned char frozen; } ; 134 union __anonunion_ldv_16929_151 { atomic_t _mapcount; struct __anonstruct_ldv_16927_152 ldv_16927; int units; } ; 134 struct __anonstruct_ldv_16931_150 { union __anonunion_ldv_16929_151 ldv_16929; atomic_t _count; } ; 134 union __anonunion_ldv_16933_149 { unsigned long counters; struct __anonstruct_ldv_16931_150 ldv_16931; unsigned int active; } ; 134 struct __anonstruct_ldv_16934_147 { union __anonunion_ldv_16917_148 ldv_16917; union __anonunion_ldv_16933_149 ldv_16933; } ; 134 struct __anonstruct_ldv_16941_154 { struct page *next; int pages; int pobjects; } ; 134 struct slab ; 134 union __anonunion_ldv_16946_153 { struct list_head lru; struct __anonstruct_ldv_16941_154 ldv_16941; struct slab *slab_page; struct callback_head callback_head; pgtable_t pmd_huge_pte; } ; 134 union __anonunion_ldv_16952_155 { unsigned long private; spinlock_t *ptl; struct kmem_cache *slab_cache; struct page *first_page; } ; 134 struct page { unsigned long flags; union __anonunion_ldv_16911_146 ldv_16911; struct __anonstruct_ldv_16934_147 ldv_16934; union __anonunion_ldv_16946_153 ldv_16946; union __anonunion_ldv_16952_155 ldv_16952; unsigned long debug_flags; } ; 239 struct __anonstruct_linear_157 { struct rb_node rb; unsigned long rb_subtree_last; } ; 239 union __anonunion_shared_156 { struct __anonstruct_linear_157 linear; struct list_head nonlinear; } ; 239 struct anon_vma ; 239 struct mempolicy ; 239 struct vm_area_struct { unsigned long vm_start; unsigned long vm_end; struct vm_area_struct *vm_next; struct vm_area_struct *vm_prev; struct rb_node vm_rb; unsigned long rb_subtree_gap; struct mm_struct *vm_mm; pgprot_t vm_page_prot; unsigned long vm_flags; union __anonunion_shared_156 shared; struct list_head anon_vma_chain; struct anon_vma *anon_vma; const struct vm_operations_struct *vm_ops; unsigned long vm_pgoff; struct file *vm_file; void *vm_private_data; struct mempolicy *vm_policy; } ; 311 struct core_thread { struct task_struct *task; struct core_thread *next; } ; 317 struct core_state { atomic_t nr_threads; struct core_thread dumper; struct completion startup; } ; 338 struct mm_rss_stat { atomic_long_t count[3U]; } ; 343 struct kioctx_table ; 344 struct linux_binfmt ; 344 struct mmu_notifier_mm ; 344 struct mm_struct { struct vm_area_struct *mmap; struct rb_root mm_rb; u32 vmacache_seqnum; unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); unsigned long mmap_base; unsigned long mmap_legacy_base; unsigned long task_size; unsigned long highest_vm_end; pgd_t *pgd; atomic_t mm_users; atomic_t mm_count; atomic_long_t nr_ptes; int map_count; spinlock_t page_table_lock; struct rw_semaphore mmap_sem; struct list_head mmlist; unsigned long hiwater_rss; unsigned long hiwater_vm; unsigned long total_vm; unsigned long locked_vm; unsigned long pinned_vm; unsigned long shared_vm; unsigned long exec_vm; unsigned long stack_vm; unsigned long def_flags; unsigned long start_code; unsigned long end_code; unsigned long start_data; unsigned long end_data; unsigned long start_brk; unsigned long brk; unsigned long start_stack; unsigned long arg_start; unsigned long arg_end; unsigned long env_start; unsigned long env_end; unsigned long saved_auxv[46U]; struct mm_rss_stat rss_stat; struct linux_binfmt *binfmt; cpumask_var_t cpu_vm_mask_var; mm_context_t context; unsigned long flags; struct core_state *core_state; spinlock_t ioctx_lock; struct kioctx_table *ioctx_table; struct task_struct *owner; struct file *exe_file; struct mmu_notifier_mm *mmu_notifier_mm; struct cpumask cpumask_allocation; unsigned long numa_next_scan; unsigned long numa_scan_offset; int numa_scan_seq; bool tlb_flush_pending; struct uprobes_state uprobes_state; } ; 15 typedef __u64 Elf64_Addr; 16 typedef __u16 Elf64_Half; 20 typedef __u32 Elf64_Word; 21 typedef __u64 Elf64_Xword; 190 struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } ; 198 typedef struct elf64_sym Elf64_Sym; 48 struct kernel_param ; 53 struct kernel_param_ops { unsigned int flags; int (*set)(const char *, const struct kernel_param *); int (*get)(char *, const struct kernel_param *); void (*free)(void *); } ; 58 struct kparam_string ; 58 struct kparam_array ; 58 union __anonunion_ldv_17335_161 { void *arg; const struct kparam_string *str; const struct kparam_array *arr; } ; 58 struct kernel_param { const char *name; const struct kernel_param_ops *ops; u16 perm; s16 level; union __anonunion_ldv_17335_161 ldv_17335; } ; 70 struct kparam_string { unsigned int maxlen; char *string; } ; 76 struct kparam_array { unsigned int max; unsigned int elemsize; unsigned int *num; const struct kernel_param_ops *ops; void *elem; } ; 466 struct mod_arch_specific { } ; 36 struct module_param_attrs ; 36 struct module_kobject { struct kobject kobj; struct module *mod; struct kobject *drivers_dir; struct module_param_attrs *mp; struct completion *kobj_completion; } ; 46 struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t ); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); } ; 72 struct exception_table_entry ; 205 enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2, MODULE_STATE_UNFORMED = 3 } ; 212 struct module_ref { unsigned long incs; unsigned long decs; } ; 226 struct module_sect_attrs ; 226 struct module_notes_attrs ; 226 struct tracepoint ; 226 struct ftrace_event_call ; 226 struct module { enum module_state state; struct list_head list; char name[56U]; struct module_kobject mkobj; struct module_attribute *modinfo_attrs; const char *version; const char *srcversion; struct kobject *holders_dir; const struct kernel_symbol *syms; const unsigned long *crcs; unsigned int num_syms; struct kernel_param *kp; unsigned int num_kp; unsigned int num_gpl_syms; const struct kernel_symbol *gpl_syms; const unsigned long *gpl_crcs; const struct kernel_symbol *unused_syms; const unsigned long *unused_crcs; unsigned int num_unused_syms; unsigned int num_unused_gpl_syms; const struct kernel_symbol *unused_gpl_syms; const unsigned long *unused_gpl_crcs; bool sig_ok; const struct kernel_symbol *gpl_future_syms; const unsigned long *gpl_future_crcs; unsigned int num_gpl_future_syms; unsigned int num_exentries; struct exception_table_entry *extable; int (*init)(); void *module_init; void *module_core; unsigned int init_size; unsigned int core_size; unsigned int init_text_size; unsigned int core_text_size; unsigned int init_ro_size; unsigned int core_ro_size; struct mod_arch_specific arch; unsigned int taints; unsigned int num_bugs; struct list_head bug_list; struct bug_entry *bug_table; Elf64_Sym *symtab; Elf64_Sym *core_symtab; unsigned int num_symtab; unsigned int core_num_syms; char *strtab; char *core_strtab; struct module_sect_attrs *sect_attrs; struct module_notes_attrs *notes_attrs; char *args; void *percpu; unsigned int percpu_size; unsigned int num_tracepoints; const struct tracepoint **tracepoints_ptrs; unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; struct ftrace_event_call **trace_events; unsigned int num_trace_events; struct list_head source_list; struct list_head target_list; void (*exit)(); struct module_ref *refptr; ctor_fn_t (**ctors)(); unsigned int num_ctors; } ; 655 enum irqreturn { IRQ_NONE = 0, IRQ_HANDLED = 1, IRQ_WAKE_THREAD = 2 } ; 16 typedef enum irqreturn irqreturn_t; 64 struct irq_chip ; 64 struct irq_data { u32 mask; unsigned int irq; unsigned long hwirq; unsigned int node; unsigned int state_use_accessors; struct irq_chip *chip; struct irq_domain *domain; void *handler_data; void *chip_data; struct msi_desc *msi_desc; cpumask_var_t affinity; } ; 279 struct irq_chip { 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 *); unsigned long flags; } ; 62 struct exception_table_entry { int insn; int fixup; } ; 30 struct input_id { __u16 bustype; __u16 vendor; __u16 product; __u16 version; } ; 47 struct input_absinfo { __s32 value; __s32 minimum; __s32 maximum; __s32 fuzz; __s32 flat; __s32 resolution; } ; 75 struct input_keymap_entry { __u8 flags; __u8 len; __u16 index; __u32 keycode; __u8 scancode[32U]; } ; 99 struct ff_replay { __u16 length; __u16 delay; } ; 995 struct ff_trigger { __u16 button; __u16 interval; } ; 1005 struct ff_envelope { __u16 attack_length; __u16 attack_level; __u16 fade_length; __u16 fade_level; } ; 1024 struct ff_constant_effect { __s16 level; struct ff_envelope envelope; } ; 1034 struct ff_ramp_effect { __s16 start_level; __s16 end_level; struct ff_envelope envelope; } ; 1046 struct ff_condition_effect { __u16 right_saturation; __u16 left_saturation; __s16 right_coeff; __s16 left_coeff; __u16 deadband; __s16 center; } ; 1067 struct ff_periodic_effect { __u16 waveform; __u16 period; __s16 magnitude; __s16 offset; __u16 phase; struct ff_envelope envelope; __u32 custom_len; __s16 *custom_data; } ; 1098 struct ff_rumble_effect { __u16 strong_magnitude; __u16 weak_magnitude; } ; 1111 union __anonunion_u_164 { struct ff_constant_effect constant; struct ff_ramp_effect ramp; struct ff_periodic_effect periodic; struct ff_condition_effect condition[2U]; struct ff_rumble_effect rumble; } ; 1111 struct ff_effect { __u16 type; __s16 id; __u16 direction; struct ff_trigger trigger; struct ff_replay replay; union __anonunion_u_164 u; } ; 93 struct hlist_bl_node ; 93 struct hlist_bl_head { struct hlist_bl_node *first; } ; 36 struct hlist_bl_node { struct hlist_bl_node *next; struct hlist_bl_node **pprev; } ; 114 struct __anonstruct_ldv_20012_166 { spinlock_t lock; unsigned int count; } ; 114 union __anonunion_ldv_20013_165 { struct __anonstruct_ldv_20012_166 ldv_20012; } ; 114 struct lockref { union __anonunion_ldv_20013_165 ldv_20013; } ; 49 struct nameidata ; 50 struct vfsmount ; 51 struct __anonstruct_ldv_20036_168 { u32 hash; u32 len; } ; 51 union __anonunion_ldv_20038_167 { struct __anonstruct_ldv_20036_168 ldv_20036; u64 hash_len; } ; 51 struct qstr { union __anonunion_ldv_20038_167 ldv_20038; const unsigned char *name; } ; 90 struct dentry_operations ; 90 union __anonunion_d_u_169 { struct list_head d_child; struct callback_head d_rcu; } ; 90 struct dentry { unsigned int d_flags; seqcount_t d_seq; struct hlist_bl_node d_hash; struct dentry *d_parent; struct qstr d_name; struct inode *d_inode; unsigned char d_iname[32U]; struct lockref d_lockref; const struct dentry_operations *d_op; struct super_block *d_sb; unsigned long d_time; void *d_fsdata; struct list_head d_lru; union __anonunion_d_u_169 d_u; struct list_head d_subdirs; struct hlist_node d_alias; } ; 142 struct dentry_operations { int (*d_revalidate)(struct dentry *, unsigned int); int (*d_weak_revalidate)(struct dentry *, unsigned int); int (*d_hash)(const struct dentry *, struct qstr *); int (*d_compare)(const struct dentry *, const struct dentry *, unsigned int, const char *, const struct qstr *); int (*d_delete)(const struct dentry *); void (*d_release)(struct dentry *); void (*d_prune)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); char * (*d_dname)(struct dentry *, char *, int); struct vfsmount * (*d_automount)(struct path *); int (*d_manage)(struct dentry *, bool ); } ; 478 struct path { struct vfsmount *mnt; struct dentry *dentry; } ; 27 struct list_lru_node { spinlock_t lock; struct list_head list; long nr_items; } ; 30 struct list_lru { struct list_lru_node *node; nodemask_t active_nodes; } ; 58 struct __anonstruct_ldv_20401_171 { struct radix_tree_node *parent; void *private_data; } ; 58 union __anonunion_ldv_20403_170 { struct __anonstruct_ldv_20401_171 ldv_20401; struct callback_head callback_head; } ; 58 struct radix_tree_node { unsigned int path; unsigned int count; union __anonunion_ldv_20403_170 ldv_20403; struct list_head private_list; void *slots[64U]; unsigned long tags[3U][1U]; } ; 105 struct radix_tree_root { unsigned int height; gfp_t gfp_mask; struct radix_tree_node *rnode; } ; 428 enum pid_type { PIDTYPE_PID = 0, PIDTYPE_PGID = 1, PIDTYPE_SID = 2, PIDTYPE_MAX = 3 } ; 435 struct pid_namespace ; 435 struct upid { int nr; struct pid_namespace *ns; struct hlist_node pid_chain; } ; 56 struct pid { atomic_t count; unsigned int level; struct hlist_head tasks[3U]; struct callback_head rcu; struct upid numbers[1U]; } ; 221 struct semaphore { raw_spinlock_t lock; unsigned int count; struct list_head wait_list; } ; 45 struct fiemap_extent { __u64 fe_logical; __u64 fe_physical; __u64 fe_length; __u64 fe_reserved64[2U]; __u32 fe_flags; __u32 fe_reserved[3U]; } ; 38 struct shrink_control { gfp_t gfp_mask; unsigned long nr_to_scan; nodemask_t nodes_to_scan; int nid; } ; 26 struct shrinker { unsigned long int (*count_objects)(struct shrinker *, struct shrink_control *); unsigned long int (*scan_objects)(struct shrinker *, struct shrink_control *); int seeks; long batch; unsigned long flags; struct list_head list; atomic_long_t *nr_deferred; } ; 70 enum migrate_mode { MIGRATE_ASYNC = 0, MIGRATE_SYNC_LIGHT = 1, MIGRATE_SYNC = 2 } ; 30 struct block_device ; 59 struct export_operations ; 61 struct iovec ; 62 struct kiocb ; 63 struct pipe_inode_info ; 64 struct poll_table_struct ; 65 struct kstatfs ; 66 struct swap_info_struct ; 67 struct iov_iter ; 69 struct iattr { unsigned int ia_valid; umode_t ia_mode; kuid_t ia_uid; kgid_t ia_gid; loff_t ia_size; struct timespec ia_atime; struct timespec ia_mtime; struct timespec ia_ctime; struct file *ia_file; } ; 253 struct percpu_counter { raw_spinlock_t lock; s64 count; struct list_head list; s32 *counters; } ; 176 struct fs_disk_quota { __s8 d_version; __s8 d_flags; __u16 d_fieldmask; __u32 d_id; __u64 d_blk_hardlimit; __u64 d_blk_softlimit; __u64 d_ino_hardlimit; __u64 d_ino_softlimit; __u64 d_bcount; __u64 d_icount; __s32 d_itimer; __s32 d_btimer; __u16 d_iwarns; __u16 d_bwarns; __s32 d_padding2; __u64 d_rtb_hardlimit; __u64 d_rtb_softlimit; __u64 d_rtbcount; __s32 d_rtbtimer; __u16 d_rtbwarns; __s16 d_padding3; char d_padding4[8U]; } ; 76 struct fs_qfilestat { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; } ; 151 typedef struct fs_qfilestat fs_qfilestat_t; 152 struct fs_quota_stat { __s8 qs_version; __u16 qs_flags; __s8 qs_pad; fs_qfilestat_t qs_uquota; fs_qfilestat_t qs_gquota; __u32 qs_incoredqs; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; } ; 166 struct fs_qfilestatv { __u64 qfs_ino; __u64 qfs_nblks; __u32 qfs_nextents; __u32 qfs_pad; } ; 196 struct fs_quota_statv { __s8 qs_version; __u8 qs_pad1; __u16 qs_flags; __u32 qs_incoredqs; struct fs_qfilestatv qs_uquota; struct fs_qfilestatv qs_gquota; struct fs_qfilestatv qs_pquota; __s32 qs_btimelimit; __s32 qs_itimelimit; __s32 qs_rtbtimelimit; __u16 qs_bwarnlimit; __u16 qs_iwarnlimit; __u64 qs_pad2[8U]; } ; 212 struct dquot ; 19 typedef __kernel_uid32_t projid_t; 23 struct __anonstruct_kprojid_t_173 { projid_t val; } ; 23 typedef struct __anonstruct_kprojid_t_173 kprojid_t; 119 struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; __u32 dqi_valid; } ; 152 enum quota_type { USRQUOTA = 0, GRPQUOTA = 1, PRJQUOTA = 2 } ; 60 typedef long long qsize_t; 61 union __anonunion_ldv_21223_174 { kuid_t uid; kgid_t gid; kprojid_t projid; } ; 61 struct kqid { union __anonunion_ldv_21223_174 ldv_21223; enum quota_type type; } ; 178 struct mem_dqblk { qsize_t dqb_bhardlimit; qsize_t dqb_bsoftlimit; qsize_t dqb_curspace; qsize_t dqb_rsvspace; qsize_t dqb_ihardlimit; qsize_t dqb_isoftlimit; qsize_t dqb_curinodes; time_t dqb_btime; time_t dqb_itime; } ; 200 struct quota_format_type ; 201 struct mem_dqinfo { struct quota_format_type *dqi_format; int dqi_fmt_id; struct list_head dqi_dirty_list; unsigned long dqi_flags; unsigned int dqi_bgrace; unsigned int dqi_igrace; qsize_t dqi_maxblimit; qsize_t dqi_maxilimit; void *dqi_priv; } ; 264 struct dquot { struct hlist_node dq_hash; struct list_head dq_inuse; struct list_head dq_free; struct list_head dq_dirty; struct mutex dq_lock; atomic_t dq_count; wait_queue_head_t dq_wait_unused; struct super_block *dq_sb; struct kqid dq_id; loff_t dq_off; unsigned long dq_flags; struct mem_dqblk dq_dqb; } ; 291 struct quota_format_ops { int (*check_quota_file)(struct super_block *, int); int (*read_file_info)(struct super_block *, int); int (*write_file_info)(struct super_block *, int); int (*free_file_info)(struct super_block *, int); int (*read_dqblk)(struct dquot *); int (*commit_dqblk)(struct dquot *); int (*release_dqblk)(struct dquot *); } ; 302 struct dquot_operations { int (*write_dquot)(struct dquot *); struct dquot * (*alloc_dquot)(struct super_block *, int); void (*destroy_dquot)(struct dquot *); int (*acquire_dquot)(struct dquot *); int (*release_dquot)(struct dquot *); int (*mark_dirty)(struct dquot *); int (*write_info)(struct super_block *, int); qsize_t * (*get_reserved_space)(struct inode *); } ; 316 struct quotactl_ops { int (*quota_on)(struct super_block *, int, int, struct path *); int (*quota_on_meta)(struct super_block *, int, int); int (*quota_off)(struct super_block *, int); int (*quota_sync)(struct super_block *, int); int (*get_info)(struct super_block *, int, struct if_dqinfo *); int (*set_info)(struct super_block *, int, struct if_dqinfo *); int (*get_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*set_dqblk)(struct super_block *, struct kqid , struct fs_disk_quota *); int (*get_xstate)(struct super_block *, struct fs_quota_stat *); int (*set_xstate)(struct super_block *, unsigned int, int); int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); int (*rm_xquota)(struct super_block *, unsigned int); } ; 334 struct quota_format_type { int qf_fmt_id; const struct quota_format_ops *qf_ops; struct module *qf_owner; struct quota_format_type *qf_next; } ; 380 struct quota_info { unsigned int flags; struct mutex dqio_mutex; struct mutex dqonoff_mutex; struct inode *files[2U]; struct mem_dqinfo info[2U]; const struct quota_format_ops *ops[2U]; } ; 410 struct writeback_control ; 323 struct address_space_operations { int (*writepage)(struct page *, struct writeback_control *); int (*readpage)(struct file *, struct page *); int (*writepages)(struct address_space *, struct writeback_control *); int (*set_page_dirty)(struct page *); int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); int (*write_begin)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page **, void **); int (*write_end)(struct file *, struct address_space *, loff_t , unsigned int, unsigned int, struct page *, void *); sector_t (*bmap)(struct address_space *, sector_t ); void (*invalidatepage)(struct page *, unsigned int, unsigned int); int (*releasepage)(struct page *, gfp_t ); void (*freepage)(struct page *); ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *, loff_t ); int (*get_xip_mem)(struct address_space *, unsigned long, int, void **, unsigned long *); int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode ); int (*launder_page)(struct page *); int (*is_partially_uptodate)(struct page *, unsigned long, unsigned long); void (*is_dirty_writeback)(struct page *, bool *, bool *); int (*error_remove_page)(struct address_space *, struct page *); int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); void (*swap_deactivate)(struct file *); } ; 382 struct backing_dev_info ; 383 struct address_space { struct inode *host; struct radix_tree_root page_tree; spinlock_t tree_lock; atomic_t i_mmap_writable; struct rb_root i_mmap; struct list_head i_mmap_nonlinear; struct mutex i_mmap_mutex; unsigned long nrpages; unsigned long nrshadows; unsigned long writeback_index; const struct address_space_operations *a_ops; unsigned long flags; struct backing_dev_info *backing_dev_info; spinlock_t private_lock; struct list_head private_list; void *private_data; } ; 405 struct request_queue ; 406 struct hd_struct ; 406 struct gendisk ; 406 struct block_device { dev_t bd_dev; int bd_openers; struct inode *bd_inode; struct super_block *bd_super; struct mutex bd_mutex; struct list_head bd_inodes; void *bd_claiming; void *bd_holder; int bd_holders; bool bd_write_holder; struct list_head bd_holder_disks; struct block_device *bd_contains; unsigned int bd_block_size; struct hd_struct *bd_part; unsigned int bd_part_count; int bd_invalidated; struct gendisk *bd_disk; struct request_queue *bd_queue; struct list_head bd_list; unsigned long bd_private; int bd_fsfreeze_count; struct mutex bd_fsfreeze_mutex; } ; 503 struct posix_acl ; 504 struct inode_operations ; 504 union __anonunion_ldv_21650_177 { const unsigned int i_nlink; unsigned int __i_nlink; } ; 504 union __anonunion_ldv_21670_178 { struct hlist_head i_dentry; struct callback_head i_rcu; } ; 504 struct file_lock ; 504 struct cdev ; 504 union __anonunion_ldv_21687_179 { struct pipe_inode_info *i_pipe; struct block_device *i_bdev; struct cdev *i_cdev; } ; 504 struct inode { umode_t i_mode; unsigned short i_opflags; kuid_t i_uid; kgid_t i_gid; unsigned int i_flags; struct posix_acl *i_acl; struct posix_acl *i_default_acl; const struct inode_operations *i_op; struct super_block *i_sb; struct address_space *i_mapping; void *i_security; unsigned long i_ino; union __anonunion_ldv_21650_177 ldv_21650; dev_t i_rdev; loff_t i_size; struct timespec i_atime; struct timespec i_mtime; struct timespec i_ctime; spinlock_t i_lock; unsigned short i_bytes; unsigned int i_blkbits; blkcnt_t i_blocks; unsigned long i_state; struct mutex i_mutex; unsigned long dirtied_when; struct hlist_node i_hash; struct list_head i_wb_list; struct list_head i_lru; struct list_head i_sb_list; union __anonunion_ldv_21670_178 ldv_21670; u64 i_version; atomic_t i_count; atomic_t i_dio_count; atomic_t i_writecount; atomic_t i_readcount; const struct file_operations *i_fop; struct file_lock *i_flock; struct address_space i_data; struct dquot *i_dquot[2U]; struct list_head i_devices; union __anonunion_ldv_21687_179 ldv_21687; __u32 i_generation; __u32 i_fsnotify_mask; struct hlist_head i_fsnotify_marks; void *i_private; } ; 740 struct fown_struct { rwlock_t lock; struct pid *pid; enum pid_type pid_type; kuid_t uid; kuid_t euid; int signum; } ; 748 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; } ; 771 union __anonunion_f_u_180 { struct llist_node fu_llist; struct callback_head fu_rcuhead; } ; 771 struct file { union __anonunion_f_u_180 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; } ; 861 typedef void *fl_owner_t; 862 struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); } ; 867 struct lock_manager_operations { int (*lm_compare_owner)(struct file_lock *, struct file_lock *); unsigned long int (*lm_owner_key)(struct file_lock *); void (*lm_notify)(struct file_lock *); int (*lm_grant)(struct file_lock *, struct file_lock *, int); void (*lm_break)(struct file_lock *); int (*lm_change)(struct file_lock **, int); } ; 885 struct nlm_lockowner ; 886 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_182 { struct list_head link; int state; } ; 19 union __anonunion_fl_u_181 { struct nfs_lock_info nfs_fl; struct nfs4_lock_info nfs4_fl; struct __anonstruct_afs_182 afs; } ; 19 struct file_lock { struct file_lock *fl_next; struct hlist_node fl_link; struct list_head fl_block; fl_owner_t fl_owner; unsigned int fl_flags; unsigned char fl_type; unsigned int fl_pid; int fl_link_cpu; struct pid *fl_nspid; wait_queue_head_t fl_wait; struct file *fl_file; loff_t fl_start; loff_t fl_end; struct fasync_struct *fl_fasync; unsigned long fl_break_time; unsigned long fl_downgrade_time; const struct file_lock_operations *fl_ops; const struct lock_manager_operations *fl_lmops; union __anonunion_fl_u_181 fl_u; } ; 988 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; } ; 1182 struct sb_writers { struct percpu_counter counter[3U]; wait_queue_head_t wait; int frozen; wait_queue_head_t wait_unfrozen; struct lockdep_map lock_map[3U]; } ; 1198 struct super_operations ; 1198 struct xattr_handler ; 1198 struct mtd_info ; 1198 struct super_block { struct list_head s_list; dev_t s_dev; unsigned char s_blocksize_bits; unsigned long s_blocksize; loff_t s_maxbytes; struct file_system_type *s_type; const struct super_operations *s_op; const struct dquot_operations *dq_op; const struct quotactl_ops *s_qcop; const struct export_operations *s_export_op; unsigned long s_flags; unsigned long s_magic; struct dentry *s_root; struct rw_semaphore s_umount; int s_count; atomic_t s_active; void *s_security; const struct xattr_handler **s_xattr; struct list_head s_inodes; struct hlist_bl_head s_anon; struct list_head s_mounts; struct block_device *s_bdev; struct backing_dev_info *s_bdi; struct mtd_info *s_mtd; struct hlist_node s_instances; struct quota_info s_dquot; struct sb_writers s_writers; char s_id[32U]; u8 s_uuid[16U]; void *s_fs_info; unsigned int s_max_links; fmode_t s_mode; u32 s_time_gran; struct mutex s_vfs_rename_mutex; char *s_subtype; char *s_options; const struct dentry_operations *s_d_op; int cleancache_poolid; struct shrinker s_shrink; atomic_long_t s_remove_count; int s_readonly_remount; struct workqueue_struct *s_dio_done_wq; struct hlist_head s_pins; struct list_lru s_dentry_lru; struct list_lru s_inode_lru; struct callback_head rcu; } ; 1429 struct fiemap_extent_info { unsigned int fi_flags; unsigned int fi_extents_mapped; unsigned int fi_extents_max; struct fiemap_extent *fi_extents_start; } ; 1467 struct dir_context { int (*actor)(void *, const char *, int, loff_t , u64 , unsigned int); loff_t pos; } ; 1472 struct file_operations { struct module *owner; loff_t (*llseek)(struct file *, loff_t , int); ssize_t (*read)(struct file *, char *, size_t , loff_t *); ssize_t (*write)(struct file *, const char *, size_t , loff_t *); ssize_t (*aio_read)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t (*aio_write)(struct kiocb *, const struct iovec *, unsigned long, loff_t ); ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); int (*iterate)(struct file *, struct dir_context *); unsigned int (*poll)(struct file *, struct poll_table_struct *); long int (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); long int (*compat_ioctl)(struct file *, unsigned int, unsigned long); int (*mmap)(struct file *, struct vm_area_struct *); int (*open)(struct inode *, struct file *); int (*flush)(struct file *, fl_owner_t ); int (*release)(struct inode *, struct file *); int (*fsync)(struct file *, loff_t , loff_t , int); int (*aio_fsync)(struct kiocb *, int); int (*fasync)(int, struct file *, int); int (*lock)(struct file *, int, struct file_lock *); ssize_t (*sendpage)(struct file *, struct page *, int, size_t , loff_t *, int); unsigned long int (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); int (*check_flags)(int); int (*flock)(struct file *, int, struct file_lock *); ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t , unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t , unsigned int); int (*setlease)(struct file *, long, struct file_lock **); long int (*fallocate)(struct file *, int, loff_t , loff_t ); int (*show_fdinfo)(struct seq_file *, struct file *); } ; 1514 struct inode_operations { struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); void * (*follow_link)(struct dentry *, struct nameidata *); int (*permission)(struct inode *, int); struct posix_acl * (*get_acl)(struct inode *, int); int (*readlink)(struct dentry *, char *, int); void (*put_link)(struct dentry *, struct nameidata *, void *); int (*create)(struct inode *, struct dentry *, umode_t , bool ); int (*link)(struct dentry *, struct inode *, struct dentry *); int (*unlink)(struct inode *, struct dentry *); int (*symlink)(struct inode *, struct dentry *, const char *); int (*mkdir)(struct inode *, struct dentry *, umode_t ); int (*rmdir)(struct inode *, struct dentry *); int (*mknod)(struct inode *, struct dentry *, umode_t , dev_t ); int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *); int (*rename2)(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*setattr)(struct dentry *, struct iattr *); int (*getattr)(struct vfsmount *, struct dentry *, struct kstat *); int (*setxattr)(struct dentry *, const char *, const void *, size_t , int); ssize_t (*getxattr)(struct dentry *, const char *, void *, size_t ); ssize_t (*listxattr)(struct dentry *, char *, size_t ); int (*removexattr)(struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 , u64 ); int (*update_time)(struct inode *, struct timespec *, int); int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t , int *); int (*tmpfile)(struct inode *, struct dentry *, umode_t ); int (*set_acl)(struct inode *, struct posix_acl *, int); } ; 1561 struct super_operations { struct inode * (*alloc_inode)(struct super_block *); void (*destroy_inode)(struct inode *); void (*dirty_inode)(struct inode *, int); int (*write_inode)(struct inode *, struct writeback_control *); int (*drop_inode)(struct inode *); void (*evict_inode)(struct inode *); void (*put_super)(struct super_block *); int (*sync_fs)(struct super_block *, int); int (*freeze_fs)(struct super_block *); int (*unfreeze_fs)(struct super_block *); int (*statfs)(struct dentry *, struct kstatfs *); int (*remount_fs)(struct super_block *, int *, char *); void (*umount_begin)(struct super_block *); int (*show_options)(struct seq_file *, struct dentry *); int (*show_devname)(struct seq_file *, struct dentry *); int (*show_path)(struct seq_file *, struct dentry *); int (*show_stats)(struct seq_file *, struct dentry *); ssize_t (*quota_read)(struct super_block *, int, char *, size_t , loff_t ); ssize_t (*quota_write)(struct super_block *, int, const char *, size_t , loff_t ); int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t ); long int (*nr_cached_objects)(struct super_block *, int); long int (*free_cached_objects)(struct super_block *, long, int); } ; 1775 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; } ; 2798 struct input_value { __u16 type; __u16 code; __s32 value; } ; 38 struct ff_device ; 38 struct input_mt ; 38 struct input_handle ; 38 struct input_dev { const char *name; const char *phys; const char *uniq; struct input_id id; unsigned long propbit[1U]; unsigned long evbit[1U]; unsigned long keybit[12U]; unsigned long relbit[1U]; unsigned long absbit[1U]; unsigned long mscbit[1U]; unsigned long ledbit[1U]; unsigned long sndbit[1U]; unsigned long ffbit[2U]; unsigned long swbit[1U]; unsigned int hint_events_per_packet; unsigned int keycodemax; unsigned int keycodesize; void *keycode; int (*setkeycode)(struct input_dev *, const struct input_keymap_entry *, unsigned int *); int (*getkeycode)(struct input_dev *, struct input_keymap_entry *); struct ff_device *ff; unsigned int repeat_key; struct timer_list timer; int rep[2U]; struct input_mt *mt; struct input_absinfo *absinfo; unsigned long key[12U]; unsigned long led[1U]; unsigned long snd[1U]; unsigned long sw[1U]; int (*open)(struct input_dev *); void (*close)(struct input_dev *); int (*flush)(struct input_dev *, struct file *); int (*event)(struct input_dev *, unsigned int, unsigned int, int); struct input_handle *grab; spinlock_t event_lock; struct mutex mutex; unsigned int users; bool going_away; struct device dev; struct list_head h_list; struct list_head node; unsigned int num_vals; unsigned int max_vals; struct input_value *vals; bool devres_managed; } ; 191 struct input_handler { void *private; void (*event)(struct input_handle *, unsigned int, unsigned int, int); void (*events)(struct input_handle *, const struct input_value *, unsigned int); bool (*filter)(struct input_handle *, unsigned int, unsigned int, int); bool (*match)(struct input_handler *, struct input_dev *); int (*connect)(struct input_handler *, struct input_dev *, const struct input_device_id *); void (*disconnect)(struct input_handle *); void (*start)(struct input_handle *); bool legacy_minors; int minor; const char *name; const struct input_device_id *id_table; struct list_head h_list; struct list_head node; } ; 306 struct input_handle { void *private; int open; const char *name; struct input_dev *dev; struct input_handler *handler; struct list_head d_node; struct list_head h_node; } ; 473 struct ff_device { int (*upload)(struct input_dev *, struct ff_effect *, struct ff_effect *); int (*erase)(struct input_dev *, int); int (*playback)(struct input_dev *, int, int); void (*set_gain)(struct input_dev *, u16 ); void (*set_autocenter)(struct input_dev *, u16 ); void (*destroy)(struct ff_device *); void *private; unsigned long ffbit[2U]; struct mutex mutex; int max_effects; struct ff_effect *effects; struct file *effect_owners[]; } ; 353 struct hid_collection { unsigned int type; unsigned int usage; unsigned int level; } ; 364 struct hid_usage { unsigned int hid; unsigned int collection_index; unsigned int usage_index; __u16 code; __u8 type; __s8 hat_min; __s8 hat_max; __s8 hat_dir; } ; 376 struct hid_input ; 377 struct hid_report ; 377 struct hid_field { unsigned int physical; unsigned int logical; unsigned int application; struct hid_usage *usage; unsigned int maxusage; unsigned int flags; unsigned int report_offset; unsigned int report_size; unsigned int report_count; unsigned int report_type; __s32 *value; __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; __s32 unit_exponent; unsigned int unit; struct hid_report *report; unsigned int index; struct hid_input *hidinput; __u16 dpad; } ; 403 struct hid_device ; 403 struct hid_report { struct list_head list; unsigned int id; unsigned int type; struct hid_field *field[256U]; unsigned int maxfield; unsigned int size; struct hid_device *device; } ; 415 struct hid_report_enum { unsigned int numbered; struct list_head report_list; struct hid_report *report_id_hash[256U]; } ; 439 struct hid_input { struct list_head list; struct hid_report *report; struct input_dev *input; } ; 452 enum hid_type { HID_TYPE_OTHER = 0, HID_TYPE_USBMOUSE = 1, HID_TYPE_USBNONE = 2 } ; 458 struct hid_driver ; 459 struct hid_ll_driver ; 460 struct hid_device { __u8 *dev_rdesc; unsigned int dev_rsize; __u8 *rdesc; unsigned int rsize; struct hid_collection *collection; unsigned int collection_size; unsigned int maxcollection; unsigned int maxapplication; __u16 bus; __u16 group; __u32 vendor; __u32 product; __u32 version; enum hid_type type; unsigned int country; struct hid_report_enum report_enum[3U]; struct work_struct led_work; struct semaphore driver_lock; struct semaphore driver_input_lock; struct device dev; struct hid_driver *driver; struct hid_ll_driver *ll_driver; unsigned int status; unsigned int claimed; unsigned int quirks; bool io_started; struct list_head inputs; void *hiddev; void *hidraw; int minor; int open; char name[128U]; char phys[64U]; char uniq[64U]; void *driver_data; int (*ff_init)(struct hid_device *); int (*hiddev_connect)(struct hid_device *, unsigned int); void (*hiddev_disconnect)(struct hid_device *); void (*hiddev_hid_event)(struct hid_device *, struct hid_field *, struct hid_usage *, __s32 ); void (*hiddev_report_event)(struct hid_device *, struct hid_report *); unsigned short debug; struct dentry *debug_dir; struct dentry *debug_rdesc; struct dentry *debug_events; struct list_head debug_list; spinlock_t debug_list_lock; wait_queue_head_t debug_wait; } ; 577 struct hid_report_id { __u32 report_type; } ; 597 struct hid_usage_id { __u32 usage_hid; __u32 usage_type; __u32 usage_code; } ; 602 struct hid_driver { char *name; const struct hid_device_id *id_table; struct list_head dyn_list; spinlock_t dyn_lock; int (*probe)(struct hid_device *, const struct hid_device_id *); void (*remove)(struct hid_device *); const struct hid_report_id *report_table; int (*raw_event)(struct hid_device *, struct hid_report *, u8 *, int); const struct hid_usage_id *usage_table; int (*event)(struct hid_device *, struct hid_field *, struct hid_usage *, __s32 ); void (*report)(struct hid_device *, struct hid_report *); __u8 * (*report_fixup)(struct hid_device *, __u8 *, unsigned int *); int (*input_mapping)(struct hid_device *, struct hid_input *, struct hid_field *, struct hid_usage *, unsigned long **, int *); int (*input_mapped)(struct hid_device *, struct hid_input *, struct hid_field *, struct hid_usage *, unsigned long **, int *); void (*input_configured)(struct hid_device *, struct hid_input *); void (*feature_mapping)(struct hid_device *, struct hid_field *, struct hid_usage *); int (*suspend)(struct hid_device *, pm_message_t ); int (*resume)(struct hid_device *); int (*reset_resume)(struct hid_device *); struct device_driver driver; } ; 683 struct hid_ll_driver { int (*start)(struct hid_device *); void (*stop)(struct hid_device *); int (*open)(struct hid_device *); void (*close)(struct hid_device *); int (*power)(struct hid_device *, int); int (*parse)(struct hid_device *); void (*request)(struct hid_device *, struct hid_report *, int); int (*wait)(struct hid_device *); int (*raw_request)(struct hid_device *, unsigned char, __u8 *, size_t , unsigned char, int); int (*output_report)(struct hid_device *, __u8 *, size_t ); int (*idle)(struct hid_device *, int, int, int); } ; 1073 struct cdev { struct kobject kobj; struct module *owner; const struct file_operations *ops; struct list_head list; dev_t dev; unsigned int count; } ; 34 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 } ; 86 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 } ; 94 enum iio_event_info { IIO_EV_INFO_ENABLE = 0, IIO_EV_INFO_VALUE = 1, IIO_EV_INFO_HYSTERESIS = 2, IIO_EV_INFO_PERIOD = 3 } ; 101 enum iio_event_direction { IIO_EV_DIR_EITHER = 0, IIO_EV_DIR_RISING = 1, IIO_EV_DIR_FALLING = 2 } ; 127 enum iio_shared_by { IIO_SEPARATE = 0, IIO_SHARED_BY_TYPE = 1, IIO_SHARED_BY_DIR = 2, IIO_SHARED_BY_ALL = 3 } ; 134 enum iio_endian { IIO_CPU = 0, IIO_BE = 1, IIO_LE = 2 } ; 140 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; } ; 105 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; } ; 163 struct __anonstruct_scan_type_184 { char sign; u8 realbits; u8 storagebits; u8 shift; u8 repeat; enum iio_endian endianness; } ; 163 struct iio_chan_spec { enum iio_chan_type type; int channel; int channel2; unsigned long address; int scan_index; struct __anonstruct_scan_type_184 scan_type; long info_mask_separate; long info_mask_shared_by_type; long info_mask_shared_by_dir; long info_mask_shared_by_all; 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; } ; 282 struct iio_trigger ; 283 struct iio_info { struct module *driver_module; 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 (*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 *); } ; 387 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 *); } ; 407 struct iio_event_interface ; 407 struct iio_buffer ; 407 struct iio_poll_func ; 407 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; struct iio_poll_func *pollfunc; 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; 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; } ; 610 struct iio_subirq { bool enabled; } ; 20 struct iio_trigger_ops { struct module *owner; int (*set_trigger_state)(struct iio_trigger *, bool ); int (*try_reenable)(struct iio_trigger *); int (*validate_device)(struct iio_trigger *, struct iio_dev *); } ; 39 struct iio_trigger { const struct iio_trigger_ops *ops; int id; const char *name; struct device dev; struct list_head list; struct list_head alloc_list; atomic_t use_count; struct irq_chip subirq_chip; int subirq_base; struct iio_subirq subirqs[2U]; unsigned long pool[1U]; struct mutex pool_lock; } ; 142 struct hid_sensor_hub_attribute_info { u32 usage_id; u32 attrib_id; s32 report_id; s32 index; s32 units; s32 unit_expo; s32 size; s32 logical_minimum; s32 logical_maximum; } ; 48 struct hid_sensor_hub_device { struct hid_device *hdev; u32 vendor_id; u32 product_id; int start_collection_index; int end_collection_index; } ; 64 struct hid_sensor_hub_callbacks { struct platform_device *pdev; int (*suspend)(struct hid_sensor_hub_device *, void *); int (*resume)(struct hid_sensor_hub_device *, void *); int (*capture_sample)(struct hid_sensor_hub_device *, u32 , size_t , char *, void *); int (*send_event)(struct hid_sensor_hub_device *, u32 , void *); } ; 183 struct hid_sensor_common { struct hid_sensor_hub_device *hsdev; struct platform_device *pdev; unsigned int usage_id; atomic_t data_ready; struct iio_trigger *trigger; struct hid_sensor_hub_attribute_info poll; struct hid_sensor_hub_attribute_info report_state; struct hid_sensor_hub_attribute_info power_state; struct hid_sensor_hub_attribute_info sensitivity; } ; 47 struct iio_buffer_access_funcs { int (*store_to)(struct iio_buffer *, const void *); int (*read_first_n)(struct iio_buffer *, size_t , char *); bool (*data_available)(struct iio_buffer *); int (*request_update)(struct iio_buffer *); int (*get_bytes_per_datum)(struct iio_buffer *); int (*set_bytes_per_datum)(struct iio_buffer *, size_t ); int (*get_length)(struct iio_buffer *); int (*set_length)(struct iio_buffer *, int); void (*release)(struct iio_buffer *); } ; 59 struct iio_buffer { int length; int bytes_per_datum; struct attribute_group *scan_el_attrs; long *scan_mask; bool scan_timestamp; const struct iio_buffer_access_funcs *access; struct list_head scan_el_dev_attr_list; struct attribute_group scan_el_group; wait_queue_head_t pollq; bool stufftoread; const struct attribute_group *attrs; struct list_head demux_list; void *demux_bounce; struct list_head buffer_list; struct kref ref; } ; 232 struct iio_poll_func { struct iio_dev *indio_dev; irqreturn_t (*h)(int, void *); irqreturn_t (*thread)(int, void *); int type; char *name; int irq; s64 timestamp; } ; 26 struct prox_state { struct hid_sensor_hub_callbacks callbacks; struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info prox_attr; u32 human_presence; } ; 680 typedef int ldv_func_ret_type; 705 typedef int ldv_func_ret_type___0; 719 typedef int ldv_func_ret_type___1; 768 typedef int ldv_func_ret_type___2; 29 struct attribute___0 { const char *name; umode_t mode; bool ignore_lockdep; struct lock_class_key *key; struct lock_class_key skey; } ; 60 struct attribute_group___0 { const char *name; umode_t (*is_visible)(struct kobject___0 *, struct attribute___0 *, int); struct attribute___0 **attrs; struct bin_attribute___0 **bin_attrs; } ; 121 struct bin_attribute___0 { struct attribute___0 attr; size_t size; void *private; ssize_t (*read)(struct file *, struct kobject___0 *, struct bin_attribute___0 *, char *, loff_t , size_t ); ssize_t (*write)(struct file *, struct kobject___0 *, struct bin_attribute___0 *, char *, loff_t , size_t ); int (*mmap)(struct file *, struct kobject___0 *, struct bin_attribute___0 *attr, struct vm_area_struct *vma); } ; 175 struct sysfs_ops___0 { ssize_t (*show)(struct kobject___0 *, struct attribute___0 *, char *); ssize_t (*store)(struct kobject___0 *, struct attribute___0 *, const char *, size_t ); } ; 63 struct kobject___0 { const char *name; struct list_head entry; struct kobject___0 *parent; struct kset *kset; struct kobj_type___0 *ktype; struct kernfs_node *sd; struct kref kref; struct delayed_work release; unsigned int state_initialized; unsigned int state_in_sysfs; unsigned int state_add_uevent_sent; unsigned int state_remove_uevent_sent; unsigned int uevent_suppress; } ; 115 struct kobj_type___0 { void (*release)(struct kobject___0 *kobj); const struct sysfs_ops___0 *sysfs_ops; struct attribute___0 **default_attrs; const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject___0 *kobj); const void * (*namespace)(struct kobject___0 *kobj); } ; 295 struct dev_pm_ops___0 { int (*prepare)(struct device___0 *dev); void (*complete)(struct device___0 *dev); int (*suspend)(struct device___0 *dev); int (*resume)(struct device___0 *dev); int (*freeze)(struct device___0 *dev); int (*thaw)(struct device___0 *dev); int (*poweroff)(struct device___0 *dev); int (*restore)(struct device___0 *dev); int (*suspend_late)(struct device___0 *dev); int (*resume_early)(struct device___0 *dev); int (*freeze_late)(struct device___0 *dev); int (*thaw_early)(struct device___0 *dev); int (*poweroff_late)(struct device___0 *dev); int (*restore_early)(struct device___0 *dev); int (*suspend_noirq)(struct device___0 *dev); int (*resume_noirq)(struct device___0 *dev); int (*freeze_noirq)(struct device___0 *dev); int (*thaw_noirq)(struct device___0 *dev); int (*poweroff_noirq)(struct device___0 *dev); int (*restore_noirq)(struct device___0 *dev); int (*runtime_suspend)(struct device___0 *dev); int (*runtime_resume)(struct device___0 *dev); int (*runtime_idle)(struct device___0 *dev); } ; 558 struct dev_pm_info___0 { pm_message_t power_state; unsigned int can_wakeup; unsigned int async_suspend; bool is_prepared; bool is_suspended; bool is_noirq_suspended; bool is_late_suspended; bool ignore_children; bool early_init; bool direct_complete; spinlock_t lock; struct list_head entry; struct completion completion; struct wakeup_source___0 *wakeup; bool wakeup_path; bool syscore; struct timer_list suspend_timer; unsigned long timer_expires; struct work_struct work; wait_queue_head_t wait_queue; atomic_t usage_count; atomic_t child_count; unsigned int disable_depth; unsigned int idle_notification; unsigned int request_pending; unsigned int deferred_resume; unsigned int run_wake; unsigned int runtime_auto; unsigned int no_callbacks; unsigned int irq_safe; unsigned int use_autosuspend; unsigned int timer_autosuspends; unsigned int memalloc_noio; enum rpm_request request; enum rpm_status runtime_status; int runtime_error; int autosuspend_delay; unsigned long last_busy; unsigned long active_jiffies; unsigned long suspended_jiffies; unsigned long accounting_timestamp; struct pm_subsys_data *subsys_data; void (*set_latency_tolerance)(struct device___0 *, s32 ); struct dev_pm_qos *qos; } ; 620 struct dev_pm_domain___0 { struct dev_pm_ops___0 ops; } ; 104 struct bus_type___0 { const char *name; const char *dev_name; struct device___0 *dev_root; struct device_attribute___0 *dev_attrs; const struct attribute_group___0 **bus_groups; const struct attribute_group___0 **dev_groups; const struct attribute_group___0 **drv_groups; int (*match)(struct device___0 *dev, struct device_driver___0 *drv); int (*uevent)(struct device___0 *dev, struct kobj_uevent_env *env); int (*probe)(struct device___0 *dev); int (*remove)(struct device___0 *dev); void (*shutdown)(struct device___0 *dev); int (*online)(struct device___0 *dev); int (*offline)(struct device___0 *dev); int (*suspend)(struct device___0 *dev, pm_message_t state); int (*resume)(struct device___0 *dev); const struct dev_pm_ops___0 *pm; const struct iommu_ops *iommu_ops; struct subsys_private *p; struct lock_class_key lock_key; } ; 228 struct device_driver___0 { const char *name; struct bus_type___0 *bus; struct module *owner; const char *mod_name; bool suppress_bind_attrs; const struct of_device_id *of_match_table; const struct acpi_device_id *acpi_match_table; int (*probe)(struct device___0 *dev); int (*remove)(struct device___0 *dev); void (*shutdown)(struct device___0 *dev); int (*suspend)(struct device___0 *dev, pm_message_t state); int (*resume)(struct device___0 *dev); const struct attribute_group___0 **groups; const struct dev_pm_ops___0 *pm; struct driver_private *p; } ; 351 struct class___0 { const char *name; struct module *owner; struct class_attribute___0 *class_attrs; const struct attribute_group___0 **dev_groups; struct kobject___0 *dev_kobj; int (*dev_uevent)(struct device___0 *dev, struct kobj_uevent_env *env); char * (*devnode)(struct device___0 *dev, umode_t *mode); void (*class_release)(struct class___0 *class); void (*dev_release)(struct device___0 *dev); int (*suspend)(struct device___0 *dev, pm_message_t state); int (*resume)(struct device___0 *dev); const struct kobj_ns_type_operations *ns_type; const void * (*namespace)(struct device___0 *dev); const struct dev_pm_ops___0 *pm; struct subsys_private *p; } ; 417 struct class_attribute___0 { struct attribute___0 attr; ssize_t (*show)(struct class___0 *class, struct class_attribute___0 *attr, char *buf); ssize_t (*store)(struct class___0 *class, struct class_attribute___0 *attr, const char *buf, size_t count); } ; 500 struct device_type___0 { const char *name; const struct attribute_group___0 **groups; int (*uevent)(struct device___0 *dev, struct kobj_uevent_env *env); char * (*devnode)(struct device___0 *dev, umode_t *mode, kuid_t *uid, kgid_t *gid); void (*release)(struct device___0 *dev); const struct dev_pm_ops___0 *pm; } ; 512 struct device_attribute___0 { struct attribute___0 attr; ssize_t (*show)(struct device___0 *dev, struct device_attribute___0 *attr, char *buf); ssize_t (*store)(struct device___0 *dev, struct device_attribute___0 *attr, const char *buf, size_t count); } ; 729 struct device___0 { struct device___0 *parent; struct device_private *p; struct kobject___0 kobj; const char *init_name; const struct device_type___0 *type; struct mutex mutex; struct bus_type___0 *bus; struct device_driver___0 *driver; void *platform_data; void *driver_data; struct dev_pm_info___0 power; struct dev_pm_domain___0 *pm_domain; struct dev_pin_info *pins; int numa_node; u64 *dma_mask; u64 coherent_dma_mask; unsigned long dma_pfn_offset; struct device_dma_parameters *dma_parms; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct cma *cma_area; struct dev_archdata archdata; struct device_node *of_node; struct acpi_dev_node acpi_node; dev_t devt; u32 id; spinlock_t devres_lock; struct list_head devres_head; struct klist_node knode_class; struct class___0 *class; const struct attribute_group___0 **groups; void (*release)(struct device___0 *dev); struct iommu_group *iommu_group; bool offline_disabled; bool offline; } ; 46 struct wakeup_source___0 { const char *name; struct list_head entry; spinlock_t lock; struct timer_list timer; unsigned long timer_expires; ktime_t total_time; ktime_t max_time; ktime_t last_time; ktime_t start_prevent_time; ktime_t prevent_sleep_time; unsigned long event_count; unsigned long active_count; unsigned long relax_count; unsigned long expire_count; unsigned long wakeup_count; bool active; bool autosleep_enabled; } ; 1 long int __builtin_expect(long exp, long c); 33 extern struct module __this_module; 53 int __dynamic_dev_dbg(struct _ddebug *, const struct device *, const char *, ...); 14 void ldv_error(); 24 void ldv_stop(); 29 int ldv_undef_int(); 30 void * ldv_undef_ptr(); 33 void * __VERIFIER_alloc(size_t size); 35 void * ldv_successful_alloc(size_t size); 58 int ldv_undef_int_nonpositive(); 79 void __builtin_trap(); 16 void * ldv_alloc(size_t size); 18 void ldv_free(); 24 void * ldv_zalloc_without_counter(size_t size); 123 void * ldv_kmemdup_11(const void *ldv_func_arg1, size_t ldv_func_arg2, gfp_t ldv_func_arg3); 25 int atomic_read(const atomic_t *v); 37 void atomic_set(atomic_t *v, int i); 144 void kfree(const void *); 147 void ldv_kfree_15(const void *ldv_func_arg1); 151 void ldv_kfree_17(const void *ldv_func_arg1); 33 int LDV_IN_INTERRUPT = 1; 34 const struct iio_chan_spec *prox_info_group1 = 0; 35 int ldv_state_variable_2 = 0; 36 int __VERIFIER_nondet_int(); 37 int ref_cnt = 0; 38 struct iio_dev *prox_info_group0 = 0; 39 int ldv_state_variable_1 = 0; 40 int probed_1 = 0; 41 int ldv_state_variable_0 = 0; 42 struct platform_device *hid_prox_platform_driver_group1 = 0; 43 void ldv_initialyze_iio_info_2(); 44 void ldv_platform_probe_1(int (*probe)(struct platform_device *)); 46 void ldv_platform_driver_init_1(); 839 void * dev_get_drvdata(const struct device *dev); 844 void dev_set_drvdata(struct device *dev, void *data); 1044 int dev_err(const struct device *, const char *, ...); 193 int __platform_driver_register(struct platform_driver *, struct module *); 197 int ldv___platform_driver_register_18(struct platform_driver *ldv_func_arg1, struct module *ldv_func_arg2); 199 void platform_driver_unregister(struct platform_driver *); 202 void ldv_platform_driver_unregister_19(struct platform_driver *ldv_func_arg1); 211 void * platform_get_drvdata(const struct platform_device *pdev); 216 void platform_set_drvdata(struct platform_device *pdev, void *data); 123 int request_threaded_irq(unsigned int, irqreturn_t (*)(int, void *), irqreturn_t (*)(int, void *), unsigned long, const char *, void *); 128 int ldv_request_threaded_irq_9(unsigned int ldv_func_arg1, irqreturn_t (*ldv_func_arg2)(int, void *), irqreturn_t (*ldv_func_arg3)(int, void *), unsigned long ldv_func_arg4, const char *ldv_func_arg5, void *ldv_func_arg6); 47 unsigned long int msleep_interruptible(unsigned int); 492 int iio_device_register(struct iio_dev *); 495 int ldv_iio_device_register_12(struct iio_dev *ldv_func_arg1); 497 void iio_device_unregister(struct iio_dev *); 500 void ldv_iio_device_unregister_14(struct iio_dev *ldv_func_arg1); 504 void ldv_iio_device_unregister_16(struct iio_dev *ldv_func_arg1); 561 void * iio_priv(const struct iio_dev *indio_dev); 576 struct iio_dev * ldv_devm_iio_device_alloc_10(struct device *ldv_func_arg1, int ldv_func_arg2); 113 int sensor_hub_register_callback(struct hid_sensor_hub_device *, u32 , struct hid_sensor_hub_callbacks *); 118 int ldv_sensor_hub_register_callback_13(struct hid_sensor_hub_device *ldv_func_arg1, u32 ldv_func_arg2, struct hid_sensor_hub_callbacks *ldv_func_arg3); 125 int sensor_hub_remove_callback(struct hid_sensor_hub_device *, u32 ); 142 int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *, u8 , u32 , u32 , struct hid_sensor_hub_attribute_info *); 158 int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *, u32 , u32 , u32 ); 201 int hid_sensor_convert_exponent(int unit_expo); 211 int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *, u32 , struct hid_sensor_common *); 214 int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *, int, int); 216 int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *, int *, int *); 218 int hid_sensor_write_samp_freq_value(struct hid_sensor_common *, int, int); 220 int hid_sensor_read_samp_freq_value(struct hid_sensor_common *, int *, int *); 230 s32 hid_sensor_read_poll_value(struct hid_sensor_common *); 133 int iio_push_to_buffers(struct iio_dev *, const void *); 52 irqreturn_t iio_pollfunc_store_time(int, void *); 9 int iio_triggered_buffer_setup(struct iio_dev *, irqreturn_t (*)(int, void *), irqreturn_t (*)(int, void *), const struct iio_buffer_setup_ops *); 13 void iio_triggered_buffer_cleanup(struct iio_dev *); 22 int hid_sensor_setup_trigger(struct iio_dev *, const char *, struct hid_sensor_common *); 24 void hid_sensor_remove_trigger(struct hid_sensor_common *); 25 int hid_sensor_power_state(struct hid_sensor_common *, bool ); 89 const struct iio_chan_spec prox_channels[1U] = { { 8, 0, 0, 0UL, 0, { 0, 0U, 0U, 0U, 0U, 0 }, 1L, 34828L, 0L, 0L, 0, 0U, 0, 0, 0, 1U, 0U, 0U, 0U } }; 104 void prox_adjust_channel_bit_mask(struct iio_chan_spec *channels, int channel, int size); 115 int prox_read_raw(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int *val, int *val2, long mask); 189 int prox_write_raw(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, int val, int val2, long mask); 214 const struct iio_info prox_info = { &__this_module, 0, 0, &prox_read_raw, 0, &prox_write_raw, 0, 0, 0, 0, 0, 0, 0, 0 }; 221 void hid_sensor_push_data(struct iio_dev *indio_dev, const void *data, int len); 229 int prox_proc_event(struct hid_sensor_hub_device *hsdev, unsigned int usage_id, void *priv); 246 int prox_capture_sample(struct hid_sensor_hub_device *hsdev, unsigned int usage_id, size_t raw_len, char *raw_data, void *priv); 268 int prox_parse_report(struct platform_device *pdev, struct hid_sensor_hub_device *hsdev, struct iio_chan_spec *channels, unsigned int usage_id, struct prox_state *st); 303 int hid_prox_probe(struct platform_device *pdev); 394 int hid_prox_remove(struct platform_device *pdev); 409 struct platform_device_id hid_prox_ids[2U] = { { { 'H', 'I', 'D', '-', 'S', 'E', 'N', 'S', 'O', 'R', '-', '2', '0', '0', '0', '1', '1', '\x0' }, 0UL } }; 416 const struct platform_device_id __mod_platform__hid_prox_ids_device_table = { }; 418 struct platform_driver hid_prox_platform_driver = { &hid_prox_probe, &hid_prox_remove, 0, 0, 0, { "hid_sensor_prox", 0, &__this_module, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, (const struct platform_device_id *)(&hid_prox_ids), 0 }; 427 int hid_prox_platform_driver_init(); 427 void hid_prox_platform_driver_exit(); 433 int ldv_retval_0 = 0; 434 int ldv_retval_1 = 0; 435 void ldv_initialize(); 436 int ldv_release_2(); 437 void ldv_check_final_state(); 438 int ldv_probe_2(); 439 int ldv_retval_2 = 0; 470 void entry_point(); 14 void ldv_error___0(); 24 void ldv_stop___0(); 34 void * ldv_zalloc(size_t size); 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_alloc_count = 0; 11 void (*gadget_release_pointer)(struct device___0 *_dev) = 0; 22 void ldv_assume_and_increase(void *res); 26 void * ldv_zero_alloc(size_t size); 43 void * ldv_nonzero_alloc(size_t size); 56 void * ldv_alloc_without_counter(size_t size); 80 void ldv_condition_free(); 89 void ldv_save_gadget_release(void (*func)(struct device___0 *_dev)); 94 int ldv_dev_set_drvdata(struct device___0 *dev, void *data); 100 void * ldv_dev_get_drvdata(const struct device___0 *dev); return ; } { 472 int *ldvarg1; 473 int ldvarg4; 474 int ldvarg3; 475 int *ldvarg0; 476 long ldvarg5; 477 long ldvarg2; 478 int tmp; 479 int tmp___0; 480 int tmp___1; 481 int tmp___2; 471 ldv_initialize() { /* Function call is skipped due to function is undefined */} 480 ldv_state_variable_1 = 0; 481 ref_cnt = 0; 482 ldv_state_variable_0 = 1; 483 ldv_state_variable_2 = 0; 484 ldv_25803:; 485 tmp = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 485 switch (tmp) 536 tmp___1 = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 536 switch (tmp___1) { 429 int tmp; { } 768 ldv_func_ret_type___2 ldv_func_res; 769 int tmp; 770 tmp = __platform_driver_register(ldv_func_arg1, ldv_func_arg2) { /* Function call is skipped due to function is undefined */} 770 ldv_func_res = tmp; 772 ldv_state_variable_1 = 1; { } 460 void *tmp; { 37 void *ret; 38 void *tmp; 37 tmp = __VERIFIER_alloc(size) { /* Function call is skipped due to function is undefined */} 37 ret = tmp; } 459 hid_prox_platform_driver_group1 = (struct platform_device *)tmp; } 558 ldv_state_variable_0 = 2; 562 goto ldv_25792; 567 goto ldv_25788; 622 goto ldv_25803; 485 tmp = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 485 switch (tmp) 490 tmp___0 = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 490 switch (tmp___0) { 305 int ret; 306 const char *name; 307 struct iio_dev *indio_dev; 308 struct prox_state *prox_state; 309 struct hid_sensor_hub_device *hsdev; 310 struct iio_chan_spec *channels; 311 void *tmp; 312 void *tmp___0; 305 ret = 0; 306 name = "prox"; 309 hsdev = (struct hid_sensor_hub_device *)(pdev->dev.platform_data); { 691 void *tmp; { } 66 void *res; 67 void *tmp; 66 tmp = ldv_zalloc(size) { /* Function call is skipped due to function is undefined */} 66 res = tmp; } { } 318 prox_state = (struct prox_state *)tmp; 319 prox_state->common_attributes.hsdev = hsdev; 320 prox_state->common_attributes.pdev = pdev; 322 ret = hid_sensor_parse_common_attributes(hsdev, 2097169U, &(prox_state->common_attributes)) { /* Function call is skipped due to function is undefined */} { 699 void *tmp; { } 21 void *res; 22 void *tmp; 21 tmp = __VERIFIER_alloc(size) { /* Function call is skipped due to function is undefined */} 21 res = tmp; } 329 channels = (struct iio_chan_spec *)tmp___0; { 272 int ret; 273 struct _ddebug descriptor; 274 long tmp; 275 struct _ddebug descriptor___0; 276 long tmp___0; 276 ret = sensor_hub_input_get_attribute_info(hsdev, 0, usage_id, 2098353U, &(st->prox_attr)) { /* Function call is skipped due to function is undefined */} { 107 (channels + ((unsigned long)channel))->scan_type.sign = 115; 109 (channels + ((unsigned long)channel))->scan_type.realbits = ((unsigned int)((u8 )size)) * 8U; 111 (channels + ((unsigned long)channel))->scan_type.storagebits = 32U; } 285 descriptor.modname = "hid_sensor_prox"; 285 descriptor.function = "prox_parse_report"; 285 descriptor.filename = "/home/ldvuser/andrianov/work/current--X--drivers/--X--defaultlinux-3.17-rc1.tar.xz--X--104_1a--X--cpachecker/linux-3.17-rc1.tar.xz/csd_deg_dscv/3939/dscv_tempdir/dscv/ri/104_1a/drivers/iio/light/hid-sensor-prox.c.prepared"; 285 descriptor.format = "prox %x:%x\n"; 285 descriptor.lineno = 286U; 285 descriptor.flags = 0U; } 338 dev_err((const struct device *)(&(pdev->dev)), "failed to setup attributes\n") { /* Function call is skipped due to function is undefined */} 339 goto error_free_dev_mem; 389 const void *__CPAchecker_TMP_0 = (const void *)(indio_dev->channels); } 503 goto ldv_25785; 531 goto ldv_25788; 622 goto ldv_25803; 485 tmp = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 485 switch (tmp) 536 tmp___1 = __VERIFIER_nondet_int() { /* Function call is skipped due to function is undefined */} 536 switch (tmp___1) { { } 780 platform_driver_unregister(ldv_func_arg1) { /* Function call is skipped due to function is undefined */} 782 ldv_state_variable_1 = 0; } 542 ldv_state_variable_0 = 3; 543 goto ldv_final; 623 ldv_final:; } | Source code 1
2 #include <linux/kernel.h>
3 bool ldv_is_err(const void *ptr);
4 bool ldv_is_err_or_null(const void *ptr);
5 void* ldv_err_ptr(long error);
6 long ldv_ptr_err(const void *ptr);
7
8 /* TODO: this include should be avoided here while bindings below should
9 * call just model functions from LDV_COMMON_MODEL rather then, say,
10 * ldv_undef_int_negative(). */
11 #include <verifier/rcv.h>
12 // Provide model function prototypes before their usage.
13 //for dev_get_drvdata, dev_set_drvdata
14 //#include <linux/device.h>
15
16 void* ldv_alloc(size_t size);
17 void* ldv_zero_alloc(size_t size);
18 void ldv_free(void);
19 void ldv_condition_free(void);
20 void ldv_save_gadget_release(void (*func)(struct device *_dev));
21 void *ldv_dev_get_drvdata(const struct device *dev);
22 int ldv_dev_set_drvdata(struct device *dev, void *data);
23 void* ldv_alloc_without_counter(size_t size);
24 void* ldv_zalloc_without_counter(size_t size);
25 void* ldv_nonzero_alloc(size_t size);
26 void* __VERIFIER_alloc(size_t size);
27 void* ldv_zalloc(size_t size);
28 void ldv_assume_and_increase(void* res) ;
29
30 #include <linux/slab.h>
31 #include <verifier/rcv.h>
32 #include <linux/gfp.h>
33 int LDV_IN_INTERRUPT = 1;
34 struct iio_chan_spec const *prox_info_group1;
35 int ldv_state_variable_2;
36 int __VERIFIER_nondet_int(void);
37 int ref_cnt;
38 struct iio_dev *prox_info_group0;
39 int ldv_state_variable_1;
40 int probed_1=0;
41 int ldv_state_variable_0;
42 struct platform_device *hid_prox_platform_driver_group1;
43 void ldv_initialyze_iio_info_2(void);
44 void ldv_platform_probe_1(int (*probe)(struct platform_device *));
45 int __VERIFIER_nondet_int(void);
46 void ldv_platform_driver_init_1(void);
47 /*
48 * HID Sensors Driver
49 * Copyright (c) 2014, Intel Corporation.
50 *
51 * This program is free software; you can redistribute it and/or modify it
52 * under the terms and conditions of the GNU General Public License,
53 * version 2, as published by the Free Software Foundation.
54 *
55 * This program is distributed in the hope it will be useful, but WITHOUT
56 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
57 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
58 * more details.
59 *
60 * You should have received a copy of the GNU General Public License along with
61 * this program.
62 *
63 */
64 #include <linux/device.h>
65 #include <linux/platform_device.h>
66 #include <linux/module.h>
67 #include <linux/interrupt.h>
68 #include <linux/irq.h>
69 #include <linux/slab.h>
70 #include <linux/delay.h>
71 #include <linux/hid-sensor-hub.h>
72 #include <linux/iio/iio.h>
73 #include <linux/iio/sysfs.h>
74 #include <linux/iio/buffer.h>
75 #include <linux/iio/trigger_consumer.h>
76 #include <linux/iio/triggered_buffer.h>
77 #include "../common/hid-sensors/hid-sensor-trigger.h"
78
79 #define CHANNEL_SCAN_INDEX_PRESENCE 0
80
81 struct prox_state {
82 struct hid_sensor_hub_callbacks callbacks;
83 struct hid_sensor_common common_attributes;
84 struct hid_sensor_hub_attribute_info prox_attr;
85 u32 human_presence;
86 };
87
88 /* Channel definitions */
89 static const struct iio_chan_spec prox_channels[] = {
90 {
91 .type = IIO_PROXIMITY,
92 .modified = 1,
93 .channel2 = IIO_NO_MOD,
94 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
95 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
96 BIT(IIO_CHAN_INFO_SCALE) |
97 BIT(IIO_CHAN_INFO_SAMP_FREQ) |
98 BIT(IIO_CHAN_INFO_HYSTERESIS),
99 .scan_index = CHANNEL_SCAN_INDEX_PRESENCE,
100 }
101 };
102
103 /* Adjust channel real bits based on report descriptor */
104 static void prox_adjust_channel_bit_mask(struct iio_chan_spec *channels,
105 int channel, int size)
106 {
107 channels[channel].scan_type.sign = 's';
108 /* Real storage bits will change based on the report desc. */
109 channels[channel].scan_type.realbits = size * 8;
110 /* Maximum size of a sample to capture is u32 */
111 channels[channel].scan_type.storagebits = sizeof(u32) * 8;
112 }
113
114 /* Channel read_raw handler */
115 static int prox_read_raw(struct iio_dev *indio_dev,
116 struct iio_chan_spec const *chan,
117 int *val, int *val2,
118 long mask)
119 {
120 struct prox_state *prox_state = iio_priv(indio_dev);
121 int report_id = -1;
122 u32 address;
123 int ret_type;
124 s32 poll_value;
125
126 *val = 0;
127 *val2 = 0;
128 switch (mask) {
129 case IIO_CHAN_INFO_RAW:
130 switch (chan->scan_index) {
131 case CHANNEL_SCAN_INDEX_PRESENCE:
132 report_id = prox_state->prox_attr.report_id;
133 address =
134 HID_USAGE_SENSOR_HUMAN_PRESENCE;
135 break;
136 default:
137 report_id = -1;
138 break;
139 }
140 if (report_id >= 0) {
141 poll_value = hid_sensor_read_poll_value(
142 &prox_state->common_attributes);
143 if (poll_value < 0)
144 return -EINVAL;
145
146 hid_sensor_power_state(&prox_state->common_attributes,
147 true);
148
149 msleep_interruptible(poll_value * 2);
150
151 *val = sensor_hub_input_attr_get_raw_value(
152 prox_state->common_attributes.hsdev,
153 HID_USAGE_SENSOR_PROX, address,
154 report_id);
155 hid_sensor_power_state(&prox_state->common_attributes,
156 false);
157 } else {
158 *val = 0;
159 return -EINVAL;
160 }
161 ret_type = IIO_VAL_INT;
162 break;
163 case IIO_CHAN_INFO_SCALE:
164 *val = prox_state->prox_attr.units;
165 ret_type = IIO_VAL_INT;
166 break;
167 case IIO_CHAN_INFO_OFFSET:
168 *val = hid_sensor_convert_exponent(
169 prox_state->prox_attr.unit_expo);
170 ret_type = IIO_VAL_INT;
171 break;
172 case IIO_CHAN_INFO_SAMP_FREQ:
173 ret_type = hid_sensor_read_samp_freq_value(
174 &prox_state->common_attributes, val, val2);
175 break;
176 case IIO_CHAN_INFO_HYSTERESIS:
177 ret_type = hid_sensor_read_raw_hyst_value(
178 &prox_state->common_attributes, val, val2);
179 break;
180 default:
181 ret_type = -EINVAL;
182 break;
183 }
184
185 return ret_type;
186 }
187
188 /* Channel write_raw handler */
189 static int prox_write_raw(struct iio_dev *indio_dev,
190 struct iio_chan_spec const *chan,
191 int val,
192 int val2,
193 long mask)
194 {
195 struct prox_state *prox_state = iio_priv(indio_dev);
196 int ret = 0;
197
198 switch (mask) {
199 case IIO_CHAN_INFO_SAMP_FREQ:
200 ret = hid_sensor_write_samp_freq_value(
201 &prox_state->common_attributes, val, val2);
202 break;
203 case IIO_CHAN_INFO_HYSTERESIS:
204 ret = hid_sensor_write_raw_hyst_value(
205 &prox_state->common_attributes, val, val2);
206 break;
207 default:
208 ret = -EINVAL;
209 }
210
211 return ret;
212 }
213
214 static const struct iio_info prox_info = {
215 .driver_module = THIS_MODULE,
216 .read_raw = &prox_read_raw,
217 .write_raw = &prox_write_raw,
218 };
219
220 /* Function to push data to buffer */
221 static void hid_sensor_push_data(struct iio_dev *indio_dev, const void *data,
222 int len)
223 {
224 dev_dbg(&indio_dev->dev, "hid_sensor_push_data\n");
225 iio_push_to_buffers(indio_dev, data);
226 }
227
228 /* Callback handler to send event after all samples are received and captured */
229 static int prox_proc_event(struct hid_sensor_hub_device *hsdev,
230 unsigned usage_id,
231 void *priv)
232 {
233 struct iio_dev *indio_dev = platform_get_drvdata(priv);
234 struct prox_state *prox_state = iio_priv(indio_dev);
235
236 dev_dbg(&indio_dev->dev, "prox_proc_event\n");
237 if (atomic_read(&prox_state->common_attributes.data_ready))
238 hid_sensor_push_data(indio_dev,
239 &prox_state->human_presence,
240 sizeof(prox_state->human_presence));
241
242 return 0;
243 }
244
245 /* Capture samples in local storage */
246 static int prox_capture_sample(struct hid_sensor_hub_device *hsdev,
247 unsigned usage_id,
248 size_t raw_len, char *raw_data,
249 void *priv)
250 {
251 struct iio_dev *indio_dev = platform_get_drvdata(priv);
252 struct prox_state *prox_state = iio_priv(indio_dev);
253 int ret = -EINVAL;
254
255 switch (usage_id) {
256 case HID_USAGE_SENSOR_HUMAN_PRESENCE:
257 prox_state->human_presence = *(u32 *)raw_data;
258 ret = 0;
259 break;
260 default:
261 break;
262 }
263
264 return ret;
265 }
266
267 /* Parse report which is specific to an usage id*/
268 static int prox_parse_report(struct platform_device *pdev,
269 struct hid_sensor_hub_device *hsdev,
270 struct iio_chan_spec *channels,
271 unsigned usage_id,
272 struct prox_state *st)
273 {
274 int ret;
275
276 ret = sensor_hub_input_get_attribute_info(hsdev, HID_INPUT_REPORT,
277 usage_id,
278 HID_USAGE_SENSOR_HUMAN_PRESENCE,
279 &st->prox_attr);
280 if (ret < 0)
281 return ret;
282 prox_adjust_channel_bit_mask(channels, CHANNEL_SCAN_INDEX_PRESENCE,
283 st->prox_attr.size);
284
285 dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
286 st->prox_attr.report_id);
287
288 /* Set Sensitivity field ids, when there is no individual modifier */
289 if (st->common_attributes.sensitivity.index < 0) {
290 sensor_hub_input_get_attribute_info(hsdev,
291 HID_FEATURE_REPORT, usage_id,
292 HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
293 HID_USAGE_SENSOR_DATA_PRESENCE,
294 &st->common_attributes.sensitivity);
295 dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
296 st->common_attributes.sensitivity.index,
297 st->common_attributes.sensitivity.report_id);
298 }
299 return ret;
300 }
301
302 /* Function to initialize the processing for usage id */
303 static int hid_prox_probe(struct platform_device *pdev)
304 {
305 int ret = 0;
306 static const char *name = "prox";
307 struct iio_dev *indio_dev;
308 struct prox_state *prox_state;
309 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
310 struct iio_chan_spec *channels;
311
312 indio_dev = devm_iio_device_alloc(&pdev->dev,
313 sizeof(struct prox_state));
314 if (!indio_dev)
315 return -ENOMEM;
316 platform_set_drvdata(pdev, indio_dev);
317
318 prox_state = iio_priv(indio_dev);
319 prox_state->common_attributes.hsdev = hsdev;
320 prox_state->common_attributes.pdev = pdev;
321
322 ret = hid_sensor_parse_common_attributes(hsdev, HID_USAGE_SENSOR_PROX,
323 &prox_state->common_attributes);
324 if (ret) {
325 dev_err(&pdev->dev, "failed to setup common attributes\n");
326 return ret;
327 }
328
329 channels = kmemdup(prox_channels, sizeof(prox_channels), GFP_KERNEL);
330 if (!channels) {
331 dev_err(&pdev->dev, "failed to duplicate channels\n");
332 return -ENOMEM;
333 }
334
335 ret = prox_parse_report(pdev, hsdev, channels,
336 HID_USAGE_SENSOR_PROX, prox_state);
337 if (ret) {
338 dev_err(&pdev->dev, "failed to setup attributes\n");
339 goto error_free_dev_mem;
340 }
341
342 indio_dev->channels = channels;
343 indio_dev->num_channels =
344 ARRAY_SIZE(prox_channels);
345 indio_dev->dev.parent = &pdev->dev;
346 indio_dev->info = &prox_info;
347 indio_dev->name = name;
348 indio_dev->modes = INDIO_DIRECT_MODE;
349
350 ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
351 NULL, NULL);
352 if (ret) {
353 dev_err(&pdev->dev, "failed to initialize trigger buffer\n");
354 goto error_free_dev_mem;
355 }
356 atomic_set(&prox_state->common_attributes.data_ready, 0);
357 ret = hid_sensor_setup_trigger(indio_dev, name,
358 &prox_state->common_attributes);
359 if (ret) {
360 dev_err(&pdev->dev, "trigger setup failed\n");
361 goto error_unreg_buffer_funcs;
362 }
363
364 ret = iio_device_register(indio_dev);
365 if (ret) {
366 dev_err(&pdev->dev, "device register failed\n");
367 goto error_remove_trigger;
368 }
369
370 prox_state->callbacks.send_event = prox_proc_event;
371 prox_state->callbacks.capture_sample = prox_capture_sample;
372 prox_state->callbacks.pdev = pdev;
373 ret = sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_PROX,
374 &prox_state->callbacks);
375 if (ret < 0) {
376 dev_err(&pdev->dev, "callback reg failed\n");
377 goto error_iio_unreg;
378 }
379
380 return ret;
381
382 error_iio_unreg:
383 iio_device_unregister(indio_dev);
384 error_remove_trigger:
385 hid_sensor_remove_trigger(&prox_state->common_attributes);
386 error_unreg_buffer_funcs:
387 iio_triggered_buffer_cleanup(indio_dev);
388 error_free_dev_mem:
389 kfree(indio_dev->channels);
390 return ret;
391 }
392
393 /* Function to deinitialize the processing for usage id */
394 static int hid_prox_remove(struct platform_device *pdev)
395 {
396 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
397 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
398 struct prox_state *prox_state = iio_priv(indio_dev);
399
400 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PROX);
401 iio_device_unregister(indio_dev);
402 hid_sensor_remove_trigger(&prox_state->common_attributes);
403 iio_triggered_buffer_cleanup(indio_dev);
404 kfree(indio_dev->channels);
405
406 return 0;
407 }
408
409 static struct platform_device_id hid_prox_ids[] = {
410 {
411 /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
412 .name = "HID-SENSOR-200011",
413 },
414 { /* sentinel */ }
415 };
416 MODULE_DEVICE_TABLE(platform, hid_prox_ids);
417
418 static struct platform_driver hid_prox_platform_driver = {
419 .id_table = hid_prox_ids,
420 .driver = {
421 .name = KBUILD_MODNAME,
422 .owner = THIS_MODULE,
423 },
424 .probe = hid_prox_probe,
425 .remove = hid_prox_remove,
426 };
427 module_platform_driver(hid_prox_platform_driver);
428
429 MODULE_DESCRIPTION("HID Sensor Proximity");
430 MODULE_AUTHOR("Archana Patni <archana.patni@intel.com>");
431 MODULE_LICENSE("GPL");
432
433 int ldv_retval_0;
434 int ldv_retval_1;
435 void ldv_initialize(void);
436 int ldv_release_2(void);
437 void ldv_check_final_state(void);
438 int ldv_probe_2(void);
439 int ldv_retval_2;
440
441
442 void ldv_initialyze_iio_info_2(void){
443 prox_info_group0 = ldv_undef_ptr();
444 prox_info_group1 = ldv_undef_ptr();
445 }
446
447 void ldv_platform_probe_1(int (*probe)(struct platform_device *)){
448 int err;
449 err = probe(hid_prox_platform_driver_group1);
450 if(err == 0){
451 probed_1 = 1;
452 ref_cnt++;
453 }
454 }
455
456 int __VERIFIER_nondet_int(void);
457
458 void ldv_platform_driver_init_1(void){
459 hid_prox_platform_driver_group1 = ldv_successful_alloc(sizeof(struct platform_device));
460 }
461
462
463 /* DEG-ENVIRONMENT-BEGIN */
464 extern void ldv_main_exported_1(void);
465 extern void ldv_main_exported_0(void);
466 extern void ldv_main_exported_2(void);
467
468 //********************* LDV MAIN *********************
469 //main
470 void entry_point(void){
471 ldv_initialize();
472 //args for callbacks
473 int *ldvarg1;
474 int ldvarg4;
475 int ldvarg3;
476 int *ldvarg0;
477 long int ldvarg5;
478 long int ldvarg2;
479 //initialization of machine states
480 ldv_state_variable_1=0;
481 ref_cnt=0;
482 ldv_state_variable_0=1;
483 ldv_state_variable_2=0;
484 while(1){
485 switch(__VERIFIER_nondet_int()){
486 case 0:{
487 /*DEG-struct: handlers from structure hid_prox_platform_driver*/
488 /*DEG-CHECK: checking registration of hid_prox_platform_driver structure*/
489 if(ldv_state_variable_1 != 0){
490 switch(__VERIFIER_nondet_int()){
491 case 0:{
492 /*DEG-state: state 1 (look at corresponding state-chart diagram for details)*/
493 if(ldv_state_variable_1 == 1){
494 /*DEG-CALL: handler probe from hid_prox_platform_driver*/
495 ldv_retval_1=(& hid_prox_probe)(hid_prox_platform_driver_group1);
496 if(ldv_retval_1==0){
497 ldv_state_variable_1 = 2;
498 ref_cnt++;
499 probed_1 = 1;
500 }
501 }
502 }
503 break;
504 case 1:{
505 /*DEG-state: state 1 (look at corresponding state-chart diagram for details)*/
506 if(ldv_state_variable_1 == 1 && probed_1 == 1){
507 /*DEG-CALL: handler remove from hid_prox_platform_driver*/
508 ldv_retval_0=(& hid_prox_remove)(hid_prox_platform_driver_group1);
509 if(ldv_retval_0==0){
510 ldv_state_variable_1 = 1;
511 ref_cnt--;
512 probed_1 = 0;
513 }
514 }
515 /*DEG-state: state 2 (look at corresponding state-chart diagram for details)*/
516 if(ldv_state_variable_1 == 2 && probed_1 == 1){
517 /*DEG-CALL: handler remove from hid_prox_platform_driver*/
518 ldv_retval_0=(& hid_prox_remove)(hid_prox_platform_driver_group1);
519 if(ldv_retval_0==0){
520 ldv_state_variable_1 = 1;
521 ref_cnt--;
522 probed_1 = 0;
523 }
524 }
525 }
526 break;
527 default: ldv_assume(0);
528 }
529 }
530 }
531 break;
532 case 1:{
533 /*DEG-struct: handlers from structure module*/
534 /*DEG-CHECK: checking registration of module structure*/
535 if(ldv_state_variable_0 != 0){
536 switch(__VERIFIER_nondet_int()){
537 case 0:{
538 /*DEG-state: state 2 (look at corresponding state-chart diagram for details)*/
539 if(ldv_state_variable_0 == 2 && ref_cnt==0){
540 /*DEG-CALL: handler module_exit from module*/
541 hid_prox_platform_driver_exit();
542 ldv_state_variable_0 = 3;
543 goto ldv_final;
544 }
545 }
546 break;
547 case 1:{
548 /*DEG-state: state 1 (look at corresponding state-chart diagram for details)*/
549 if(ldv_state_variable_0 == 1){
550 /*DEG-CALL: handler module_init from module*/
551 ldv_retval_2=hid_prox_platform_driver_init();
552 if(ldv_retval_2!=0){
553 ldv_state_variable_0 = 3;
554 goto ldv_final;
555 }
556 /*DEG-postcall: if success*/
557 if(ldv_retval_2==0){
558 ldv_state_variable_0 = 2;
559 }
560 }
561 }
562 break;
563 default: ldv_assume(0);
564 }
565 }
566 }
567 break;
568 case 2:{
569 /*DEG-struct: handlers from structure prox_info*/
570 /*DEG-CHECK: checking registration of prox_info structure*/
571 if(ldv_state_variable_2 != 0){
572 switch(__VERIFIER_nondet_int()){
573 case 0:{
574 /*DEG-state: state 2 (look at corresponding state-chart diagram for details)*/
575 if(ldv_state_variable_2 == 2){
576 /*DEG-CALL: handler write_raw from prox_info*/
577 (& prox_write_raw)(prox_info_group0,prox_info_group1,ldvarg4,ldvarg3,ldvarg5);
578 /*DEG-postcall: default*/
579 ldv_state_variable_2 = 2;
580 }
581 }
582 break;
583 case 1:{
584 /*DEG-state: state 2 (look at corresponding state-chart diagram for details)*/
585 if(ldv_state_variable_2 == 2){
586 /*DEG-CALL: handler read_raw from prox_info*/
587 (& prox_read_raw)(prox_info_group0,prox_info_group1,ldvarg1,ldvarg0,ldvarg2);
588 /*DEG-postcall: default*/
589 ldv_state_variable_2 = 2;
590 }
591 }
592 break;
593 case 2:{
594 /*DEG-state: state 2 (look at corresponding state-chart diagram for details)*/
595 if(ldv_state_variable_2 == 2){
596 /*DEG-CALL: handler release from prox_info*/
597 ldv_release_2();
598 /*DEG-postcall: module put*/
599 ldv_state_variable_2 = 1;
600 ref_cnt--;
601 }
602 }
603 break;
604 case 3:{
605 /*DEG-state: state 1 (look at corresponding state-chart diagram for details)*/
606 if(ldv_state_variable_2 == 1){
607 /*DEG-CALL: handler probe from prox_info*/
608 ldv_probe_2();
609 /*DEG-postcall: get module*/
610 ldv_state_variable_2 = 2;
611 ref_cnt++;
612 }
613 }
614 break;
615 default: ldv_assume(0);
616 }
617 }
618 }
619 break;
620 default: ldv_assume(0);
621 }
622 }
623 ldv_final:
624 ldv_check_final_state();
625 return;
626 }
627 /* DEG-ENVIRONMENT-END */ 1
2
3 #include <verifier/rcv.h>
4 #include <linux/device.h>
5 #include <kernel-model/ERR.inc>
6 struct device_private;
7 /* LDV_COMMENT_CHANGE_STATE At the beginning nothing is allocated. */
8 int ldv_alloc_count = 0;
9
10 /* LDV_COMMENT_CHANGE_STATE Saved release function pointer. */
11 void (*gadget_release_pointer)(struct device *_dev);
12
13 void* __VERIFIER_alloc(size_t size);
14
15 /* LDV_COMMENT_CHANGE_STATE At the beginning nothing is allocated. */
16 //void* ldv_saved_drv_data;
17
18 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_alloc') Allocate a "memory". */
19 void* ldv_alloc(size_t size)
20 {
21 void *res = __VERIFIER_alloc(size);
22 ldv_assume_and_increase(res);
23 return res;
24 }
25
26 void* ldv_zero_alloc(size_t size)
27 {
28 void *res = ldv_zalloc(size);
29 ldv_assume_and_increase(res);
30 return res;
31 }
32
33 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_assume_and_increase') Allocate a "memory". */
34 void ldv_assume_and_increase(void* res)
35 {
36 ldv_assume(res <= LDV_PTR_MAX);
37 if (res != 0) {
38 /* LDV_COMMENT_CHANGE_STATE One more "memory" is allocated. */
39 ldv_alloc_count++;
40 }
41 }
42
43 void* ldv_nonzero_alloc(size_t size)
44 {
45 //functions, like memdup_user returns either valid pointer, or ptr_err
46 void *res = __VERIFIER_alloc(size);
47 ldv_assume(res != 0);
48 if (res <= LDV_PTR_MAX) {
49 /* LDV_COMMENT_CHANGE_STATE One more "memory" is allocated. */
50 ldv_alloc_count++;
51 }
52 return res;
53 }
54
55 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_alloc_without_counter') Allocate a "memory". */
56 void* ldv_alloc_without_counter(size_t size)
57 {
58 void *res = __VERIFIER_alloc(size);
59 ldv_assume(res <= LDV_PTR_MAX);
60 return res;
61 }
62
63 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_zalloc_without_counter') Allocate a "memory". */
64 void* ldv_zalloc_without_counter(size_t size)
65 {
66 void *res = ldv_zalloc(size);
67 ldv_assume(res <= LDV_PTR_MAX);
68 return res;
69 }
70
71 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_free') Free a "memory". */
72 void ldv_free(void)
73 {
74 ldv_assert(ldv_alloc_count > 0);
75 /* LDV_COMMENT_CHANGE_STATE Free a "memory". */
76 ldv_alloc_count--;
77 //ldv_saved_drv_data = 0;
78 }
79
80 void ldv_condition_free()
81 {
82 if (ldv_alloc_count > 0)
83 {
84 ldv_free();
85 }
86 }
87
88 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_save_gadget_release') Free a "memory". */
89 void ldv_save_gadget_release(void (*func)(struct device *_dev))
90 {
91 gadget_release_pointer = func;
92 }
93
94 int ldv_dev_set_drvdata(struct device *dev, void *data)
95 {
96 dev->p = data;
97 return 0;
98 }
99
100 void *ldv_dev_get_drvdata(const struct device *dev)
101 {
102 return dev->p;
103 }
104
105
106
107 /* LDV_COMMENT_MODEL_FUNCTION_DEFINITION(name='ldv_check_final_state') All allocated memory should be freed at the end. */
108 void ldv_check_final_state(void)
109 {
110 /* LDV_COMMENT_ASSERT Nothing should be allocated at the end. */
111 ldv_assert(ldv_alloc_count == 0);
112 } 1 #ifndef _LDV_RCV_H_
2 #define _LDV_RCV_H_
3
4 //Only for defining size_t
5 #include <linux/types.h>
6
7 /* If expr evaluates to zero, ldv_assert() causes a program to reach the error
8 label like the standard assert(). */
9 #define ldv_assert(expr) ((expr) ? 0 : ldv_error())
10
11
12 /* The error label wrapper. It is used because of some static verifiers (like
13 BLAST) don't accept multiple error labels through a program. */
14 static inline void ldv_error(void)
15 {
16 LDV_ERROR: goto LDV_ERROR;
17 }
18
19 /* If expr evaluates to zero, ldv_assume() causes an infinite loop that is
20 avoided by verifiers. */
21 #define ldv_assume(expr) ((expr) ? 0 : ldv_stop())
22
23 /* Infinite loop, that causes verifiers to skip such paths. */
24 static inline void ldv_stop(void) {
25 LDV_STOP: goto LDV_STOP;
26 }
27
28 /* Special nondeterministic functions. */
29 int ldv_undef_int(void);
30 void *ldv_undef_ptr(void);
31 unsigned long ldv_undef_ulong(void);
32
33 void* __VERIFIER_alloc(size_t size);
34 void* ldv_zalloc(size_t size);
35 static inline void* ldv_successful_alloc(size_t size)
36 {
37 void* ret = __VERIFIER_alloc(size);
38 ldv_assume(ret != 0);
39 return ret;
40 }
41
42 static inline void* ldv_successful_zalloc(size_t size)
43 {
44 void* ret = ldv_zalloc(size);
45 ldv_assume(ret != 0);
46 return ret;
47 }
48 /* Return nondeterministic negative integer number. */
49 static inline int ldv_undef_int_negative(void)
50 {
51 int ret = ldv_undef_int();
52
53 ldv_assume(ret < 0);
54
55 return ret;
56 }
57 /* Return nondeterministic nonpositive integer number. */
58 static inline int ldv_undef_int_nonpositive(void)
59 {
60 int ret = ldv_undef_int();
61
62 ldv_assume(ret <= 0);
63
64 return ret;
65 }
66
67 /* Add explicit model for __builin_expect GCC function. Without the model a
68 return value will be treated as nondetermined by verifiers. */
69 long __builtin_expect(long exp, long c)
70 {
71 return exp;
72 }
73
74 /* This function causes the program to exit abnormally. GCC implements this
75 function by using a target-dependent mechanism (such as intentionally executing
76 an illegal instruction) or by calling abort. The mechanism used may vary from
77 release to release so you should not rely on any particular implementation.
78 http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html */
79 void __builtin_trap(void)
80 {
81 ldv_assert(0);
82 }
83
84 /* The constant is for simulating an error of ldv_undef_ptr() function. */
85 #define LDV_PTR_MAX 201200
86
87 #endif /* _LDV_RCV_H_ */ 1 /*
2 * device.h - generic, centralized driver model
3 *
4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
5 * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
6 * Copyright (c) 2008-2009 Novell Inc.
7 *
8 * This file is released under the GPLv2
9 *
10 * See Documentation/driver-model/ for more information.
11 */
12
13 #ifndef _DEVICE_H_
14 #define _DEVICE_H_
15
16 #include <linux/ioport.h>
17 #include <linux/kobject.h>
18 #include <linux/klist.h>
19 #include <linux/list.h>
20 #include <linux/lockdep.h>
21 #include <linux/compiler.h>
22 #include <linux/types.h>
23 #include <linux/mutex.h>
24 #include <linux/pinctrl/devinfo.h>
25 #include <linux/pm.h>
26 #include <linux/atomic.h>
27 #include <linux/ratelimit.h>
28 #include <linux/uidgid.h>
29 #include <linux/gfp.h>
30 #include <asm/device.h>
31
32 struct device;
33 struct device_private;
34 struct device_driver;
35 struct driver_private;
36 struct module;
37 struct class;
38 struct subsys_private;
39 struct bus_type;
40 struct device_node;
41 struct iommu_ops;
42 struct iommu_group;
43
44 struct bus_attribute {
45 struct attribute attr;
46 ssize_t (*show)(struct bus_type *bus, char *buf);
47 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
48 };
49
50 #define BUS_ATTR(_name, _mode, _show, _store) \
51 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
52 #define BUS_ATTR_RW(_name) \
53 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
54 #define BUS_ATTR_RO(_name) \
55 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
56
57 extern int __must_check bus_create_file(struct bus_type *,
58 struct bus_attribute *);
59 extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
60
61 /**
62 * struct bus_type - The bus type of the device
63 *
64 * @name: The name of the bus.
65 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
66 * @dev_root: Default device to use as the parent.
67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @bus_groups: Default attributes of the bus.
69 * @dev_groups: Default attributes of the devices on the bus.
70 * @drv_groups: Default attributes of the device drivers on the bus.
71 * @match: Called, perhaps multiple times, whenever a new device or driver
72 * is added for this bus. It should return a nonzero value if the
73 * given device can be handled by the given driver.
74 * @uevent: Called when a device is added, removed, or a few other things
75 * that generate uevents to add the environment variables.
76 * @probe: Called when a new device or driver add to this bus, and callback
77 * the specific driver's probe to initial the matched device.
78 * @remove: Called when a device removed from this bus.
79 * @shutdown: Called at shut-down time to quiesce the device.
80 *
81 * @online: Called to put the device back online (after offlining it).
82 * @offline: Called to put the device offline for hot-removal. May fail.
83 *
84 * @suspend: Called when a device on this bus wants to go to sleep mode.
85 * @resume: Called to bring a device on this bus out of sleep mode.
86 * @pm: Power management operations of this bus, callback the specific
87 * device driver's pm-ops.
88 * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU
89 * driver implementations to a bus and allow the driver to do
90 * bus-specific setup
91 * @p: The private data of the driver core, only the driver core can
92 * touch this.
93 * @lock_key: Lock class key for use by the lock validator
94 *
95 * A bus is a channel between the processor and one or more devices. For the
96 * purposes of the device model, all devices are connected via a bus, even if
97 * it is an internal, virtual, "platform" bus. Buses can plug into each other.
98 * A USB controller is usually a PCI device, for example. The device model
99 * represents the actual connections between buses and the devices they control.
100 * A bus is represented by the bus_type structure. It contains the name, the
101 * default attributes, the bus' methods, PM operations, and the driver core's
102 * private data.
103 */
104 struct bus_type {
105 const char *name;
106 const char *dev_name;
107 struct device *dev_root;
108 struct device_attribute *dev_attrs; /* use dev_groups instead */
109 const struct attribute_group **bus_groups;
110 const struct attribute_group **dev_groups;
111 const struct attribute_group **drv_groups;
112
113 int (*match)(struct device *dev, struct device_driver *drv);
114 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
115 int (*probe)(struct device *dev);
116 int (*remove)(struct device *dev);
117 void (*shutdown)(struct device *dev);
118
119 int (*online)(struct device *dev);
120 int (*offline)(struct device *dev);
121
122 int (*suspend)(struct device *dev, pm_message_t state);
123 int (*resume)(struct device *dev);
124
125 const struct dev_pm_ops *pm;
126
127 const struct iommu_ops *iommu_ops;
128
129 struct subsys_private *p;
130 struct lock_class_key lock_key;
131 };
132
133 extern int __must_check bus_register(struct bus_type *bus);
134
135 extern void bus_unregister(struct bus_type *bus);
136
137 extern int __must_check bus_rescan_devices(struct bus_type *bus);
138
139 /* iterator helpers for buses */
140 struct subsys_dev_iter {
141 struct klist_iter ki;
142 const struct device_type *type;
143 };
144 void subsys_dev_iter_init(struct subsys_dev_iter *iter,
145 struct bus_type *subsys,
146 struct device *start,
147 const struct device_type *type);
148 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
149 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
150
151 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
152 int (*fn)(struct device *dev, void *data));
153 struct device *bus_find_device(struct bus_type *bus, struct device *start,
154 void *data,
155 int (*match)(struct device *dev, void *data));
156 struct device *bus_find_device_by_name(struct bus_type *bus,
157 struct device *start,
158 const char *name);
159 struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
160 struct device *hint);
161 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
162 void *data, int (*fn)(struct device_driver *, void *));
163 void bus_sort_breadthfirst(struct bus_type *bus,
164 int (*compare)(const struct device *a,
165 const struct device *b));
166 /*
167 * Bus notifiers: Get notified of addition/removal of devices
168 * and binding/unbinding of drivers to devices.
169 * In the long run, it should be a replacement for the platform
170 * notify hooks.
171 */
172 struct notifier_block;
173
174 extern int bus_register_notifier(struct bus_type *bus,
175 struct notifier_block *nb);
176 extern int bus_unregister_notifier(struct bus_type *bus,
177 struct notifier_block *nb);
178
179 /* All 4 notifers below get called with the target struct device *
180 * as an argument. Note that those functions are likely to be called
181 * with the device lock held in the core, so be careful.
182 */
183 #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
184 #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
185 #define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be
186 bound */
187 #define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */
188 #define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be
189 unbound */
190 #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
191 from the device */
192
193 extern struct kset *bus_get_kset(struct bus_type *bus);
194 extern struct klist *bus_get_device_klist(struct bus_type *bus);
195
196 /**
197 * struct device_driver - The basic device driver structure
198 * @name: Name of the device driver.
199 * @bus: The bus which the device of this driver belongs to.
200 * @owner: The module owner.
201 * @mod_name: Used for built-in modules.
202 * @suppress_bind_attrs: Disables bind/unbind via sysfs.
203 * @of_match_table: The open firmware table.
204 * @acpi_match_table: The ACPI match table.
205 * @probe: Called to query the existence of a specific device,
206 * whether this driver can work with it, and bind the driver
207 * to a specific device.
208 * @remove: Called when the device is removed from the system to
209 * unbind a device from this driver.
210 * @shutdown: Called at shut-down time to quiesce the device.
211 * @suspend: Called to put the device to sleep mode. Usually to a
212 * low power state.
213 * @resume: Called to bring a device from sleep mode.
214 * @groups: Default attributes that get created by the driver core
215 * automatically.
216 * @pm: Power management operations of the device which matched
217 * this driver.
218 * @p: Driver core's private data, no one other than the driver
219 * core can touch this.
220 *
221 * The device driver-model tracks all of the drivers known to the system.
222 * The main reason for this tracking is to enable the driver core to match
223 * up drivers with new devices. Once drivers are known objects within the
224 * system, however, a number of other things become possible. Device drivers
225 * can export information and configuration variables that are independent
226 * of any specific device.
227 */
228 struct device_driver {
229 const char *name;
230 struct bus_type *bus;
231
232 struct module *owner;
233 const char *mod_name; /* used for built-in modules */
234
235 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
236
237 const struct of_device_id *of_match_table;
238 const struct acpi_device_id *acpi_match_table;
239
240 int (*probe) (struct device *dev);
241 int (*remove) (struct device *dev);
242 void (*shutdown) (struct device *dev);
243 int (*suspend) (struct device *dev, pm_message_t state);
244 int (*resume) (struct device *dev);
245 const struct attribute_group **groups;
246
247 const struct dev_pm_ops *pm;
248
249 struct driver_private *p;
250 };
251
252
253 extern int __must_check driver_register(struct device_driver *drv);
254 extern void driver_unregister(struct device_driver *drv);
255
256 extern struct device_driver *driver_find(const char *name,
257 struct bus_type *bus);
258 extern int driver_probe_done(void);
259 extern void wait_for_device_probe(void);
260
261
262 /* sysfs interface for exporting driver attributes */
263
264 struct driver_attribute {
265 struct attribute attr;
266 ssize_t (*show)(struct device_driver *driver, char *buf);
267 ssize_t (*store)(struct device_driver *driver, const char *buf,
268 size_t count);
269 };
270
271 #define DRIVER_ATTR(_name, _mode, _show, _store) \
272 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
273 #define DRIVER_ATTR_RW(_name) \
274 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
275 #define DRIVER_ATTR_RO(_name) \
276 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
277 #define DRIVER_ATTR_WO(_name) \
278 struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
279
280 extern int __must_check driver_create_file(struct device_driver *driver,
281 const struct driver_attribute *attr);
282 extern void driver_remove_file(struct device_driver *driver,
283 const struct driver_attribute *attr);
284
285 extern int __must_check driver_for_each_device(struct device_driver *drv,
286 struct device *start,
287 void *data,
288 int (*fn)(struct device *dev,
289 void *));
290 struct device *driver_find_device(struct device_driver *drv,
291 struct device *start, void *data,
292 int (*match)(struct device *dev, void *data));
293
294 /**
295 * struct subsys_interface - interfaces to device functions
296 * @name: name of the device function
297 * @subsys: subsytem of the devices to attach to
298 * @node: the list of functions registered at the subsystem
299 * @add_dev: device hookup to device function handler
300 * @remove_dev: device hookup to device function handler
301 *
302 * Simple interfaces attached to a subsystem. Multiple interfaces can
303 * attach to a subsystem and its devices. Unlike drivers, they do not
304 * exclusively claim or control devices. Interfaces usually represent
305 * a specific functionality of a subsystem/class of devices.
306 */
307 struct subsys_interface {
308 const char *name;
309 struct bus_type *subsys;
310 struct list_head node;
311 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
312 int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
313 };
314
315 int subsys_interface_register(struct subsys_interface *sif);
316 void subsys_interface_unregister(struct subsys_interface *sif);
317
318 int subsys_system_register(struct bus_type *subsys,
319 const struct attribute_group **groups);
320 int subsys_virtual_register(struct bus_type *subsys,
321 const struct attribute_group **groups);
322
323 /**
324 * struct class - device classes
325 * @name: Name of the class.
326 * @owner: The module owner.
327 * @class_attrs: Default attributes of this class.
328 * @dev_groups: Default attributes of the devices that belong to the class.
329 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
330 * @dev_uevent: Called when a device is added, removed from this class, or a
331 * few other things that generate uevents to add the environment
332 * variables.
333 * @devnode: Callback to provide the devtmpfs.
334 * @class_release: Called to release this class.
335 * @dev_release: Called to release the device.
336 * @suspend: Used to put the device to sleep mode, usually to a low power
337 * state.
338 * @resume: Used to bring the device from the sleep mode.
339 * @ns_type: Callbacks so sysfs can detemine namespaces.
340 * @namespace: Namespace of the device belongs to this class.
341 * @pm: The default device power management operations of this class.
342 * @p: The private data of the driver core, no one other than the
343 * driver core can touch this.
344 *
345 * A class is a higher-level view of a device that abstracts out low-level
346 * implementation details. Drivers may see a SCSI disk or an ATA disk, but,
347 * at the class level, they are all simply disks. Classes allow user space
348 * to work with devices based on what they do, rather than how they are
349 * connected or how they work.
350 */
351 struct class {
352 const char *name;
353 struct module *owner;
354
355 struct class_attribute *class_attrs;
356 const struct attribute_group **dev_groups;
357 struct kobject *dev_kobj;
358
359 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
360 char *(*devnode)(struct device *dev, umode_t *mode);
361
362 void (*class_release)(struct class *class);
363 void (*dev_release)(struct device *dev);
364
365 int (*suspend)(struct device *dev, pm_message_t state);
366 int (*resume)(struct device *dev);
367
368 const struct kobj_ns_type_operations *ns_type;
369 const void *(*namespace)(struct device *dev);
370
371 const struct dev_pm_ops *pm;
372
373 struct subsys_private *p;
374 };
375
376 struct class_dev_iter {
377 struct klist_iter ki;
378 const struct device_type *type;
379 };
380
381 extern struct kobject *sysfs_dev_block_kobj;
382 extern struct kobject *sysfs_dev_char_kobj;
383 extern int __must_check __class_register(struct class *class,
384 struct lock_class_key *key);
385 extern void class_unregister(struct class *class);
386
387 /* This is a #define to keep the compiler from merging different
388 * instances of the __key variable */
389 #define class_register(class) \
390 ({ \
391 static struct lock_class_key __key; \
392 __class_register(class, &__key); \
393 })
394
395 struct class_compat;
396 struct class_compat *class_compat_register(const char *name);
397 void class_compat_unregister(struct class_compat *cls);
398 int class_compat_create_link(struct class_compat *cls, struct device *dev,
399 struct device *device_link);
400 void class_compat_remove_link(struct class_compat *cls, struct device *dev,
401 struct device *device_link);
402
403 extern void class_dev_iter_init(struct class_dev_iter *iter,
404 struct class *class,
405 struct device *start,
406 const struct device_type *type);
407 extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
408 extern void class_dev_iter_exit(struct class_dev_iter *iter);
409
410 extern int class_for_each_device(struct class *class, struct device *start,
411 void *data,
412 int (*fn)(struct device *dev, void *data));
413 extern struct device *class_find_device(struct class *class,
414 struct device *start, const void *data,
415 int (*match)(struct device *, const void *));
416
417 struct class_attribute {
418 struct attribute attr;
419 ssize_t (*show)(struct class *class, struct class_attribute *attr,
420 char *buf);
421 ssize_t (*store)(struct class *class, struct class_attribute *attr,
422 const char *buf, size_t count);
423 };
424
425 #define CLASS_ATTR(_name, _mode, _show, _store) \
426 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
427 #define CLASS_ATTR_RW(_name) \
428 struct class_attribute class_attr_##_name = __ATTR_RW(_name)
429 #define CLASS_ATTR_RO(_name) \
430 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
431
432 extern int __must_check class_create_file_ns(struct class *class,
433 const struct class_attribute *attr,
434 const void *ns);
435 extern void class_remove_file_ns(struct class *class,
436 const struct class_attribute *attr,
437 const void *ns);
438
439 static inline int __must_check class_create_file(struct class *class,
440 const struct class_attribute *attr)
441 {
442 return class_create_file_ns(class, attr, NULL);
443 }
444
445 static inline void class_remove_file(struct class *class,
446 const struct class_attribute *attr)
447 {
448 return class_remove_file_ns(class, attr, NULL);
449 }
450
451 /* Simple class attribute that is just a static string */
452 struct class_attribute_string {
453 struct class_attribute attr;
454 char *str;
455 };
456
457 /* Currently read-only only */
458 #define _CLASS_ATTR_STRING(_name, _mode, _str) \
459 { __ATTR(_name, _mode, show_class_attr_string, NULL), _str }
460 #define CLASS_ATTR_STRING(_name, _mode, _str) \
461 struct class_attribute_string class_attr_##_name = \
462 _CLASS_ATTR_STRING(_name, _mode, _str)
463
464 extern ssize_t show_class_attr_string(struct class *class, struct class_attribute *attr,
465 char *buf);
466
467 struct class_interface {
468 struct list_head node;
469 struct class *class;
470
471 int (*add_dev) (struct device *, struct class_interface *);
472 void (*remove_dev) (struct device *, struct class_interface *);
473 };
474
475 extern int __must_check class_interface_register(struct class_interface *);
476 extern void class_interface_unregister(struct class_interface *);
477
478 extern struct class * __must_check __class_create(struct module *owner,
479 const char *name,
480 struct lock_class_key *key);
481 extern void class_destroy(struct class *cls);
482
483 /* This is a #define to keep the compiler from merging different
484 * instances of the __key variable */
485 #define class_create(owner, name) \
486 ({ \
487 static struct lock_class_key __key; \
488 __class_create(owner, name, &__key); \
489 })
490
491 /*
492 * The type of device, "struct device" is embedded in. A class
493 * or bus can contain devices of different types
494 * like "partitions" and "disks", "mouse" and "event".
495 * This identifies the device type and carries type-specific
496 * information, equivalent to the kobj_type of a kobject.
497 * If "name" is specified, the uevent will contain it in
498 * the DEVTYPE variable.
499 */
500 struct device_type {
501 const char *name;
502 const struct attribute_group **groups;
503 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
504 char *(*devnode)(struct device *dev, umode_t *mode,
505 kuid_t *uid, kgid_t *gid);
506 void (*release)(struct device *dev);
507
508 const struct dev_pm_ops *pm;
509 };
510
511 /* interface for exporting device attributes */
512 struct device_attribute {
513 struct attribute attr;
514 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
515 char *buf);
516 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
517 const char *buf, size_t count);
518 };
519
520 struct dev_ext_attribute {
521 struct device_attribute attr;
522 void *var;
523 };
524
525 ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
526 char *buf);
527 ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
528 const char *buf, size_t count);
529 ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
530 char *buf);
531 ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
532 const char *buf, size_t count);
533 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
534 char *buf);
535 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
536 const char *buf, size_t count);
537
538 #define DEVICE_ATTR(_name, _mode, _show, _store) \
539 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
540 #define DEVICE_ATTR_RW(_name) \
541 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
542 #define DEVICE_ATTR_RO(_name) \
543 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
544 #define DEVICE_ATTR_WO(_name) \
545 struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
546 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \
547 struct dev_ext_attribute dev_attr_##_name = \
548 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
549 #define DEVICE_INT_ATTR(_name, _mode, _var) \
550 struct dev_ext_attribute dev_attr_##_name = \
551 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
552 #define DEVICE_BOOL_ATTR(_name, _mode, _var) \
553 struct dev_ext_attribute dev_attr_##_name = \
554 { __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
555 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
556 struct device_attribute dev_attr_##_name = \
557 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
558
559 extern int device_create_file(struct device *device,
560 const struct device_attribute *entry);
561 extern void device_remove_file(struct device *dev,
562 const struct device_attribute *attr);
563 extern bool device_remove_file_self(struct device *dev,
564 const struct device_attribute *attr);
565 extern int __must_check device_create_bin_file(struct device *dev,
566 const struct bin_attribute *attr);
567 extern void device_remove_bin_file(struct device *dev,
568 const struct bin_attribute *attr);
569
570 /* device resource management */
571 typedef void (*dr_release_t)(struct device *dev, void *res);
572 typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
573
574 #ifdef CONFIG_DEBUG_DEVRES
575 extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
576 const char *name);
577 #define devres_alloc(release, size, gfp) \
578 __devres_alloc(release, size, gfp, #release)
579 #else
580 extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
581 #endif
582 extern void devres_for_each_res(struct device *dev, dr_release_t release,
583 dr_match_t match, void *match_data,
584 void (*fn)(struct device *, void *, void *),
585 void *data);
586 extern void devres_free(void *res);
587 extern void devres_add(struct device *dev, void *res);
588 extern void *devres_find(struct device *dev, dr_release_t release,
589 dr_match_t match, void *match_data);
590 extern void *devres_get(struct device *dev, void *new_res,
591 dr_match_t match, void *match_data);
592 extern void *devres_remove(struct device *dev, dr_release_t release,
593 dr_match_t match, void *match_data);
594 extern int devres_destroy(struct device *dev, dr_release_t release,
595 dr_match_t match, void *match_data);
596 extern int devres_release(struct device *dev, dr_release_t release,
597 dr_match_t match, void *match_data);
598
599 /* devres group */
600 extern void * __must_check devres_open_group(struct device *dev, void *id,
601 gfp_t gfp);
602 extern void devres_close_group(struct device *dev, void *id);
603 extern void devres_remove_group(struct device *dev, void *id);
604 extern int devres_release_group(struct device *dev, void *id);
605
606 /* managed devm_k.alloc/kfree for device drivers */
607 extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
608 extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
609 va_list ap);
610 extern char *devm_kasprintf(struct device *dev, gfp_t gfp,
611 const char *fmt, ...);
612 static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613 {
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
615 }
616 static inline void *devm_kmalloc_array(struct device *dev,
617 size_t n, size_t size, gfp_t flags)
618 {
619 if (size != 0 && n > SIZE_MAX / size)
620 return NULL;
621 return devm_kmalloc(dev, n * size, flags);
622 }
623 static inline void *devm_kcalloc(struct device *dev,
624 size_t n, size_t size, gfp_t flags)
625 {
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627 }
628 extern void devm_kfree(struct device *dev, void *p);
629 extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
630 extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
631 gfp_t gfp);
632
633 extern unsigned long devm_get_free_pages(struct device *dev,
634 gfp_t gfp_mask, unsigned int order);
635 extern void devm_free_pages(struct device *dev, unsigned long addr);
636
637 void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
638
639 /* allows to add/remove a custom action to devres stack */
640 int devm_add_action(struct device *dev, void (*action)(void *), void *data);
641 void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
642
643 struct device_dma_parameters {
644 /*
645 * a low level driver may set these to teach IOMMU code about
646 * sg limitations.
647 */
648 unsigned int max_segment_size;
649 unsigned long segment_boundary_mask;
650 };
651
652 struct acpi_device;
653
654 struct acpi_dev_node {
655 #ifdef CONFIG_ACPI
656 struct acpi_device *companion;
657 #endif
658 };
659
660 /**
661 * struct device - The basic device structure
662 * @parent: The device's "parent" device, the device to which it is attached.
663 * In most cases, a parent device is some sort of bus or host
664 * controller. If parent is NULL, the device, is a top-level device,
665 * which is not usually what you want.
666 * @p: Holds the private data of the driver core portions of the device.
667 * See the comment of the struct device_private for detail.
668 * @kobj: A top-level, abstract class from which other classes are derived.
669 * @init_name: Initial name of the device.
670 * @type: The type of device.
671 * This identifies the device type and carries type-specific
672 * information.
673 * @mutex: Mutex to synchronize calls to its driver.
674 * @bus: Type of bus device is on.
675 * @driver: Which driver has allocated this
676 * @platform_data: Platform data specific to the device.
677 * Example: For devices on custom boards, as typical of embedded
678 * and SOC based hardware, Linux often uses platform_data to point
679 * to board-specific structures describing devices and how they
680 * are wired. That can include what ports are available, chip
681 * variants, which GPIO pins act in what additional roles, and so
682 * on. This shrinks the "Board Support Packages" (BSPs) and
683 * minimizes board-specific #ifdefs in drivers.
684 * @driver_data: Private pointer for driver specific info.
685 * @power: For device power management.
686 * See Documentation/power/devices.txt for details.
687 * @pm_domain: Provide callbacks that are executed during system suspend,
688 * hibernation, system resume and during runtime PM transitions
689 * along with subsystem-level and driver-level callbacks.
690 * @pins: For device pin management.
691 * See Documentation/pinctrl.txt for details.
692 * @numa_node: NUMA node this device is close to.
693 * @dma_mask: Dma mask (if dma'ble device).
694 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
695 * hardware supports 64-bit addresses for consistent allocations
696 * such descriptors.
697 * @dma_pfn_offset: offset of DMA memory range relatively of RAM
698 * @dma_parms: A low level driver may set these to teach IOMMU code about
699 * segment limitations.
700 * @dma_pools: Dma pools (if dma'ble device).
701 * @dma_mem: Internal for coherent mem override.
702 * @cma_area: Contiguous memory area for dma allocations
703 * @archdata: For arch-specific additions.
704 * @of_node: Associated device tree node.
705 * @acpi_node: Associated ACPI device node.
706 * @devt: For creating the sysfs "dev".
707 * @id: device instance
708 * @devres_lock: Spinlock to protect the resource of the device.
709 * @devres_head: The resources list of the device.
710 * @knode_class: The node used to add the device to the class list.
711 * @class: The class of the device.
712 * @groups: Optional attribute groups.
713 * @release: Callback to free the device after all references have
714 * gone away. This should be set by the allocator of the
715 * device (i.e. the bus driver that discovered the device).
716 * @iommu_group: IOMMU group the device belongs to.
717 *
718 * @offline_disabled: If set, the device is permanently online.
719 * @offline: Set after successful invocation of bus type's .offline().
720 *
721 * At the lowest level, every device in a Linux system is represented by an
722 * instance of struct device. The device structure contains the information
723 * that the device model core needs to model the system. Most subsystems,
724 * however, track additional information about the devices they host. As a
725 * result, it is rare for devices to be represented by bare device structures;
726 * instead, that structure, like kobject structures, is usually embedded within
727 * a higher-level representation of the device.
728 */
729 struct device {
730 struct device *parent;
731
732 struct device_private *p;
733
734 struct kobject kobj;
735 const char *init_name; /* initial name of the device */
736 const struct device_type *type;
737
738 struct mutex mutex; /* mutex to synchronize calls to
739 * its driver.
740 */
741
742 struct bus_type *bus; /* type of bus device is on */
743 struct device_driver *driver; /* which driver has allocated this
744 device */
745 void *platform_data; /* Platform specific data, device
746 core doesn't touch it */
747 void *driver_data; /* Driver data, set and get with
748 dev_set/get_drvdata */
749 struct dev_pm_info power;
750 struct dev_pm_domain *pm_domain;
751
752 #ifdef CONFIG_PINCTRL
753 struct dev_pin_info *pins;
754 #endif
755
756 #ifdef CONFIG_NUMA
757 int numa_node; /* NUMA node this device is close to */
758 #endif
759 u64 *dma_mask; /* dma mask (if dma'able device) */
760 u64 coherent_dma_mask;/* Like dma_mask, but for
761 alloc_coherent mappings as
762 not all hardware supports
763 64 bit addresses for consistent
764 allocations such descriptors. */
765 unsigned long dma_pfn_offset;
766
767 struct device_dma_parameters *dma_parms;
768
769 struct list_head dma_pools; /* dma pools (if dma'ble) */
770
771 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
772 override */
773 #ifdef CONFIG_DMA_CMA
774 struct cma *cma_area; /* contiguous memory area for dma
775 allocations */
776 #endif
777 /* arch specific additions */
778 struct dev_archdata archdata;
779
780 struct device_node *of_node; /* associated device tree node */
781 struct acpi_dev_node acpi_node; /* associated ACPI device node */
782
783 dev_t devt; /* dev_t, creates the sysfs "dev" */
784 u32 id; /* device instance */
785
786 spinlock_t devres_lock;
787 struct list_head devres_head;
788
789 struct klist_node knode_class;
790 struct class *class;
791 const struct attribute_group **groups; /* optional groups */
792
793 void (*release)(struct device *dev);
794 struct iommu_group *iommu_group;
795
796 bool offline_disabled:1;
797 bool offline:1;
798 };
799
800 static inline struct device *kobj_to_dev(struct kobject *kobj)
801 {
802 return container_of(kobj, struct device, kobj);
803 }
804
805 /* Get the wakeup routines, which depend on struct device */
806 #include <linux/pm_wakeup.h>
807
808 static inline const char *dev_name(const struct device *dev)
809 {
810 /* Use the init name until the kobject becomes available */
811 if (dev->init_name)
812 return dev->init_name;
813
814 return kobject_name(&dev->kobj);
815 }
816
817 extern __printf(2, 3)
818 int dev_set_name(struct device *dev, const char *name, ...);
819
820 #ifdef CONFIG_NUMA
821 static inline int dev_to_node(struct device *dev)
822 {
823 return dev->numa_node;
824 }
825 static inline void set_dev_node(struct device *dev, int node)
826 {
827 dev->numa_node = node;
828 }
829 #else
830 static inline int dev_to_node(struct device *dev)
831 {
832 return -1;
833 }
834 static inline void set_dev_node(struct device *dev, int node)
835 {
836 }
837 #endif
838
839 static inline void *dev_get_drvdata(const struct device *dev)
840 {
841 return dev->driver_data;
842 }
843
844 static inline void dev_set_drvdata(struct device *dev, void *data)
845 {
846 dev->driver_data = data;
847 }
848
849 static inline struct pm_subsys_data *dev_to_psd(struct device *dev)
850 {
851 return dev ? dev->power.subsys_data : NULL;
852 }
853
854 static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
855 {
856 return dev->kobj.uevent_suppress;
857 }
858
859 static inline void dev_set_uevent_suppress(struct device *dev, int val)
860 {
861 dev->kobj.uevent_suppress = val;
862 }
863
864 static inline int device_is_registered(struct device *dev)
865 {
866 return dev->kobj.state_in_sysfs;
867 }
868
869 static inline void device_enable_async_suspend(struct device *dev)
870 {
871 if (!dev->power.is_prepared)
872 dev->power.async_suspend = true;
873 }
874
875 static inline void device_disable_async_suspend(struct device *dev)
876 {
877 if (!dev->power.is_prepared)
878 dev->power.async_suspend = false;
879 }
880
881 static inline bool device_async_suspend_enabled(struct device *dev)
882 {
883 return !!dev->power.async_suspend;
884 }
885
886 static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
887 {
888 dev->power.ignore_children = enable;
889 }
890
891 static inline void dev_pm_syscore_device(struct device *dev, bool val)
892 {
893 #ifdef CONFIG_PM_SLEEP
894 dev->power.syscore = val;
895 #endif
896 }
897
898 static inline void device_lock(struct device *dev)
899 {
900 mutex_lock(&dev->mutex);
901 }
902
903 static inline int device_trylock(struct device *dev)
904 {
905 return mutex_trylock(&dev->mutex);
906 }
907
908 static inline void device_unlock(struct device *dev)
909 {
910 mutex_unlock(&dev->mutex);
911 }
912
913 void driver_init(void);
914
915 /*
916 * High level routines for use by the bus drivers
917 */
918 extern int __must_check device_register(struct device *dev);
919 extern void device_unregister(struct device *dev);
920 extern void device_initialize(struct device *dev);
921 extern int __must_check device_add(struct device *dev);
922 extern void device_del(struct device *dev);
923 extern int device_for_each_child(struct device *dev, void *data,
924 int (*fn)(struct device *dev, void *data));
925 extern struct device *device_find_child(struct device *dev, void *data,
926 int (*match)(struct device *dev, void *data));
927 extern int device_rename(struct device *dev, const char *new_name);
928 extern int device_move(struct device *dev, struct device *new_parent,
929 enum dpm_order dpm_order);
930 extern const char *device_get_devnode(struct device *dev,
931 umode_t *mode, kuid_t *uid, kgid_t *gid,
932 const char **tmp);
933
934 static inline bool device_supports_offline(struct device *dev)
935 {
936 return dev->bus && dev->bus->offline && dev->bus->online;
937 }
938
939 extern void lock_device_hotplug(void);
940 extern void unlock_device_hotplug(void);
941 extern int lock_device_hotplug_sysfs(void);
942 extern int device_offline(struct device *dev);
943 extern int device_online(struct device *dev);
944 /*
945 * Root device objects for grouping under /sys/devices
946 */
947 extern struct device *__root_device_register(const char *name,
948 struct module *owner);
949
950 /* This is a macro to avoid include problems with THIS_MODULE */
951 #define root_device_register(name) \
952 __root_device_register(name, THIS_MODULE)
953
954 extern void root_device_unregister(struct device *root);
955
956 static inline void *dev_get_platdata(const struct device *dev)
957 {
958 return dev->platform_data;
959 }
960
961 /*
962 * Manual binding of a device to driver. See drivers/base/bus.c
963 * for information on use.
964 */
965 extern int __must_check device_bind_driver(struct device *dev);
966 extern void device_release_driver(struct device *dev);
967 extern int __must_check device_attach(struct device *dev);
968 extern int __must_check driver_attach(struct device_driver *drv);
969 extern int __must_check device_reprobe(struct device *dev);
970
971 /*
972 * Easy functions for dynamically creating devices on the fly
973 */
974 extern struct device *device_create_vargs(struct class *cls,
975 struct device *parent,
976 dev_t devt,
977 void *drvdata,
978 const char *fmt,
979 va_list vargs);
980 extern __printf(5, 6)
981 struct device *device_create(struct class *cls, struct device *parent,
982 dev_t devt, void *drvdata,
983 const char *fmt, ...);
984 extern __printf(6, 7)
985 struct device *device_create_with_groups(struct class *cls,
986 struct device *parent, dev_t devt, void *drvdata,
987 const struct attribute_group **groups,
988 const char *fmt, ...);
989 extern void device_destroy(struct class *cls, dev_t devt);
990
991 /*
992 * Platform "fixup" functions - allow the platform to have their say
993 * about devices and actions that the general device layer doesn't
994 * know about.
995 */
996 /* Notify platform of device discovery */
997 extern int (*platform_notify)(struct device *dev);
998
999 extern int (*platform_notify_remove)(struct device *dev);
1000
1001
1002 /*
1003 * get_device - atomically increment the reference count for the device.
1004 *
1005 */
1006 extern struct device *get_device(struct device *dev);
1007 extern void put_device(struct device *dev);
1008
1009 #ifdef CONFIG_DEVTMPFS
1010 extern int devtmpfs_create_node(struct device *dev);
1011 extern int devtmpfs_delete_node(struct device *dev);
1012 extern int devtmpfs_mount(const char *mntdir);
1013 #else
1014 static inline int devtmpfs_create_node(struct device *dev) { return 0; }
1015 static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
1016 static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
1017 #endif
1018
1019 /* drivers/base/power/shutdown.c */
1020 extern void device_shutdown(void);
1021
1022 /* debugging and troubleshooting/diagnostic helpers. */
1023 extern const char *dev_driver_string(const struct device *dev);
1024
1025
1026 #ifdef CONFIG_PRINTK
1027
1028 extern __printf(3, 0)
1029 int dev_vprintk_emit(int level, const struct device *dev,
1030 const char *fmt, va_list args);
1031 extern __printf(3, 4)
1032 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
1033
1034 extern __printf(3, 4)
1035 int dev_printk(const char *level, const struct device *dev,
1036 const char *fmt, ...);
1037 extern __printf(2, 3)
1038 int dev_emerg(const struct device *dev, const char *fmt, ...);
1039 extern __printf(2, 3)
1040 int dev_alert(const struct device *dev, const char *fmt, ...);
1041 extern __printf(2, 3)
1042 int dev_crit(const struct device *dev, const char *fmt, ...);
1043 extern __printf(2, 3)
1044 int dev_err(const struct device *dev, const char *fmt, ...);
1045 extern __printf(2, 3)
1046 int dev_warn(const struct device *dev, const char *fmt, ...);
1047 extern __printf(2, 3)
1048 int dev_notice(const struct device *dev, const char *fmt, ...);
1049 extern __printf(2, 3)
1050 int _dev_info(const struct device *dev, const char *fmt, ...);
1051
1052 #else
1053
1054 static inline __printf(3, 0)
1055 int dev_vprintk_emit(int level, const struct device *dev,
1056 const char *fmt, va_list args)
1057 { return 0; }
1058 static inline __printf(3, 4)
1059 int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
1060 { return 0; }
1061
1062 static inline int __dev_printk(const char *level, const struct device *dev,
1063 struct va_format *vaf)
1064 { return 0; }
1065 static inline __printf(3, 4)
1066 int dev_printk(const char *level, const struct device *dev,
1067 const char *fmt, ...)
1068 { return 0; }
1069
1070 static inline __printf(2, 3)
1071 int dev_emerg(const struct device *dev, const char *fmt, ...)
1072 { return 0; }
1073 static inline __printf(2, 3)
1074 int dev_crit(const struct device *dev, const char *fmt, ...)
1075 { return 0; }
1076 static inline __printf(2, 3)
1077 int dev_alert(const struct device *dev, const char *fmt, ...)
1078 { return 0; }
1079 static inline __printf(2, 3)
1080 int dev_err(const struct device *dev, const char *fmt, ...)
1081 { return 0; }
1082 static inline __printf(2, 3)
1083 int dev_warn(const struct device *dev, const char *fmt, ...)
1084 { return 0; }
1085 static inline __printf(2, 3)
1086 int dev_notice(const struct device *dev, const char *fmt, ...)
1087 { return 0; }
1088 static inline __printf(2, 3)
1089 int _dev_info(const struct device *dev, const char *fmt, ...)
1090 { return 0; }
1091
1092 #endif
1093
1094 /*
1095 * Stupid hackaround for existing uses of non-printk uses dev_info
1096 *
1097 * Note that the definition of dev_info below is actually _dev_info
1098 * and a macro is used to avoid redefining dev_info
1099 */
1100
1101 #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
1102
1103 #if defined(CONFIG_DYNAMIC_DEBUG)
1104 #define dev_dbg(dev, format, ...) \
1105 do { \
1106 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
1107 } while (0)
1108 #elif defined(DEBUG)
1109 #define dev_dbg(dev, format, arg...) \
1110 dev_printk(KERN_DEBUG, dev, format, ##arg)
1111 #else
1112 #define dev_dbg(dev, format, arg...) \
1113 ({ \
1114 if (0) \
1115 dev_printk(KERN_DEBUG, dev, format, ##arg); \
1116 0; \
1117 })
1118 #endif
1119
1120 #define dev_level_ratelimited(dev_level, dev, fmt, ...) \
1121 do { \
1122 static DEFINE_RATELIMIT_STATE(_rs, \
1123 DEFAULT_RATELIMIT_INTERVAL, \
1124 DEFAULT_RATELIMIT_BURST); \
1125 if (__ratelimit(&_rs)) \
1126 dev_level(dev, fmt, ##__VA_ARGS__); \
1127 } while (0)
1128
1129 #define dev_emerg_ratelimited(dev, fmt, ...) \
1130 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
1131 #define dev_alert_ratelimited(dev, fmt, ...) \
1132 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
1133 #define dev_crit_ratelimited(dev, fmt, ...) \
1134 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
1135 #define dev_err_ratelimited(dev, fmt, ...) \
1136 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
1137 #define dev_warn_ratelimited(dev, fmt, ...) \
1138 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
1139 #define dev_notice_ratelimited(dev, fmt, ...) \
1140 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
1141 #define dev_info_ratelimited(dev, fmt, ...) \
1142 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1143 #if defined(CONFIG_DYNAMIC_DEBUG)
1144 /* descriptor check is first to prevent flooding with "callbacks suppressed" */
1145 #define dev_dbg_ratelimited(dev, fmt, ...) \
1146 do { \
1147 static DEFINE_RATELIMIT_STATE(_rs, \
1148 DEFAULT_RATELIMIT_INTERVAL, \
1149 DEFAULT_RATELIMIT_BURST); \
1150 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
1151 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
1152 __ratelimit(&_rs)) \
1153 __dynamic_dev_dbg(&descriptor, dev, fmt, \
1154 ##__VA_ARGS__); \
1155 } while (0)
1156 #elif defined(DEBUG)
1157 #define dev_dbg_ratelimited(dev, fmt, ...) \
1158 do { \
1159 static DEFINE_RATELIMIT_STATE(_rs, \
1160 DEFAULT_RATELIMIT_INTERVAL, \
1161 DEFAULT_RATELIMIT_BURST); \
1162 if (__ratelimit(&_rs)) \
1163 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
1164 } while (0)
1165 #else
1166 #define dev_dbg_ratelimited(dev, fmt, ...) \
1167 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
1168 #endif
1169
1170 #ifdef VERBOSE_DEBUG
1171 #define dev_vdbg dev_dbg
1172 #else
1173 #define dev_vdbg(dev, format, arg...) \
1174 ({ \
1175 if (0) \
1176 dev_printk(KERN_DEBUG, dev, format, ##arg); \
1177 0; \
1178 })
1179 #endif
1180
1181 /*
1182 * dev_WARN*() acts like dev_printk(), but with the key difference of
1183 * using WARN/WARN_ONCE to include file/line information and a backtrace.
1184 */
1185 #define dev_WARN(dev, format, arg...) \
1186 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
1187
1188 #define dev_WARN_ONCE(dev, condition, format, arg...) \
1189 WARN_ONCE(condition, "%s %s: " format, \
1190 dev_driver_string(dev), dev_name(dev), ## arg)
1191
1192 /* Create alias, so I can be autoloaded. */
1193 #define MODULE_ALIAS_CHARDEV(major,minor) \
1194 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
1195 #define MODULE_ALIAS_CHARDEV_MAJOR(major) \
1196 MODULE_ALIAS("char-major-" __stringify(major) "-*")
1197
1198 #ifdef CONFIG_SYSFS_DEPRECATED
1199 extern long sysfs_deprecated;
1200 #else
1201 #define sysfs_deprecated 0
1202 #endif
1203
1204 /**
1205 * module_driver() - Helper macro for drivers that don't do anything
1206 * special in module init/exit. This eliminates a lot of boilerplate.
1207 * Each module may only use this macro once, and calling it replaces
1208 * module_init() and module_exit().
1209 *
1210 * @__driver: driver name
1211 * @__register: register function for this driver type
1212 * @__unregister: unregister function for this driver type
1213 * @...: Additional arguments to be passed to __register and __unregister.
1214 *
1215 * Use this macro to construct bus specific macros for registering
1216 * drivers, and do not use it on its own.
1217 */
1218 #define module_driver(__driver, __register, __unregister, ...) \
1219 static int __init __driver##_init(void) \
1220 { \
1221 return __register(&(__driver) , ##__VA_ARGS__); \
1222 } \
1223 module_init(__driver##_init); \
1224 static void __exit __driver##_exit(void) \
1225 { \
1226 __unregister(&(__driver) , ##__VA_ARGS__); \
1227 } \
1228 module_exit(__driver##_exit);
1229
1230 #endif /* _DEVICE_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 /* IIO TODO LIST */
17 /*
18 * Provide means of adjusting timer accuracy.
19 * Currently assumes nano seconds.
20 */
21
22 enum iio_chan_info_enum {
23 IIO_CHAN_INFO_RAW = 0,
24 IIO_CHAN_INFO_PROCESSED,
25 IIO_CHAN_INFO_SCALE,
26 IIO_CHAN_INFO_OFFSET,
27 IIO_CHAN_INFO_CALIBSCALE,
28 IIO_CHAN_INFO_CALIBBIAS,
29 IIO_CHAN_INFO_PEAK,
30 IIO_CHAN_INFO_PEAK_SCALE,
31 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
32 IIO_CHAN_INFO_AVERAGE_RAW,
33 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
34 IIO_CHAN_INFO_SAMP_FREQ,
35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS,
39 IIO_CHAN_INFO_INT_TIME,
40 };
41
42 enum iio_shared_by {
43 IIO_SEPARATE,
44 IIO_SHARED_BY_TYPE,
45 IIO_SHARED_BY_DIR,
46 IIO_SHARED_BY_ALL
47 };
48
49 enum iio_endian {
50 IIO_CPU,
51 IIO_BE,
52 IIO_LE,
53 };
54
55 struct iio_chan_spec;
56 struct iio_dev;
57
58 /**
59 * struct iio_chan_spec_ext_info - Extended channel info attribute
60 * @name: Info attribute name
61 * @shared: Whether this attribute is shared between all channels.
62 * @read: Read callback for this info attribute, may be NULL.
63 * @write: Write callback for this info attribute, may be NULL.
64 * @private: Data private to the driver.
65 */
66 struct iio_chan_spec_ext_info {
67 const char *name;
68 enum iio_shared_by shared;
69 ssize_t (*read)(struct iio_dev *, uintptr_t private,
70 struct iio_chan_spec const *, char *buf);
71 ssize_t (*write)(struct iio_dev *, uintptr_t private,
72 struct iio_chan_spec const *, const char *buf,
73 size_t len);
74 uintptr_t private;
75 };
76
77 /**
78 * struct iio_enum - Enum channel info attribute
79 * @items: An array of strings.
80 * @num_items: Length of the item array.
81 * @set: Set callback function, may be NULL.
82 * @get: Get callback function, may be NULL.
83 *
84 * The iio_enum struct can be used to implement enum style channel attributes.
85 * Enum style attributes are those which have a set of strings which map to
86 * unsigned integer values. The IIO enum helper code takes care of mapping
87 * between value and string as well as generating a "_available" file which
88 * contains a list of all available items. The set callback will be called when
89 * the attribute is updated. The last parameter is the index to the newly
90 * activated item. The get callback will be used to query the currently active
91 * item and is supposed to return the index for it.
92 */
93 struct iio_enum {
94 const char * const *items;
95 unsigned int num_items;
96 int (*set)(struct iio_dev *, const struct iio_chan_spec *, unsigned int);
97 int (*get)(struct iio_dev *, const struct iio_chan_spec *);
98 };
99
100 ssize_t iio_enum_available_read(struct iio_dev *indio_dev,
101 uintptr_t priv, const struct iio_chan_spec *chan, char *buf);
102 ssize_t iio_enum_read(struct iio_dev *indio_dev,
103 uintptr_t priv, const struct iio_chan_spec *chan, char *buf);
104 ssize_t iio_enum_write(struct iio_dev *indio_dev,
105 uintptr_t priv, const struct iio_chan_spec *chan, const char *buf,
106 size_t len);
107
108 /**
109 * IIO_ENUM() - Initialize enum extended channel attribute
110 * @_name: Attribute name
111 * @_shared: Whether the attribute is shared between all channels
112 * @_e: Pointer to an iio_enum struct
113 *
114 * This should usually be used together with IIO_ENUM_AVAILABLE()
115 */
116 #define IIO_ENUM(_name, _shared, _e) \
117 { \
118 .name = (_name), \
119 .shared = (_shared), \
120 .read = iio_enum_read, \
121 .write = iio_enum_write, \
122 .private = (uintptr_t)(_e), \
123 }
124
125 /**
126 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute
127 * @_name: Attribute name ("_available" will be appended to the name)
128 * @_e: Pointer to an iio_enum struct
129 *
130 * Creates a read only attribute which lists all the available enum items in a
131 * space separated list. This should usually be used together with IIO_ENUM()
132 */
133 #define IIO_ENUM_AVAILABLE(_name, _e) \
134 { \
135 .name = (_name "_available"), \
136 .shared = IIO_SHARED_BY_TYPE, \
137 .read = iio_enum_available_read, \
138 .private = (uintptr_t)(_e), \
139 }
140
141 /**
142 * struct iio_event_spec - specification for a channel event
143 * @type: Type of the event
144 * @dir: Direction of the event
145 * @mask_separate: Bit mask of enum iio_event_info values. Attributes
146 * set in this mask will be registered per channel.
147 * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes
148 * set in this mask will be shared by channel type.
149 * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes
150 * set in this mask will be shared by channel type and
151 * direction.
152 * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes
153 * set in this mask will be shared by all channels.
154 */
155 struct iio_event_spec {
156 enum iio_event_type type;
157 enum iio_event_direction dir;
158 unsigned long mask_separate;
159 unsigned long mask_shared_by_type;
160 unsigned long mask_shared_by_dir;
161 unsigned long mask_shared_by_all;
162 };
163
164 /**
165 * struct iio_chan_spec - specification of a single channel
166 * @type: What type of measurement is the channel making.
167 * @channel: What number do we wish to assign the channel.
168 * @channel2: If there is a second number for a differential
169 * channel then this is it. If modified is set then the
170 * value here specifies the modifier.
171 * @address: Driver specific identifier.
172 * @scan_index: Monotonic index to give ordering in scans when read
173 * from a buffer.
174 * @scan_type: Sign: 's' or 'u' to specify signed or unsigned
175 * realbits: Number of valid bits of data
176 * storage_bits: Realbits + padding
177 * shift: Shift right by this before masking out
178 * realbits.
179 * endianness: little or big endian
180 * repeat: Number of times real/storage bits
181 * repeats. When the repeat element is
182 * more than 1, then the type element in
183 * sysfs will show a repeat value.
184 * Otherwise, the number of repetitions is
185 * omitted.
186 * @info_mask_separate: What information is to be exported that is specific to
187 * this channel.
188 * @info_mask_shared_by_type: What information is to be exported that is shared
189 * by all channels of the same type.
190 * @info_mask_shared_by_dir: What information is to be exported that is shared
191 * by all channels of the same direction.
192 * @info_mask_shared_by_all: What information is to be exported that is shared
193 * by all channels.
194 * @event_spec: Array of events which should be registered for this
195 * channel.
196 * @num_event_specs: Size of the event_spec array.
197 * @ext_info: Array of extended info attributes for this channel.
198 * The array is NULL terminated, the last element should
199 * have its name field set to NULL.
200 * @extend_name: Allows labeling of channel attributes with an
201 * informative name. Note this has no effect codes etc,
202 * unlike modifiers.
203 * @datasheet_name: A name used in in-kernel mapping of channels. It should
204 * correspond to the first name that the channel is referred
205 * to by in the datasheet (e.g. IND), or the nearest
206 * possible compound name (e.g. IND-INC).
207 * @modified: Does a modifier apply to this channel. What these are
208 * depends on the channel type. Modifier is set in
209 * channel2. Examples are IIO_MOD_X for axial sensors about
210 * the 'x' axis.
211 * @indexed: Specify the channel has a numerical index. If not,
212 * the channel index number will be suppressed for sysfs
213 * attributes but not for event codes.
214 * @output: Channel is output.
215 * @differential: Channel is differential.
216 */
217 struct iio_chan_spec {
218 enum iio_chan_type type;
219 int channel;
220 int channel2;
221 unsigned long address;
222 int scan_index;
223 struct {
224 char sign;
225 u8 realbits;
226 u8 storagebits;
227 u8 shift;
228 u8 repeat;
229 enum iio_endian endianness;
230 } scan_type;
231 long info_mask_separate;
232 long info_mask_shared_by_type;
233 long info_mask_shared_by_dir;
234 long info_mask_shared_by_all;
235 const struct iio_event_spec *event_spec;
236 unsigned int num_event_specs;
237 const struct iio_chan_spec_ext_info *ext_info;
238 const char *extend_name;
239 const char *datasheet_name;
240 unsigned modified:1;
241 unsigned indexed:1;
242 unsigned output:1;
243 unsigned differential:1;
244 };
245
246
247 /**
248 * iio_channel_has_info() - Checks whether a channel supports a info attribute
249 * @chan: The channel to be queried
250 * @type: Type of the info attribute to be checked
251 *
252 * Returns true if the channels supports reporting values for the given info
253 * attribute type, false otherwise.
254 */
255 static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
256 enum iio_chan_info_enum type)
257 {
258 return (chan->info_mask_separate & BIT(type)) |
259 (chan->info_mask_shared_by_type & BIT(type)) |
260 (chan->info_mask_shared_by_dir & BIT(type)) |
261 (chan->info_mask_shared_by_all & BIT(type));
262 }
263
264 #define IIO_CHAN_SOFT_TIMESTAMP(_si) { \
265 .type = IIO_TIMESTAMP, \
266 .channel = -1, \
267 .scan_index = _si, \
268 .scan_type = { \
269 .sign = 's', \
270 .realbits = 64, \
271 .storagebits = 64, \
272 }, \
273 }
274
275 /**
276 * iio_get_time_ns() - utility function to get a time stamp for events etc
277 **/
278 static inline s64 iio_get_time_ns(void)
279 {
280 return ktime_get_real_ns();
281 }
282
283 /* Device operating modes */
284 #define INDIO_DIRECT_MODE 0x01
285 #define INDIO_BUFFER_TRIGGERED 0x02
286 #define INDIO_BUFFER_HARDWARE 0x08
287
288 #define INDIO_ALL_BUFFER_MODES \
289 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
290
291 #define INDIO_MAX_RAW_ELEMENTS 4
292
293 struct iio_trigger; /* forward declaration */
294 struct iio_dev;
295
296 /**
297 * struct iio_info - constant information about device
298 * @driver_module: module structure used to ensure correct
299 * ownership of chrdevs etc
300 * @event_attrs: event control attributes
301 * @attrs: general purpose device attributes
302 * @read_raw: function to request a value from the device.
303 * mask specifies which value. Note 0 means a reading of
304 * the channel in question. Return value will specify the
305 * type of value returned by the device. val and val2 will
306 * contain the elements making up the returned value.
307 * @read_raw_multi: function to return values from the device.
308 * mask specifies which value. Note 0 means a reading of
309 * the channel in question. Return value will specify the
310 * type of value returned by the device. vals pointer
311 * contain the elements making up the returned value.
312 * max_len specifies maximum number of elements
313 * vals pointer can contain. val_len is used to return
314 * length of valid elements in vals.
315 * @write_raw: function to write a value to the device.
316 * Parameters are the same as for read_raw.
317 * @write_raw_get_fmt: callback function to query the expected
318 * format/precision. If not set by the driver, write_raw
319 * returns IIO_VAL_INT_PLUS_MICRO.
320 * @read_event_config: find out if the event is enabled.
321 * @write_event_config: set if the event is enabled.
322 * @read_event_value: read a configuration value associated with the event.
323 * @write_event_value: write a configuration value for the event.
324 * @validate_trigger: function to validate the trigger when the
325 * current trigger gets changed.
326 * @update_scan_mode: function to configure device and scan buffer when
327 * channels have changed
328 * @debugfs_reg_access: function to read or write register value of device
329 **/
330 struct iio_info {
331 struct module *driver_module;
332 struct attribute_group *event_attrs;
333 const struct attribute_group *attrs;
334
335 int (*read_raw)(struct iio_dev *indio_dev,
336 struct iio_chan_spec const *chan,
337 int *val,
338 int *val2,
339 long mask);
340
341 int (*read_raw_multi)(struct iio_dev *indio_dev,
342 struct iio_chan_spec const *chan,
343 int max_len,
344 int *vals,
345 int *val_len,
346 long mask);
347
348 int (*write_raw)(struct iio_dev *indio_dev,
349 struct iio_chan_spec const *chan,
350 int val,
351 int val2,
352 long mask);
353
354 int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
355 struct iio_chan_spec const *chan,
356 long mask);
357
358 int (*read_event_config)(struct iio_dev *indio_dev,
359 const struct iio_chan_spec *chan,
360 enum iio_event_type type,
361 enum iio_event_direction dir);
362
363 int (*write_event_config)(struct iio_dev *indio_dev,
364 const struct iio_chan_spec *chan,
365 enum iio_event_type type,
366 enum iio_event_direction dir,
367 int state);
368
369 int (*read_event_value)(struct iio_dev *indio_dev,
370 const struct iio_chan_spec *chan,
371 enum iio_event_type type,
372 enum iio_event_direction dir,
373 enum iio_event_info info, int *val, int *val2);
374
375 int (*write_event_value)(struct iio_dev *indio_dev,
376 const struct iio_chan_spec *chan,
377 enum iio_event_type type,
378 enum iio_event_direction dir,
379 enum iio_event_info info, int val, int val2);
380
381 int (*validate_trigger)(struct iio_dev *indio_dev,
382 struct iio_trigger *trig);
383 int (*update_scan_mode)(struct iio_dev *indio_dev,
384 const unsigned long *scan_mask);
385 int (*debugfs_reg_access)(struct iio_dev *indio_dev,
386 unsigned reg, unsigned writeval,
387 unsigned *readval);
388 };
389
390 /**
391 * struct iio_buffer_setup_ops - buffer setup related callbacks
392 * @preenable: [DRIVER] function to run prior to marking buffer enabled
393 * @postenable: [DRIVER] function to run after marking buffer enabled
394 * @predisable: [DRIVER] function to run prior to marking buffer
395 * disabled
396 * @postdisable: [DRIVER] function to run after marking buffer disabled
397 * @validate_scan_mask: [DRIVER] function callback to check whether a given
398 * scan mask is valid for the device.
399 */
400 struct iio_buffer_setup_ops {
401 int (*preenable)(struct iio_dev *);
402 int (*postenable)(struct iio_dev *);
403 int (*predisable)(struct iio_dev *);
404 int (*postdisable)(struct iio_dev *);
405 bool (*validate_scan_mask)(struct iio_dev *indio_dev,
406 const unsigned long *scan_mask);
407 };
408
409 /**
410 * struct iio_dev - industrial I/O device
411 * @id: [INTERN] used to identify device internally
412 * @modes: [DRIVER] operating modes supported by device
413 * @currentmode: [DRIVER] current operating mode
414 * @dev: [DRIVER] device structure, should be assigned a parent
415 * and owner
416 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
417 * @buffer: [DRIVER] any buffer present
418 * @buffer_list: [INTERN] list of all buffers currently attached
419 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
420 * @mlock: [INTERN] lock used to prevent simultaneous device state
421 * changes
422 * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
423 * @masklength: [INTERN] the length of the mask established from
424 * channels
425 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers
426 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp
427 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
428 * @trig: [INTERN] current device trigger (buffer modes)
429 * @pollfunc: [DRIVER] function run on trigger being received
430 * @channels: [DRIVER] channel specification structure table
431 * @num_channels: [DRIVER] number of channels specified in @channels.
432 * @channel_attr_list: [INTERN] keep track of automatically created channel
433 * attributes
434 * @chan_attr_group: [INTERN] group for all attrs in base directory
435 * @name: [DRIVER] name of the device.
436 * @info: [DRIVER] callbacks and constant info from driver
437 * @info_exist_lock: [INTERN] lock to prevent use during removal
438 * @setup_ops: [DRIVER] callbacks to call before and after buffer
439 * enable/disable
440 * @chrdev: [INTERN] associated character device
441 * @groups: [INTERN] attribute groups
442 * @groupcounter: [INTERN] index of next attribute group
443 * @flags: [INTERN] file ops related flags including busy flag.
444 * @debugfs_dentry: [INTERN] device specific debugfs dentry.
445 * @cached_reg_addr: [INTERN] cached register address for debugfs reads.
446 */
447 struct iio_dev {
448 int id;
449
450 int modes;
451 int currentmode;
452 struct device dev;
453
454 struct iio_event_interface *event_interface;
455
456 struct iio_buffer *buffer;
457 struct list_head buffer_list;
458 int scan_bytes;
459 struct mutex mlock;
460
461 const unsigned long *available_scan_masks;
462 unsigned masklength;
463 const unsigned long *active_scan_mask;
464 bool scan_timestamp;
465 unsigned scan_index_timestamp;
466 struct iio_trigger *trig;
467 struct iio_poll_func *pollfunc;
468
469 struct iio_chan_spec const *channels;
470 int num_channels;
471
472 struct list_head channel_attr_list;
473 struct attribute_group chan_attr_group;
474 const char *name;
475 const struct iio_info *info;
476 struct mutex info_exist_lock;
477 const struct iio_buffer_setup_ops *setup_ops;
478 struct cdev chrdev;
479 #define IIO_MAX_GROUPS 6
480 const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
481 int groupcounter;
482
483 unsigned long flags;
484 #if defined(CONFIG_DEBUG_FS)
485 struct dentry *debugfs_dentry;
486 unsigned cached_reg_addr;
487 #endif
488 };
489
490 const struct iio_chan_spec
491 *iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
492 int iio_device_register(struct iio_dev *indio_dev);
493 void iio_device_unregister(struct iio_dev *indio_dev);
494 int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev);
495 void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev);
496 int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
497
498 extern struct bus_type iio_bus_type;
499
500 /**
501 * iio_device_put() - reference counted deallocation of struct device
502 * @indio_dev: IIO device structure containing the device
503 **/
504 static inline void iio_device_put(struct iio_dev *indio_dev)
505 {
506 if (indio_dev)
507 put_device(&indio_dev->dev);
508 }
509
510 /**
511 * dev_to_iio_dev() - Get IIO device struct from a device struct
512 * @dev: The device embedded in the IIO device
513 *
514 * Note: The device must be a IIO device, otherwise the result is undefined.
515 */
516 static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
517 {
518 return container_of(dev, struct iio_dev, dev);
519 }
520
521 /**
522 * iio_device_get() - increment reference count for the device
523 * @indio_dev: IIO device structure
524 *
525 * Returns: The passed IIO device
526 **/
527 static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
528 {
529 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
530 }
531
532
533 /**
534 * iio_device_set_drvdata() - Set device driver data
535 * @indio_dev: IIO device structure
536 * @data: Driver specific data
537 *
538 * Allows to attach an arbitrary pointer to an IIO device, which can later be
539 * retrieved by iio_device_get_drvdata().
540 */
541 static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data)
542 {
543 dev_set_drvdata(&indio_dev->dev, data);
544 }
545
546 /**
547 * iio_device_get_drvdata() - Get device driver data
548 * @indio_dev: IIO device structure
549 *
550 * Returns the data previously set with iio_device_set_drvdata()
551 */
552 static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
553 {
554 return dev_get_drvdata(&indio_dev->dev);
555 }
556
557 /* Can we make this smaller? */
558 #define IIO_ALIGN L1_CACHE_BYTES
559 struct iio_dev *iio_device_alloc(int sizeof_priv);
560
561 static inline void *iio_priv(const struct iio_dev *indio_dev)
562 {
563 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
564 }
565
566 static inline struct iio_dev *iio_priv_to_dev(void *priv)
567 {
568 return (struct iio_dev *)((char *)priv -
569 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
570 }
571
572 void iio_device_free(struct iio_dev *indio_dev);
573 struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
574 void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
575 struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
576 const char *fmt, ...);
577 void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
578
579 /**
580 * iio_buffer_enabled() - helper function to test if the buffer is enabled
581 * @indio_dev: IIO device structure for device
582 **/
583 static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
584 {
585 return indio_dev->currentmode
586 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
587 }
588
589 /**
590 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
591 * @indio_dev: IIO device structure for device
592 **/
593 #if defined(CONFIG_DEBUG_FS)
594 static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
595 {
596 return indio_dev->debugfs_dentry;
597 }
598 #else
599 static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
600 {
601 return NULL;
602 }
603 #endif
604
605 int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
606 int *fract);
607
608 /**
609 * IIO_DEGREE_TO_RAD() - Convert degree to rad
610 * @deg: A value in degree
611 *
612 * Returns the given value converted from degree to rad
613 */
614 #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
615
616 /**
617 * IIO_G_TO_M_S_2() - Convert g to meter / second**2
618 * @g: A value in g
619 *
620 * Returns the given value converted from g to meter / second**2
621 */
622 #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
623
624 #endif /* _INDUSTRIAL_IO_H_ */ 1 /*
2 * platform_device.h - generic, centralized driver model
3 *
4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
5 *
6 * This file is released under the GPLv2
7 *
8 * See Documentation/driver-model/ for more information.
9 */
10
11 #ifndef _PLATFORM_DEVICE_H_
12 #define _PLATFORM_DEVICE_H_
13
14 #include <linux/device.h>
15 #include <linux/mod_devicetable.h>
16
17 #define PLATFORM_DEVID_NONE (-1)
18 #define PLATFORM_DEVID_AUTO (-2)
19
20 struct mfd_cell;
21
22 struct platform_device {
23 const char *name;
24 int id;
25 bool id_auto;
26 struct device dev;
27 u32 num_resources;
28 struct resource *resource;
29
30 const struct platform_device_id *id_entry;
31 char *driver_override; /* Driver name to force a match */
32
33 /* MFD cell pointer */
34 struct mfd_cell *mfd_cell;
35
36 /* arch specific additions */
37 struct pdev_archdata archdata;
38 };
39
40 #define platform_get_device_id(pdev) ((pdev)->id_entry)
41
42 #define to_platform_device(x) container_of((x), struct platform_device, dev)
43
44 extern int platform_device_register(struct platform_device *);
45 extern void platform_device_unregister(struct platform_device *);
46
47 extern struct bus_type platform_bus_type;
48 extern struct device platform_bus;
49
50 extern void arch_setup_pdev_archdata(struct platform_device *);
51 extern struct resource *platform_get_resource(struct platform_device *,
52 unsigned int, unsigned int);
53 extern int platform_get_irq(struct platform_device *, unsigned int);
54 extern struct resource *platform_get_resource_byname(struct platform_device *,
55 unsigned int,
56 const char *);
57 extern int platform_get_irq_byname(struct platform_device *, const char *);
58 extern int platform_add_devices(struct platform_device **, int);
59
60 struct platform_device_info {
61 struct device *parent;
62 struct acpi_dev_node acpi_node;
63
64 const char *name;
65 int id;
66
67 const struct resource *res;
68 unsigned int num_res;
69
70 const void *data;
71 size_t size_data;
72 u64 dma_mask;
73 };
74 extern struct platform_device *platform_device_register_full(
75 const struct platform_device_info *pdevinfo);
76
77 /**
78 * platform_device_register_resndata - add a platform-level device with
79 * resources and platform-specific data
80 *
81 * @parent: parent device for the device we're adding
82 * @name: base name of the device we're adding
83 * @id: instance id
84 * @res: set of resources that needs to be allocated for the device
85 * @num: number of resources
86 * @data: platform specific data for this platform device
87 * @size: size of platform specific data
88 *
89 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
90 */
91 static inline struct platform_device *platform_device_register_resndata(
92 struct device *parent, const char *name, int id,
93 const struct resource *res, unsigned int num,
94 const void *data, size_t size) {
95
96 struct platform_device_info pdevinfo = {
97 .parent = parent,
98 .name = name,
99 .id = id,
100 .res = res,
101 .num_res = num,
102 .data = data,
103 .size_data = size,
104 .dma_mask = 0,
105 };
106
107 return platform_device_register_full(&pdevinfo);
108 }
109
110 /**
111 * platform_device_register_simple - add a platform-level device and its resources
112 * @name: base name of the device we're adding
113 * @id: instance id
114 * @res: set of resources that needs to be allocated for the device
115 * @num: number of resources
116 *
117 * This function creates a simple platform device that requires minimal
118 * resource and memory management. Canned release function freeing memory
119 * allocated for the device allows drivers using such devices to be
120 * unloaded without waiting for the last reference to the device to be
121 * dropped.
122 *
123 * This interface is primarily intended for use with legacy drivers which
124 * probe hardware directly. Because such drivers create sysfs device nodes
125 * themselves, rather than letting system infrastructure handle such device
126 * enumeration tasks, they don't fully conform to the Linux driver model.
127 * In particular, when such drivers are built as modules, they can't be
128 * "hotplugged".
129 *
130 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
131 */
132 static inline struct platform_device *platform_device_register_simple(
133 const char *name, int id,
134 const struct resource *res, unsigned int num)
135 {
136 return platform_device_register_resndata(NULL, name, id,
137 res, num, NULL, 0);
138 }
139
140 /**
141 * platform_device_register_data - add a platform-level device with platform-specific data
142 * @parent: parent device for the device we're adding
143 * @name: base name of the device we're adding
144 * @id: instance id
145 * @data: platform specific data for this platform device
146 * @size: size of platform specific data
147 *
148 * This function creates a simple platform device that requires minimal
149 * resource and memory management. Canned release function freeing memory
150 * allocated for the device allows drivers using such devices to be
151 * unloaded without waiting for the last reference to the device to be
152 * dropped.
153 *
154 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
155 */
156 static inline struct platform_device *platform_device_register_data(
157 struct device *parent, const char *name, int id,
158 const void *data, size_t size)
159 {
160 return platform_device_register_resndata(parent, name, id,
161 NULL, 0, data, size);
162 }
163
164 extern struct platform_device *platform_device_alloc(const char *name, int id);
165 extern int platform_device_add_resources(struct platform_device *pdev,
166 const struct resource *res,
167 unsigned int num);
168 extern int platform_device_add_data(struct platform_device *pdev,
169 const void *data, size_t size);
170 extern int platform_device_add(struct platform_device *pdev);
171 extern void platform_device_del(struct platform_device *pdev);
172 extern void platform_device_put(struct platform_device *pdev);
173
174 struct platform_driver {
175 int (*probe)(struct platform_device *);
176 int (*remove)(struct platform_device *);
177 void (*shutdown)(struct platform_device *);
178 int (*suspend)(struct platform_device *, pm_message_t state);
179 int (*resume)(struct platform_device *);
180 struct device_driver driver;
181 const struct platform_device_id *id_table;
182 bool prevent_deferred_probe;
183 };
184
185 #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
186 driver))
187
188 /*
189 * use a macro to avoid include chaining to get THIS_MODULE
190 */
191 #define platform_driver_register(drv) \
192 __platform_driver_register(drv, THIS_MODULE)
193 extern int __platform_driver_register(struct platform_driver *,
194 struct module *);
195 extern void platform_driver_unregister(struct platform_driver *);
196
197 /* non-hotpluggable platform devices may use this so that probe() and
198 * its support may live in __init sections, conserving runtime memory.
199 */
200 extern int platform_driver_probe(struct platform_driver *driver,
201 int (*probe)(struct platform_device *));
202
203 static inline void *platform_get_drvdata(const struct platform_device *pdev)
204 {
205 return dev_get_drvdata(&pdev->dev);
206 }
207
208 static inline void platform_set_drvdata(struct platform_device *pdev,
209 void *data)
210 {
211 dev_set_drvdata(&pdev->dev, data);
212 }
213
214 /* module_platform_driver() - Helper macro for drivers that don't do
215 * anything special in module init/exit. This eliminates a lot of
216 * boilerplate. Each module may only use this macro once, and
217 * calling it replaces module_init() and module_exit()
218 */
219 #define module_platform_driver(__platform_driver) \
220 module_driver(__platform_driver, platform_driver_register, \
221 platform_driver_unregister)
222
223 /* module_platform_driver_probe() - Helper macro for drivers that don't do
224 * anything special in module init/exit. This eliminates a lot of
225 * boilerplate. Each module may only use this macro once, and
226 * calling it replaces module_init() and module_exit()
227 */
228 #define module_platform_driver_probe(__platform_driver, __platform_probe) \
229 static int __init __platform_driver##_init(void) \
230 { \
231 return platform_driver_probe(&(__platform_driver), \
232 __platform_probe); \
233 } \
234 module_init(__platform_driver##_init); \
235 static void __exit __platform_driver##_exit(void) \
236 { \
237 platform_driver_unregister(&(__platform_driver)); \
238 } \
239 module_exit(__platform_driver##_exit);
240
241 extern struct platform_device *platform_create_bundle(
242 struct platform_driver *driver, int (*probe)(struct platform_device *),
243 struct resource *res, unsigned int n_res,
244 const void *data, size_t size);
245
246 /* early platform driver interface */
247 struct early_platform_driver {
248 const char *class_str;
249 struct platform_driver *pdrv;
250 struct list_head list;
251 int requested_id;
252 char *buffer;
253 int bufsize;
254 };
255
256 #define EARLY_PLATFORM_ID_UNSET -2
257 #define EARLY_PLATFORM_ID_ERROR -3
258
259 extern int early_platform_driver_register(struct early_platform_driver *epdrv,
260 char *buf);
261 extern void early_platform_add_devices(struct platform_device **devs, int num);
262
263 static inline int is_early_platform_device(struct platform_device *pdev)
264 {
265 return !pdev->dev.driver;
266 }
267
268 extern void early_platform_driver_register_all(char *class_str);
269 extern int early_platform_driver_probe(char *class_str,
270 int nr_probe, int user_only);
271 extern void early_platform_cleanup(void);
272
273 #define early_platform_init(class_string, platdrv) \
274 early_platform_init_buffer(class_string, platdrv, NULL, 0)
275
276 #ifndef MODULE
277 #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
278 static __initdata struct early_platform_driver early_driver = { \
279 .class_str = class_string, \
280 .buffer = buf, \
281 .bufsize = bufsiz, \
282 .pdrv = platdrv, \
283 .requested_id = EARLY_PLATFORM_ID_UNSET, \
284 }; \
285 static int __init early_platform_driver_setup_func(char *buffer) \
286 { \
287 return early_platform_driver_register(&early_driver, buffer); \
288 } \
289 early_param(class_string, early_platform_driver_setup_func)
290 #else /* MODULE */
291 #define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
292 static inline char *early_platform_driver_setup_func(void) \
293 { \
294 return bufsiz ? buf : NULL; \
295 }
296 #endif /* MODULE */
297
298 #ifdef CONFIG_SUSPEND
299 extern int platform_pm_suspend(struct device *dev);
300 extern int platform_pm_resume(struct device *dev);
301 #else
302 #define platform_pm_suspend NULL
303 #define platform_pm_resume NULL
304 #endif
305
306 #ifdef CONFIG_HIBERNATE_CALLBACKS
307 extern int platform_pm_freeze(struct device *dev);
308 extern int platform_pm_thaw(struct device *dev);
309 extern int platform_pm_poweroff(struct device *dev);
310 extern int platform_pm_restore(struct device *dev);
311 #else
312 #define platform_pm_freeze NULL
313 #define platform_pm_thaw NULL
314 #define platform_pm_poweroff NULL
315 #define platform_pm_restore NULL
316 #endif
317
318 #ifdef CONFIG_PM_SLEEP
319 #define USE_PLATFORM_PM_SLEEP_OPS \
320 .suspend = platform_pm_suspend, \
321 .resume = platform_pm_resume, \
322 .freeze = platform_pm_freeze, \
323 .thaw = platform_pm_thaw, \
324 .poweroff = platform_pm_poweroff, \
325 .restore = platform_pm_restore,
326 #else
327 #define USE_PLATFORM_PM_SLEEP_OPS
328 #endif
329
330 #endif /* _PLATFORM_DEVICE_H_ */ |
Here is an explanation of a rule violation arisen while checking your driver against a corresponding kernel.
Note that it may be false positive, i.e. there isn't a real error indeed. Please analyze a given error trace and related source code to understand whether there is an error in your driver.
Error trace column contains a path on which the given rule is violated. You can expand/collapse some entity classes by clicking on corresponding checkboxes in a main menu or in an advanced Others menu. Also you can expand/collapse each particular entity by clicking on +/-. In hovering on some entities you can see some tips. Also the error trace is bound with related source code. Line numbers may be shown as links on the left. You can click on them to open corresponding lines in source code.
Source code column contains a content of files related with the error trace. There is source code of your driver (note that there are some LDV modifications at the end), kernel headers and rule model. Tabs show a currently opened file and other available files. In hovering on them you can see full file names. On clicking a corresponding file content will be shown.
Ядро | Модуль | Правило | Верификатор | Вердикт | Статус | Время создания | Описание проблемы |
linux-3.17-rc1.tar.xz | drivers/iio/light/hid-sensor-prox.ko | 104_1a | CPAchecker | Bug | Fixed | 2015-05-07 00:50:10 | L0194 |
Комментарий
reported: 7 May 2015
[В начало]