From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Date: Thu, 15 Sep 2005 01:45:55 -0500 [thread overview]
Message-ID: <20050915064943.124653000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20050915064552.836273000.dtor_core@ameritech.net
Greg KH <gregkh@suse.de>,
Kay Sievers <kay.sievers@vrfy.org>,
Vojtech Pavlik <vojtech@suse.cz>,
Hannes Reinecke <hare@suse.de>
Subject: [patch 03/28] Driver core: allow nesting classes
Content-Disposition: inline; filename=nested-classes.patch
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Driver core: allow nesting classes
This will allow unclutter /sys/classes directory, combining
classes related to the same subsystem "under one roof".
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/base/class.c | 8 +++++++-
include/linux/device.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
Index: work/drivers/base/class.c
===================================================================
--- work.orig/drivers/base/class.c
+++ work/drivers/base/class.c
@@ -135,6 +135,7 @@ static void remove_class_attrs(struct cl
int class_register(struct class * cls)
{
+ struct class *parent;
int error;
pr_debug("device class '%s': registering\n", cls->name);
@@ -146,7 +147,11 @@ int class_register(struct class * cls)
if (error)
return error;
- subsys_set_kset(cls, class_subsys);
+ parent = class_get(cls->parent);
+ if (parent)
+ subsys_set_kset(cls, parent->subsys);
+ else
+ subsys_set_kset(cls, class_subsys);
error = subsystem_register(&cls->subsys);
if (!error) {
@@ -161,6 +166,7 @@ void class_unregister(struct class * cls
pr_debug("device class '%s': unregistering\n", cls->name);
remove_class_attrs(cls);
subsystem_unregister(&cls->subsys);
+ class_put(cls->parent);
}
static void class_create_release(struct class *cls)
Index: work/include/linux/device.h
===================================================================
--- work.orig/include/linux/device.h
+++ work/include/linux/device.h
@@ -157,6 +157,7 @@ struct class {
struct module * owner;
struct subsystem subsys;
+ struct class * parent;
struct list_head children;
struct list_head interfaces;
struct semaphore sem; /* locks both the children and interfaces lists */
next prev parent reply other threads:[~2005-09-15 6:54 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 6:45 Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov [this message]
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:45 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
2005-09-15 15:30 ` subject goes here? Chris White
2005-09-15 7:05 ` Dmitry Torokhov
2005-09-15 6:46 ` Dmitry Torokhov
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=20050915064943.124653000.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=akpm@osdl.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox