power: suspend - convert sysdev_class to a regular subsystem

After all sysdev classes are ported to regular driver core entities, the
sysdev implementation will be entirely removed from the kernel.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Kay Sievers 2011-12-21 15:09:52 -08:00 committed by Greg Kroah-Hartman
parent cfde779fcc
commit 86ba41d033
1 changed files with 17 additions and 16 deletions

View File

@ -26,7 +26,7 @@
#include <asm/rtas.h> #include <asm/rtas.h>
static u64 stream_id; static u64 stream_id;
static struct sys_device suspend_sysdev; static struct device suspend_dev;
static DECLARE_COMPLETION(suspend_work); static DECLARE_COMPLETION(suspend_work);
static struct rtas_suspend_me_data suspend_data; static struct rtas_suspend_me_data suspend_data;
static atomic_t suspending; static atomic_t suspending;
@ -110,8 +110,8 @@ static int pseries_prepare_late(void)
/** /**
* store_hibernate - Initiate partition hibernation * store_hibernate - Initiate partition hibernation
* @classdev: sysdev class struct * @dev: subsys root device
* @attr: class device attribute struct * @attr: device attribute struct
* @buf: buffer * @buf: buffer
* @count: buffer size * @count: buffer size
* *
@ -121,8 +121,8 @@ static int pseries_prepare_late(void)
* Return value: * Return value:
* number of bytes printed to buffer / other on failure * number of bytes printed to buffer / other on failure
**/ **/
static ssize_t store_hibernate(struct sysdev_class *classdev, static ssize_t store_hibernate(struct device *dev,
struct sysdev_class_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int rc; int rc;
@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,
return rc; return rc;
} }
static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
static struct sysdev_class suspend_sysdev_class = { static struct bus_type suspend_subsys = {
.name = "power", .name = "power",
.dev_name = "power",
}; };
static const struct platform_suspend_ops pseries_suspend_ops = { static const struct platform_suspend_ops pseries_suspend_ops = {
@ -167,23 +168,23 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
* Return value: * Return value:
* 0 on success / other on failure * 0 on success / other on failure
**/ **/
static int pseries_suspend_sysfs_register(struct sys_device *sysdev) static int pseries_suspend_sysfs_register(struct device *dev)
{ {
int rc; int rc;
if ((rc = sysdev_class_register(&suspend_sysdev_class))) if ((rc = subsys_system_register(&suspend_subsys, NULL)))
return rc; return rc;
sysdev->id = 0; dev->id = 0;
sysdev->cls = &suspend_sysdev_class; dev->bus = &suspend_subsys;
if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate))) if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
goto class_unregister; goto subsys_unregister;
return 0; return 0;
class_unregister: subsys_unregister:
sysdev_class_unregister(&suspend_sysdev_class); bus_unregister(&suspend_subsys);
return rc; return rc;
} }
@ -204,7 +205,7 @@ static int __init pseries_suspend_init(void)
if (suspend_data.token == RTAS_UNKNOWN_SERVICE) if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
return 0; return 0;
if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev))) if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
return rc; return rc;
ppc_md.suspend_disable_cpu = pseries_suspend_cpu; ppc_md.suspend_disable_cpu = pseries_suspend_cpu;