@@ -811,7 +811,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
811811 devfreq -> dev .release = devfreq_dev_release ;
812812 INIT_LIST_HEAD (& devfreq -> node );
813813 devfreq -> profile = profile ;
814- strscpy (devfreq -> governor_name , governor_name , DEVFREQ_NAME_LEN );
815814 devfreq -> previous_freq = profile -> initial_freq ;
816815 devfreq -> last_status .current_frequency = profile -> initial_freq ;
817816 devfreq -> data = data ;
@@ -907,7 +906,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
907906
908907 mutex_lock (& devfreq_list_lock );
909908
910- governor = try_then_request_governor (devfreq -> governor_name );
909+ governor = try_then_request_governor (governor_name );
911910 if (IS_ERR (governor )) {
912911 dev_err (dev , "%s: Unable to find governor for the device\n" ,
913912 __func__ );
@@ -1249,7 +1248,7 @@ int devfreq_add_governor(struct devfreq_governor *governor)
12491248 int ret = 0 ;
12501249 struct device * dev = devfreq -> dev .parent ;
12511250
1252- if (!strncmp (devfreq -> governor_name , governor -> name ,
1251+ if (!strncmp (devfreq -> governor -> name , governor -> name ,
12531252 DEVFREQ_NAME_LEN )) {
12541253 /* The following should never occur */
12551254 if (devfreq -> governor ) {
@@ -1311,7 +1310,7 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
13111310 int ret ;
13121311 struct device * dev = devfreq -> dev .parent ;
13131312
1314- if (!strncmp (devfreq -> governor_name , governor -> name ,
1313+ if (!strncmp (devfreq -> governor -> name , governor -> name ,
13151314 DEVFREQ_NAME_LEN )) {
13161315 /* we should have a devfreq governor! */
13171316 if (!devfreq -> governor ) {
@@ -1406,21 +1405,18 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
14061405 */
14071406 prev_governor = df -> governor ;
14081407 df -> governor = governor ;
1409- strncpy (df -> governor_name , governor -> name , DEVFREQ_NAME_LEN );
14101408 ret = df -> governor -> event_handler (df , DEVFREQ_GOV_START , NULL );
14111409 if (ret ) {
14121410 dev_warn (dev , "%s: Governor %s not started(%d)\n" ,
14131411 __func__ , df -> governor -> name , ret );
14141412
14151413 /* Restore previous governor */
14161414 df -> governor = prev_governor ;
1417- strncpy (df -> governor_name , prev_governor -> name ,
1418- DEVFREQ_NAME_LEN );
14191415 ret = df -> governor -> event_handler (df , DEVFREQ_GOV_START , NULL );
14201416 if (ret ) {
14211417 dev_err (dev ,
14221418 "%s: reverting to Governor %s failed (%d)\n" ,
1423- __func__ , df -> governor_name , ret );
1419+ __func__ , prev_governor -> name , ret );
14241420 df -> governor = NULL ;
14251421 goto out ;
14261422 }
@@ -1459,7 +1455,7 @@ static ssize_t available_governors_show(struct device *d,
14591455 */
14601456 if (IS_SUPPORTED_FLAG (df -> governor -> flags , IMMUTABLE )) {
14611457 count = scnprintf (& buf [count ], DEVFREQ_NAME_LEN ,
1462- "%s " , df -> governor_name );
1458+ "%s " , df -> governor -> name );
14631459 /*
14641460 * The devfreq device shows the registered governor except for
14651461 * immutable governors such as passive governor .
@@ -1902,7 +1898,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
19021898
19031899 list_for_each_entry_reverse (devfreq , & devfreq_list , node ) {
19041900#if IS_ENABLED (CONFIG_DEVFREQ_GOV_PASSIVE )
1905- if (!strncmp (devfreq -> governor_name , DEVFREQ_GOV_PASSIVE ,
1901+ if (!strncmp (devfreq -> governor -> name , DEVFREQ_GOV_PASSIVE ,
19061902 DEVFREQ_NAME_LEN )) {
19071903 struct devfreq_passive_data * data = devfreq -> data ;
19081904
@@ -1928,7 +1924,7 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
19281924 "%-30s %-30s %-15s %-10s %10d %12ld %12ld %12ld\n" ,
19291925 dev_name (& devfreq -> dev ),
19301926 p_devfreq ? dev_name (& p_devfreq -> dev ) : "null" ,
1931- devfreq -> governor_name ,
1927+ devfreq -> governor -> name ,
19321928 polling_ms ? timer_name [timer ] : "null" ,
19331929 polling_ms ,
19341930 cur_freq ,
0 commit comments