From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Some driver core and kobject minor patches
Date: Fri, 14 Sep 2007 13:25:19 +0200 [thread overview]
Message-ID: <20070914132519.587d7a35@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <20070913233751.GA10856@kroah.com>
On Thu, 13 Sep 2007 16:37:51 -0700,
Greg KH <greg@kroah.com> wrote:
> Kay pointed out to me the other day that we are dragging around 20 bytes
> in every struct kobject and in every struct device to contain a name
> string that can be dynamically allocated instead. For small device
> names (the majority), this savings can add up, especially with a lot of
> individual devices.
>
> So, I started out by getting rid of the static array in the kobject
> structure, as we already were dynamically allocating space if it was
> needed.
>
> Of course, this required a number of other minor cleanups through the
> code tree to handle places where we were incorrectly directly accessing
> the kobject name instead of using the "proper" function. I also got
> sidetracked by a few driver core and kobject.h cleanups of macros that
> are no longer needed, or functions that no longer need to be global
> (they were never exported, so we don't have to worry about that mess...)
>
> And I added a change to trigger a warning if we add an attribute to
> sysfs that we have already had created, to help the SCSI developers out
> with their driver model reworks.
>
> So, here's a series of 11 patches that I've added to my tree, and will
> send to Linus when 2.6.24 is opened up.
>
> Any review comments are appreciated. The full diffstat is below showing
> that overall, we did get rid of more code than was added.
Neat. We can get rid of even more stuff if we remove the removed
functions from the Documentation as well.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
Documentation/kobject.txt | 21 ++-------------------
1 files changed, 2 insertions(+), 19 deletions(-)
--- linux-2.6.orig/Documentation/kobject.txt
+++ linux-2.6/Documentation/kobject.txt
@@ -54,7 +54,6 @@ embedded in larger data structures and r
struct kobject {
const char * k_name;
- char name[KOBJ_NAME_LEN];
struct kref kref;
struct list_head entry;
struct kobject * parent;
@@ -223,18 +222,15 @@ decl_subsys(devices, &ktype_device, &dev
is equivalent to doing:
struct kset devices_subsys = {
- .kobj = {
- .name = "devices",
- },
.ktype = &ktype_devices,
.uevent_ops = &device_uevent_ops,
};
-
+kobject_set_name(&devices_subsys, name);
The objects that are registered with a subsystem that use the
subsystem's default list must have their kset ptr set properly. These
objects may have embedded kobjects or ksets. The
-following helpers make setting the kset easier:
+following helper makes setting the kset easier:
kobj_set_kset_s(obj,subsys)
@@ -242,22 +238,9 @@ kobj_set_kset_s(obj,subsys)
- Assumes that obj->kobj exists, and is a struct kobject.
- Sets the kset of that kobject to the kset <subsys>.
-
-kset_set_kset_s(obj,subsys)
-
-- Assumes that obj->kset exists, and is a struct kset.
-- Sets the kset of the embedded kobject to the kset <subsys>.
-
-subsys_set_kset(obj,subsys)
-
-- Assumes obj->subsys exists, and is a struct subsystem.
-- Sets obj->subsys.kset.kobj.kset to the subsystem's embedded kset.
-
void subsystem_init(struct kset *s);
int subsystem_register(struct kset *s);
void subsystem_unregister(struct kset *s);
-struct kset *subsys_get(struct kset *s);
-void kset_put(struct kset *s);
These are just wrappers around the respective kset_* functions.
prev parent reply other threads:[~2007-09-14 11:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-13 23:37 Greg KH
2007-09-13 23:38 ` Driver core: remove get_bus() Greg KH
2007-09-14 11:02 ` Cornelia Huck
2007-09-14 11:27 ` Greg KH
2007-09-13 23:39 ` Driver core: remove kset_set_kset_s Greg KH
2007-09-13 23:39 ` Driver core: remove put_bus() Greg KH
2007-09-14 11:03 ` Cornelia Huck
2007-09-13 23:40 ` Driver core: remove subsys_get() Greg KH
2007-09-13 23:40 ` Driver core: remove subsys_put() Greg KH
2007-09-13 23:40 ` Driver core: remove subsys_set_kset Greg KH
2007-09-13 23:41 ` sysfs: spit a warning to users when they try to create a duplicate sysfs file Greg KH
2007-09-14 12:06 ` Cornelia Huck
2007-09-16 20:39 ` Greg KH
2007-09-15 12:44 ` Stefan Richter
2007-09-13 23:42 ` Drivers: clean up direct setting of the name of a kset Greg KH
2007-09-13 23:42 ` [RFC] Some driver core and kobject minor patches Greg KH
2007-09-13 23:43 ` cdev: remove unneeded setting of cdev names Greg KH
2007-09-13 23:43 ` kobjects: fix up improper use of the kobject name field Greg KH
2007-09-13 23:44 ` kobject: remove the static array for the name Greg KH
2007-09-14 11:25 ` Cornelia Huck [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=20070914132519.587d7a35@gondolin.boeblingen.de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®