From: "Thomas Maier" <balagi@justmail.de>
To: "Greg KH" <greg@kroah.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] class.c: added class_create_attrs() function
Date: Mon, 11 Sep 2006 22:07:23 +0200 [thread overview]
Message-ID: <op.tfqcrka5iudtyh@master> (raw)
In-Reply-To: <20060909213054.GC19188@kroah.com>
Hello,
this is a patch based on linux 2.6.18-rc6.
It adds a class_create_attrs() function in
drivers/base/class.c .
This new function works similar to class_create(),
but also allows to create the class attribute files
(if any) during class creation.
-Thomas Maier
diff -urpN linux-2.6.18-rc6/drivers/base/class.c patch/drivers/base/class.c
--- linux-2.6.18-rc6/drivers/base/class.c 2006-09-11 21:45:12.000000000 +0200
+++ patch/drivers/base/class.c 2006-09-11 21:52:06.000000000 +0200
@@ -199,6 +199,18 @@ static int class_device_create_uevent(st
*/
struct class *class_create(struct module *owner, char *name)
{
+ return class_create_attrs(owner, name, NULL);
+}
+/**
+ * class_create_attrs - similar to class_create(), but can also
+ * create class attribute files on class creation.
+ * @owner: pointer to the module that is to "own" this struct class
+ * @name: pointer to a string for the name of this class.
+ * @cls_attrs: pointer to a class_attribute array.
+ */
+struct class *class_create_attrs(struct module *owner, char *name,
+ struct class_attribute *cls_attrs)
+{
struct class *cls;
int retval;
@@ -212,6 +224,7 @@ struct class *class_create(struct module
cls->owner = owner;
cls->class_release = class_create_release;
cls->release = class_device_create_release;
+ cls->class_attrs = cls_attrs;
retval = class_register(cls);
if (retval)
@@ -900,6 +913,7 @@ EXPORT_SYMBOL_GPL(class_remove_file);
EXPORT_SYMBOL_GPL(class_register);
EXPORT_SYMBOL_GPL(class_unregister);
EXPORT_SYMBOL_GPL(class_create);
+EXPORT_SYMBOL_GPL(class_create_attrs);
EXPORT_SYMBOL_GPL(class_destroy);
EXPORT_SYMBOL_GPL(class_device_register);
diff -urpN linux-2.6.18-rc6/include/linux/device.h patch/include/linux/device.h
--- linux-2.6.18-rc6/include/linux/device.h 2006-09-11 21:53:10.000000000 +0200
+++ patch/include/linux/device.h 2006-09-11 21:54:21.000000000 +0200
@@ -272,6 +272,8 @@ extern int class_interface_register(stru
extern void class_interface_unregister(struct class_interface *);
extern struct class *class_create(struct module *owner, char *name);
+extern struct class *class_create_attrs(struct module *owner, char *name,
+ struct class_attribute *cls_attrs);
extern void class_destroy(struct class *cls);
extern struct class_device *class_device_create(struct class *cls,
struct class_device *parent,
prev parent reply other threads:[~2006-09-11 19:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-08 17:55 [PATCH] pktcdvd: added sysfs interface + bio write queue handling fix Thomas Maier
2006-09-08 18:53 ` Phillip Susi
2006-09-09 18:03 ` Thomas Maier
2006-09-08 21:00 ` Greg KH
2006-09-08 21:40 ` Phillip Susi
2006-09-08 22:01 ` Greg KH
2006-09-09 18:11 ` Thomas Maier
2006-09-09 21:30 ` Greg KH
2006-09-09 22:53 ` Kay Sievers
2006-09-10 19:33 ` Thomas Maier
2006-09-10 22:25 ` Kay Sievers
2006-09-10 19:27 ` Thomas Maier
2006-09-11 20:11 ` Thomas Maier
2006-09-11 20:07 ` Thomas Maier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.tfqcrka5iudtyh@master \
--to=balagi@justmail.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.