cpuidle: Make cpuidle's sysfs directory dynamically allocated
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 23 Jul 2013 10:19:06 +0000 (15:19 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:40:13 +0000 (13:40 -0700)
commit97a205a10f6b1289f16278bc6bb72021d87ac30d
treebdc023c045d57b48fde9a961357e016aaf973c5b
parentbe94ee82d3979ce032d187933f8c092c359a04ab
cpuidle: Make cpuidle's sysfs directory dynamically allocated

The cpuidle sysfs code is designed to have a single instance of per
CPU cpuidle directory.  It is not possible to remove the sysfs entry
and create it again.  This is not a problem with the current code but
future changes will add CPU hotplug support to enable/disable the
device, so it will need to remove the sysfs entry like other
subsystems do.  That won't be possible without this change, because
the kobj is a static object which can't be reused for
kobj_init_and_add().

Add cpuidle_device_kobj to be allocated dynamically when
adding/removing a sysfs entry which is consistent with the other
cpuidle's sysfs entries.

An added benefit is that the sysfs code is now more self-contained
and the includes needed for sysfs can be moved from cpuidle.h
directly into sysfs.c so as to reduce the total number of headers
dragged along with cpuidle.h.

[rjw: Changelog]
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 728ce22b696f9f1404a74d7b2279a65933553a1b)

Change-Id: I0d67b229d1e2ea31ac382b4625de2b558e0b6805
Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-on: http://git-master/r/258057
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
drivers/cpuidle/sysfs.c
include/linux/cpuidle.h