kobject: convert pseries/power.c to kobj_attr interface

This makes the code a bit simpler and and gets us one step closer to
deleting the deprecated subsys_attr code.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2007-11-02 13:20:40 -07:00
Родитель 851324c6ff
Коммит 79393fc46e
1 изменённых файлов: 8 добавлений и 12 удалений

Просмотреть файл

@ -28,13 +28,15 @@
unsigned long rtas_poweron_auto; /* default and normal state is 0 */ unsigned long rtas_poweron_auto; /* default and normal state is 0 */
static ssize_t auto_poweron_show(struct kset *kset, char *buf) static ssize_t auto_poweron_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ {
return sprintf(buf, "%lu\n", rtas_poweron_auto); return sprintf(buf, "%lu\n", rtas_poweron_auto);
} }
static ssize_t static ssize_t auto_poweron_store(struct kobject *kobj,
auto_poweron_store(struct kset *kset, const char *buf, size_t n) struct kobj_attribute *attr,
const char *buf, size_t n)
{ {
int ret; int ret;
unsigned long ups_restart; unsigned long ups_restart;
@ -47,14 +49,8 @@ auto_poweron_store(struct kset *kset, const char *buf, size_t n)
return -EINVAL; return -EINVAL;
} }
static struct subsys_attribute auto_poweron_attr = { static struct kobj_attribute auto_poweron_attr =
.attr = { __ATTR(auto_poweron, 0644, auto_poweron_show, auto_poweron_store);
.name = __stringify(auto_poweron),
.mode = 0644,
},
.show = auto_poweron_show,
.store = auto_poweron_store,
};
#ifndef CONFIG_PM #ifndef CONFIG_PM
struct kset *power_kset; struct kset *power_kset;
@ -79,7 +75,7 @@ core_initcall(pm_init);
#else #else
static int __init apo_pm_init(void) static int __init apo_pm_init(void)
{ {
return (subsys_create_file(power_kset, &auto_poweron_attr)); return (sysfs_create_file(&power_kset->kobj, &auto_poweron_attr));
} }
__initcall(apo_pm_init); __initcall(apo_pm_init);
#endif #endif