From: Kay Sievers <kay.sievers@vrfy.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Greg KH <greg@kroah.com>, Mark Lord <lkml@rtr.ca>,
NeilBrown <neilb@suse.de>, SL Baur <steve@xemacs.org>,
Tejun Heo <htejun@gmail.com>, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH try2] sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor
Date: Fri, 18 Apr 2008 22:53:54 +0200 [thread overview]
Message-ID: <1208552034.8589.16.camel@lov.site> (raw)
In-Reply-To: <1208547223.5083.17.camel@dwillia2-linux.ch.intel.com>
On Fri, 2008-04-18 at 12:33 -0700, Dan Williams wrote:
> --- a/Documentation/filesystems/sysfs.txt
> +++ b/Documentation/filesystems/sysfs.txt
> @@ -248,6 +248,7 @@ The top level sysfs directory looks like:
> block/
> bus/
> class/
> +dev/
> devices/
Lots of stuff in that file is pretty damn wrong, and at it should
probably just be deleted. Care to put this new documentation into:
Documentation/ABI/
> --- a/drivers/base/class.c
> +++ b/drivers/base/class.c
> @@ -134,6 +134,18 @@ static void remove_class_attrs(struct class *cls)
> }
> }
>
> +static void class_set_dev_kobj(struct class *class)
> +{
> +#ifdef CONFIG_BLOCK
> + if (class == &block_class) {
> + class->dev_kobj = block_kobj;
> + return;
> + }
> +#endif
> +
> + class->dev_kobj = char_kobj;
> +}
> +
If you do:
struct class block_class = {
.name = "block",
.dev_kobj = block_kobj,
}
in:
block/genhd.c
and put:
if (!class->dev_kobj)
class->dev_kobj = char_kobj;
in:
class_register()
we can get rid of all this logic and the BLOCK #ifdef, right?
Also:
class_create(THIS_MODULE, "usb_device");
in:
drivers/usb/core/devio.c
should probably clear the dev_kobj after registration, and we can get
rid of the "parent has the same dev_t" logic?
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -192,6 +192,7 @@ struct class {
> struct class_attribute *class_attrs;
> struct class_device_attribute *class_dev_attrs;
> struct device_attribute *dev_attrs;
> + struct kobject *dev_kobj;
>
> int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
> int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
> @@ -204,6 +205,8 @@ struct class {
> int (*resume)(struct device *dev);
> };
>
> +extern struct kobject *block_kobj;
> +extern struct kobject *char_kobj;
These global symbols should get better names, to make it obvious that
it's "only" the /sys/dev/ stuff.
Thanks,
Kay
next parent reply other threads:[~2008-04-18 21:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1208547223.5083.17.camel@dwillia2-linux.ch.intel.com>
2008-04-18 20:53 ` Kay Sievers [this message]
[not found] ` <1208565705.5083.27.camel@dwillia2-linux.ch.intel.com>
2008-04-19 6:16 ` [RFC PATCH try2] sysfs: add /sys/dev/{char,block} to lookupsysfs path by major:minor Kay Sievers
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=1208552034.8589.16.camel@lov.site \
--to=kay.sievers@vrfy.org \
--cc=dan.j.williams@intel.com \
--cc=greg@kroah.com \
--cc=hpa@zytor.com \
--cc=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkml@rtr.ca \
--cc=neilb@suse.de \
--cc=steve@xemacs.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