From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver core changes for 2.5.69
Date: Fri, 9 May 2003 16:53:59 -0700 [thread overview]
Message-ID: <20030509235359.GB3517@kroah.com> (raw)
In-Reply-To: <20030509235346.GA3517@kroah.com>
ChangeSet 1.1097, 2003/05/09 16:26:28-07:00, greg@kroah.com
[PATCH] driver core: Add driver symlink to class devices in sysfs.
Thanks to Mike Anderson for the idea for this.
drivers/base/class.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+)
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c Fri May 9 16:40:29 2003
+++ b/drivers/base/class.c Fri May 9 16:40:29 2003
@@ -133,6 +133,21 @@
sysfs_remove_link(&class_dev->kobj, "device");
}
+static int class_device_driver_link(struct class_device * class_dev)
+{
+ if ((class_dev->dev) && (class_dev->dev->driver))
+ return sysfs_create_link(&class_dev->kobj,
+ &class_dev->dev->driver->kobj, "driver");
+ return 0;
+}
+
+static void class_device_driver_unlink(struct class_device * class_dev)
+{
+ if ((class_dev->dev) && (class_dev->dev->driver))
+ sysfs_remove_link(&class_dev->kobj, "driver");
+}
+
+
#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
#define to_class_dev_attr(_attr) container_of(_attr,struct class_device_attribute,attr)
@@ -265,6 +280,7 @@
}
class_device_dev_link(class_dev);
+ class_device_driver_link(class_dev);
register_done:
if (error && parent)
@@ -298,6 +314,7 @@
if (class_dev->dev) {
class_device_dev_unlink(class_dev);
+ class_device_driver_unlink(class_dev);
put_device(class_dev->dev);
}
next prev parent reply other threads:[~2003-05-09 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-09 23:51 [BK PATCH] Driver core changes for 2.5.69 Greg KH
2003-05-09 23:53 ` [PATCH] " Greg KH
2003-05-09 23:53 ` Greg KH [this message]
2003-05-09 23:54 ` Greg KH
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=20030509235359.GB3517@kroah.com \
--to=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