diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-22 18:17:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 00:54:51 -0400 |
commit | 7c71448b8aa80123fc521563d5f7c63a099d97ab (patch) | |
tree | 2605e4ce90c6ee0201eae83dc9b612321564feb7 /drivers/base/base.h | |
parent | 16be63fd1670000b96b76cb55b6f1bead21b4c4b (diff) |
class: move driver core specific parts to a private structure
This moves the portions of struct class that are dynamic (kobject and
lock and lists) out of the main structure and into a dynamic, private,
structure.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/base.h')
-rw-r--r-- | drivers/base/base.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index 2c9ae43e2219..0ec372a67762 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -36,6 +36,33 @@ struct driver_private { | |||
36 | }; | 36 | }; |
37 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) | 37 | #define to_driver(obj) container_of(obj, struct driver_private, kobj) |
38 | 38 | ||
39 | |||
40 | /** | ||
41 | * struct class_private - structure to hold the private to the driver core portions of the class structure. | ||
42 | * | ||
43 | * @subsys - the struct kset that defines this class. This is the main kobject | ||
44 | * @children - list of class_devices associated with this class | ||
45 | * @devices - list of devices associated with this class | ||
46 | * @interfaces - list of class_interfaces associated with this class | ||
47 | * @class_dirs - | ||
48 | * @sem - semaphore to protect the children, devices, and interfaces lists. | ||
49 | * @class - pointer back to the struct class that this structure is associated | ||
50 | * with. | ||
51 | * | ||
52 | * This structure is the one that is the actual kobject allowing struct | ||
53 | * class to be statically allocated safely. Nothing outside of the driver | ||
54 | * core should ever touch these fields. | ||
55 | */ | ||
56 | struct class_private { | ||
57 | struct kset subsys; | ||
58 | struct list_head devices; | ||
59 | struct list_head interfaces; | ||
60 | struct kset class_dirs; | ||
61 | struct semaphore sem; | ||
62 | struct class *class; | ||
63 | }; | ||
64 | #define to_class(obj) container_of(obj, struct class_private, subsys.kobj) | ||
65 | |||
39 | /* initialisation functions */ | 66 | /* initialisation functions */ |
40 | extern int devices_init(void); | 67 | extern int devices_init(void); |
41 | extern int buses_init(void); | 68 | extern int buses_init(void); |