Skip to content

Commit 86ba41d

Browse files
kaysieversgregkh
authored andcommitted
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>
1 parent cfde779 commit 86ba41d

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

‎arch/powerpc/platforms/pseries/suspend.c‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <asm/rtas.h>
2727

2828
static u64 stream_id;
29-
static struct sys_device suspend_sysdev;
29+
static struct device suspend_dev;
3030
static DECLARE_COMPLETION(suspend_work);
3131
static struct rtas_suspend_me_data suspend_data;
3232
static atomic_t suspending;
@@ -110,8 +110,8 @@ static int pseries_prepare_late(void)
110110

111111
/**
112112
* store_hibernate - Initiate partition hibernation
113-
* @classdev: sysdev class struct
114-
* @attr: class device attribute struct
113+
* @dev: subsys root device
114+
* @attr: device attribute struct
115115
* @buf: buffer
116116
* @count: buffer size
117117
*
@@ -121,8 +121,8 @@ static int pseries_prepare_late(void)
121121
* Return value:
122122
* number of bytes printed to buffer / other on failure
123123
**/
124-
static ssize_t store_hibernate(struct sysdev_class *classdev,
125-
struct sysdev_class_attribute *attr,
124+
static ssize_t store_hibernate(struct device *dev,
125+
struct device_attribute *attr,
126126
const char *buf, size_t count)
127127
{
128128
int rc;
@@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,
148148
return rc;
149149
}
150150

151-
static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
151+
static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
152152

153-
static struct sysdev_class suspend_sysdev_class = {
153+
static struct bus_type suspend_subsys = {
154154
.name = "power",
155+
.dev_name = "power",
155156
};
156157

157158
static const struct platform_suspend_ops pseries_suspend_ops = {
@@ -167,23 +168,23 @@ static const struct platform_suspend_ops pseries_suspend_ops = {
167168
* Return value:
168169
* 0 on success / other on failure
169170
**/
170-
static int pseries_suspend_sysfs_register(struct sys_device *sysdev)
171+
static int pseries_suspend_sysfs_register(struct device *dev)
171172
{
172173
int rc;
173174

174-
if ((rc = sysdev_class_register(&suspend_sysdev_class)))
175+
if ((rc = subsys_system_register(&suspend_subsys, NULL)))
175176
return rc;
176177

177-
sysdev->id = 0;
178-
sysdev->cls = &suspend_sysdev_class;
178+
dev->id = 0;
179+
dev->bus = &suspend_subsys;
179180

180-
if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate)))
181-
goto class_unregister;
181+
if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate)))
182+
goto subsys_unregister;
182183

183184
return 0;
184185

185-
class_unregister:
186-
sysdev_class_unregister(&suspend_sysdev_class);
186+
subsys_unregister:
187+
bus_unregister(&suspend_subsys);
187188
return rc;
188189
}
189190

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

207-
if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev)))
208+
if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
208209
return rc;
209210

210211
ppc_md.suspend_disable_cpu = pseries_suspend_cpu;

0 commit comments

Comments
 (0)