cpufreq: interactive: fix cpufreq object duplicate creatation in sysfs
authorRocky Hao <rocky.hao@rock-chips.com>
Sat, 5 Mar 2016 03:06:12 +0000 (11:06 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 7 Mar 2016 09:49:18 +0000 (17:49 +0800)
[    4.216722] sysfs: cannot create duplicate filename '/devices/system/cpu/cpufreq'
[    4.233798] ------------[ cut here ]------------
[    4.244376] WARNING: at fs/sysfs/dir.c:31
[    4.253556]
[    4.256975] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.4.0 #156
[    4.270730] Hardware name: Rockchip SDK tb board (DT)
[    4.282302] task: ffffffc039670000 ti: ffffffc039678000 task.ti: ffffffc039678000
[    4.299444] PC is at sysfs_warn_dup+0x5c/0x78
[    4.309422] LR is at sysfs_warn_dup+0x5c/0x78

Change-Id: Id21fe74dc082ec6c94fcb3e0cc11b78226549f7d
Fixes: bc68f6c4efbd ("cpufreq: interactive: build fixes for 4.4")
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
drivers/cpufreq/cpufreq_interactive.c

index 0be66df..25dd588 100644 (file)
@@ -116,28 +116,6 @@ struct cpufreq_interactive_tunables {
        bool io_is_busy;
 };
 
-/*
- * HACK: FIXME: Bring back cpufreq_{get,put}_global_kobject()
- * definition removed by upstream commit 8eec1020f0c0 "cpufreq:
- * create cpu/cpufreq at boot time" to fix build failures.
- */
-static int cpufreq_global_kobject_usage;
-
-int cpufreq_get_global_kobject(void)
-{
-       if (!cpufreq_global_kobject_usage++)
-               return kobject_add(cpufreq_global_kobject,
-                               &cpu_subsys.dev_root->kobj, "%s", "cpufreq");
-
-       return 0;
-}
-
-void cpufreq_put_global_kobject(void)
-{
-       if (!--cpufreq_global_kobject_usage)
-               kobject_del(cpufreq_global_kobject);
-}
-
 /* For cases where we have single governor instance for system */
 static struct cpufreq_interactive_tunables *common_tunables;
 
@@ -1172,7 +1150,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
                policy->governor_data = tunables;
                if (!have_governor_per_policy()) {
                        common_tunables = tunables;
-                       WARN_ON(cpufreq_get_global_kobject());
                }
 
                rc = sysfs_create_group(get_governor_parent_kobj(policy),
@@ -1182,7 +1159,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
                        policy->governor_data = NULL;
                        if (!have_governor_per_policy()) {
                                common_tunables = NULL;
-                               cpufreq_put_global_kobject();
                        }
                        return rc;
                }
@@ -1206,8 +1182,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
                        sysfs_remove_group(get_governor_parent_kobj(policy),
                                        get_sysfs_attr());
 
-                       if (!have_governor_per_policy())
-                               cpufreq_put_global_kobject();
 
                        kfree(tunables);
                        common_tunables = NULL;