Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\sched\cpufreq_schedutil.c Create Date:2022-07-28 09:45:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:sugov_init

Proto:static int sugov_init(struct cpufreq_policy *policy)

Type:int

Parameter:

TypeParameterName
struct cpufreq_policy *policy
741  ret = 0
744  If governor_data Then Return -EBUSY
747  cpufreq_enable_fast_switch(policy)
749  sg_policy = sugov_policy_alloc(policy)
750  If Not sg_policy Then
751  ret = -ENOMEM
752  Go to disable_fast_switch
755  ret = sugov_kthread_create(sg_policy)
756  If ret Then Go to free_sg_policy
759  mutex_lock( & global_tunables_lock)
761  If sysfs interface *********************** Then
763  ret = -EINVAL
764  Go to stop_kthread
766  governor_data = sg_policy
767  tunables = sysfs interface ***********************
769  gov_attr_set_get( & attr_set, & tunables_hook)
770  Go to out
773  tunables = sugov_tunables_alloc(sg_policy)
774  If Not tunables Then
775  ret = -ENOMEM
776  Go to stop_kthread
779  rate_limit_us = cpufreq_policy_transition_delay_us(policy)
781  governor_data = sg_policy
782  tunables = tunables
784  ret = kobject_init_and_add() - Initialize a kobject structure and add it to* the kobject hierarchy.*@kobj: pointer to the kobject to initialize*@ktype: pointer to the ktype for this kobject.*@parent: pointer to the parent of this kobject.
787  If ret Then Go to fail
790  out :
791  mutex_unlock( & global_tunables_lock)
792  Return 0
794  fail :
795  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
796  governor_data = NULL
797  sugov_tunables_free(tunables)
799  stop_kthread :
800  sugov_kthread_stop(sg_policy)
801  mutex_unlock( & global_tunables_lock)
803  free_sg_policy :
804  sugov_policy_free(sg_policy)
806  disable_fast_switch :
807  cpufreq_disable_fast_switch(policy)
809  pr_err("initialization failed (error %d)\n", ret)
810  Return ret