From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core update and fixes for 2.6.1
Date: Mon, 19 Jan 2004 17:12:39 -0800 [thread overview]
Message-ID: <1074561159715@kroah.com> (raw)
In-Reply-To: <10745611583988@kroah.com>
ChangeSet 1.1496, 2004/01/19 16:31:36-08:00, hollisb@us.ibm.com
[PATCH] Driver Core: add device_find() function
Greg KH wrote:
>
> How about just adding a device_find() function to the driver core, where
> you pass in a name and a type, so that others can use it?
Something like this?
drivers/base/core.c | 9 +++++++++
include/linux/device.h | 1 +
2 files changed, 10 insertions(+)
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c Mon Jan 19 17:05:19 2004
+++ b/drivers/base/core.c Mon Jan 19 17:05:19 2004
@@ -400,6 +400,14 @@
return error;
}
+struct device *device_find(const char *name, struct bus_type *bus)
+{
+ struct kobject *k = kset_find_obj(&bus->devices, name);
+ if (k)
+ return to_dev(k);
+ return NULL;
+}
+
int __init devices_init(void)
{
return subsystem_register(&devices_subsys);
@@ -416,6 +424,7 @@
EXPORT_SYMBOL(device_unregister_wait);
EXPORT_SYMBOL(get_device);
EXPORT_SYMBOL(put_device);
+EXPORT_SYMBOL(device_find);
EXPORT_SYMBOL(device_create_file);
EXPORT_SYMBOL(device_remove_file);
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h Mon Jan 19 17:05:19 2004
+++ b/include/linux/device.h Mon Jan 19 17:05:19 2004
@@ -354,6 +354,7 @@
*/
extern struct device * get_device(struct device * dev);
extern void put_device(struct device * dev);
+extern struct device *device_find(const char *name, struct bus_type *bus);
/* drivers/base/platform.c */
next prev parent reply other threads:[~2004-01-20 1:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-20 1:10 [BK PATCH] Driver Core update for 2.6.1 Greg KH
2004-01-20 1:12 ` [PATCH] Driver Core update and fixes " Greg KH
2004-01-20 1:12 ` Greg KH [this message]
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 8:40 ` [BK PATCH] Driver Core update " Måns Rullgård
2004-01-20 11:13 ` Andreas Jellinghaus
2004-01-20 17:14 ` Greg KH
2004-01-20 17:48 ` Måns Rullgård
2004-01-21 0:10 ` Greg KH
2004-01-21 1:59 ` Måns Rullgård
2004-01-21 2:18 ` Greg KH
2004-01-21 18:39 ` Måns Rullgård
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=1074561159715@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 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.