summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@yahoo.com>2004-02-01 23:39:32 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2004-02-01 23:39:32 -0800
commit0eb9b18eb108a9d169084ee154155041f413e945 (patch)
tree4f1dc133fc8a756f4cf91a93c9b93078b85eb753
parentb1c76c1cb272f5dedf0264a58904b544c6ce56fb (diff)
[PATCH] Driver core: add hotplug support for class_simple
This is needed by the DRI code.
-rw-r--r--drivers/base/class_simple.c18
-rw-r--r--include/linux/device.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/base/class_simple.c b/drivers/base/class_simple.c
index bb29e34bd2e5..53548e0ed544 100644
--- a/drivers/base/class_simple.c
+++ b/drivers/base/class_simple.c
@@ -170,6 +170,24 @@ error:
EXPORT_SYMBOL(class_simple_device_add);
/**
+ * class_simple_set_hotplug - set the hotplug callback in the embedded struct class
+ * @cs: pointer to the struct class_simple to hold the pointer
+ * @hotplug: function pointer to the hotplug function
+ *
+ * Implement and set a hotplug function to add environment variables specific to this
+ * class on the hotplug event.
+ */
+int class_simple_set_hotplug(struct class_simple *cs,
+ int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size))
+{
+ if ((cs == NULL) || (IS_ERR(cs)))
+ return -ENODEV;
+ cs->class.hotplug = hotplug;
+ return 0;
+}
+EXPORT_SYMBOL(class_simple_set_hotplug);
+
+/**
* class_simple_device_remove - removes a class device that was created with class_simple_device_add()
* @dev: the dev_t of the device that was previously registered.
*
diff --git a/include/linux/device.h b/include/linux/device.h
index 367b21888ad4..c8f5aa7d9f5a 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -253,6 +253,8 @@ extern struct class_simple *class_simple_create(struct module *owner, char *name
extern void class_simple_destroy(struct class_simple *cs);
extern struct class_device *class_simple_device_add(struct class_simple *cs, dev_t dev, struct device *device, const char *fmt, ...)
__attribute__((format(printf,4,5)));
+extern int class_simple_set_hotplug(struct class_simple *,
+ int (*hotplug)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size));
extern void class_simple_device_remove(dev_t dev);