Kobject: auto-cleanup on final unref
We save the current state in the object itself, so we can do proper cleanup when the last reference is dropped. If the initial reference is dropped, the object will be removed from sysfs if needed, if an "add" event was sent, "remove" will be send, and the allocated resources are released. This allows us to clean up some driver core usage as well as allowing us to do other such changes to the rest of the kernel. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
12e339ac6e
commit
0f4dafc056
@@ -68,6 +68,11 @@ struct kobject {
|
||||
struct kset * kset;
|
||||
struct kobj_type * ktype;
|
||||
struct sysfs_dirent * sd;
|
||||
unsigned int state_initialized:1;
|
||||
unsigned int state_name_set:1;
|
||||
unsigned int state_in_sysfs:1;
|
||||
unsigned int state_add_uevent_sent:1;
|
||||
unsigned int state_remove_uevent_sent:1;
|
||||
};
|
||||
|
||||
extern int kobject_set_name(struct kobject *, const char *, ...)
|
||||
|
Reference in New Issue
Block a user