Skip to content

Commit

Permalink
power: suspend - convert sysdev_class to a regular subsystem
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kay Sievers authored and Greg Kroah-Hartman committed Dec 21, 2011
1 parent cfde779 commit 86ba41d
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions arch/powerpc/platforms/pseries/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <asm/rtas.h>

static u64 stream_id;
static struct sys_device suspend_sysdev;
static struct device suspend_dev;
static DECLARE_COMPLETION(suspend_work);
static struct rtas_suspend_me_data suspend_data;
static atomic_t suspending;
Expand Down Expand Up @@ -110,8 +110,8 @@ static int pseries_prepare_late(void)

/**
* store_hibernate - Initiate partition hibernation
* @classdev: sysdev class struct
* @attr: class device attribute struct
* @dev: subsys root device
* @attr: device attribute struct
* @buf: buffer
* @count: buffer size
*
Expand All @@ -121,8 +121,8 @@ static int pseries_prepare_late(void)
* Return value:
* number of bytes printed to buffer / other on failure
**/
static ssize_t store_hibernate(struct sysdev_class *classdev,
struct sysdev_class_attribute *attr,
static ssize_t store_hibernate(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int rc;
Expand All @@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,
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",
.dev_name = "power",
};

static const struct platform_suspend_ops pseries_suspend_ops = {
Expand All @@ -167,23 +168,23 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
* Return value:
* 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;

if ((rc = sysdev_class_register(&suspend_sysdev_class)))
if ((rc = subsys_system_register(&suspend_subsys, NULL)))
return rc;

sysdev->id = 0;
sysdev->cls = &suspend_sysdev_class;
dev->id = 0;
dev->bus = &suspend_subsys;

if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate)))
goto class_unregister;
if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
goto subsys_unregister;

return 0;

class_unregister:
sysdev_class_unregister(&suspend_sysdev_class);
subsys_unregister:
bus_unregister(&suspend_subsys);
return rc;
}

Expand All @@ -204,7 +205,7 @@ static int __init pseries_suspend_init(void)
if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
return 0;

if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev)))
if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
return rc;

ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
Expand Down

0 comments on commit 86ba41d

Please sign in to comment.