Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6:
  remove "struct subsystem" as it is no longer needed
  sysfs: printk format warning
  DOC: Fix wrong identifier name in Documentation/driver-model/devres.txt
  platform: reorder platform_device_del
  Driver core: fix show_uevent from taking up way too much stack
This commit is contained in:
Linus Torvalds 2007-05-04 18:04:48 -07:00
commit 5b33991576
49 changed files with 244 additions and 298 deletions

View File

@ -182,7 +182,7 @@ For example, you can do something like the following.
... ...
devres_close_group(dev, my_midlayer_something); devres_close_group(dev, my_midlayer_create_something);
return 0; return 0;
} }

View File

@ -72,12 +72,12 @@ static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
static unsigned short enable_dyn_sleep = 1; static unsigned short enable_dyn_sleep = 1;
static ssize_t omap_pm_sleep_while_idle_show(struct subsystem * subsys, char *buf) static ssize_t omap_pm_sleep_while_idle_show(struct kset *kset, char *buf)
{ {
return sprintf(buf, "%hu\n", enable_dyn_sleep); return sprintf(buf, "%hu\n", enable_dyn_sleep);
} }
static ssize_t omap_pm_sleep_while_idle_store(struct subsystem * subsys, static ssize_t omap_pm_sleep_while_idle_store(struct kset *kset,
const char * buf, const char * buf,
size_t n) size_t n)
{ {
@ -100,7 +100,7 @@ static struct subsys_attribute sleep_while_idle_attr = {
.store = omap_pm_sleep_while_idle_store, .store = omap_pm_sleep_while_idle_store,
}; };
extern struct subsystem power_subsys; extern struct kset power_subsys;
static void (*omap_sram_idle)(void) = NULL; static void (*omap_sram_idle)(void) = NULL;
static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL; static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;

View File

@ -37,7 +37,7 @@
#include <asm/iseries/hv_call_xm.h> #include <asm/iseries/hv_call_xm.h>
#include <asm/iseries/iommu.h> #include <asm/iseries/iommu.h>
extern struct subsystem devices_subsys; /* needed for vio_find_name() */ extern struct kset devices_subsys; /* needed for vio_find_name() */
static struct vio_dev vio_bus_device = { /* fake "parent" device */ static struct vio_dev vio_bus_device = { /* fake "parent" device */
.name = vio_bus_device.dev.bus_id, .name = vio_bus_device.dev.bus_id,
@ -427,7 +427,7 @@ static struct vio_dev *vio_find_name(const char *kobj_name)
{ {
struct kobject *found; struct kobject *found;
found = kset_find_obj(&devices_subsys.kset, kobj_name); found = kset_find_obj(&devices_subsys, kobj_name);
if (!found) if (!found)
return NULL; return NULL;

View File

@ -28,13 +28,13 @@
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 subsystem *subsys, char *buf) static ssize_t auto_poweron_show(struct kset *kset, 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 subsystem *subsys, const char *buf, size_t n) auto_poweron_store(struct kset *kset, const char *buf, size_t n)
{ {
int ret; int ret;
unsigned long ups_restart; unsigned long ups_restart;
@ -72,12 +72,12 @@ static int __init pm_init(void)
{ {
int error = subsystem_register(&power_subsys); int error = subsystem_register(&power_subsys);
if (!error) if (!error)
error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); error = sysfs_create_group(&power_subsys.kobj, &attr_group);
return error; return error;
} }
core_initcall(pm_init); core_initcall(pm_init);
#else #else
extern struct subsystem power_subsys; extern struct kset power_subsys;
static int __init apo_pm_init(void) static int __init apo_pm_init(void)
{ {

View File

@ -164,7 +164,7 @@ EXPORT_SYMBOL_GPL(diag308);
/* SYSFS */ /* SYSFS */
#define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \ #define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
char *page) \ char *page) \
{ \ { \
return sprintf(page, _format, _value); \ return sprintf(page, _format, _value); \
@ -173,13 +173,13 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
__ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL); __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
#define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \ #define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
char *page) \ char *page) \
{ \ { \
return sprintf(page, _fmt_out, \ return sprintf(page, _fmt_out, \
(unsigned long long) _value); \ (unsigned long long) _value); \
} \ } \
static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
const char *buf, size_t len) \ const char *buf, size_t len) \
{ \ { \
unsigned long long value; \ unsigned long long value; \
@ -194,12 +194,12 @@ static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
sys_##_prefix##_##_name##_store); sys_##_prefix##_##_name##_store);
#define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\ #define DEFINE_IPL_ATTR_STR_RW(_prefix, _name, _fmt_out, _fmt_in, _value)\
static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \ static ssize_t sys_##_prefix##_##_name##_show(struct kset *kset, \
char *page) \ char *page) \
{ \ { \
return sprintf(page, _fmt_out, _value); \ return sprintf(page, _fmt_out, _value); \
} \ } \
static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\ static ssize_t sys_##_prefix##_##_name##_store(struct kset *kset, \
const char *buf, size_t len) \ const char *buf, size_t len) \
{ \ { \
if (sscanf(buf, _fmt_in, _value) != 1) \ if (sscanf(buf, _fmt_in, _value) != 1) \
@ -272,14 +272,14 @@ void __init setup_ipl_info(void)
struct ipl_info ipl_info; struct ipl_info ipl_info;
EXPORT_SYMBOL_GPL(ipl_info); EXPORT_SYMBOL_GPL(ipl_info);
static ssize_t ipl_type_show(struct subsystem *subsys, char *page) static ssize_t ipl_type_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%s\n", ipl_type_str(ipl_info.type)); return sprintf(page, "%s\n", ipl_type_str(ipl_info.type));
} }
static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type); static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page) static ssize_t sys_ipl_device_show(struct kset *kset, char *page)
{ {
struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START; struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
@ -371,7 +371,7 @@ static struct attribute_group ipl_fcp_attr_group = {
/* CCW ipl device attributes */ /* CCW ipl device attributes */
static ssize_t ipl_ccw_loadparm_show(struct subsystem *subsys, char *page) static ssize_t ipl_ccw_loadparm_show(struct kset *kset, char *page)
{ {
char loadparm[LOADPARM_LEN + 1] = {}; char loadparm[LOADPARM_LEN + 1] = {};
@ -469,7 +469,7 @@ static void reipl_get_ascii_loadparm(char *loadparm)
strstrip(loadparm); strstrip(loadparm);
} }
static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page) static ssize_t reipl_ccw_loadparm_show(struct kset *kset, char *page)
{ {
char buf[LOADPARM_LEN + 1]; char buf[LOADPARM_LEN + 1];
@ -477,7 +477,7 @@ static ssize_t reipl_ccw_loadparm_show(struct subsystem *subsys, char *page)
return sprintf(page, "%s\n", buf); return sprintf(page, "%s\n", buf);
} }
static ssize_t reipl_ccw_loadparm_store(struct subsystem *subsys, static ssize_t reipl_ccw_loadparm_store(struct kset *kset,
const char *buf, size_t len) const char *buf, size_t len)
{ {
int i, lp_len; int i, lp_len;
@ -572,12 +572,12 @@ static int reipl_set_type(enum ipl_type type)
return 0; return 0;
} }
static ssize_t reipl_type_show(struct subsystem *subsys, char *page) static ssize_t reipl_type_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%s\n", ipl_type_str(reipl_type)); return sprintf(page, "%s\n", ipl_type_str(reipl_type));
} }
static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf, static ssize_t reipl_type_store(struct kset *kset, const char *buf,
size_t len) size_t len)
{ {
int rc = -EINVAL; int rc = -EINVAL;
@ -665,12 +665,12 @@ static int dump_set_type(enum dump_type type)
return 0; return 0;
} }
static ssize_t dump_type_show(struct subsystem *subsys, char *page) static ssize_t dump_type_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%s\n", dump_type_str(dump_type)); return sprintf(page, "%s\n", dump_type_str(dump_type));
} }
static ssize_t dump_type_store(struct subsystem *subsys, const char *buf, static ssize_t dump_type_store(struct kset *kset, const char *buf,
size_t len) size_t len)
{ {
int rc = -EINVAL; int rc = -EINVAL;
@ -697,12 +697,12 @@ static decl_subsys(shutdown_actions, NULL, NULL);
/* on panic */ /* on panic */
static ssize_t on_panic_show(struct subsystem *subsys, char *page) static ssize_t on_panic_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%s\n", shutdown_action_str(on_panic_action)); return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
} }
static ssize_t on_panic_store(struct subsystem *subsys, const char *buf, static ssize_t on_panic_store(struct kset *kset, const char *buf,
size_t len) size_t len)
{ {
if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0) if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)

View File

