summaryrefslogtreecommitdiffstats
path: root/drivers/base/base.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-22 18:17:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 21:54:51 -0700
commit7c71448b8aa80123fc521563d5f7c63a099d97ab (patch)
tree2605e4ce90c6ee0201eae83dc9b612321564feb7 /drivers/base/base.h
parent16be63fd1670000b96b76cb55b6f1bead21b4c4b (diff)
downloadblackbird-op-linux-7c71448b8aa80123fc521563d5f7c63a099d97ab.tar.gz
blackbird-op-linux-7c71448b8aa80123fc521563d5f7c63a099d97ab.zip
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.h27
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 {
};
#define to_driver(obj) container_of(obj, struct driver_private, kobj)
+
+/**
+ * struct class_private - structure to hold the private to the driver core portions of the class structure.
+ *
+ * @subsys - the struct kset that defines this class. This is the main kobject
+ * @children - list of class_devices associated with this class
+ * @devices - list of devices associated with this class
+ * @interfaces - list of class_interfaces associated with this class
+ * @class_dirs -
+ * @sem - semaphore to protect the children, devices, and interfaces lists.
+ * @class - pointer back to the struct class that this structure is associated
+ * with.
+ *
+ * This structure is the one that is the actual kobject allowing struct
+ * class to be statically allocated safely. Nothing outside of the driver
+ * core should ever touch these fields.
+ */
+struct class_private {
+ struct kset subsys;
+ struct list_head devices;
+ struct list_head interfaces;
+ struct kset class_dirs;
+ struct semaphore sem;
+ struct class *class;
+};
+#define to_class(obj) container_of(obj, struct class_private, subsys.kobj)
+
/* initialisation functions */
extern int devices_init(void);
extern int buses_init(void);
OpenPOWER on IntegriCloud