extern void abort(void); extern void __assert_fail(const char *, const char *, unsigned int, const char *) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__)); void reach_error() { __assert_fail("0", "drivers--hwmon--it87.ko_050.98dd22c.32_7a.cil_true-unreach-call.i", 3, "reach_error"); } /* Generated by CIL v. 1.5.1 */ /* print_CIL_Input is false */ typedef __builtin_va_list __gnuc_va_list[1U]; typedef __gnuc_va_list va_list[1U]; typedef unsigned int __kernel_mode_t; typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_time_t; typedef int __kernel_clockid_t; typedef unsigned short __u16; typedef unsigned int __u32; typedef unsigned long long __u64; typedef unsigned char u8; typedef unsigned short u16; typedef unsigned int u32; typedef unsigned long long u64; typedef __u32 __kernel_dev_t; typedef __kernel_dev_t dev_t; typedef __kernel_mode_t mode_t; typedef __kernel_clockid_t clockid_t; typedef __kernel_size_t size_t; typedef __kernel_ssize_t ssize_t; typedef __kernel_time_t time_t; typedef unsigned int gfp_t; typedef u64 resource_size_t; struct module; struct bug_entry { unsigned long bug_addr ; char const *file ; unsigned short line ; unsigned short flags ; }; struct completion; struct pt_regs; struct task_struct; struct pt_regs { unsigned long r15 ; unsigned long r14 ; unsigned long r13 ; unsigned long r12 ; unsigned long bp ; unsigned long bx ; unsigned long r11 ; unsigned long r10 ; unsigned long r9 ; unsigned long r8 ; unsigned long ax ; unsigned long cx ; unsigned long dx ; unsigned long si ; unsigned long di ; unsigned long orig_ax ; unsigned long ip ; unsigned long cs ; unsigned long flags ; unsigned long sp ; unsigned long ss ; }; struct info { long ___orig_eip ; long ___ebx ; long ___ecx ; long ___edx ; long ___esi ; long ___edi ; long ___ebp ; long ___eax ; long ___ds ; long ___es ; long ___fs ; long ___orig_eax ; long ___eip ; long ___cs ; long ___eflags ; long ___esp ; long ___ss ; long ___vm86_es ; long ___vm86_ds ; long ___vm86_fs ; long ___vm86_gs ; }; struct page; struct __anonstruct_ldv_1897_11 { unsigned int a ; unsigned int b ; }; struct __anonstruct_ldv_1912_12 { u16 limit0 ; u16 base0 ; unsigned char base1 ; unsigned char type : 4 ; unsigned char s : 1 ; unsigned char dpl : 2 ; unsigned char p : 1 ; unsigned char limit : 4 ; unsigned char avl : 1 ; unsigned char l : 1 ; unsigned char d : 1 ; unsigned char g : 1 ; unsigned char base2 ; }; union __anonunion_ldv_1913_10 { struct __anonstruct_ldv_1897_11 ldv_1897 ; struct __anonstruct_ldv_1912_12 ldv_1912 ; }; struct desc_struct { union __anonunion_ldv_1913_10 ldv_1913 ; }; struct gate_struct64 { u16 offset_low ; u16 segment ; unsigned char ist : 3 ; unsigned char zero0 : 5 ; unsigned char type : 5 ; unsigned char dpl : 2 ; unsigned char p : 1 ; u16 offset_middle ; u32 offset_high ; u32 zero1 ; }; typedef struct gate_struct64 gate_desc; struct desc_ptr { unsigned short size ; unsigned long address ; }; struct thread_struct; struct tss_struct; struct pv_lazy_ops { void (*enter)(void) ; void (*leave)(void) ; }; struct pv_cpu_ops { unsigned long (*get_debugreg)(int ) ; void (*set_debugreg)(int , unsigned long ) ; void (*clts)(void) ; unsigned long (*read_cr0)(void) ; void (*write_cr0)(unsigned long ) ; unsigned long (*read_cr4_safe)(void) ; unsigned long (*read_cr4)(void) ; void (*write_cr4)(unsigned long ) ; unsigned long (*read_cr8)(void) ; void (*write_cr8)(unsigned long ) ; void (*load_tr_desc)(void) ; void (*load_gdt)(struct desc_ptr const * ) ; void (*load_idt)(struct desc_ptr const * ) ; void (*store_gdt)(struct desc_ptr * ) ; void (*store_idt)(struct desc_ptr * ) ; void (*set_ldt)(void const * , unsigned int ) ; unsigned long (*store_tr)(void) ; void (*load_tls)(struct thread_struct * , unsigned int ) ; void (*load_gs_index)(unsigned int ) ; void (*write_ldt_entry)(struct desc_struct * , int , void const * ) ; void (*write_gdt_entry)(struct desc_struct * , int , void const * , int ) ; void (*write_idt_entry)(gate_desc * , int , gate_desc const * ) ; void (*load_sp0)(struct tss_struct * , struct thread_struct * ) ; void (*set_iopl_mask)(unsigned int ) ; void (*wbinvd)(void) ; void (*io_delay)(void) ; void (*cpuid)(unsigned int * , unsigned int * , unsigned int * , unsigned int * ) ; u64 (*read_msr)(unsigned int , int * ) ; int (*write_msr)(unsigned int , unsigned int , unsigned int ) ; u64 (*read_tsc)(void) ; u64 (*read_pmc)(int ) ; unsigned long long (*read_tscp)(unsigned int * ) ; void (*irq_enable_sysexit)(void) ; void (*usergs_sysret64)(void) ; void (*usergs_sysret32)(void) ; void (*iret)(void) ; void (*swapgs)(void) ; struct pv_lazy_ops lazy_mode ; }; struct raw_spinlock; struct exec_domain; struct map_segment; struct exec_domain { char const *name ; void (*handler)(int , struct pt_regs * ) ; unsigned char pers_low ; unsigned char pers_high ; unsigned long *signal_map ; unsigned long *signal_invmap ; struct map_segment *err_map ; struct map_segment *socktype_map ; struct map_segment *sockopt_map ; struct map_segment *af_map ; struct module *module ; struct exec_domain *next ; }; struct x86_hw_tss { u32 reserved1 ; u64 sp0 ; u64 sp1 ; u64 sp2 ; u64 reserved2 ; u64 ist[7U] ; u32 reserved3 ; u32 reserved4 ; u16 reserved5 ; u16 io_bitmap_base ; }; struct tss_struct { struct x86_hw_tss x86_tss ; unsigned long io_bitmap[1025U] ; unsigned long io_bitmap_max ; struct thread_struct *io_bitmap_owner ; unsigned long stack[64U] ; }; struct i387_fsave_struct { u32 cwd ; u32 swd ; u32 twd ; u32 fip ; u32 fcs ; u32 foo ; u32 fos ; u32 st_space[20U] ; u32 status ; }; struct __anonstruct_ldv_4303_15 { u64 rip ; u64 rdp ; }; struct __anonstruct_ldv_4309_16 { u32 fip ; u32 fcs ; u32 foo ; u32 fos ; }; union __anonunion_ldv_4310_14 { struct __anonstruct_ldv_4303_15 ldv_4303 ; struct __anonstruct_ldv_4309_16 ldv_4309 ; }; struct i387_fxsave_struct { u16 cwd ; u16 swd ; u16 twd ; u16 fop ; union __anonunion_ldv_4310_14 ldv_4310 ; u32 mxcsr ; u32 mxcsr_mask ; u32 st_space[32U] ; u32 xmm_space[64U] ; u32 padding[24U] ; }; struct i387_soft_struct { u32 cwd ; u32 swd ; u32 twd ; u32 fip ; u32 fcs ; u32 foo ; u32 fos ; u32 st_space[20U] ; u8 ftop ; u8 changed ; u8 lookahead ; u8 no_update ; u8 rm ; u8 alimit ; struct info *info ; u32 entry_eip ; }; union thread_xstate { struct i387_fsave_struct fsave ; struct i387_fxsave_struct fxsave ; struct i387_soft_struct soft ; }; struct kmem_cache; struct thread_struct { struct desc_struct tls_array[3U] ; unsigned long sp0 ; unsigned long sp ; unsigned long usersp ; unsigned short es ; unsigned short ds ; unsigned short fsindex ; unsigned short gsindex ; unsigned long ip ; unsigned long fs ; unsigned long gs ; unsigned long debugreg0 ; unsigned long debugreg1 ; unsigned long debugreg2 ; unsigned long debugreg3 ; unsigned long debugreg6 ; unsigned long debugreg7 ; unsigned long cr2 ; unsigned long trap_no ; unsigned long error_code ; union thread_xstate *xstate ; unsigned long *io_bitmap_ptr ; unsigned long iopl ; unsigned int io_bitmap_max ; unsigned long debugctlmsr ; unsigned long ds_area_msr ; }; struct __anonstruct_mm_segment_t_17 { unsigned long seg ; }; typedef struct __anonstruct_mm_segment_t_17 mm_segment_t; struct list_head { struct list_head *next ; struct list_head *prev ; }; struct raw_spinlock { unsigned int slock ; }; typedef struct raw_spinlock raw_spinlock_t; struct lockdep_map; struct stack_trace { unsigned int nr_entries ; unsigned int max_entries ; unsigned long *entries ; int skip ; }; struct lockdep_subclass_key { char __one_byte ; } __attribute__((__packed__)) ; struct lock_class_key { struct lockdep_subclass_key subkeys[8U] ; }; 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[9U] ; struct list_head locks_after ; struct list_head locks_before ; unsigned int version ; unsigned long ops ; char const *name ; int name_version ; unsigned long contention_point[4U] ; }; struct lockdep_map { struct lock_class_key *key ; struct lock_class *class_cache ; char const *name ; int cpu ; }; struct __anonstruct_spinlock_t_19 { raw_spinlock_t raw_lock ; unsigned int magic ; unsigned int owner_cpu ; void *owner ; struct lockdep_map dep_map ; }; typedef struct __anonstruct_spinlock_t_19 spinlock_t; struct __anonstruct_atomic_t_21 { int counter ; }; typedef struct __anonstruct_atomic_t_21 atomic_t; struct __anonstruct_atomic64_t_22 { long counter ; }; typedef struct __anonstruct_atomic64_t_22 atomic64_t; typedef atomic64_t atomic_long_t; struct thread_info; struct mutex { atomic_t count ; spinlock_t wait_lock ; struct list_head wait_list ; struct thread_info *owner ; char const *name ; void *magic ; struct lockdep_map dep_map ; }; struct timespec; struct compat_timespec; struct __anonstruct_ldv_5285_24 { unsigned long arg0 ; unsigned long arg1 ; unsigned long arg2 ; unsigned long arg3 ; }; struct __anonstruct_futex_25 { u32 *uaddr ; u32 val ; u32 flags ; u32 bitset ; u64 time ; }; struct __anonstruct_nanosleep_26 { clockid_t index ; struct timespec *rmtp ; struct compat_timespec *compat_rmtp ; u64 expires ; }; union __anonunion_ldv_5299_23 { struct __anonstruct_ldv_5285_24 ldv_5285 ; struct __anonstruct_futex_25 futex ; struct __anonstruct_nanosleep_26 nanosleep ; }; struct restart_block { long (*fn)(struct restart_block * ) ; union __anonunion_ldv_5299_23 ldv_5299 ; }; struct thread_info { struct task_struct *task ; struct exec_domain *exec_domain ; unsigned long flags ; __u32 status ; __u32 cpu ; int preempt_count ; mm_segment_t addr_limit ; struct restart_block restart_block ; void *sysenter_return ; }; struct timespec { time_t tv_sec ; long tv_nsec ; }; struct __wait_queue_head { spinlock_t lock ; struct list_head task_list ; }; typedef struct __wait_queue_head wait_queue_head_t; struct device; struct pm_message { int event ; }; typedef struct pm_message pm_message_t; struct 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 * ) ; }; struct pm_ext_ops { struct pm_ops base ; 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 * ) ; }; enum dpm_state { DPM_INVALID = 0, DPM_ON = 1, DPM_PREPARING = 2, DPM_RESUMING = 3, DPM_SUSPENDING = 4, DPM_OFF = 5, DPM_OFF_IRQ = 6 } ; struct dev_pm_info { pm_message_t power_state ; unsigned char can_wakeup : 1 ; unsigned char should_wakeup : 1 ; enum dpm_state status ; struct list_head entry ; }; typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; 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 ; }; typedef struct elf64_sym Elf64_Sym; struct kobject; struct attribute { char const *name ; struct module *owner ; mode_t mode ; }; struct attribute_group { char const *name ; mode_t (*is_visible)(struct kobject * , struct attribute * , int ) ; struct attribute **attrs ; }; struct sysfs_ops { ssize_t (*show)(struct kobject * , struct attribute * , char * ) ; ssize_t (*store)(struct kobject * , struct attribute * , char const * , size_t ) ; }; struct kref { atomic_t refcount ; }; struct kset; struct kobj_type; struct sysfs_dirent; struct kobject { char const *name ; struct list_head entry ; struct kobject *parent ; struct kset *kset ; struct kobj_type *ktype ; struct sysfs_dirent *sd ; struct kref kref ; unsigned char state_initialized : 1 ; unsigned char state_in_sysfs : 1 ; unsigned char state_add_uevent_sent : 1 ; unsigned char state_remove_uevent_sent : 1 ; }; struct kobj_type { void (*release)(struct kobject * ) ; struct sysfs_ops *sysfs_ops ; struct attribute **default_attrs ; }; struct kobj_uevent_env { char *envp[32U] ; int envp_idx ; char buf[2048U] ; int buflen ; }; struct kset_uevent_ops { int (*filter)(struct kset * , struct kobject * ) ; char const *(*name)(struct kset * , struct kobject * ) ; int (*uevent)(struct kset * , struct kobject * , struct kobj_uevent_env * ) ; }; struct kset { struct list_head list ; spinlock_t list_lock ; struct kobject kobj ; struct kset_uevent_ops *uevent_ops ; }; struct marker; typedef void marker_probe_func(void * , void * , char const * , va_list * ); struct marker_probe_closure { marker_probe_func *func ; void *probe_private ; }; struct marker { char const *name ; char const *format ; char state ; char ptype ; void (*call)(struct marker const * , void * , ...) ; struct marker_probe_closure single ; struct marker_probe_closure *multi ; }; struct kmem_cache_cpu { void **freelist ; struct page *page ; int node ; unsigned int offset ; unsigned int objsize ; unsigned int stat[18U] ; }; struct kmem_cache_node { spinlock_t list_lock ; unsigned long nr_partial ; unsigned long min_partial ; struct list_head partial ; atomic_long_t nr_slabs ; atomic_long_t total_objects ; struct list_head full ; }; struct kmem_cache_order_objects { unsigned long x ; }; struct kmem_cache { unsigned long flags ; int size ; int objsize ; int offset ; struct kmem_cache_order_objects oo ; struct kmem_cache_node local_node ; struct kmem_cache_order_objects max ; struct kmem_cache_order_objects min ; gfp_t allocflags ; int refcount ; void (*ctor)(void * ) ; int inuse ; int align ; char const *name ; struct list_head list ; struct kobject kobj ; int remote_node_defrag_ratio ; struct kmem_cache_node *node[64U] ; struct kmem_cache_cpu *cpu_slab[8U] ; }; struct __anonstruct_local_t_86 { atomic_long_t a ; }; typedef struct __anonstruct_local_t_86 local_t; struct mod_arch_specific { }; struct kernel_symbol { unsigned long value ; char const *name ; }; struct module_attribute { struct attribute attr ; ssize_t (*show)(struct module_attribute * , struct module * , char * ) ; ssize_t (*store)(struct module_attribute * , struct module * , char const * , size_t ) ; void (*setup)(struct module * , char const * ) ; int (*test)(struct module * ) ; void (*free)(struct module * ) ; }; struct module_kobject { struct kobject kobj ; struct module *mod ; struct kobject *drivers_dir ; }; struct exception_table_entry; struct module_ref { local_t count ; }; enum module_state { MODULE_STATE_LIVE = 0, MODULE_STATE_COMING = 1, MODULE_STATE_GOING = 2 } ; struct module_param_attrs; struct module_sect_attrs; struct module_notes_attrs; struct module { enum module_state state ; struct list_head list ; char name[56U] ; struct module_kobject mkobj ; struct module_param_attrs *param_attrs ; struct module_attribute *modinfo_attrs ; char const *version ; char const *srcversion ; struct kobject *holders_dir ; struct kernel_symbol const *syms ; unsigned long const *crcs ; unsigned int num_syms ; unsigned int num_gpl_syms ; struct kernel_symbol const *gpl_syms ; unsigned long const *gpl_crcs ; struct kernel_symbol const *unused_syms ; unsigned long const *unused_crcs ; unsigned int num_unused_syms ; unsigned int num_unused_gpl_syms ; struct kernel_symbol const *unused_gpl_syms ; unsigned long const *unused_gpl_crcs ; struct kernel_symbol const *gpl_future_syms ; unsigned long const *gpl_future_crcs ; unsigned int num_gpl_future_syms ; unsigned int num_exentries ; struct exception_table_entry const *extable ; int (*init)(void) ; void *module_init ; void *module_core ; unsigned int init_size ; unsigned int core_size ; unsigned int init_text_size ; unsigned int core_text_size ; void *unwind_info ; 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 ; unsigned int num_symtab ; char *strtab ; struct module_sect_attrs *sect_attrs ; struct module_notes_attrs *notes_attrs ; void *percpu ; char *args ; struct marker *markers ; unsigned int num_markers ; struct list_head modules_which_use_me ; struct task_struct *waiter ; void (*exit)(void) ; struct module_ref ref[8U] ; }; struct device_driver; struct resource { resource_size_t start ; resource_size_t end ; char const *name ; unsigned long flags ; struct resource *parent ; struct resource *sibling ; struct resource *child ; }; struct completion { unsigned int done ; wait_queue_head_t wait ; }; struct klist_node; struct klist { spinlock_t k_lock ; struct list_head k_list ; void (*get)(struct klist_node * ) ; void (*put)(struct klist_node * ) ; }; struct klist_node { struct klist *n_klist ; struct list_head n_node ; struct kref n_ref ; struct completion n_removed ; }; struct semaphore { spinlock_t lock ; unsigned int count ; struct list_head wait_list ; }; struct dma_mapping_ops; struct dev_archdata { void *acpi_handle ; struct dma_mapping_ops *dma_ops ; void *iommu ; }; struct driver_private; struct class; struct class_private; struct bus_type; struct bus_type_private; struct bus_attribute { struct attribute attr ; ssize_t (*show)(struct bus_type * , char * ) ; ssize_t (*store)(struct bus_type * , char const * , size_t ) ; }; struct device_attribute; struct driver_attribute; struct bus_type { char const *name ; struct bus_attribute *bus_attrs ; struct device_attribute *dev_attrs ; struct driver_attribute *drv_attrs ; 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 (*suspend)(struct device * , pm_message_t ) ; int (*suspend_late)(struct device * , pm_message_t ) ; int (*resume_early)(struct device * ) ; int (*resume)(struct device * ) ; struct pm_ext_ops *pm ; struct bus_type_private *p ; }; struct device_driver { char const *name ; struct bus_type *bus ; struct module *owner ; char const *mod_name ; int (*probe)(struct device * ) ; int (*remove)(struct device * ) ; void (*shutdown)(struct device * ) ; int (*suspend)(struct device * , pm_message_t ) ; int (*resume)(struct device * ) ; struct attribute_group **groups ; struct pm_ops *pm ; struct driver_private *p ; }; struct driver_attribute { struct attribute attr ; ssize_t (*show)(struct device_driver * , char * ) ; ssize_t (*store)(struct device_driver * , char const * , size_t ) ; }; struct class_attribute; struct class { char const *name ; struct module *owner ; struct class_attribute *class_attrs ; struct device_attribute *dev_attrs ; struct kobject *dev_kobj ; int (*dev_uevent)(struct device * , struct kobj_uevent_env * ) ; void (*class_release)(struct class * ) ; void (*dev_release)(struct device * ) ; int (*suspend)(struct device * , pm_message_t ) ; int (*resume)(struct device * ) ; struct pm_ops *pm ; struct class_private *p ; }; struct class_attribute { struct attribute attr ; ssize_t (*show)(struct class * , char * ) ; ssize_t (*store)(struct class * , char const * , size_t ) ; }; struct device_type { char const *name ; struct attribute_group **groups ; int (*uevent)(struct device * , struct kobj_uevent_env * ) ; void (*release)(struct device * ) ; int (*suspend)(struct device * , pm_message_t ) ; int (*resume)(struct device * ) ; struct pm_ops *pm ; }; struct device_attribute { struct attribute attr ; ssize_t (*show)(struct device * , struct device_attribute * , char * ) ; ssize_t (*store)(struct device * , struct device_attribute * , char const * , size_t ) ; }; struct device_dma_parameters { unsigned int max_segment_size ; unsigned long segment_boundary_mask ; }; struct dma_coherent_mem; struct device { struct klist klist_children ; struct klist_node knode_parent ; struct klist_node knode_driver ; struct klist_node knode_bus ; struct device *parent ; struct kobject kobj ; char bus_id[20U] ; char const *init_name ; struct device_type *type ; unsigned char uevent_suppress : 1 ; struct semaphore sem ; struct bus_type *bus ; struct device_driver *driver ; void *driver_data ; void *platform_data ; struct dev_pm_info power ; int numa_node ; u64 *dma_mask ; u64 coherent_dma_mask ; struct device_dma_parameters *dma_parms ; struct list_head dma_pools ; struct dma_coherent_mem *dma_mem ; struct dev_archdata archdata ; spinlock_t devres_lock ; struct list_head devres_head ; struct list_head node ; struct class *class ; dev_t devt ; struct attribute_group **groups ; void (*release)(struct device * ) ; }; struct platform_device { char const *name ; int id ; struct device dev ; u32 num_resources ; struct resource *resource ; }; 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 (*suspend_late)(struct platform_device * , pm_message_t ) ; int (*resume_early)(struct platform_device * ) ; int (*resume)(struct platform_device * ) ; struct pm_ext_ops *pm ; struct device_driver driver ; }; struct sensor_device_attribute { struct device_attribute dev_attr ; int index ; }; enum chips { it87 = 0, it8712 = 1, it8716 = 2, it8718 = 3 } ; struct it87_sio_data { enum chips type ; u8 revision ; u8 vid_value ; u8 skip_pwm ; }; struct it87_data { struct device *hwmon_dev ; enum chips type ; u8 revision ; unsigned short addr ; char const *name ; struct mutex update_lock ; char valid ; unsigned long last_updated ; u8 in[9U] ; u8 in_max[8U] ; u8 in_min[8U] ; u8 has_fan ; u16 fan[5U] ; u16 fan_min[5U] ; u8 temp[3U] ; u8 temp_high[3U] ; u8 temp_low[3U] ; u8 sensor ; u8 fan_div[3U] ; u8 vid ; u8 vrm ; u32 alarms ; u8 fan_main_ctrl ; u8 fan_ctl ; u8 manual_pwm_ctl[3U] ; }; enum lock_usage_bit { LOCK_USED = 0, LOCK_USED_IN_HARDIRQ = 1, LOCK_USED_IN_SOFTIRQ = 2, LOCK_ENABLED_SOFTIRQS = 3, LOCK_ENABLED_HARDIRQS = 4, LOCK_USED_IN_HARDIRQ_READ = 5, LOCK_USED_IN_SOFTIRQ_READ = 6, LOCK_ENABLED_SOFTIRQS_READ = 7, LOCK_ENABLED_HARDIRQS_READ = 8, LOCK_USAGE_STATES = 9 } ; long ldv__builtin_expect(long exp , long c ) ; extern unsigned long simple_strtoul(char const * , char ** , unsigned int ) ; extern long simple_strtol(char const * , char ** , unsigned int ) ; extern int sprintf(char * , char const * , ...) ; extern int printk(char const * , ...) ; extern void *memset(void * , int , size_t ) ; extern int strcmp(char const * , char const * ) ; extern struct pv_cpu_ops pv_cpu_ops ; __inline static void slow_down_io(void) { { (*(pv_cpu_ops.io_delay))(); return; } } extern void __mutex_init(struct mutex * , char const * , struct lock_class_key * ) ; extern void mutex_unlock(struct mutex * ) ; void ldv_mutex_unlock_2(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_4(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_6(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_8(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_10(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_11(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_13(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_15(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_17(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_18(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_20(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_22(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_24(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_unlock_26(struct mutex *ldv_func_arg1 ) ; extern void mutex_lock(struct mutex * ) ; void ldv_mutex_lock_1(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_3(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_5(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_7(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_9(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_12(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_14(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_16(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_19(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_21(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_23(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_25(struct mutex *ldv_func_arg1 ) ; void ldv_mutex_lock_update_lock_of_it87_data(struct mutex *lock ) ; void ldv_mutex_unlock_update_lock_of_it87_data(struct mutex *lock ) ; extern int sysfs_create_group(struct kobject * , struct attribute_group const * ) ; extern void sysfs_remove_group(struct kobject * , struct attribute_group const * ) ; extern void kfree(void const * ) ; extern unsigned long volatile jiffies ; extern void *__kmalloc(size_t , gfp_t ) ; __inline static void *kmalloc(size_t size , gfp_t flags ) { void *tmp___2 ; { tmp___2 = __kmalloc(size, flags); return (tmp___2); } } __inline static void *kzalloc(size_t size , gfp_t flags ) { void *tmp ; { tmp = kmalloc(size, flags | 32768U); return (tmp); } } extern struct module __this_module ; extern struct resource ioport_resource ; extern struct resource *__request_region(struct resource * , resource_size_t , resource_size_t , char const * ) ; extern void __release_region(struct resource * , resource_size_t , resource_size_t ) ; extern int device_create_file(struct device * , struct device_attribute * ) ; __inline static char const *dev_name(struct device const *dev ) { { return ((char const *)(& dev->bus_id)); } } __inline static void *dev_get_drvdata(struct device *dev ) { { return (dev->driver_data); } } __inline static void dev_set_drvdata(struct device *dev , void *data ) { { dev->driver_data = data; return; } } extern char const *dev_driver_string(struct device const * ) ; extern void platform_device_unregister(struct platform_device * ) ; extern struct resource *platform_get_resource(struct platform_device * , unsigned int , unsigned int ) ; extern struct platform_device *platform_device_alloc(char const * , int ) ; extern int platform_device_add_resources(struct platform_device * , struct resource * , unsigned int ) ; extern int platform_device_add_data(struct platform_device * , void const * , size_t ) ; extern int platform_device_add(struct platform_device * ) ; extern void platform_device_put(struct platform_device * ) ; extern int platform_driver_register(struct platform_driver * ) ; extern void platform_driver_unregister(struct platform_driver * ) ; extern struct device *hwmon_device_register(struct device * ) ; extern void hwmon_device_unregister(struct device * ) ; __inline static int SENSORS_LIMIT(long value , long low , long high ) { { if (value < low) { return ((int )low); } else if (value > high) { return ((int )high); } else { return ((int )value); } } } extern int vid_from_reg(int , u8 ) ; extern u8 vid_which_vrm(void) ; __inline static long PTR_ERR(void const *ptr ) { { return ((long )ptr); } } __inline static long IS_ERR(void const *ptr ) { long tmp ; { tmp = ldv__builtin_expect((unsigned long )ptr > 0xfffffffffffff000UL, 0L); return (tmp); } } extern char const *dmi_get_system_info(int ) ; __inline static unsigned char inb(unsigned short port ) { unsigned char _v ; { __asm__ volatile ("inb %w1,%0": "=a" (_v): "Nd" (port)); return (_v); } } __inline static unsigned char inb_p(unsigned short port ) { unsigned char _v ; { __asm__ volatile ("inb %w1,%0": "=a" (_v): "Nd" (port)); slow_down_io(); return (_v); } } __inline static void outb(unsigned char value , unsigned short port ) { { __asm__ volatile ("outb %b0,%w1": : "a" (value), "Nd" (port)); return; } } __inline static void outb_p(unsigned char value , unsigned short port ) { { __asm__ volatile ("outb %b0,%w1": : "a" (value), "Nd" (port)); slow_down_io(); return; } } static unsigned short force_id ; static struct platform_device *pdev ; __inline static int superio_inb(int reg ) { unsigned char tmp ; { outb((int )((unsigned char )reg), 46); tmp = inb(47); return ((int )tmp); } } static int superio_inw(int reg ) { int val ; int tmp ; unsigned char tmp___0 ; unsigned char tmp___1 ; { tmp = reg; reg = reg + 1; outb((int )((unsigned char )tmp), 46); tmp___0 = inb(47); val = (int )tmp___0 << 8; outb((int )((unsigned char )reg), 46); tmp___1 = inb(47); val = (int )tmp___1 | val; return (val); } } __inline static void superio_select(int ldn ) { { outb(7, 46); outb((int )((unsigned char )ldn), 47); return; } } __inline static void superio_enter(void) { { outb(135, 46); outb(1, 46); outb(85, 46); outb(85, 46); return; } } __inline static void superio_exit(void) { { outb(2, 46); outb(2, 47); return; } } static int update_vbat ; static int fix_pwm_polarity ; static u8 const IT87_REG_FAN[5U] = { 13U, 14U, 15U, 128U, 130U}; static u8 const IT87_REG_FAN_MIN[5U] = { 16U, 17U, 18U, 132U, 134U}; static u8 const IT87_REG_FANX[5U] = { 24U, 25U, 26U, 129U, 131U}; static u8 const IT87_REG_FANX_MIN[5U] = { 27U, 28U, 29U, 133U, 135U}; __inline static u8 FAN_TO_REG(long rpm , int div ) { int tmp ; int tmp___0 ; { if (rpm == 0L) { return (255U); } else { } tmp = SENSORS_LIMIT(rpm, 1L, 1000000L); rpm = (long )tmp; tmp___0 = SENSORS_LIMIT((((long )div * rpm) / 2L + 1350000L) / ((long )div * rpm), 1L, 254L); return ((u8 )tmp___0); } } __inline static u16 FAN16_TO_REG(long rpm ) { int tmp ; { if (rpm == 0L) { return (65535U); } else { } tmp = SENSORS_LIMIT((rpm + 1350000L) / (rpm * 2L), 1L, 65534L); return ((u16 )tmp); } } static int DIV_TO_REG(int val ) { int answer ; { answer = 0; goto ldv_10579; ldv_10578: answer = answer + 1; ldv_10579: ; if (answer <= 6) { val = val >> 1; if (val != 0) { goto ldv_10578; } else { goto ldv_10580; } } else { } ldv_10580: ; return (answer); } } static unsigned int const pwm_freq[8U] = { 375000U, 187500U, 93750U, 62500U, 46875U, 23437U, 11718U, 5859U}; __inline static int has_16bit_fans(struct it87_data const *data ) { { return (((((unsigned int )data->type == 0U && (unsigned int )((unsigned char )data->revision) > 2U) || ((unsigned int )data->type == 1U && (unsigned int )((unsigned char )data->revision) > 7U)) || (unsigned int )data->type == 2U) || (unsigned int )data->type == 3U); } } static int it87_probe(struct platform_device *pdev___0 ) ; static int it87_remove(struct platform_device *pdev___0 ) ; static int it87_read_value(struct it87_data *data , u8 reg ) ; static void it87_write_value(struct it87_data *data , u8 reg , u8 value ) ; static struct it87_data *it87_update_device(struct device *dev ) ; static int it87_check_pwm(struct device *dev ) ; static void it87_init_device(struct platform_device *pdev___0 ) ; static struct platform_driver it87_driver = {& it87_probe, & it87_remove, 0, 0, 0, 0, 0, 0, {"it87", 0, & __this_module, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; static ssize_t show_in(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (int )data->in[nr] * 16); return ((ssize_t )tmp___0); } } static ssize_t show_in_min(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (int )data->in_min[nr] * 16); return ((ssize_t )tmp___0); } } static ssize_t show_in_max(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (int )data->in_max[nr] * 16); return ((ssize_t )tmp___0); } } static ssize_t set_in_min(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; unsigned long val ; unsigned long tmp___0 ; int tmp___1 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtoul(buf, 0, 10U); val = tmp___0; ldv_mutex_lock_1(& data->update_lock); tmp___1 = SENSORS_LIMIT((long )((val + 8UL) / 16UL), 0L, 255L); data->in_min[nr] = (u8 )tmp___1; it87_write_value(data, (int )((unsigned int )((u8 )nr) * 2U + 49U), (int )data->in_min[nr]); ldv_mutex_unlock_2(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_in_max(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; unsigned long val ; unsigned long tmp___0 ; int tmp___1 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtoul(buf, 0, 10U); val = tmp___0; ldv_mutex_lock_3(& data->update_lock); tmp___1 = SENSORS_LIMIT((long )((val + 8UL) / 16UL), 0L, 255L); data->in_max[nr] = (u8 )tmp___1; it87_write_value(data, (int )((unsigned int )((u8 )(nr + 24)) * 2U), (int )data->in_max[nr]); ldv_mutex_unlock_4(& data->update_lock); return ((ssize_t )count); } } static struct sensor_device_attribute sensor_dev_attr_in0_input = {{{"in0_input", 0, 292U}, & show_in, 0}, 0}; static struct sensor_device_attribute sensor_dev_attr_in0_min = {{{"in0_min", 0, 420U}, & show_in_min, & set_in_min}, 0}; static struct sensor_device_attribute sensor_dev_attr_in0_max = {{{"in0_max", 0, 420U}, & show_in_max, & set_in_max}, 0}; static struct sensor_device_attribute sensor_dev_attr_in1_input = {{{"in1_input", 0, 292U}, & show_in, 0}, 1}; static struct sensor_device_attribute sensor_dev_attr_in1_min = {{{"in1_min", 0, 420U}, & show_in_min, & set_in_min}, 1}; static struct sensor_device_attribute sensor_dev_attr_in1_max = {{{"in1_max", 0, 420U}, & show_in_max, & set_in_max}, 1}; static struct sensor_device_attribute sensor_dev_attr_in2_input = {{{"in2_input", 0, 292U}, & show_in, 0}, 2}; static struct sensor_device_attribute sensor_dev_attr_in2_min = {{{"in2_min", 0, 420U}, & show_in_min, & set_in_min}, 2}; static struct sensor_device_attribute sensor_dev_attr_in2_max = {{{"in2_max", 0, 420U}, & show_in_max, & set_in_max}, 2}; static struct sensor_device_attribute sensor_dev_attr_in3_input = {{{"in3_input", 0, 292U}, & show_in, 0}, 3}; static struct sensor_device_attribute sensor_dev_attr_in3_min = {{{"in3_min", 0, 420U}, & show_in_min, & set_in_min}, 3}; static struct sensor_device_attribute sensor_dev_attr_in3_max = {{{"in3_max", 0, 420U}, & show_in_max, & set_in_max}, 3}; static struct sensor_device_attribute sensor_dev_attr_in4_input = {{{"in4_input", 0, 292U}, & show_in, 0}, 4}; static struct sensor_device_attribute sensor_dev_attr_in4_min = {{{"in4_min", 0, 420U}, & show_in_min, & set_in_min}, 4}; static struct sensor_device_attribute sensor_dev_attr_in4_max = {{{"in4_max", 0, 420U}, & show_in_max, & set_in_max}, 4}; static struct sensor_device_attribute sensor_dev_attr_in5_input = {{{"in5_input", 0, 292U}, & show_in, 0}, 5}; static struct sensor_device_attribute sensor_dev_attr_in5_min = {{{"in5_min", 0, 420U}, & show_in_min, & set_in_min}, 5}; static struct sensor_device_attribute sensor_dev_attr_in5_max = {{{"in5_max", 0, 420U}, & show_in_max, & set_in_max}, 5}; static struct sensor_device_attribute sensor_dev_attr_in6_input = {{{"in6_input", 0, 292U}, & show_in, 0}, 6}; static struct sensor_device_attribute sensor_dev_attr_in6_min = {{{"in6_min", 0, 420U}, & show_in_min, & set_in_min}, 6}; static struct sensor_device_attribute sensor_dev_attr_in6_max = {{{"in6_max", 0, 420U}, & show_in_max, & set_in_max}, 6}; static struct sensor_device_attribute sensor_dev_attr_in7_input = {{{"in7_input", 0, 292U}, & show_in, 0}, 7}; static struct sensor_device_attribute sensor_dev_attr_in7_min = {{{"in7_min", 0, 420U}, & show_in_min, & set_in_min}, 7}; static struct sensor_device_attribute sensor_dev_attr_in7_max = {{{"in7_max", 0, 420U}, & show_in_max, & set_in_max}, 7}; static struct sensor_device_attribute sensor_dev_attr_in8_input = {{{"in8_input", 0, 292U}, & show_in, 0}, 8}; static ssize_t show_temp(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->temp[nr] > 128U ? (int )data->temp[nr] * 1000 + -256000 : (int )data->temp[nr] * 1000); return ((ssize_t )tmp___0); } } static ssize_t show_temp_max(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->temp_high[nr] > 128U ? (int )data->temp_high[nr] * 1000 + -256000 : (int )data->temp_high[nr] * 1000); return ((ssize_t )tmp___0); } } static ssize_t show_temp_min(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->temp_low[nr] > 128U ? (int )data->temp_low[nr] * 1000 + -256000 : (int )data->temp_low[nr] * 1000); return ((ssize_t )tmp___0); } } static ssize_t set_temp_max(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; int tmp___1 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_5(& data->update_lock); tmp___1 = SENSORS_LIMIT((long )(val < 0 ? (val + -500) / 1000 : (val + 500) / 1000), -128L, 127L); data->temp_high[nr] = (u8 )tmp___1; it87_write_value(data, (int )((unsigned int )((u8 )(nr + 32)) * 2U), (int )data->temp_high[nr]); ldv_mutex_unlock_6(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_temp_min(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; int tmp___1 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_7(& data->update_lock); tmp___1 = SENSORS_LIMIT((long )(val < 0 ? (val + -500) / 1000 : (val + 500) / 1000), -128L, 127L); data->temp_low[nr] = (u8 )tmp___1; it87_write_value(data, (int )((unsigned int )((u8 )nr) * 2U + 65U), (int )data->temp_low[nr]); ldv_mutex_unlock_8(& data->update_lock); return ((ssize_t )count); } } static struct sensor_device_attribute sensor_dev_attr_temp1_input = {{{"temp1_input", 0, 292U}, & show_temp, 0}, 0}; static struct sensor_device_attribute sensor_dev_attr_temp1_max = {{{"temp1_max", 0, 420U}, & show_temp_max, & set_temp_max}, 0}; static struct sensor_device_attribute sensor_dev_attr_temp1_min = {{{"temp1_min", 0, 420U}, & show_temp_min, & set_temp_min}, 0}; static struct sensor_device_attribute sensor_dev_attr_temp2_input = {{{"temp2_input", 0, 292U}, & show_temp, 0}, 1}; static struct sensor_device_attribute sensor_dev_attr_temp2_max = {{{"temp2_max", 0, 420U}, & show_temp_max, & set_temp_max}, 1}; static struct sensor_device_attribute sensor_dev_attr_temp2_min = {{{"temp2_min", 0, 420U}, & show_temp_min, & set_temp_min}, 1}; static struct sensor_device_attribute sensor_dev_attr_temp3_input = {{{"temp3_input", 0, 292U}, & show_temp, 0}, 2}; static struct sensor_device_attribute sensor_dev_attr_temp3_max = {{{"temp3_max", 0, 420U}, & show_temp_max, & set_temp_max}, 2}; static struct sensor_device_attribute sensor_dev_attr_temp3_min = {{{"temp3_min", 0, 420U}, & show_temp_min, & set_temp_min}, 2}; static ssize_t show_sensor(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; u8 reg ; int tmp___0 ; int tmp___1 ; int tmp___2 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; reg = data->sensor; if (((int )reg >> nr) & 1) { tmp___0 = sprintf(buf, "3\n"); return ((ssize_t )tmp___0); } else { } if (((int )reg & (8 << nr)) != 0) { tmp___1 = sprintf(buf, "2\n"); return ((ssize_t )tmp___1); } else { } tmp___2 = sprintf(buf, "0\n"); return ((ssize_t )tmp___2); } } static ssize_t set_sensor(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_9(& data->update_lock); data->sensor = (u8 )((int )((signed char )data->sensor) & ~ ((int )((signed char )(1 << nr)))); data->sensor = (u8 )((int )((signed char )data->sensor) & ~ ((int )((signed char )(8 << nr)))); if (val == 3) { data->sensor = (u8 )((int )((signed char )data->sensor) | (int )((signed char )(1 << nr))); } else if (val == 2) { data->sensor = (u8 )((int )((signed char )data->sensor) | (int )((signed char )(8 << nr))); } else if (val != 0) { ldv_mutex_unlock_10(& data->update_lock); return (-22L); } else { } it87_write_value(data, 81, (int )data->sensor); ldv_mutex_unlock_11(& data->update_lock); return ((ssize_t )count); } } static struct sensor_device_attribute sensor_dev_attr_temp1_type = {{{"temp1_type", 0, 420U}, & show_sensor, & set_sensor}, 0}; static struct sensor_device_attribute sensor_dev_attr_temp2_type = {{{"temp2_type", 0, 420U}, & show_sensor, & set_sensor}, 1}; static struct sensor_device_attribute sensor_dev_attr_temp3_type = {{{"temp3_type", 0, 420U}, & show_sensor, & set_sensor}, 2}; static ssize_t show_fan(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->fan[nr] != 0U ? ((unsigned int )data->fan[nr] != 255U ? 1350000 / ((int )data->fan[nr] << (int )data->fan_div[nr]) : 0) : -1); return ((ssize_t )tmp___0); } } static ssize_t show_fan_min(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->fan_min[nr] != 0U ? ((unsigned int )data->fan_min[nr] != 255U ? 1350000 / ((int )data->fan_min[nr] << (int )data->fan_div[nr]) : 0) : -1); return ((ssize_t )tmp___0); } } static ssize_t show_fan_div(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", 1 << (int )data->fan_div[nr]); return ((ssize_t )tmp___0); } } static ssize_t show_pwm_enable(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", ((int )data->fan_main_ctrl >> nr) & 1); return ((ssize_t )tmp___0); } } static ssize_t show_pwm(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (int )data->manual_pwm_ctl[nr]); return ((ssize_t )tmp___0); } } static ssize_t show_pwm_freq(struct device *dev , struct device_attribute *attr , char *buf ) { struct it87_data *data ; struct it87_data *tmp ; int index ; int tmp___0 ; { tmp = it87_update_device(dev); data = tmp; index = ((int )data->fan_ctl >> 4) & 7; tmp___0 = sprintf(buf, "%u\n", pwm_freq[index]); return ((ssize_t )tmp___0); } } static ssize_t set_fan_min(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; u8 reg ; int tmp___1 ; u8 tmp___2 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_12(& data->update_lock); tmp___1 = it87_read_value(data, 11); reg = (u8 )tmp___1; switch (nr) { case 0: data->fan_div[nr] = (unsigned int )reg & 7U; goto ldv_10873; case 1: data->fan_div[nr] = (unsigned int )((u8 )((int )reg >> 3)) & 7U; goto ldv_10873; case 2: data->fan_div[nr] = ((int )reg & 64) != 0 ? 3U : 1U; goto ldv_10873; } ldv_10873: tmp___2 = FAN_TO_REG((long )val, 1 << (int )data->fan_div[nr]); data->fan_min[nr] = (u16 )tmp___2; it87_write_value(data, (int )IT87_REG_FAN_MIN[nr], (int )((u8 )data->fan_min[nr])); ldv_mutex_unlock_13(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_fan_div(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; unsigned long val ; unsigned long tmp___0 ; int min ; u8 old ; int tmp___1 ; int tmp___2 ; u8 tmp___3 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtoul(buf, 0, 10U); val = tmp___0; ldv_mutex_lock_14(& data->update_lock); tmp___1 = it87_read_value(data, 11); old = (u8 )tmp___1; min = (unsigned int )data->fan_min[nr] != 0U ? ((unsigned int )data->fan_min[nr] != 255U ? 1350000 / ((int )data->fan_min[nr] << (int )data->fan_div[nr]) : 0) : -1; switch (nr) { case 0: ; case 1: tmp___2 = DIV_TO_REG((int )val); data->fan_div[nr] = (u8 )tmp___2; goto ldv_10892; case 2: ; if (val <= 7UL) { data->fan_div[nr] = 1U; } else { data->fan_div[nr] = 3U; } } ldv_10892: val = (unsigned long )old & 128UL; val = ((unsigned long )data->fan_div[0] & 7UL) | val; val = (unsigned long )(((int )data->fan_div[1] & 7) << 3) | val; if ((unsigned int )data->fan_div[2] == 3U) { val = val | 64UL; } else { } it87_write_value(data, 11, (int )((u8 )val)); tmp___3 = FAN_TO_REG((long )min, 1 << (int )data->fan_div[nr]); data->fan_min[nr] = (u16 )tmp___3; it87_write_value(data, (int )IT87_REG_FAN_MIN[nr], (int )((u8 )data->fan_min[nr])); ldv_mutex_unlock_15(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_pwm_enable(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; int tmp___1 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_16(& data->update_lock); if (val == 0) { tmp___1 = it87_read_value(data, 20); it87_write_value(data, 20, (int )((u8 )((int )((signed char )(1 << nr)) | (int )((signed char )tmp___1)))); data->fan_main_ctrl = (u8 )((int )((signed char )data->fan_main_ctrl) & ~ ((int )((signed char )(1 << nr)))); it87_write_value(data, 19, (int )data->fan_main_ctrl); } else if (val == 1) { data->fan_main_ctrl = (u8 )((int )((signed char )data->fan_main_ctrl) | (int )((signed char )(1 << nr))); it87_write_value(data, 19, (int )data->fan_main_ctrl); it87_write_value(data, (int )((unsigned int )((u8 )nr) + 21U), (int )data->manual_pwm_ctl[nr] >> 1); } else { ldv_mutex_unlock_17(& data->update_lock); return (-22L); } ldv_mutex_unlock_18(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_pwm(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; if (val < 0 || val > 255) { return (-22L); } else { } ldv_mutex_lock_19(& data->update_lock); data->manual_pwm_ctl[nr] = (u8 )val; if (((int )data->fan_main_ctrl >> nr) & 1) { it87_write_value(data, (int )((unsigned int )((u8 )nr) + 21U), (int )data->manual_pwm_ctl[nr] >> 1); } else { } ldv_mutex_unlock_20(& data->update_lock); return ((ssize_t )count); } } static ssize_t set_pwm_freq(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct it87_data *data ; void *tmp ; unsigned long val ; unsigned long tmp___0 ; int i ; int tmp___1 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtoul(buf, 0, 10U); val = tmp___0; i = 0; goto ldv_10930; ldv_10929: ; if ((unsigned long )(((unsigned int )pwm_freq[i] + (unsigned int )pwm_freq[i + 1]) / 2U) < val) { goto ldv_10928; } else { } i = i + 1; ldv_10930: ; if (i <= 6) { goto ldv_10929; } else { } ldv_10928: ldv_mutex_lock_21(& data->update_lock); tmp___1 = it87_read_value(data, 20); data->fan_ctl = (unsigned int )((u8 )tmp___1) & 143U; data->fan_ctl = (u8 )((int )((signed char )data->fan_ctl) | (int )((signed char )(i << 4))); it87_write_value(data, 20, (int )data->fan_ctl); ldv_mutex_unlock_22(& data->update_lock); return ((ssize_t )count); } } static struct sensor_device_attribute sensor_dev_attr_fan1_input = {{{"fan1_input", 0, 292U}, & show_fan, 0}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan1_min = {{{"fan1_min", 0, 420U}, & show_fan_min, & set_fan_min}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan1_div = {{{"fan1_div", 0, 420U}, & show_fan_div, & set_fan_div}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan2_input = {{{"fan2_input", 0, 292U}, & show_fan, 0}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan2_min = {{{"fan2_min", 0, 420U}, & show_fan_min, & set_fan_min}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan2_div = {{{"fan2_div", 0, 420U}, & show_fan_div, & set_fan_div}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan3_input = {{{"fan3_input", 0, 292U}, & show_fan, 0}, 2}; static struct sensor_device_attribute sensor_dev_attr_fan3_min = {{{"fan3_min", 0, 420U}, & show_fan_min, & set_fan_min}, 2}; static struct sensor_device_attribute sensor_dev_attr_fan3_div = {{{"fan3_div", 0, 420U}, & show_fan_div, & set_fan_div}, 2}; static struct sensor_device_attribute sensor_dev_attr_pwm1_enable = {{{"pwm1_enable", 0, 420U}, & show_pwm_enable, & set_pwm_enable}, 0}; static struct sensor_device_attribute sensor_dev_attr_pwm1 = {{{"pwm1", 0, 420U}, & show_pwm, & set_pwm}, 0}; static struct device_attribute dev_attr_pwm1_freq = {{"pwm1_freq", 0, 420U}, & show_pwm_freq, & set_pwm_freq}; static struct sensor_device_attribute sensor_dev_attr_pwm2_enable = {{{"pwm2_enable", 0, 420U}, & show_pwm_enable, & set_pwm_enable}, 1}; static struct sensor_device_attribute sensor_dev_attr_pwm2 = {{{"pwm2", 0, 420U}, & show_pwm, & set_pwm}, 1}; static struct device_attribute dev_attr_pwm2_freq = {{"pwm2_freq", 0, 292U}, & show_pwm_freq, 0}; static struct sensor_device_attribute sensor_dev_attr_pwm3_enable = {{{"pwm3_enable", 0, 420U}, & show_pwm_enable, & set_pwm_enable}, 2}; static struct sensor_device_attribute sensor_dev_attr_pwm3 = {{{"pwm3", 0, 420U}, & show_pwm, & set_pwm}, 2}; static struct device_attribute dev_attr_pwm3_freq = {{"pwm3_freq", 0, 292U}, & show_pwm_freq, 0}; static ssize_t show_fan16(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->fan[nr] != 0U ? ((unsigned int )data->fan[nr] != 65535U ? 1350000 / ((int )data->fan[nr] * 2) : 0) : -1); return ((ssize_t )tmp___0); } } static ssize_t show_fan16_min(struct device *dev , struct device_attribute *attr , char *buf ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%d\n", (unsigned int )data->fan_min[nr] != 0U ? ((unsigned int )data->fan_min[nr] != 65535U ? 1350000 / ((int )data->fan_min[nr] * 2) : 0) : -1); return ((ssize_t )tmp___0); } } static ssize_t set_fan16_min(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct sensor_device_attribute *sensor_attr ; struct device_attribute const *__mptr ; int nr ; struct it87_data *data ; void *tmp ; int val ; long tmp___0 ; { __mptr = (struct device_attribute const *)attr; sensor_attr = (struct sensor_device_attribute *)__mptr; nr = sensor_attr->index; tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtol(buf, 0, 10U); val = (int )tmp___0; ldv_mutex_lock_23(& data->update_lock); data->fan_min[nr] = FAN16_TO_REG((long )val); it87_write_value(data, (int )IT87_REG_FAN_MIN[nr], (int )((u8 )data->fan_min[nr])); it87_write_value(data, (int )IT87_REG_FANX_MIN[nr], (int )((u8 )((int )data->fan_min[nr] >> 8))); ldv_mutex_unlock_24(& data->update_lock); return ((ssize_t )count); } } static struct sensor_device_attribute sensor_dev_attr_fan1_input16 = {{{"fan1_input", 0, 292U}, & show_fan16, 0}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan1_min16 = {{{"fan1_min", 0, 420U}, & show_fan16_min, & set_fan16_min}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan2_input16 = {{{"fan2_input", 0, 292U}, & show_fan16, 0}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan2_min16 = {{{"fan2_min", 0, 420U}, & show_fan16_min, & set_fan16_min}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan3_input16 = {{{"fan3_input", 0, 292U}, & show_fan16, 0}, 2}; static struct sensor_device_attribute sensor_dev_attr_fan3_min16 = {{{"fan3_min", 0, 420U}, & show_fan16_min, & set_fan16_min}, 2}; static struct sensor_device_attribute sensor_dev_attr_fan4_input16 = {{{"fan4_input", 0, 292U}, & show_fan16, 0}, 3}; static struct sensor_device_attribute sensor_dev_attr_fan4_min16 = {{{"fan4_min", 0, 420U}, & show_fan16_min, & set_fan16_min}, 3}; static struct sensor_device_attribute sensor_dev_attr_fan5_input16 = {{{"fan5_input", 0, 292U}, & show_fan16, 0}, 4}; static struct sensor_device_attribute sensor_dev_attr_fan5_min16 = {{{"fan5_min", 0, 420U}, & show_fan16_min, & set_fan16_min}, 4}; static ssize_t show_alarms(struct device *dev , struct device_attribute *attr , char *buf ) { struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%u\n", data->alarms); return ((ssize_t )tmp___0); } } static struct device_attribute dev_attr_alarms = {{"alarms", 0, 292U}, & show_alarms, 0}; static ssize_t show_alarm(struct device *dev , struct device_attribute *attr , char *buf ) { int bitnr ; struct device_attribute const *__mptr ; struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; { __mptr = (struct device_attribute const *)attr; bitnr = ((struct sensor_device_attribute *)__mptr)->index; tmp = it87_update_device(dev); data = tmp; tmp___0 = sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1U); return ((ssize_t )tmp___0); } } static struct sensor_device_attribute sensor_dev_attr_in0_alarm = {{{"in0_alarm", 0, 292U}, & show_alarm, 0}, 8}; static struct sensor_device_attribute sensor_dev_attr_in1_alarm = {{{"in1_alarm", 0, 292U}, & show_alarm, 0}, 9}; static struct sensor_device_attribute sensor_dev_attr_in2_alarm = {{{"in2_alarm", 0, 292U}, & show_alarm, 0}, 10}; static struct sensor_device_attribute sensor_dev_attr_in3_alarm = {{{"in3_alarm", 0, 292U}, & show_alarm, 0}, 11}; static struct sensor_device_attribute sensor_dev_attr_in4_alarm = {{{"in4_alarm", 0, 292U}, & show_alarm, 0}, 12}; static struct sensor_device_attribute sensor_dev_attr_in5_alarm = {{{"in5_alarm", 0, 292U}, & show_alarm, 0}, 13}; static struct sensor_device_attribute sensor_dev_attr_in6_alarm = {{{"in6_alarm", 0, 292U}, & show_alarm, 0}, 14}; static struct sensor_device_attribute sensor_dev_attr_in7_alarm = {{{"in7_alarm", 0, 292U}, & show_alarm, 0}, 15}; static struct sensor_device_attribute sensor_dev_attr_fan1_alarm = {{{"fan1_alarm", 0, 292U}, & show_alarm, 0}, 0}; static struct sensor_device_attribute sensor_dev_attr_fan2_alarm = {{{"fan2_alarm", 0, 292U}, & show_alarm, 0}, 1}; static struct sensor_device_attribute sensor_dev_attr_fan3_alarm = {{{"fan3_alarm", 0, 292U}, & show_alarm, 0}, 2}; static struct sensor_device_attribute sensor_dev_attr_fan4_alarm = {{{"fan4_alarm", 0, 292U}, & show_alarm, 0}, 3}; static struct sensor_device_attribute sensor_dev_attr_fan5_alarm = {{{"fan5_alarm", 0, 292U}, & show_alarm, 0}, 6}; static struct sensor_device_attribute sensor_dev_attr_temp1_alarm = {{{"temp1_alarm", 0, 292U}, & show_alarm, 0}, 16}; static struct sensor_device_attribute sensor_dev_attr_temp2_alarm = {{{"temp2_alarm", 0, 292U}, & show_alarm, 0}, 17}; static struct sensor_device_attribute sensor_dev_attr_temp3_alarm = {{{"temp3_alarm", 0, 292U}, & show_alarm, 0}, 18}; static ssize_t show_vrm_reg(struct device *dev , struct device_attribute *attr , char *buf ) { struct it87_data *data ; void *tmp ; int tmp___0 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = sprintf(buf, "%u\n", (int )data->vrm); return ((ssize_t )tmp___0); } } static ssize_t store_vrm_reg(struct device *dev , struct device_attribute *attr , char const *buf , size_t count ) { struct it87_data *data ; void *tmp ; u32 val ; unsigned long tmp___0 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = simple_strtoul(buf, 0, 10U); val = (u32 )tmp___0; data->vrm = (u8 )val; return ((ssize_t )count); } } static struct device_attribute dev_attr_vrm = {{"vrm", 0, 420U}, & show_vrm_reg, & store_vrm_reg}; static ssize_t show_vid_reg(struct device *dev , struct device_attribute *attr , char *buf ) { struct it87_data *data ; struct it87_data *tmp ; int tmp___0 ; int tmp___1 ; { tmp = it87_update_device(dev); data = tmp; tmp___0 = vid_from_reg((int )data->vid, (int )data->vrm); tmp___1 = sprintf(buf, "%ld\n", (long )tmp___0); return ((ssize_t )tmp___1); } } static struct device_attribute dev_attr_cpu0_vid = {{"cpu0_vid", 0, 292U}, & show_vid_reg, 0}; static ssize_t show_name(struct device *dev , struct device_attribute *devattr , char *buf ) { struct it87_data *data ; void *tmp ; int tmp___0 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___0 = sprintf(buf, "%s\n", data->name); return ((ssize_t )tmp___0); } } static struct device_attribute dev_attr_name = {{"name", 0, 292U}, & show_name, 0}; static struct attribute *it87_attributes[51U] = { & sensor_dev_attr_in0_input.dev_attr.attr, & sensor_dev_attr_in1_input.dev_attr.attr, & sensor_dev_attr_in2_input.dev_attr.attr, & sensor_dev_attr_in3_input.dev_attr.attr, & sensor_dev_attr_in4_input.dev_attr.attr, & sensor_dev_attr_in5_input.dev_attr.attr, & sensor_dev_attr_in6_input.dev_attr.attr, & sensor_dev_attr_in7_input.dev_attr.attr, & sensor_dev_attr_in8_input.dev_attr.attr, & sensor_dev_attr_in0_min.dev_attr.attr, & sensor_dev_attr_in1_min.dev_attr.attr, & sensor_dev_attr_in2_min.dev_attr.attr, & sensor_dev_attr_in3_min.dev_attr.attr, & sensor_dev_attr_in4_min.dev_attr.attr, & sensor_dev_attr_in5_min.dev_attr.attr, & sensor_dev_attr_in6_min.dev_attr.attr, & sensor_dev_attr_in7_min.dev_attr.attr, & sensor_dev_attr_in0_max.dev_attr.attr, & sensor_dev_attr_in1_max.dev_attr.attr, & sensor_dev_attr_in2_max.dev_attr.attr, & sensor_dev_attr_in3_max.dev_attr.attr, & sensor_dev_attr_in4_max.dev_attr.attr, & sensor_dev_attr_in5_max.dev_attr.attr, & sensor_dev_attr_in6_max.dev_attr.attr, & sensor_dev_attr_in7_max.dev_attr.attr, & sensor_dev_attr_in0_alarm.dev_attr.attr, & sensor_dev_attr_in1_alarm.dev_attr.attr, & sensor_dev_attr_in2_alarm.dev_attr.attr, & sensor_dev_attr_in3_alarm.dev_attr.attr, & sensor_dev_attr_in4_alarm.dev_attr.attr, & sensor_dev_attr_in5_alarm.dev_attr.attr, & sensor_dev_attr_in6_alarm.dev_attr.attr, & sensor_dev_attr_in7_alarm.dev_attr.attr, & sensor_dev_attr_temp1_input.dev_attr.attr, & sensor_dev_attr_temp2_input.dev_attr.attr, & sensor_dev_attr_temp3_input.dev_attr.attr, & sensor_dev_attr_temp1_max.dev_attr.attr, & sensor_dev_attr_temp2_max.dev_attr.attr, & sensor_dev_attr_temp3_max.dev_attr.attr, & sensor_dev_attr_temp1_min.dev_attr.attr, & sensor_dev_attr_temp2_min.dev_attr.attr, & sensor_dev_attr_temp3_min.dev_attr.attr, & sensor_dev_attr_temp1_type.dev_attr.attr, & sensor_dev_attr_temp2_type.dev_attr.attr, & sensor_dev_attr_temp3_type.dev_attr.attr, & sensor_dev_attr_temp1_alarm.dev_attr.attr, & sensor_dev_attr_temp2_alarm.dev_attr.attr, & sensor_dev_attr_temp3_alarm.dev_attr.attr, & dev_attr_alarms.attr, & dev_attr_name.attr, 0}; static struct attribute_group const it87_group = {0, 0, (struct attribute **)(& it87_attributes)}; static struct attribute *it87_attributes_opt[36U] = { & sensor_dev_attr_fan1_input16.dev_attr.attr, & sensor_dev_attr_fan1_min16.dev_attr.attr, & sensor_dev_attr_fan2_input16.dev_attr.attr, & sensor_dev_attr_fan2_min16.dev_attr.attr, & sensor_dev_attr_fan3_input16.dev_attr.attr, & sensor_dev_attr_fan3_min16.dev_attr.attr, & sensor_dev_attr_fan4_input16.dev_attr.attr, & sensor_dev_attr_fan4_min16.dev_attr.attr, & sensor_dev_attr_fan5_input16.dev_attr.attr, & sensor_dev_attr_fan5_min16.dev_attr.attr, & sensor_dev_attr_fan1_input.dev_attr.attr, & sensor_dev_attr_fan1_min.dev_attr.attr, & sensor_dev_attr_fan1_div.dev_attr.attr, & sensor_dev_attr_fan2_input.dev_attr.attr, & sensor_dev_attr_fan2_min.dev_attr.attr, & sensor_dev_attr_fan2_div.dev_attr.attr, & sensor_dev_attr_fan3_input.dev_attr.attr, & sensor_dev_attr_fan3_min.dev_attr.attr, & sensor_dev_attr_fan3_div.dev_attr.attr, & sensor_dev_attr_fan1_alarm.dev_attr.attr, & sensor_dev_attr_fan2_alarm.dev_attr.attr, & sensor_dev_attr_fan3_alarm.dev_attr.attr, & sensor_dev_attr_fan4_alarm.dev_attr.attr, & sensor_dev_attr_fan5_alarm.dev_attr.attr, & sensor_dev_attr_pwm1_enable.dev_attr.attr, & sensor_dev_attr_pwm2_enable.dev_attr.attr, & sensor_dev_attr_pwm3_enable.dev_attr.attr, & sensor_dev_attr_pwm1.dev_attr.attr, & sensor_dev_attr_pwm2.dev_attr.attr, & sensor_dev_attr_pwm3.dev_attr.attr, & dev_attr_pwm1_freq.attr, & dev_attr_pwm2_freq.attr, & dev_attr_pwm3_freq.attr, & dev_attr_vrm.attr, & dev_attr_cpu0_vid.attr, 0}; static struct attribute_group const it87_group_opt = {0, 0, (struct attribute **)(& it87_attributes_opt)}; static int it87_find(unsigned short *address , struct it87_sio_data *sio_data ) { int err ; u16 chip_type ; char const *board_vendor ; char const *board_name ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int reg ; int tmp___3 ; int tmp___4 ; int tmp___5 ; { err = -19; superio_enter(); if ((unsigned int )force_id == 0U) { tmp = superio_inw(32); chip_type = (u16 )tmp; } else { chip_type = force_id; } switch ((int )chip_type) { case 34565: sio_data->type = it87; goto ldv_11065; case 34578: sio_data->type = it8712; goto ldv_11065; case 34582: ; case 34598: sio_data->type = it8716; goto ldv_11065; case 34584: sio_data->type = it8718; goto ldv_11065; case 65535: ; goto exit; default: printk("<7>it87: Unsupported chip (DEVID=0x%x)\n", (int )chip_type); goto exit; } ldv_11065: superio_select(4); tmp___0 = superio_inb(48); if ((tmp___0 & 1) == 0) { printk("<6>it87: Device not activated, skipping\n"); goto exit; } else { } tmp___1 = superio_inw(96); *address = (unsigned int )((unsigned short )tmp___1) & 65528U; if ((unsigned int )*address == 0U) { printk("<6>it87: Base address not set, skipping\n"); goto exit; } else { } err = 0; tmp___2 = superio_inb(34); sio_data->revision = (unsigned int )((u8 )tmp___2) & 15U; printk("<6>it87: Found IT%04xF chip at 0x%x, revision %d\n", (int )chip_type, (int )*address, (int )sio_data->revision); if ((unsigned int )chip_type != 34565U) { superio_select(7); if ((unsigned int )chip_type == 3U) { tmp___3 = superio_inb(252); sio_data->vid_value = (u8 )tmp___3; } else { } reg = superio_inb(44); if (reg & 1) { printk("<6>it87: in3 is VCC (+5V)\n"); } else { } if ((reg & 2) != 0) { printk("<6>it87: in7 is VCCH (+5V Stand-By)\n"); } else { } } else { } board_vendor = dmi_get_system_info(9); board_name = dmi_get_system_info(10); if ((unsigned long )board_vendor != (unsigned long )((char const *)0) && (unsigned long )board_name != (unsigned long )((char const *)0)) { tmp___4 = strcmp(board_vendor, "nVIDIA"); if (tmp___4 == 0) { tmp___5 = strcmp(board_name, "FN68PT"); if (tmp___5 == 0) { printk("<6>it87: Disabling pwm2 due to hardware constraints\n"); sio_data->skip_pwm = 2U; } else { } } else { } } else { } exit: superio_exit(); return (err); } } static int it87_probe(struct platform_device *pdev___0 ) { struct it87_data *data ; struct resource *res ; struct device *dev ; struct it87_sio_data *sio_data ; int err ; int enable_pwm_interface ; char const *names[4U] ; char const *tmp ; char const *tmp___0 ; struct resource *tmp___1 ; void *tmp___2 ; int tmp___3 ; int tmp___4 ; struct lock_class_key __key ; int tmp___5 ; long tmp___6 ; long tmp___7 ; { dev = & pdev___0->dev; sio_data = (struct it87_sio_data *)dev->platform_data; err = 0; names[0] = "it87"; names[1] = "it8712"; names[2] = "it8716"; names[3] = "it8718"; res = platform_get_resource(pdev___0, 256U, 0U); tmp___1 = __request_region(& ioport_resource, res->start, 2ULL, "it87"); if ((unsigned long )tmp___1 == (unsigned long )((struct resource *)0)) { tmp = dev_name((struct device const *)dev); tmp___0 = dev_driver_string((struct device const *)dev); printk("<3>%s %s: Failed to request region 0x%lx-0x%lx\n", tmp___0, tmp, (unsigned long )res->start, (unsigned long )(res->start + 1ULL)); err = -16; goto ERROR0; } else { } tmp___2 = kzalloc(256UL, 208U); data = (struct it87_data *)tmp___2; if ((unsigned long )data == (unsigned long )((struct it87_data *)0)) { err = -12; goto ERROR1; } else { } data->addr = (unsigned short )res->start; data->type = sio_data->type; data->revision = sio_data->revision; data->name = names[(unsigned int )sio_data->type]; tmp___3 = it87_read_value(data, 0); if ((tmp___3 & 128) != 0) { err = -19; goto ERROR2; } else { tmp___4 = it87_read_value(data, 88); if (tmp___4 != 144) { err = -19; goto ERROR2; } else { } } dev_set_drvdata(& pdev___0->dev, (void *)data); __mutex_init(& data->update_lock, "&data->update_lock", & __key); enable_pwm_interface = it87_check_pwm(dev); it87_init_device(pdev___0); err = sysfs_create_group(& dev->kobj, & it87_group); if (err != 0) { goto ERROR2; } else { } tmp___5 = has_16bit_fans((struct it87_data const *)data); if (tmp___5 != 0) { if ((int )data->has_fan & 1) { err = device_create_file(dev, & sensor_dev_attr_fan1_input16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan1_min16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan1_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )data->has_fan & 2) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan2_input16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan2_min16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan2_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )data->has_fan & 4) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan3_input16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan3_min16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan3_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )data->has_fan & 8) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan4_input16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan4_min16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan4_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )data->has_fan & 16) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan5_input16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan5_min16.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan5_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } else { } } else { if ((int )data->has_fan & 1) { err = device_create_file(dev, & sensor_dev_attr_fan1_input.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan1_min.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan1_div.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan1_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } } else { } if (((int )data->has_fan & 2) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan2_input.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan2_min.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan2_div.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan2_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } } else { } if (((int )data->has_fan & 4) != 0) { err = device_create_file(dev, & sensor_dev_attr_fan3_input.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan3_min.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan3_div.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_fan3_alarm.dev_attr); if (err != 0) { goto ERROR4; } else { } } } } } else { } } if (enable_pwm_interface != 0) { if (((int )sio_data->skip_pwm & 1) == 0) { err = device_create_file(dev, & sensor_dev_attr_pwm1_enable.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_pwm1.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & dev_attr_pwm1_freq); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )sio_data->skip_pwm & 2) == 0) { err = device_create_file(dev, & sensor_dev_attr_pwm2_enable.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_pwm2.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & dev_attr_pwm2_freq); if (err != 0) { goto ERROR4; } else { } } } } else { } if (((int )sio_data->skip_pwm & 4) == 0) { err = device_create_file(dev, & sensor_dev_attr_pwm3_enable.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & sensor_dev_attr_pwm3.dev_attr); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & dev_attr_pwm3_freq); if (err != 0) { goto ERROR4; } else { } } } } else { } } else { } if (((unsigned int )data->type == 1U || (unsigned int )data->type == 2U) || (unsigned int )data->type == 3U) { data->vrm = vid_which_vrm(); data->vid = sio_data->vid_value; err = device_create_file(dev, & dev_attr_vrm); if (err != 0) { goto ERROR4; } else { err = device_create_file(dev, & dev_attr_cpu0_vid); if (err != 0) { goto ERROR4; } else { } } } else { } data->hwmon_dev = hwmon_device_register(dev); tmp___7 = IS_ERR((void const *)data->hwmon_dev); if (tmp___7 != 0L) { tmp___6 = PTR_ERR((void const *)data->hwmon_dev); err = (int )tmp___6; goto ERROR4; } else { } return (0); ERROR4: sysfs_remove_group(& dev->kobj, & it87_group); sysfs_remove_group(& dev->kobj, & it87_group_opt); ERROR2: dev_set_drvdata(& pdev___0->dev, 0); kfree((void const *)data); ERROR1: __release_region(& ioport_resource, res->start, 2ULL); ERROR0: ; return (err); } } static int it87_remove(struct platform_device *pdev___0 ) { struct it87_data *data ; void *tmp ; { tmp = dev_get_drvdata(& pdev___0->dev); data = (struct it87_data *)tmp; hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(& pdev___0->dev.kobj, & it87_group); sysfs_remove_group(& pdev___0->dev.kobj, & it87_group_opt); __release_region(& ioport_resource, (resource_size_t )data->addr, 2ULL); dev_set_drvdata(& pdev___0->dev, 0); kfree((void const *)data); return (0); } } static int it87_read_value(struct it87_data *data , u8 reg ) { unsigned char tmp ; { outb_p((int )reg, (int )data->addr); tmp = inb_p((int )((unsigned int )data->addr + 1U)); return ((int )tmp); } } static void it87_write_value(struct it87_data *data , u8 reg , u8 value ) { { outb_p((int )reg, (int )data->addr); outb_p((int )value, (int )((unsigned int )data->addr + 1U)); return; } } static int it87_check_pwm(struct device *dev ) { struct it87_data *data ; void *tmp ; int tmp___0 ; int tmp___1 ; int i ; u8 pwm[3U] ; int tmp___2 ; char const *tmp___3 ; char const *tmp___4 ; char const *tmp___5 ; char const *tmp___6 ; char const *tmp___7 ; char const *tmp___8 ; char const *tmp___9 ; char const *tmp___10 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; tmp___1 = it87_read_value(data, 20); tmp___0 = tmp___1; if ((tmp___0 & 135) == 0) { if (fix_pwm_polarity != 0) { i = 0; goto ldv_11110; ldv_11109: tmp___2 = it87_read_value(data, (int )((unsigned int )((u8 )i) + 21U)); pwm[i] = (u8 )tmp___2; i = i + 1; ldv_11110: ; if (i <= 2) { goto ldv_11109; } else { } if ((int )((signed char )(((int )pwm[0] | (int )pwm[1]) | (int )pwm[2])) >= 0) { tmp___3 = dev_name((struct device const *)dev); tmp___4 = dev_driver_string((struct device const *)dev); printk("<6>%s %s: Reconfiguring PWM to active high polarity\n", tmp___4, tmp___3); it87_write_value(data, 20, (int )((u8 )((int )((signed char )tmp___0) | -121))); i = 0; goto ldv_11113; ldv_11112: it87_write_value(data, (int )((unsigned int )((u8 )i) + 21U), ~ ((int )pwm[i]) & 127); i = i + 1; ldv_11113: ; if (i <= 2) { goto ldv_11112; } else { } return (1); } else { } tmp___5 = dev_name((struct device const *)dev); tmp___6 = dev_driver_string((struct device const *)dev); printk("<6>%s %s: PWM configuration is too broken to be fixed\n", tmp___6, tmp___5); } else { } tmp___7 = dev_name((struct device const *)dev); tmp___8 = dev_driver_string((struct device const *)dev); printk("<6>%s %s: Detected broken BIOS defaults, disabling PWM interface\n", tmp___8, tmp___7); return (0); } else if (fix_pwm_polarity != 0) { tmp___9 = dev_name((struct device const *)dev); tmp___10 = dev_driver_string((struct device const *)dev); printk("<6>%s %s: PWM configuration looks sane, won\'t touch\n", tmp___10, tmp___9); } else { } return (1); } } static void it87_init_device(struct platform_device *pdev___0 ) { struct it87_data *data ; void *tmp ; int tmp___0 ; int i ; int tmp___1 ; char const *tmp___2 ; char const *tmp___3 ; int tmp___4 ; int tmp___5 ; { tmp = dev_get_drvdata(& pdev___0->dev); data = (struct it87_data *)tmp; i = 0; goto ldv_11122; ldv_11121: data->manual_pwm_ctl[i] = 255U; i = i + 1; ldv_11122: ; if (i <= 2) { goto ldv_11121; } else { } i = 0; goto ldv_11125; ldv_11124: tmp___0 = it87_read_value(data, (int )((unsigned int )((u8 )i) * 2U + 49U)); if (tmp___0 == 255) { it87_write_value(data, (int )((unsigned int )((u8 )i) * 2U + 49U), 0); } else { } i = i + 1; ldv_11125: ; if (i <= 7) { goto ldv_11124; } else { } i = 0; goto ldv_11128; ldv_11127: tmp___0 = it87_read_value(data, (int )((unsigned int )((u8 )(i + 32)) * 2U)); if (tmp___0 == 255) { it87_write_value(data, (int )((unsigned int )((u8 )(i + 32)) * 2U), 127); } else { } i = i + 1; ldv_11128: ; if (i <= 2) { goto ldv_11127; } else { } tmp___0 = it87_read_value(data, 81); if ((tmp___0 & 63) == 0) { tmp___0 = (tmp___0 & 192) | 42; it87_write_value(data, 81, (int )((u8 )tmp___0)); } else { } data->sensor = (u8 )tmp___0; tmp___0 = it87_read_value(data, 80); if ((tmp___0 & 255) == 0) { it87_write_value(data, 80, 255); } else { } tmp___1 = it87_read_value(data, 19); data->fan_main_ctrl = (u8 )tmp___1; if (((int )data->fan_main_ctrl & 112) == 0) { data->fan_main_ctrl = (u8 )((unsigned int )data->fan_main_ctrl | 112U); it87_write_value(data, 19, (int )data->fan_main_ctrl); } else { } data->has_fan = (unsigned int )((u8 )((int )data->fan_main_ctrl >> 4)) & 7U; tmp___4 = has_16bit_fans((struct it87_data const *)data); if (tmp___4 != 0) { tmp___0 = it87_read_value(data, 12); if (((~ tmp___0 & 7) & (int )data->has_fan) != 0) { tmp___2 = dev_name((struct device const *)(& pdev___0->dev)); tmp___3 = dev_driver_string((struct device const *)(& pdev___0->dev)); printk("<7>%s %s: Setting fan1-3 to 16-bit mode\n", tmp___3, tmp___2); it87_write_value(data, 12, (int )((u8 )((int )((signed char )tmp___0) | 7))); } else { } if ((unsigned int )data->type != 0U) { if ((tmp___0 & 16) != 0) { data->has_fan = (u8 )((unsigned int )data->has_fan | 8U); } else { } if ((tmp___0 & 32) != 0) { data->has_fan = (u8 )((unsigned int )data->has_fan | 16U); } else { } } else { } } else { } i = 0; goto ldv_11131; ldv_11130: ; if (((int )data->fan_main_ctrl >> i) & 1) { tmp___0 = it87_read_value(data, (int )((unsigned int )((u8 )i) + 21U)); if ((tmp___0 & 128) != 0) { } else { data->manual_pwm_ctl[i] = (u8 )(tmp___0 << 1); } } else { } i = i + 1; ldv_11131: ; if (i <= 2) { goto ldv_11130; } else { } tmp___5 = it87_read_value(data, 0); it87_write_value(data, 0, (int )((u8 )(((int )((signed char )tmp___5) & 54) | (update_vbat != 0 ? 65 : 1)))); return; } } static struct it87_data *it87_update_device(struct device *dev ) { struct it87_data *data ; void *tmp ; int i ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; int tmp___9 ; int tmp___10 ; int tmp___11 ; int tmp___12 ; int tmp___13 ; int tmp___14 ; int tmp___15 ; int tmp___16 ; int tmp___17 ; int tmp___18 ; int tmp___19 ; int tmp___20 ; { tmp = dev_get_drvdata(dev); data = (struct it87_data *)tmp; ldv_mutex_lock_25(& data->update_lock); if (((1 != 0 && 1 != 0) && (long )(data->last_updated + 375UL) - (long )jiffies < 0L) || (int )((signed char )data->valid) == 0) { if (update_vbat != 0) { tmp___0 = it87_read_value(data, 0); it87_write_value(data, 0, (int )((u8 )((int )((signed char )tmp___0) | 64))); } else { } i = 0; goto ldv_11145; ldv_11144: tmp___1 = it87_read_value(data, (int )((unsigned int )((u8 )i) + 32U)); data->in[i] = (u8 )tmp___1; tmp___2 = it87_read_value(data, (int )((unsigned int )((u8 )i) * 2U + 49U)); data->in_min[i] = (u8 )tmp___2; tmp___3 = it87_read_value(data, (int )((unsigned int )((u8 )(i + 24)) * 2U)); data->in_max[i] = (u8 )tmp___3; i = i + 1; ldv_11145: ; if (i <= 7) { goto ldv_11144; } else { } tmp___4 = it87_read_value(data, 40); data->in[8] = (u8 )tmp___4; i = 0; goto ldv_11149; ldv_11148: ; if ((((int )data->has_fan >> i) & 1) == 0) { goto ldv_11147; } else { } tmp___5 = it87_read_value(data, (int )IT87_REG_FAN_MIN[i]); data->fan_min[i] = (u16 )tmp___5; tmp___6 = it87_read_value(data, (int )IT87_REG_FAN[i]); data->fan[i] = (u16 )tmp___6; tmp___9 = has_16bit_fans((struct it87_data const *)data); if (tmp___9 != 0) { tmp___7 = it87_read_value(data, (int )IT87_REG_FANX[i]); data->fan[i] = (u16 )((int )((short )data->fan[i]) | (int )((short )(tmp___7 << 8))); tmp___8 = it87_read_value(data, (int )IT87_REG_FANX_MIN[i]); data->fan_min[i] = (u16 )((int )((short )data->fan_min[i]) | (int )((short )(tmp___8 << 8))); } else { } ldv_11147: i = i + 1; ldv_11149: ; if (i <= 4) { goto ldv_11148; } else { } i = 0; goto ldv_11152; ldv_11151: tmp___10 = it87_read_value(data, (int )((unsigned int )((u8 )i) + 41U)); data->temp[i] = (u8 )tmp___10; tmp___11 = it87_read_value(data, (int )((unsigned int )((u8 )(i + 32)) * 2U)); data->temp_high[i] = (u8 )tmp___11; tmp___12 = it87_read_value(data, (int )((unsigned int )((u8 )i) * 2U + 65U)); data->temp_low[i] = (u8 )tmp___12; i = i + 1; ldv_11152: ; if (i <= 2) { goto ldv_11151; } else { } if (((int )data->has_fan & 7) != 0) { tmp___13 = has_16bit_fans((struct it87_data const *)data); if (tmp___13 == 0) { i = it87_read_value(data, 11); data->fan_div[0] = (unsigned int )((u8 )i) & 7U; data->fan_div[1] = (unsigned int )((u8 )(i >> 3)) & 7U; data->fan_div[2] = (i & 64) != 0 ? 3U : 1U; } else { } } else { } tmp___14 = it87_read_value(data, 1); tmp___15 = it87_read_value(data, 2); tmp___16 = it87_read_value(data, 3); data->alarms = (u32 )((tmp___14 | (tmp___15 << 8)) | (tmp___16 << 16)); tmp___17 = it87_read_value(data, 19); data->fan_main_ctrl = (u8 )tmp___17; tmp___18 = it87_read_value(data, 20); data->fan_ctl = (u8 )tmp___18; tmp___19 = it87_read_value(data, 81); data->sensor = (u8 )tmp___19; if ((unsigned int )data->type == 1U || (unsigned int )data->type == 2U) { tmp___20 = it87_read_value(data, 10); data->vid = (u8 )tmp___20; data->vid = (unsigned int )data->vid & 63U; } else { } data->last_updated = jiffies; data->valid = 1; } else { } ldv_mutex_unlock_26(& data->update_lock); return (data); } } static int it87_device_add(unsigned short address , struct it87_sio_data const *sio_data ) { struct resource res ; int err ; { res.start = (unsigned long long )((int )address + 5); res.end = (unsigned long long )((int )address + 6); res.name = "it87"; res.flags = 256UL; res.parent = 0; res.sibling = 0; res.child = 0; pdev = platform_device_alloc("it87", (int )address); if ((unsigned long )pdev == (unsigned long )((struct platform_device *)0)) { err = -12; printk("<3>it87: Device allocation failed\n"); goto exit; } else { } err = platform_device_add_resources(pdev, & res, 1U); if (err != 0) { printk("<3>it87: Device resource addition failed (%d)\n", err); goto exit_device_put; } else { } err = platform_device_add_data(pdev, (void const *)sio_data, 8UL); if (err != 0) { printk("<3>it87: Platform data allocation failed\n"); goto exit_device_put; } else { } err = platform_device_add(pdev); if (err != 0) { printk("<3>it87: Device addition failed (%d)\n", err); goto exit_device_put; } else { } return (0); exit_device_put: platform_device_put(pdev); exit: ; return (err); } } static int sm_it87_init(void) { int err ; unsigned short isa_address ; struct it87_sio_data sio_data ; { isa_address = 0U; memset((void *)(& sio_data), 0, 8UL); err = it87_find(& isa_address, & sio_data); if (err != 0) { return (err); } else { } err = platform_driver_register(& it87_driver); if (err != 0) { return (err); } else { } err = it87_device_add((int )isa_address, (struct it87_sio_data const *)(& sio_data)); if (err != 0) { platform_driver_unregister(& it87_driver); return (err); } else { } return (0); } } static void sm_it87_exit(void) { { platform_device_unregister(pdev); platform_driver_unregister(& it87_driver); return; } } void ldv_check_final_state(void) ; extern void ldv_check_return_value(int ) ; extern void ldv_check_return_value_probe(int ) ; void ldv_initialize(void) ; extern void ldv_handler_precall(void) ; extern int nondet_int(void) ; int LDV_IN_INTERRUPT ; int main(void) { struct platform_device *var_group1 ; int res_it87_probe_42 ; int ldv_s_it87_driver_platform_driver ; int tmp ; int tmp___0 ; int tmp___1 ; { ldv_s_it87_driver_platform_driver = 0; LDV_IN_INTERRUPT = 1; ldv_initialize(); ldv_handler_precall(); tmp = sm_it87_init(); if (tmp != 0) { goto ldv_final; } else { } goto ldv_11226; ldv_11225: tmp___0 = nondet_int(); switch (tmp___0) { case 0: ; if (ldv_s_it87_driver_platform_driver == 0) { res_it87_probe_42 = it87_probe(var_group1); ldv_check_return_value(res_it87_probe_42); ldv_check_return_value_probe(res_it87_probe_42); if (res_it87_probe_42 != 0) { goto ldv_module_exit; } else { } ldv_s_it87_driver_platform_driver = ldv_s_it87_driver_platform_driver + 1; } else { } goto ldv_11222; case 1: ; if (ldv_s_it87_driver_platform_driver == 1) { ldv_handler_precall(); it87_remove(var_group1); ldv_s_it87_driver_platform_driver = 0; } else { } goto ldv_11222; default: ; goto ldv_11222; } ldv_11222: ; ldv_11226: tmp___1 = nondet_int(); if (tmp___1 != 0 || ldv_s_it87_driver_platform_driver != 0) { goto ldv_11225; } else { } ldv_module_exit: ldv_handler_precall(); sm_it87_exit(); ldv_final: ldv_check_final_state(); return 0; } } void ldv_mutex_lock_1(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_2(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_3(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_4(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_5(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_6(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_7(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_8(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_9(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_10(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_unlock_11(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_12(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_13(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_14(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_15(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_16(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_17(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_unlock_18(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_19(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_20(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_21(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_22(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_23(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_24(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } void ldv_mutex_lock_25(struct mutex *ldv_func_arg1 ) { { ldv_mutex_lock_update_lock_of_it87_data(ldv_func_arg1); mutex_lock(ldv_func_arg1); return; } } void ldv_mutex_unlock_26(struct mutex *ldv_func_arg1 ) { { ldv_mutex_unlock_update_lock_of_it87_data(ldv_func_arg1); mutex_unlock(ldv_func_arg1); return; } } __inline static void ldv_error(void) { { LDV_ERROR: {reach_error();abort();} } } extern int ldv_undef_int(void) ; long ldv__builtin_expect(long exp , long c ) { { return (exp); } } static int ldv_mutex_update_lock_of_it87_data ; int ldv_mutex_lock_interruptible_update_lock_of_it87_data(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } nondetermined = ldv_undef_int(); if (nondetermined) { ldv_mutex_update_lock_of_it87_data = 2; return (0); } else { return (-4); } } } int ldv_mutex_lock_killable_update_lock_of_it87_data(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } nondetermined = ldv_undef_int(); if (nondetermined) { ldv_mutex_update_lock_of_it87_data = 2; return (0); } else { return (-4); } } } void ldv_mutex_lock_update_lock_of_it87_data(struct mutex *lock ) { { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } ldv_mutex_update_lock_of_it87_data = 2; return; } } int ldv_mutex_trylock_update_lock_of_it87_data(struct mutex *lock ) { int is_mutex_held_by_another_thread ; { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } is_mutex_held_by_another_thread = ldv_undef_int(); if (is_mutex_held_by_another_thread) { return (0); } else { ldv_mutex_update_lock_of_it87_data = 2; return (1); } } } int ldv_atomic_dec_and_mutex_lock_update_lock_of_it87_data(atomic_t *cnt , struct mutex *lock ) { int atomic_value_after_dec ; { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } atomic_value_after_dec = ldv_undef_int(); if (atomic_value_after_dec == 0) { ldv_mutex_update_lock_of_it87_data = 2; return (1); } else { } return (0); } } int ldv_mutex_is_locked_update_lock_of_it87_data(struct mutex *lock ) { int nondetermined ; { if (ldv_mutex_update_lock_of_it87_data == 1) { nondetermined = ldv_undef_int(); if (nondetermined) { return (0); } else { return (1); } } else { return (1); } } } void ldv_mutex_unlock_update_lock_of_it87_data(struct mutex *lock ) { { if (ldv_mutex_update_lock_of_it87_data == 2) { } else { ldv_error(); } ldv_mutex_update_lock_of_it87_data = 1; return; } } void ldv_initialize(void) { { ldv_mutex_update_lock_of_it87_data = 1; return; } } void ldv_check_final_state(void) { { if (ldv_mutex_update_lock_of_it87_data == 1) { } else { ldv_error(); } return; } }