@ -17,7 +17,7 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/mutex.h> #include <linux/mutex.h>
struct subsystem block_subsys; struct kset block_subsys;
static DEFINE_MUTEX(block_subsys_lock); static DEFINE_MUTEX(block_subsys_lock);
/* /*
@ -221,7 +221,7 @@ static void *part_start(struct seq_file *part, loff_t *pos)
loff_t l = *pos; loff_t l = *pos;
mutex_lock(&block_subsys_lock); mutex_lock(&block_subsys_lock);
list_for_each(p, &block_subsys.kset.list) list_for_each(p, &block_subsys.list)
if (!l--) if (!l--)
return list_entry(p, struct gendisk, kobj.entry); return list_entry(p, struct gendisk, kobj.entry);
return NULL; return NULL;
@ -231,7 +231,7 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
{ {
struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; struct list_head *p = ((struct gendisk *)v)->kobj.entry.next;
++*pos; ++*pos;
return p==&block_subsys.kset.list ? NULL : return p==&block_subsys.list ? NULL :
list_entry(p, struct gendisk, kobj.entry); list_entry(p, struct gendisk, kobj.entry);
} }
@ -246,7 +246,7 @@ static int show_partition(struct seq_file *part, void *v)
int n; int n;
char buf[BDEVNAME_SIZE]; char buf[BDEVNAME_SIZE];
if (&sgp->kobj.entry == block_subsys.kset.list.next) if (&sgp->kobj.entry == block_subsys.list.next)
seq_puts(part, "major minor #blocks name\n\n"); seq_puts(part, "major minor #blocks name\n\n");
/* Don't show non-partitionable removeable devices or empty devices */ /* Don't show non-partitionable removeable devices or empty devices */
@ -565,7 +565,7 @@ static void *diskstats_start(struct seq_file *part, loff_t *pos)
struct list_head *p; struct list_head *p;
mutex_lock(&block_subsys_lock); mutex_lock(&block_subsys_lock);
list_for_each(p, &block_subsys.kset.list) list_for_each(p, &block_subsys.list)
if (!k--) if (!k--)
return list_entry(p, struct gendisk, kobj.entry); return list_entry(p, struct gendisk, kobj.entry);
return NULL; return NULL;
@ -575,7 +575,7 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)
{ {
struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; struct list_head *p = ((struct gendisk *)v)->kobj.entry.next;
++*pos; ++*pos;
return p==&block_subsys.kset.list ? NULL : return p==&block_subsys.list ? NULL :
list_entry(p, struct gendisk, kobj.entry); list_entry(p, struct gendisk, kobj.entry);
} }

View File

@ -45,3 +45,5 @@ struct class_device_attribute *to_class_dev_attr(struct attribute *_attr)
extern char *make_class_name(const char *name, struct kobject *kobj); extern char *make_class_name(const char *name, struct kobject *kobj);
extern void devres_release_all(struct device *dev); extern void devres_release_all(struct device *dev);
extern struct kset devices_subsys;

View File

@ -17,7 +17,7 @@
#include "power/power.h" #include "power/power.h"
#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) #define to_bus(obj) container_of(obj, struct bus_type, subsys.kobj)
/* /*
* sysfs bindings for drivers * sysfs bindings for drivers
@ -123,7 +123,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
{ {
int error; int error;
if (get_bus(bus)) { if (get_bus(bus)) {
error = sysfs_create_file(&bus->subsys.kset.kobj, &attr->attr); error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
put_bus(bus); put_bus(bus);
} else } else
error = -EINVAL; error = -EINVAL;
@ -133,7 +133,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
{ {
if (get_bus(bus)) { if (get_bus(bus)) {
sysfs_remove_file(&bus->subsys.kset.kobj, &attr->attr); sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
put_bus(bus); put_bus(bus);
} }
} }
@ -397,7 +397,7 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
static int make_deprecated_bus_links(struct device *dev) static int make_deprecated_bus_links(struct device *dev)
{ {
return sysfs_create_link(&dev->kobj, return sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "bus"); &dev->bus->subsys.kobj, "bus");
} }
static void remove_deprecated_bus_links(struct device *dev) static void remove_deprecated_bus_links(struct device *dev)
@ -431,7 +431,7 @@ int bus_add_device(struct device * dev)
if (error) if (error)
goto out_id; goto out_id;
error = sysfs_create_link(&dev->kobj, error = sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "subsystem"); &dev->bus->subsys.kobj, "subsystem");
if (error) if (error)
goto out_subsys; goto out_subsys;
error = make_deprecated_bus_links(dev); error = make_deprecated_bus_links(dev);
@ -810,7 +810,7 @@ int bus_register(struct bus_type * bus)
BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier); BLOCKING_INIT_NOTIFIER_HEAD(&bus->bus_notifier);
retval = kobject_set_name(&bus->subsys.kset.kobj, "%s", bus->name); retval = kobject_set_name(&bus->subsys.kobj, "%s", bus->name);
if (retval) if (retval)
goto out; goto out;
@ -820,13 +820,13 @@ int bus_register(struct bus_type * bus)
goto out; goto out;
kobject_set_name(&bus->devices.kobj, "devices"); kobject_set_name(&bus->devices.kobj, "devices");
bus->devices.subsys = &bus->subsys; bus->devices.kobj.parent = &bus->subsys.kobj;
retval = kset_register(&bus->devices); retval = kset_register(&bus->devices);
if (retval) if (retval)
goto bus_devices_fail; goto bus_devices_fail;
kobject_set_name(&bus->drivers.kobj, "drivers"); kobject_set_name(&bus->drivers.kobj, "drivers");
bus->drivers.subsys = &bus->subsys; bus->drivers.kobj.parent = &bus->subsys.kobj;
bus->drivers.ktype = &ktype_driver; bus->drivers.ktype = &ktype_driver;
retval = kset_register(&bus->drivers); retval = kset_register(&bus->drivers);
if (retval) if (retval)

View File

@ -19,10 +19,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "base.h" #include "base.h"
extern struct subsystem devices_subsys;
#define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr) #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
#define to_class(obj) container_of(obj, struct class, subsys.kset.kobj) #define to_class(obj) container_of(obj, struct class, subsys.kobj)
static ssize_t static ssize_t
class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
@ -80,7 +78,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
{ {
int error; int error;
if (cls) { if (cls) {
error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr); error = sysfs_create_file(&cls->subsys.kobj, &attr->attr);
} else } else
error = -EINVAL; error = -EINVAL;
return error; return error;
@ -89,7 +87,7 @@ int class_create_file(struct class * cls, const struct class_attribute * attr)
void class_remove_file(struct class * cls, const struct class_attribute * attr) void class_remove_file(struct class * cls, const struct class_attribute * attr)
{ {
if (cls) if (cls)
sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr); sysfs_remove_file(&cls->subsys.kobj, &attr->attr);
} }
static struct class *class_get(struct class *cls) static struct class *class_get(struct class *cls)
@ -147,7 +145,7 @@ int class_register(struct class * cls)
INIT_LIST_HEAD(&cls->interfaces); INIT_LIST_HEAD(&cls->interfaces);
kset_init(&cls->class_dirs); kset_init(&cls->class_dirs);
init_MUTEX(&cls->sem); init_MUTEX(&cls->sem);
error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name); error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name);
if (error) if (error)
return error; return error;
@ -611,7 +609,7 @@ int class_device_add(struct class_device *class_dev)
if (parent_class_dev) if (parent_class_dev)
class_dev->kobj.parent = &parent_class_dev->kobj; class_dev->kobj.parent = &parent_class_dev->kobj;
else else
class_dev->kobj.parent = &parent_class->subsys.kset.kobj; class_dev->kobj.parent = &parent_class->subsys.kobj;
error = kobject_add(&class_dev->kobj); error = kobject_add(&class_dev->kobj);
if (error) if (error)
@ -619,7 +617,7 @@ int class_device_add(struct class_device *class_dev)
/* add the needed attributes to this device */ /* add the needed attributes to this device */
error = sysfs_create_link(&class_dev->kobj, error = sysfs_create_link(&class_dev->kobj,
&parent_class->subsys.kset.kobj, "subsystem"); &parent_class->subsys.kobj, "subsystem");
if (error) if (error)
goto out3; goto out3;
class_dev->uevent_attr.attr.name = "uevent"; class_dev->uevent_attr.attr.name = "uevent";
@ -917,8 +915,8 @@ int __init classes_init(void)
/* ick, this is ugly, the things we go through to keep from showing up /* ick, this is ugly, the things we go through to keep from showing up
* in sysfs... */ * in sysfs... */
subsystem_init(&class_obj_subsys); subsystem_init(&class_obj_subsys);
if (!class_obj_subsys.kset.subsys) if (!class_obj_subsys.kobj.parent)
class_obj_subsys.kset.subsys = &class_obj_subsys; class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
return 0; return 0;
} }

View File

