[PATCH] CLASS: move a "simple" class logic into the class core.
One step on improving the class api so that it can not be used incorrectly.
This also fixes the module owner issue with the dev files that happened when
the devt logic moved to the class core.
Based on a patch originally written by Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/include/linux/device.h b/include/linux/device.h
index fa9e6ca..73250d0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -143,6 +143,7 @@
*/
struct class {
const char * name;
+ struct module * owner;
struct subsystem subsys;
struct list_head children;
@@ -185,6 +186,7 @@
struct kobject kobj;
struct class * class; /* required */
dev_t devt; /* dev_t, creates the sysfs "dev" */
+ struct class_device_attribute *devt_attr;
struct device * dev; /* not necessary, but nice to have */
void * class_data; /* class-specific data */
@@ -245,6 +247,13 @@
extern int class_interface_register(struct class_interface *);
extern void class_interface_unregister(struct class_interface *);
+extern struct class *class_create(struct module *owner, char *name);
+extern void class_destroy(struct class *cls);
+extern struct class_device *class_device_create(struct class *cls, dev_t devt,
+ struct device *device, char *fmt, ...)
+ __attribute__((format(printf,4,5)));
+extern void class_device_destroy(struct class *cls, dev_t devt);
+
/* interface for class simple stuff */
extern struct class_simple *class_simple_create(struct module *owner, char *name);
extern void class_simple_destroy(struct class_simple *cs);