@ -252,7 +252,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
struct kobject *top_kobj; struct kobject *top_kobj;
struct kset *kset; struct kset *kset;
char *envp[32]; char *envp[32];
char data[PAGE_SIZE]; char *data = NULL;
char *pos; char *pos;
int i; int i;
size_t count = 0; size_t count = 0;
@ -276,6 +276,10 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
if (!kset->uevent_ops->filter(kset, &dev->kobj)) if (!kset->uevent_ops->filter(kset, &dev->kobj))
goto out; goto out;
data = (char *)get_zeroed_page(GFP_KERNEL);
if (!data)
return -ENOMEM;
/* let the kset specific function add its keys */ /* let the kset specific function add its keys */
pos = data; pos = data;
retval = kset->uevent_ops->uevent(kset, &dev->kobj, retval = kset->uevent_ops->uevent(kset, &dev->kobj,
@ -290,6 +294,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
count += sprintf(pos, "%s\n", envp[i]); count += sprintf(pos, "%s\n", envp[i]);
} }
out: out:
free_page((unsigned long)data);
return count; return count;
} }
@ -560,7 +565,7 @@ static struct kobject * get_device_parent(struct device *dev,
/* Set the parent to the class, not the parent device */ /* Set the parent to the class, not the parent device */
/* this keeps sysfs from having a symlink to make old udevs happy */ /* this keeps sysfs from having a symlink to make old udevs happy */
if (dev->class) if (dev->class)
return &dev->class->subsys.kset.kobj; return &dev->class->subsys.kobj;
else if (parent) else if (parent)
return &parent->kobj; return &parent->kobj;
@ -572,7 +577,7 @@ static struct kobject *virtual_device_parent(struct device *dev)
static struct kobject *virtual_dir = NULL; static struct kobject *virtual_dir = NULL;
if (!virtual_dir) if (!virtual_dir)
virtual_dir = kobject_add_dir(&devices_subsys.kset.kobj, "virtual"); virtual_dir = kobject_add_dir(&devices_subsys.kobj, "virtual");
return virtual_dir; return virtual_dir;
} }
@ -706,12 +711,12 @@ int device_add(struct device *dev)
} }
if (dev->class) { if (dev->class) {
sysfs_create_link(&dev->kobj, &dev->class->subsys.kset.kobj, sysfs_create_link(&dev->kobj, &dev->class->subsys.kobj,
"subsystem"); "subsystem");
/* If this is not a "fake" compatible device, then create the /* If this is not a "fake" compatible device, then create the
* symlink from the class to the device. */ * symlink from the class to the device. */
if (dev->kobj.parent != &dev->class->subsys.kset.kobj) if (dev->kobj.parent != &dev->class->subsys.kobj)
sysfs_create_link(&dev->class->subsys.kset.kobj, sysfs_create_link(&dev->class->subsys.kobj,
&dev->kobj, dev->bus_id); &dev->kobj, dev->bus_id);
if (parent) { if (parent) {
sysfs_create_link(&dev->kobj, &dev->parent->kobj, sysfs_create_link(&dev->kobj, &dev->parent->kobj,
@ -769,8 +774,8 @@ int device_add(struct device *dev)
sysfs_remove_link(&dev->kobj, "subsystem"); sysfs_remove_link(&dev->kobj, "subsystem");
/* If this is not a "fake" compatible device, remove the /* If this is not a "fake" compatible device, remove the
* symlink from the class to the device. */ * symlink from the class to the device. */
if (dev->kobj.parent != &dev->class->subsys.kset.kobj) if (dev->kobj.parent != &dev->class->subsys.kobj)
sysfs_remove_link(&dev->class->subsys.kset.kobj, sysfs_remove_link(&dev->class->subsys.kobj,
dev->bus_id); dev->bus_id);
if (parent) { if (parent) {
#ifdef CONFIG_SYSFS_DEPRECATED #ifdef CONFIG_SYSFS_DEPRECATED
@ -870,8 +875,8 @@ void device_del(struct device * dev)
sysfs_remove_link(&dev->kobj, "subsystem"); sysfs_remove_link(&dev->kobj, "subsystem");
/* If this is not a "fake" compatible device, remove the /* If this is not a "fake" compatible device, remove the
* symlink from the class to the device. */ * symlink from the class to the device. */
if (dev->kobj.parent != &dev->class->subsys.kset.kobj) if (dev->kobj.parent != &dev->class->subsys.kobj)
sysfs_remove_link(&dev->class->subsys.kset.kobj, sysfs_remove_link(&dev->class->subsys.kobj,
dev->bus_id); dev->bus_id);
if (parent) { if (parent) {
#ifdef CONFIG_SYSFS_DEPRECATED #ifdef CONFIG_SYSFS_DEPRECATED
@ -1187,9 +1192,9 @@ int device_rename(struct device *dev, char *new_name)
#endif #endif
if (dev->class) { if (dev->class) {
sysfs_remove_link(&dev->class->subsys.kset.kobj, sysfs_remove_link(&dev->class->subsys.kobj,
old_symlink_name); old_symlink_name);
sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
dev->bus_id); dev->bus_id);
} }
put_device(dev); put_device(dev);

View File

@ -17,13 +17,13 @@
static decl_subsys(firmware, NULL, NULL); static decl_subsys(firmware, NULL, NULL);
int firmware_register(struct subsystem * s) int firmware_register(struct kset *s)
{ {
kset_set_kset_s(s, firmware_subsys); kobj_set_kset_s(s, firmware_subsys);
return subsystem_register(s); return subsystem_register(s);
} }
void firmware_unregister(struct subsystem * s) void firmware_unregister(struct kset *s)
{ {
subsystem_unregister(s); subsystem_unregister(s);
} }

View File

@ -292,20 +292,22 @@ EXPORT_SYMBOL_GPL(platform_device_add);
* @pdev: platform device we're removing * @pdev: platform device we're removing
* *
* Note that this function will also release all memory- and port-based * Note that this function will also release all memory- and port-based
* resources owned by the device (@dev->resource). * resources owned by the device (@dev->resource). This function
* must _only_ be externally called in error cases. All other usage
* is a bug.
*/ */
void platform_device_del(struct platform_device *pdev) void platform_device_del(struct platform_device *pdev)
{ {
int i; int i;
if (pdev) { if (pdev) {
device_del(&pdev->dev);
for (i = 0; i < pdev->num_resources; i++) { for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i]; struct resource *r = &pdev->resource[i];
if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO)) if (r->flags & (IORESOURCE_MEM|IORESOURCE_IO))
release_resource(r); release_resource(r);
} }
device_del(&pdev->dev);
} }
} }
EXPORT_SYMBOL_GPL(platform_device_del); EXPORT_SYMBOL_GPL(platform_device_del);

View File

@ -16,8 +16,6 @@
#define to_dev(node) container_of(node, struct device, kobj.entry) #define to_dev(node) container_of(node, struct device, kobj.entry)
extern struct subsystem devices_subsys;
/** /**
* We handle system devices differently - we suspend and shut them * We handle system devices differently - we suspend and shut them
@ -36,7 +34,7 @@ void device_shutdown(void)
{ {
struct device * dev, *devn; struct device * dev, *devn;
list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.kset.list, list_for_each_entry_safe_reverse(dev, devn, &devices_subsys.list,
kobj.entry) { kobj.entry) {
if (dev->bus && dev->bus->shutdown) { if (dev->bus && dev->bus->shutdown) {
dev_dbg(dev, "shutdown\n"); dev_dbg(dev, "shutdown\n");

View File

@ -25,7 +25,7 @@
#include "base.h" #include "base.h"
extern struct subsystem devices_subsys; extern struct kset devices_subsys;
#define to_sysdev(k) container_of(k, struct sys_device, kobj) #define to_sysdev(k) container_of(k, struct sys_device, kobj)
#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr) #define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr)
@ -138,7 +138,7 @@ int sysdev_class_register(struct sysdev_class * cls)
pr_debug("Registering sysdev class '%s'\n", pr_debug("Registering sysdev class '%s'\n",
kobject_name(&cls->kset.kobj)); kobject_name(&cls->kset.kobj));
INIT_LIST_HEAD(&cls->drivers); INIT_LIST_HEAD(&cls->drivers);
cls->kset.subsys = &system_subsys; cls->kset.kobj.parent = &system_subsys.kobj;
kset_set_kset_s(cls, system_subsys); kset_set_kset_s(cls, system_subsys);
return kset_register(&cls->kset); return kset_register(&cls->kset);
} }
@ -309,7 +309,7 @@ void sysdev_shutdown(void)
pr_debug("Shutting Down System Devices\n"); pr_debug("Shutting Down System Devices\n");
down(&sysdev_drivers_lock); down(&sysdev_drivers_lock);
list_for_each_entry_reverse(cls, &system_subsys.kset.list, list_for_each_entry_reverse(cls, &system_subsys.list,
kset.kobj.entry) { kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device * sysdev;
@ -384,7 +384,7 @@ int sysdev_suspend(pm_message_t state)
pr_debug("Suspending System Devices\n"); pr_debug("Suspending System Devices\n");
list_for_each_entry_reverse(cls, &system_subsys.kset.list, list_for_each_entry_reverse(cls, &system_subsys.list,
kset.kobj.entry) { kset.kobj.entry) {
pr_debug("Suspending type '%s':\n", pr_debug("Suspending type '%s':\n",
@ -457,7 +457,7 @@ gbl_driver:
} }
/* resume other classes */ /* resume other classes */
list_for_each_entry_continue(cls, &system_subsys.kset.list, list_for_each_entry_continue(cls, &system_subsys.list,
kset.kobj.entry) { kset.kobj.entry) {
list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) { list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) {
pr_debug(" %s\n", kobject_name(&err_dev->kobj)); pr_debug(" %s\n", kobject_name(&err_dev->kobj));
@ -483,7 +483,7 @@ int sysdev_resume(void)
pr_debug("Resuming System Devices\n"); pr_debug("Resuming System Devices\n");
list_for_each_entry(cls, &system_subsys.kset.list, kset.kobj.entry) { list_for_each_entry(cls, &system_subsys.list, kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device * sysdev;
pr_debug("Resuming type '%s':\n", pr_debug("Resuming type '%s':\n",
@ -501,7 +501,7 @@ int sysdev_resume(void)
int __init system_bus_init(void) int __init system_bus_init(void)
{ {
system_subsys.kset.kobj.parent = &devices_subsys.kset.kobj; system_subsys.kobj.parent = &devices_subsys.kobj;
return subsystem_register(&system_subsys); return subsystem_register(&system_subsys);
} }

View File

@ -409,7 +409,7 @@ static struct kobj_type ktype_efivar = {
}; };
static ssize_t static ssize_t
dummy(struct subsystem *sub, char *buf) dummy(struct kset *kset, char *buf)
{ {
return -ENODEV; return -ENODEV;
} }
@ -422,7 +422,7 @@ efivar_unregister(struct efivar_entry *var)
static ssize_t static ssize_t
efivar_create(struct subsystem *sub, const char *buf, size_t count) efivar_create(struct kset *kset, const char *buf, size_t count)
{ {
struct efi_variable *new_var = (struct efi_variable *)buf; struct efi_variable *new_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar, *n; struct efivar_entry *search_efivar, *n;
@ -480,7 +480,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
} }
static ssize_t static ssize_t
efivar_delete(struct subsystem *sub, const char *buf, size_t count) efivar_delete(struct kset *kset, const char *buf, size_t count)
{ {
struct efi_variable *del_var = (struct efi_variable *)buf; struct efi_variable *del_var = (struct efi_variable *)buf;
struct efivar_entry *search_efivar, *n; struct efivar_entry *search_efivar, *n;
@ -551,11 +551,11 @@ static struct subsys_attribute *var_subsys_attrs[] = {
* the efivars driver * the efivars driver
*/ */
static ssize_t static ssize_t
systab_read(struct subsystem *entry, char *buf) systab_read(struct kset *kset, char *buf)
{ {
char *str = buf; char *str = buf;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
if (efi.mps != EFI_INVALID_TABLE_ADDR) if (efi.mps != EFI_INVALID_TABLE_ADDR)
@ -687,7 +687,7 @@ efivars_init(void)
goto out_free; goto out_free;
} }
kset_set_kset_s(&vars_subsys, efi_subsys); kobj_set_kset_s(&vars_subsys, efi_subsys);
error = subsystem_register(&vars_subsys); error = subsystem_register(&vars_subsys);

View File

@ -650,7 +650,7 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct
dev->cdev.dev, evdev->name); dev->cdev.dev, evdev->name);
/* temporary symlink to keep userspace happy */ /* temporary symlink to keep userspace happy */
sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
evdev->name); evdev->name);
return &evdev->handle; return &evdev->handle;
@ -661,7 +661,7 @@ static void evdev_disconnect(struct input_handle *handle)
struct evdev *evdev = handle->private; struct evdev *evdev = handle->private;
struct evdev_list *list; struct evdev_list *list;
sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name); sysfs_remove_link(&input_class.subsys.kobj, evdev->name);
class_device_destroy(&input_class, class_device_destroy(&input_class,
MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
evdev->exist = 0; evdev->exist = 0;

View File

@ -539,7 +539,7 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
dev->cdev.dev, joydev->name); dev->cdev.dev, joydev->name);
/* temporary symlink to keep userspace happy */ /* temporary symlink to keep userspace happy */
sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
joydev->name); joydev->name);
return &joydev->handle; return &joydev->handle;
@ -550,7 +550,7 @@ static void joydev_disconnect(struct input_handle *handle)
struct joydev *joydev = handle->private; struct joydev *joydev = handle->private;
struct joydev_list *list; struct joydev_list *list;
sysfs_remove_link(&input_class.subsys.kset.kobj, joydev->name); sysfs_remove_link(&input_class.subsys.kobj, joydev->name);
class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
joydev->exist = 0; joydev->exist = 0;

View File

@ -661,7 +661,7 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru
dev->cdev.dev, mousedev->name); dev->cdev.dev, mousedev->name);
/* temporary symlink to keep userspace happy */ /* temporary symlink to keep userspace happy */
sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
mousedev->name); mousedev->name);
return &mousedev->handle; return &mousedev->handle;
@ -672,7 +672,7 @@ static void mousedev_disconnect(struct input_handle *handle)
struct mousedev *mousedev = handle->private; struct mousedev *mousedev = handle->private;
struct mousedev_list *list; struct mousedev_list *list;
sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); sysfs_remove_link(&input_class.subsys.kobj, mousedev->name);
class_device_destroy(&input_class, class_device_destroy(&input_class,
MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
mousedev->exist = 0; mousedev->exist = 0;

View File

@ -420,7 +420,7 @@ static struct input_handle *tsdev_connect(struct input_handler *handler,
dev->cdev.dev, tsdev->name); dev->cdev.dev, tsdev->name);
/* temporary symlink to keep userspace happy */ /* temporary symlink to keep userspace happy */
sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, sysfs_create_link(&input_class.subsys.kobj, &cdev->kobj,
tsdev->name); tsdev->name);
return &tsdev->handle; return &tsdev->handle;
@ -431,7 +431,7 @@ static void tsdev_disconnect(struct input_handle *handle)
struct tsdev *tsdev = handle->private; struct tsdev *tsdev = handle->private;
struct tsdev_list *list; struct tsdev_list *list;
sysfs_remove_link(&input_class.subsys.kset.kobj, tsdev->name); sysfs_remove_link(&input_class.subsys.kobj, tsdev->name);
class_device_destroy(&input_class, class_device_destroy(&input_class,
MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
tsdev->exist = 0; tsdev->exist = 0;

View File

@ -520,15 +520,15 @@ static struct pdcspath_entry *pdcspath_entries[] = {
/** /**
* pdcs_size_read - Stable Storage size output. * pdcs_size_read - Stable Storage size output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
*/ */
static ssize_t static ssize_t
pdcs_size_read(struct subsystem *entry, char *buf) pdcs_size_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
/* show the size of the stable storage */ /* show the size of the stable storage */
@ -539,17 +539,17 @@ pdcs_size_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_auto_read - Stable Storage autoboot/search flag output. * pdcs_auto_read - Stable Storage autoboot/search flag output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
*/ */
static ssize_t static ssize_t
pdcs_auto_read(struct subsystem *entry, char *buf, int knob) pdcs_auto_read(struct kset *kset, char *buf, int knob)
{ {
char *out = buf; char *out = buf;
struct pdcspath_entry *pathentry; struct pdcspath_entry *pathentry;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
/* Current flags are stored in primary boot path entry */ /* Current flags are stored in primary boot path entry */
@ -565,40 +565,40 @@ pdcs_auto_read(struct subsystem *entry, char *buf, int knob)
/** /**
* pdcs_autoboot_read - Stable Storage autoboot flag output. * pdcs_autoboot_read - Stable Storage autoboot flag output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
*/ */
static inline ssize_t static inline ssize_t
pdcs_autoboot_read(struct subsystem *entry, char *buf) pdcs_autoboot_read(struct kset *kset, char *buf)
{ {
return pdcs_auto_read(entry, buf, PF_AUTOBOOT); return pdcs_auto_read(kset, buf, PF_AUTOBOOT);
} }
/** /**
* pdcs_autosearch_read - Stable Storage autoboot flag output. * pdcs_autosearch_read - Stable Storage autoboot flag output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
*/ */
static inline ssize_t static inline ssize_t
pdcs_autosearch_read(struct subsystem *entry, char *buf) pdcs_autosearch_read(struct kset *kset, char *buf)
{ {
return pdcs_auto_read(entry, buf, PF_AUTOSEARCH); return pdcs_auto_read(kset, buf, PF_AUTOSEARCH);
} }
/** /**
* pdcs_timer_read - Stable Storage timer count output (in seconds). * pdcs_timer_read - Stable Storage timer count output (in seconds).
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* *
* The value of the timer field correponds to a number of seconds in powers of 2. * The value of the timer field correponds to a number of seconds in powers of 2.
*/ */
static ssize_t static ssize_t
pdcs_timer_read(struct subsystem *entry, char *buf) pdcs_timer_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
struct pdcspath_entry *pathentry; struct pdcspath_entry *pathentry;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
/* Current flags are stored in primary boot path entry */ /* Current flags are stored in primary boot path entry */
@ -615,15 +615,15 @@ pdcs_timer_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_osid_read - Stable Storage OS ID register output. * pdcs_osid_read - Stable Storage OS ID register output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
*/ */
static ssize_t static ssize_t
pdcs_osid_read(struct subsystem *entry, char *buf) pdcs_osid_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
out += sprintf(out, "%s dependent data (0x%.4x)\n", out += sprintf(out, "%s dependent data (0x%.4x)\n",
@ -634,18 +634,18 @@ pdcs_osid_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* *
* This can hold 16 bytes of OS-Dependent data. * This can hold 16 bytes of OS-Dependent data.
*/ */
static ssize_t static ssize_t
pdcs_osdep1_read(struct subsystem *entry, char *buf) pdcs_osdep1_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
u32 result[4]; u32 result[4];
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK)
@ -661,18 +661,18 @@ pdcs_osdep1_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_diagnostic_read - Stable Storage Diagnostic register output. * pdcs_diagnostic_read - Stable Storage Diagnostic register output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* *
* I have NFC how to interpret the content of that register ;-). * I have NFC how to interpret the content of that register ;-).
*/ */
static ssize_t static ssize_t
pdcs_diagnostic_read(struct subsystem *entry, char *buf) pdcs_diagnostic_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
u32 result; u32 result;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
/* get diagnostic */ /* get diagnostic */
@ -686,18 +686,18 @@ pdcs_diagnostic_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_fastsize_read - Stable Storage FastSize register output. * pdcs_fastsize_read - Stable Storage FastSize register output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* *
* This register holds the amount of system RAM to be tested during boot sequence. * This register holds the amount of system RAM to be tested during boot sequence.
*/ */
static ssize_t static ssize_t
pdcs_fastsize_read(struct subsystem *entry, char *buf) pdcs_fastsize_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
u32 result; u32 result;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
/* get fast-size */ /* get fast-size */
@ -715,13 +715,13 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The output buffer to write to. * @buf: The output buffer to write to.
* *
* This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available.
*/ */
static ssize_t static ssize_t
pdcs_osdep2_read(struct subsystem *entry, char *buf) pdcs_osdep2_read(struct kset *kset, char *buf)
{ {
char *out = buf; char *out = buf;
unsigned long size; unsigned long size;
@ -733,7 +733,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
size = pdcs_size - 224; size = pdcs_size - 224;
if (!entry || !buf) if (!kset || !buf)
return -EINVAL; return -EINVAL;
for (i=0; i<size; i+=4) { for (i=0; i<size; i+=4) {
@ -748,7 +748,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
/** /**
* pdcs_auto_write - This function handles autoboot/search flag modifying. * pdcs_auto_write - This function handles autoboot/search flag modifying.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The input buffer to read from. * @buf: The input buffer to read from.
* @count: The number of bytes to be read. * @count: The number of bytes to be read.
* @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag
@ -758,7 +758,7 @@ pdcs_osdep2_read(struct subsystem *entry, char *buf)
* \"n\" (n == 0 or 1) to toggle AutoBoot Off or On * \"n\" (n == 0 or 1) to toggle AutoBoot Off or On
*/ */
static ssize_t static ssize_t
pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob) pdcs_auto_write(struct kset *kset, const char *buf, size_t count, int knob)
{ {
struct pdcspath_entry *pathentry; struct pdcspath_entry *pathentry;
unsigned char flags; unsigned char flags;
@ -768,7 +768,7 @@ pdcs_auto_write(struct subsystem *entry, const char *buf, size_t count, int knob
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (!entry || !buf || !count) if (!kset || !buf || !count)
return -EINVAL; return -EINVAL;
/* We'll use a local copy of buf */ /* We'll use a local copy of buf */
@ -823,7 +823,7 @@ parse_error:
/** /**
* pdcs_autoboot_write - This function handles autoboot flag modifying. * pdcs_autoboot_write - This function handles autoboot flag modifying.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The input buffer to read from. * @buf: The input buffer to read from.
* @count: The number of bytes to be read. * @count: The number of bytes to be read.
* *
@ -832,14 +832,14 @@ parse_error:
* \"n\" (n == 0 or 1) to toggle AutoSearch Off or On * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
*/ */
static inline ssize_t static inline ssize_t
pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count) pdcs_autoboot_write(struct kset *kset, const char *buf, size_t count)
{ {
return pdcs_auto_write(entry, buf, count, PF_AUTOBOOT); return pdcs_auto_write(kset, buf, count, PF_AUTOBOOT);
} }
/** /**
* pdcs_autosearch_write - This function handles autosearch flag modifying. * pdcs_autosearch_write - This function handles autosearch flag modifying.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The input buffer to read from. * @buf: The input buffer to read from.
* @count: The number of bytes to be read. * @count: The number of bytes to be read.
* *
@ -848,14 +848,14 @@ pdcs_autoboot_write(struct subsystem *entry, const char *buf, size_t count)
* \"n\" (n == 0 or 1) to toggle AutoSearch Off or On * \"n\" (n == 0 or 1) to toggle AutoSearch Off or On
*/ */
static inline ssize_t static inline ssize_t
pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count) pdcs_autosearch_write(struct kset *kset, const char *buf, size_t count)
{ {
return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH); return pdcs_auto_write(kset, buf, count, PF_AUTOSEARCH);
} }
/** /**
* pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The input buffer to read from. * @buf: The input buffer to read from.
* @count: The number of bytes to be read. * @count: The number of bytes to be read.
* *
@ -864,14 +864,14 @@ pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count)
* its input buffer. * its input buffer.
*/ */
static ssize_t static ssize_t
pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count) pdcs_osdep1_write(struct kset *kset, const char *buf, size_t count)
{ {
u8 in[16]; u8 in[16];
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (!entry || !buf || !count) if (!kset || !buf || !count)
return -EINVAL; return -EINVAL;
if (unlikely(pdcs_osid != OS_ID_LINUX)) if (unlikely(pdcs_osid != OS_ID_LINUX))
@ -892,7 +892,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
/** /**
* pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input.
* @entry: An allocated and populated subsytem struct. We don't use it tho. * @kset: An allocated and populated struct kset. We don't use it tho.
* @buf: The input buffer to read from. * @buf: The input buffer to read from.
* @count: The number of bytes to be read. * @count: The number of bytes to be read.
* *
@ -901,7 +901,7 @@ pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count)
* constructing its input buffer. * constructing its input buffer.
*/ */
static ssize_t static ssize_t
pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) pdcs_osdep2_write(struct kset *kset, const char *buf, size_t count)
{ {
unsigned long size; unsigned long size;
unsigned short i; unsigned short i;
@ -910,7 +910,7 @@ pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (!entry || !buf || !count) if (!kset || !buf || !count)
return -EINVAL; return -EINVAL;
if (unlikely(pdcs_size <= 224)) if (unlikely(pdcs_size <= 224))

View File

@ -424,7 +424,7 @@ static int __init ibm_acpiphp_init(void)
int retval = 0; int retval = 0;
acpi_status status; acpi_status status;
struct acpi_device *device; struct acpi_device *device;
struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
dbg("%s\n", __FUNCTION__); dbg("%s\n", __FUNCTION__);
@ -471,7 +471,7 @@ init_return:
static void __exit ibm_acpiphp_exit(void) static void __exit ibm_acpiphp_exit(void)
{ {
acpi_status status; acpi_status status;
struct kobject *sysdir = &pci_hotplug_slots_subsys.kset.kobj; struct kobject *sysdir = &pci_hotplug_slots_subsys.kobj;
dbg("%s\n", __FUNCTION__); dbg("%s\n", __FUNCTION__);

View File

@ -62,7 +62,7 @@ static int debug;
static LIST_HEAD(pci_hotplug_slot_list); static LIST_HEAD(pci_hotplug_slot_list);
struct subsystem pci_hotplug_slots_subsys; struct kset pci_hotplug_slots_subsys;
static ssize_t hotplug_slot_attr_show(struct kobject *kobj, static ssize_t hotplug_slot_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf) struct attribute *attr, char *buf)
@ -764,7 +764,7 @@ static int __init pci_hotplug_init (void)
{ {
int result; int result;
kset_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys); kobj_set_kset_s(&pci_hotplug_slots_subsys, pci_bus_type.subsys);
result = subsystem_register(&pci_hotplug_slots_subsys); result = subsystem_register(&pci_hotplug_slots_subsys);
if (result) { if (result) {
err("Register subsys with error %d\n", result); err("Register subsys with error %d\n", result);

View File

@ -140,7 +140,7 @@ static int __init configfs_init(void)
if (!configfs_dir_cachep) if (!configfs_dir_cachep)
goto out; goto out;
kset_set_kset_s(&config_subsys, kernel_subsys); kobj_set_kset_s(&config_subsys, kernel_subsys);
err = subsystem_register(&config_subsys); err = subsystem_register(&config_subsys);
if (err) { if (err) {
kmem_cache_destroy(configfs_dir_cachep); kmem_cache_destroy(configfs_dir_cachep);

View File

@ -374,7 +374,7 @@ static int __init debugfs_init(void)
{ {
int retval; int retval;
kset_set_kset_s(&debug_subsys, kernel_subsys); kobj_set_kset_s(&debug_subsys, kernel_subsys);
retval = subsystem_register(&debug_subsys); retval = subsystem_register(&debug_subsys);
if (retval) if (retval)
return retval; return retval;

View File

@ -167,7 +167,6 @@ static struct kobj_type dlm_ktype = {
}; };
static struct kset dlm_kset = { static struct kset dlm_kset = {
.subsys = &kernel_subsys,
.kobj = {.name = "dlm",}, .kobj = {.name = "dlm",},
.ktype = &dlm_ktype, .ktype = &dlm_ktype,
}; };
@ -218,6 +217,7 @@ int dlm_lockspace_init(void)
INIT_LIST_HEAD(&lslist); INIT_LIST_HEAD(&lslist);
spin_lock_init(&lslist_lock); spin_lock_init(&lslist_lock);
kobj_set_kset_s(&dlm_kset, kernel_subsys);
error = kset_register(&dlm_kset); error = kset_register(&dlm_kset);
if (error) if (error)
printk("dlm_lockspace_init: cannot register kset %d\n", error); printk("dlm_lockspace_init: cannot register kset %d\n", error);

View File

@ -793,7 +793,7 @@ static int do_sysfs_registration(void)
"Unable to register ecryptfs sysfs subsystem\n"); "Unable to register ecryptfs sysfs subsystem\n");
goto out; goto out;
} }
rc = sysfs_create_file(&ecryptfs_subsys.kset.kobj, rc = sysfs_create_file(&ecryptfs_subsys.kobj,
&sysfs_attr_version.attr); &sysfs_attr_version.attr);
if (rc) { if (rc) {
printk(KERN_ERR printk(KERN_ERR
@ -801,12 +801,12 @@ static int do_sysfs_registration(void)
subsystem_unregister(&ecryptfs_subsys); subsystem_unregister(&ecryptfs_subsys);
goto out; goto out;
} }
rc = sysfs_create_file(&ecryptfs_subsys.kset.kobj, rc = sysfs_create_file(&ecryptfs_subsys.kobj,
&sysfs_attr_version_str.attr); &sysfs_attr_version_str.attr);
if (rc) { if (rc) {
printk(KERN_ERR printk(KERN_ERR
"Unable to create ecryptfs version_str attribute\n"); "Unable to create ecryptfs version_str attribute\n");
sysfs_remove_file(&ecryptfs_subsys.kset.kobj, sysfs_remove_file(&ecryptfs_subsys.kobj,
&sysfs_attr_version.attr); &sysfs_attr_version.attr);
subsystem_unregister(&ecryptfs_subsys); subsystem_unregister(&ecryptfs_subsys);
goto out; goto out;
@ -841,7 +841,7 @@ static int __init ecryptfs_init(void)
ecryptfs_free_kmem_caches(); ecryptfs_free_kmem_caches();
goto out; goto out;
} }
kset_set_kset_s(&ecryptfs_subsys, fs_subsys); kobj_set_kset_s(&ecryptfs_subsys, fs_subsys);
sysfs_attr_version.attr.owner = THIS_MODULE; sysfs_attr_version.attr.owner = THIS_MODULE;
sysfs_attr_version_str.attr.owner = THIS_MODULE; sysfs_attr_version_str.attr.owner = THIS_MODULE;
rc = do_sysfs_registration(); rc = do_sysfs_registration();
@ -862,9 +862,9 @@ out:
static void __exit ecryptfs_exit(void) static void __exit ecryptfs_exit(void)
{ {
sysfs_remove_file(&ecryptfs_subsys.kset.kobj, sysfs_remove_file(&ecryptfs_subsys.kobj,
&sysfs_attr_version.attr); &sysfs_attr_version.attr);
sysfs_remove_file(&ecryptfs_subsys.kset.kobj, sysfs_remove_file(&ecryptfs_subsys.kobj,
&sysfs_attr_version_str.attr); &sysfs_attr_version_str.attr);
subsystem_unregister(&ecryptfs_subsys); subsystem_unregister(&ecryptfs_subsys);
ecryptfs_release_messaging(ecryptfs_transport); ecryptfs_release_messaging(ecryptfs_transport);

View File

@ -731,12 +731,12 @@ static int fuse_sysfs_init(void)
{ {
int err; int err;
kset_set_kset_s(&fuse_subsys, fs_subsys); kobj_set_kset_s(&fuse_subsys, fs_subsys);
err = subsystem_register(&fuse_subsys); err = subsystem_register(&fuse_subsys);
if (err) if (err)
goto out_err; goto out_err;
kset_set_kset_s(&connections_subsys, fuse_subsys); kobj_set_kset_s(&connections_subsys, fuse_subsys);
err = subsystem_register(&connections_subsys); err = subsystem_register(&connections_subsys);
if (err) if (err)
goto out_fuse_unregister; goto out_fuse_unregister;

View File

@ -190,7 +190,6 @@ static struct kobj_type gdlm_ktype = {
}; };
static struct kset gdlm_kset = { static struct kset gdlm_kset = {
.subsys = &kernel_subsys,
.kobj = {.name = "lock_dlm",}, .kobj = {.name = "lock_dlm",},
.ktype = &gdlm_ktype, .ktype = &gdlm_ktype,
}; };
@ -225,6 +224,7 @@ int gdlm_sysfs_init(void)
{ {
int error; int error;
kobj_set_kset_s(&gdlm_kset, kernel_subsys);
error = kset_register(&gdlm_kset); error = kset_register(&gdlm_kset);
if (error) if (error)
printk("lock_dlm: cannot register kset %d\n", error); printk("lock_dlm: cannot register kset %d\n", error);

View File

@ -222,7 +222,6 @@ static struct kobj_type gfs2_ktype = {
}; };
static struct kset gfs2_kset = { static struct kset gfs2_kset = {
.subsys = &fs_subsys,
.kobj = {.name = "gfs2"}, .kobj = {.name = "gfs2"},
.ktype = &gfs2_ktype, .ktype = &gfs2_ktype,
}; };
@ -554,6 +553,7 @@ int gfs2_sys_init(void)
{ {
gfs2_sys_margs = NULL; gfs2_sys_margs = NULL;
spin_lock_init(&gfs2_sys_margs_lock); spin_lock_init(&gfs2_sys_margs_lock);
kobj_set_kset_s(&gfs2_kset, fs_subsys);
return kset_register(&gfs2_kset); return kset_register(&gfs2_kset);
} }

View File

@ -147,7 +147,7 @@ static struct kset mlog_kset = {
.kobj = {.name = "logmask", .ktype = &mlog_ktype}, .kobj = {.name = "logmask", .ktype = &mlog_ktype},
}; };
int mlog_sys_init(struct subsystem *o2cb_subsys) int mlog_sys_init(struct kset *o2cb_subsys)
{ {
int i = 0; int i = 0;
@ -157,7 +157,7 @@ int mlog_sys_init(struct subsystem *o2cb_subsys)
} }
mlog_attr_ptrs[i] = NULL; mlog_attr_ptrs[i] = NULL;
mlog_kset.subsys = o2cb_subsys; kobj_set_kset_s(&mlog_kset, o2cb_subsys);
return kset_register(&mlog_kset); return kset_register(&mlog_kset);
} }

View File

@ -278,7 +278,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
int mlog_sys_init(struct subsystem *o2cb_subsys); int mlog_sys_init(struct kset *o2cb_subsys);
void mlog_sys_shutdown(void); void mlog_sys_shutdown(void);
#endif /* O2CLUSTER_MASKLOG_H */ #endif /* O2CLUSTER_MASKLOG_H */

View File

@ -42,7 +42,6 @@ struct o2cb_attribute {
#define O2CB_ATTR(_name, _mode, _show, _store) \ #define O2CB_ATTR(_name, _mode, _show, _store) \
struct o2cb_attribute o2cb_attr_##_name = __ATTR(_name, _mode, _show, _store) struct o2cb_attribute o2cb_attr_##_name = __ATTR(_name, _mode, _show, _store)
#define to_o2cb_subsys(k) container_of(to_kset(k), struct subsystem, kset)
#define to_o2cb_attr(_attr) container_of(_attr, struct o2cb_attribute, attr) #define to_o2cb_attr(_attr) container_of(_attr, struct o2cb_attribute, attr)
static ssize_t o2cb_interface_revision_show(char *buf) static ssize_t o2cb_interface_revision_show(char *buf)
@ -79,7 +78,7 @@ static ssize_t
o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer) o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
{ {
struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr); struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
struct subsystem *sbs = to_o2cb_subsys(kobj); struct kset *sbs = to_kset(kobj);
BUG_ON(sbs != &o2cb_subsys); BUG_ON(sbs != &o2cb_subsys);
@ -93,7 +92,7 @@ o2cb_store(struct kobject * kobj, struct attribute * attr,
const char * buffer, size_t count) const char * buffer, size_t count)
{ {
struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr); struct o2cb_attribute *o2cb_attr = to_o2cb_attr(attr);
struct subsystem *sbs = to_o2cb_subsys(kobj); struct kset *sbs = to_kset(kobj);
BUG_ON(sbs != &o2cb_subsys); BUG_ON(sbs != &o2cb_subsys);
@ -112,7 +111,7 @@ int o2cb_sys_init(void)
{ {
int ret; int ret;
o2cb_subsys.kset.kobj.ktype = &o2cb_subsys_type; o2cb_subsys.kobj.ktype = &o2cb_subsys_type;
ret = subsystem_register(&o2cb_subsys); ret = subsystem_register(&o2cb_subsys);
if (ret) if (ret)
return ret; return ret;

View File

@ -312,7 +312,7 @@ static struct attribute * default_attrs[] = {
NULL, NULL,
}; };
extern struct subsystem block_subsys; extern struct kset block_subsys;
static void part_release(struct kobject *kobj) static void part_release(struct kobject *kobj)
{ {
@ -388,7 +388,7 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
kobject_add(&p->kobj); kobject_add(&p->kobj);
if (!disk->part_uevent_suppress) if (!disk->part_uevent_suppress)
kobject_uevent(&p->kobj, KOBJ_ADD); kobject_uevent(&p->kobj, KOBJ_ADD);
sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem"); sysfs_create_link(&p->kobj, &block_subsys.kobj, "subsystem");
if (flags & ADDPART_FLAG_WHOLEDISK) { if (flags & ADDPART_FLAG_WHOLEDISK) {
static struct attribute addpartattr = { static struct attribute addpartattr = {
.name = "whole_disk", .name = "whole_disk",
@ -444,7 +444,7 @@ static int disk_sysfs_symlinks(struct gendisk *disk)
goto err_out_dev_link; goto err_out_dev_link;
} }
err = sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, err = sysfs_create_link(&disk->kobj, &block_subsys.kobj,
"subsystem"); "subsystem");
if (err) if (err)
goto err_out_disk_name_lnk; goto err_out_disk_name_lnk;

View File

@ -59,7 +59,7 @@ read(struct file * file, char __user * userbuf, size_t count, loff_t * off)
if (copy_to_user(userbuf, buffer, count)) if (copy_to_user(userbuf, buffer, count))
return -EFAULT; return -EFAULT;
pr_debug("offs = %lld, *off = %lld, count = %d\n", offs, *off, count); pr_debug("offs = %lld, *off = %lld, count = %zd\n", offs, *off, count);
*off = offs + count; *off = offs + count;

View File

@ -13,7 +13,6 @@
#include "sysfs.h" #include "sysfs.h"
#define to_subsys(k) container_of(k,struct subsystem,kset.kobj)
#define to_sattr(a) container_of(a,struct subsys_attribute, attr) #define to_sattr(a) container_of(a,struct subsys_attribute, attr)
/* /*
@ -24,12 +23,12 @@
static ssize_t static ssize_t
subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page)
{ {
struct subsystem * s = to_subsys(kobj); struct kset *kset = to_kset(kobj);
struct subsys_attribute * sattr = to_sattr(attr); struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = -EIO; ssize_t ret = -EIO;
if (sattr->show) if (sattr->show)
ret = sattr->show(s,page); ret = sattr->show(kset, page);
return ret; return ret;
} }
@ -37,12 +36,12 @@ static ssize_t
subsys_attr_store(struct kobject * kobj, struct attribute * attr, subsys_attr_store(struct kobject * kobj, struct attribute * attr,
const char * page, size_t count) const char * page, size_t count)
{ {
struct subsystem * s = to_subsys(kobj); struct kset *kset = to_kset(kobj);
struct subsys_attribute * sattr = to_sattr(attr); struct subsys_attribute * sattr = to_sattr(attr);
ssize_t ret = -EIO; ssize_t ret = -EIO;
if (sattr->store) if (sattr->store)
ret = sattr->store(s,page,count); ret = sattr->store(kset, page, count);
return ret; return ret;
} }

View File

@ -316,7 +316,7 @@ struct acpi_bus_event {
u32 data; u32 data;
}; };
extern struct subsystem acpi_subsys; extern struct kset acpi_subsys;
/* /*
* External Functions * External Functions

View File

@ -53,7 +53,7 @@ struct bus_type {
const char * name; const char * name;
struct module * owner; struct module * owner;
struct subsystem subsys; struct kset subsys;
struct kset drivers; struct kset drivers;
struct kset devices; struct kset devices;
struct klist klist_devices; struct klist klist_devices;
@ -178,7 +178,7 @@ struct class {
const char * name; const char * name;
struct module * owner; struct module * owner;
struct subsystem subsys; struct kset subsys;
struct list_head children; struct list_head children;
struct list_head devices; struct list_head devices;
struct list_head interfaces; struct list_head interfaces;
@ -558,8 +558,8 @@ extern void device_shutdown(void);
/* drivers/base/firmware.c */ /* drivers/base/firmware.c */
extern int __must_check firmware_register(struct subsystem *); extern int __must_check firmware_register(struct kset *);
extern void firmware_unregister(struct subsystem *); extern void firmware_unregister(struct kset *);
/* debugging and troubleshooting/diagnostic helpers. */ /* debugging and troubleshooting/diagnostic helpers. */
extern const char *dev_driver_string(struct device *dev); extern const char *dev_driver_string(struct device *dev);

View File

@ -1416,7 +1416,7 @@ extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
extern int vfs_statfs(struct dentry *, struct kstatfs *); extern int vfs_statfs(struct dentry *, struct kstatfs *);
/* /sys/fs */ /* /sys/fs */
extern struct subsystem fs_subsys; extern struct kset fs_subsys;
#define FLOCK_VERIFY_READ 1 #define FLOCK_VERIFY_READ 1
#define FLOCK_VERIFY_WRITE 2 #define FLOCK_VERIFY_WRITE 2

View File

@ -124,7 +124,6 @@ struct kset_uevent_ops {
}; };
struct kset { struct kset {
struct subsystem * subsys;
struct kobj_type * ktype; struct kobj_type * ktype;
struct list_head list; struct list_head list;
spinlock_t list_lock; spinlock_t list_lock;
@ -171,32 +170,23 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
#define set_kset_name(str) .kset = { .kobj = { .name = str } } #define set_kset_name(str) .kset = { .kobj = { .name = str } }
struct subsystem {
struct kset kset;
};
#define decl_subsys(_name,_type,_uevent_ops) \ #define decl_subsys(_name,_type,_uevent_ops) \
struct subsystem _name##_subsys = { \ struct kset _name##_subsys = { \
.kset = { \
.kobj = { .name = __stringify(_name) }, \ .kobj = { .name = __stringify(_name) }, \
.ktype = _type, \ .ktype = _type, \
.uevent_ops =_uevent_ops, \ .uevent_ops =_uevent_ops, \
} \
} }
#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ #define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
struct subsystem _varname##_subsys = { \ struct kset _varname##_subsys = { \
.kset = { \
.kobj = { .name = __stringify(_name) }, \ .kobj = { .name = __stringify(_name) }, \
.ktype = _type, \ .ktype = _type, \
.uevent_ops =_uevent_ops, \ .uevent_ops =_uevent_ops, \
} \
} }
/* The global /sys/kernel/ subsystem for people to chain off of */ /* The global /sys/kernel/ subsystem for people to chain off of */
extern struct subsystem kernel_subsys; extern struct kset kernel_subsys;
/* The global /sys/hypervisor/ subsystem */ /* The global /sys/hypervisor/ subsystem */
extern struct subsystem hypervisor_subsys; extern struct kset hypervisor_subsys;
/** /**
* Helpers for setting the kset of registered objects. * Helpers for setting the kset of registered objects.
@ -214,7 +204,7 @@ extern struct subsystem hypervisor_subsys;
*/ */
#define kobj_set_kset_s(obj,subsys) \ #define kobj_set_kset_s(obj,subsys) \
(obj)->kobj.kset = &(subsys).kset (obj)->kobj.kset = &(subsys)
/** /**
* kset_set_kset_s(obj,subsys) - set kset for embedded kset. * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
@ -228,7 +218,7 @@ extern struct subsystem hypervisor_subsys;
*/ */
#define kset_set_kset_s(obj,subsys) \ #define kset_set_kset_s(obj,subsys) \
(obj)->kset.kobj.kset = &(subsys).kset (obj)->kset.kobj.kset = &(subsys)
/** /**
* subsys_set_kset(obj,subsys) - set kset for subsystem * subsys_set_kset(obj,subsys) - set kset for subsystem
@ -241,29 +231,31 @@ extern struct subsystem hypervisor_subsys;
*/ */
#define subsys_set_kset(obj,_subsys) \ #define subsys_set_kset(obj,_subsys) \
(obj)->subsys.kset.kobj.kset = &(_subsys).kset (obj)->subsys.kobj.kset = &(_subsys)
extern void subsystem_init(struct subsystem *); extern void subsystem_init(struct kset *);
extern int __must_check subsystem_register(struct subsystem *); extern int __must_check subsystem_register(struct kset *);
extern void subsystem_unregister(struct subsystem *); extern void subsystem_unregister(struct kset *);
static inline struct subsystem * subsys_get(struct subsystem * s) static inline struct kset *subsys_get(struct kset *s)
{ {
return s ? container_of(kset_get(&s->kset),struct subsystem,kset) : NULL; if (s)
return kset_get(s);
return NULL;
} }
static inline void subsys_put(struct subsystem * s) static inline void subsys_put(struct kset *s)
{ {
kset_put(&s->kset); kset_put(s);
} }
struct subsys_attribute { struct subsys_attribute {
struct attribute attr; struct attribute attr;
ssize_t (*show)(struct subsystem *, char *); ssize_t (*show)(struct kset *, char *);
ssize_t (*store)(struct subsystem *, const char *, size_t); ssize_t (*store)(struct kset *, const char *, size_t);
}; };
extern int __must_check subsys_create_file(struct subsystem * , extern int __must_check subsys_create_file(struct kset *,
struct subsys_attribute *); struct subsys_attribute *);
#if defined(CONFIG_HOTPLUG) #if defined(CONFIG_HOTPLUG)

View File

@ -568,7 +568,7 @@ struct device_driver;
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
struct module; struct module;
extern struct subsystem module_subsys; extern struct kset module_subsys;
int mod_sysfs_init(struct module *mod); int mod_sysfs_init(struct module *mod);
int mod_sysfs_setup(struct module *mod, int mod_sysfs_setup(struct module *mod,

View File

@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);
extern int pci_hp_deregister (struct hotplug_slot *slot); extern int pci_hp_deregister (struct hotplug_slot *slot);
extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
struct hotplug_slot_info *info); struct hotplug_slot_info *info);
extern struct subsystem pci_hotplug_slots_subsys; extern struct kset pci_hotplug_slots_subsys;
/* PCI Setting Record (Type 0) */ /* PCI Setting Record (Type 0) */
struct hpp_type0 { struct hpp_type0 {

View File

@ -24,18 +24,18 @@ static struct subsys_attribute _name##_attr = \
#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
/* current uevent sequence number */ /* current uevent sequence number */
static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page) static ssize_t uevent_seqnum_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum);
} }
KERNEL_ATTR_RO(uevent_seqnum); KERNEL_ATTR_RO(uevent_seqnum);
/* uevent helper program, used during early boo */ /* uevent helper program, used during early boo */
static ssize_t uevent_helper_show(struct subsystem *subsys, char *page) static ssize_t uevent_helper_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%s\n", uevent_helper); return sprintf(page, "%s\n", uevent_helper);
} }
static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count) static ssize_t uevent_helper_store(struct kset *kset, const char *page, size_t count)
{ {
if (count+1 > UEVENT_HELPER_PATH_LEN) if (count+1 > UEVENT_HELPER_PATH_LEN)
return -ENOENT; return -ENOENT;
@ -49,13 +49,13 @@ KERNEL_ATTR_RW(uevent_helper);
#endif #endif
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
static ssize_t kexec_loaded_show(struct subsystem *subsys, char *page) static ssize_t kexec_loaded_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%d\n", !!kexec_image); return sprintf(page, "%d\n", !!kexec_image);
} }
KERNEL_ATTR_RO(kexec_loaded); KERNEL_ATTR_RO(kexec_loaded);
static ssize_t kexec_crash_loaded_show(struct subsystem *subsys, char *page) static ssize_t kexec_crash_loaded_show(struct kset *kset, char *page)
{ {
return sprintf(page, "%d\n", !!kexec_crash_image); return sprintf(page, "%d\n", !!kexec_crash_image);
} }
@ -85,7 +85,7 @@ static int __init ksysfs_init(void)
{ {
int error = subsystem_register(&kernel_subsys); int error = subsystem_register(&kernel_subsys);
if (!error) if (!error)
error = sysfs_create_group(&kernel_subsys.kset.kobj, error = sysfs_create_group(&kernel_subsys.kobj,
&kernel_attr_group); &kernel_attr_group);
return error; return error;

View File

@ -45,6 +45,8 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <linux/license.h> #include <linux/license.h>
extern int module_sysfs_initialized;
#if 0 #if 0
#define DEBUGP printk #define DEBUGP printk
#else #else
@ -1117,8 +1119,8 @@ int mod_sysfs_init(struct module *mod)
{ {
int err; int err;
if (!module_subsys.kset.subsys) { if (!module_sysfs_initialized) {
printk(KERN_ERR "%s: module_subsys not initialized\n", printk(KERN_ERR "%s: module sysfs not initialized\n",
mod->name); mod->name);
err = -EINVAL; err = -EINVAL;
goto out; goto out;
@ -2385,7 +2387,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
struct kobject *mkobj; struct kobject *mkobj;
/* Lookup built-in module entry in /sys/modules */ /* Lookup built-in module entry in /sys/modules */
mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); mkobj = kset_find_obj(&module_subsys, drv->mod_name);
if (mkobj) { if (mkobj) {
mk = container_of(mkobj, struct module_kobject, kobj); mk = container_of(mkobj, struct module_kobject, kobj);
/* remember our module structure */ /* remember our module structure */

View File

@ -691,6 +691,7 @@ static struct kset_uevent_ops module_uevent_ops = {
}; };
decl_subsys(module, &module_ktype, &module_uevent_ops); decl_subsys(module, &module_ktype, &module_uevent_ops);
int module_sysfs_initialized;
static struct kobj_type module_ktype = { static struct kobj_type module_ktype = {
.sysfs_ops = &module_sysfs_ops, .sysfs_ops = &module_sysfs_ops,
@ -709,6 +710,7 @@ static int __init param_sysfs_init(void)
__FILE__, __LINE__, ret); __FILE__, __LINE__, ret);
return ret; return ret;
} }
module_sysfs_initialized = 1;
param_sysfs_builtin(); param_sysfs_builtin();

View File

@ -322,13 +322,13 @@ static const char * const pm_disk_modes[] = {
* supports it (as determined from pm_ops->pm_disk_mode). * supports it (as determined from pm_ops->pm_disk_mode).
*/ */
static ssize_t disk_show(struct subsystem * subsys, char * buf) static ssize_t disk_show(struct kset *kset, char *buf)
{ {
return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]); return sprintf(buf, "%s\n", pm_disk_modes[pm_disk_mode]);
} }
static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n) static ssize_t disk_store(struct kset *kset, const char *buf, size_t n)
{ {
int error = 0; int error = 0;
int i; int i;
@ -373,13 +373,13 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n)
power_attr(disk); power_attr(disk);
static ssize_t resume_show(struct subsystem * subsys, char *buf) static ssize_t resume_show(struct kset *kset, char *buf)
{ {
return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device), return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device),
MINOR(swsusp_resume_device)); MINOR(swsusp_resume_device));
} }
static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n) static ssize_t resume_store(struct kset *kset, const char *buf, size_t n)
{ {
unsigned int maj, min; unsigned int maj, min;
dev_t res; dev_t res;
@ -405,12 +405,12 @@ static ssize_t resume_store(struct subsystem *subsys, const char *buf, size_t n)
power_attr(resume); power_attr(resume);
static ssize_t image_size_show(struct subsystem * subsys, char *buf) static ssize_t image_size_show(struct kset *kset, char *buf)
{ {
return sprintf(buf, "%lu\n", image_size); return sprintf(buf, "%lu\n", image_size);
} }
static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n) static ssize_t image_size_store(struct kset *kset, const char *buf, size_t n)
{ {
unsigned long size; unsigned long size;
@ -439,7 +439,7 @@ static struct attribute_group attr_group = {
static int __init pm_disk_init(void) static int __init pm_disk_init(void)
{ {
return sysfs_create_group(&power_subsys.kset.kobj,&attr_group); return sysfs_create_group(&power_subsys.kobj, &attr_group);
} }
core_initcall(pm_disk_init); core_initcall(pm_disk_init);

View File

@ -285,7 +285,7 @@ decl_subsys(power,NULL,NULL);
* proper enumerated value, and initiates a suspend transition. * proper enumerated value, and initiates a suspend transition.
*/ */
static ssize_t state_show(struct subsystem * subsys, char * buf) static ssize_t state_show(struct kset *kset, char *buf)
{ {
int i; int i;
char * s = buf; char * s = buf;
@ -298,7 +298,7 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
return (s - buf); return (s - buf);
} }
static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n) static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
{ {
suspend_state_t state = PM_SUSPEND_STANDBY; suspend_state_t state = PM_SUSPEND_STANDBY;
const char * const *s; const char * const *s;
@ -325,13 +325,13 @@ power_attr(state);
#ifdef CONFIG_PM_TRACE #ifdef CONFIG_PM_TRACE
int pm_trace_enabled; int pm_trace_enabled;
static ssize_t pm_trace_show(struct subsystem * subsys, char * buf) static ssize_t pm_trace_show(struct kset *kset, char *buf)
{ {
return sprintf(buf, "%d\n", pm_trace_enabled); return sprintf(buf, "%d\n", pm_trace_enabled);
} }
static ssize_t static ssize_t
pm_trace_store(struct subsystem * subsys, const char * buf, size_t n) pm_trace_store(struct kset *kset, const char *buf, size_t n)
{ {
int val; int val;
@ -365,7 +365,7 @@ static int __init pm_init(void)
{ {
int error = subsystem_register(&power_subsys); int error = subsystem_register(&power_subsys);
if (!error) if (!error)
error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); error = sysfs_create_group(&power_subsys.kobj,&attr_group);
return error; return error;
} }

View File

@ -35,7 +35,7 @@ static struct subsys_attribute _name##_attr = { \
.store = _name##_store, \ .store = _name##_store, \
} }
extern struct subsystem power_subsys; extern struct kset power_subsys;
/* References to section boundaries */ /* References to section boundaries */
extern const void __nosave_begin, __nosave_end; extern const void __nosave_begin, __nosave_end;

View File

@ -582,22 +582,10 @@ void kset_init(struct kset * k)
/** /**
* kset_add - add a kset object to the hierarchy. * kset_add - add a kset object to the hierarchy.
* @k: kset. * @k: kset.
*
* Simply, this adds the kset's embedded kobject to the
* hierarchy.
* We also try to make sure that the kset's embedded kobject
* has a parent before it is added. We only care if the embedded
* kobject is not part of a kset itself, since kobject_add()
* assigns a parent in that case.
* If that is the case, and the kset has a controlling subsystem,
* then we set the kset's parent to be said subsystem.
*/ */
int kset_add(struct kset * k) int kset_add(struct kset * k)
{ {
if (!k->kobj.parent && !k->kobj.kset && k->subsys)
k->kobj.parent = &k->subsys->kset.kobj;
return kobject_add(&k->kobj); return kobject_add(&k->kobj);
} }
@ -656,53 +644,28 @@ struct kobject * kset_find_obj(struct kset * kset, const char * name)
return ret; return ret;
} }
void subsystem_init(struct kset *s)
void subsystem_init(struct subsystem * s)
{ {
kset_init(&s->kset); kset_init(s);
} }
/** int subsystem_register(struct kset *s)
* subsystem_register - register a subsystem.
* @s: the subsystem we're registering.
*
* Once we register the subsystem, we want to make sure that
* the kset points back to this subsystem.
*/
int subsystem_register(struct subsystem * s)
{ {
int error; return kset_register(s);
if (!s)
return -EINVAL;
subsystem_init(s);
pr_debug("subsystem %s: registering\n",s->kset.kobj.name);
if (!(error = kset_add(&s->kset))) {
if (!s->kset.subsys)
s->kset.subsys = s;
}
return error;
} }
void subsystem_unregister(struct subsystem * s) void subsystem_unregister(struct kset *s)
{ {
if (!s) kset_unregister(s);
return;
pr_debug("subsystem %s: unregistering\n",s->kset.kobj.name);
kset_unregister(&s->kset);
} }
/** /**
* subsystem_create_file - export sysfs attribute file. * subsystem_create_file - export sysfs attribute file.
* @s: subsystem. * @s: subsystem.
* @a: subsystem attribute descriptor. * @a: subsystem attribute descriptor.
*/ */
int subsys_create_file(struct subsystem * s, struct subsys_attribute * a) int subsys_create_file(struct kset *s, struct subsys_attribute *a)
{ {
int error = 0; int error = 0;
@ -710,28 +673,12 @@ int subsys_create_file(struct subsystem * s, struct subsys_attribute * a)
return -EINVAL; return -EINVAL;
if (subsys_get(s)) { if (subsys_get(s)) {
error = sysfs_create_file(&s->kset.kobj,&a->attr); error = sysfs_create_file(&s->kobj, &a->attr);
subsys_put(s); subsys_put(s);
} }
return error; return error;
} }
/**
* subsystem_remove_file - remove sysfs attribute file.
* @s: subsystem.
* @a: attribute desciptor.
*/
#if 0
void subsys_remove_file(struct subsystem * s, struct subsys_attribute * a)
{
if (subsys_get(s)) {
sysfs_remove_file(&s->kset.kobj,&a->attr);
subsys_put(s);
}
}
#endif /* 0 */
EXPORT_SYMBOL(kobject_init); EXPORT_SYMBOL(kobject_init);
EXPORT_SYMBOL(kobject_register); EXPORT_SYMBOL(kobject_register);
EXPORT_SYMBOL(kobject_unregister); EXPORT_SYMBOL(kobject_unregister);

View File

@ -321,7 +321,7 @@ static int __init securityfs_init(void)
{ {
int retval; int retval;
kset_set_kset_s(&security_subsys, kernel_subsys); kobj_set_kset_s(&security_subsys, kernel_subsys);
retval = subsystem_register(&security_subsys); retval = subsystem_register(&security_subsys);
if (retval) if (retval)
return retval; return retval;