From: Hollis Blanchard <hollisb@us.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: kobj_to_dev ?
Date: Mon, 19 Jan 2004 14:26:47 -0600 [thread overview]
Message-ID: <400C3D87.3010502@us.ibm.com> (raw)
In-Reply-To: <20040117001739.GB3840@kroah.com>
Greg KH wrote:
>
> How about just adding a find_device() function to the driver core, where
> you pass in a name and a type, so that others can use it?
Something like this?
===== include/linux/device.h 1.111 vs edited =====
--- 1.111/include/linux/device.h Mon Dec 29 15:38:10 2003
+++ edited/include/linux/device.h Mon Jan 19 14:25:26 2004
@@ -354,6 +354,7 @@
*/
extern struct device * get_device(struct device * dev);
extern void put_device(struct device * dev);
+extern struct device *find_device(const char *name, struct bus_type *bus);
/* drivers/base/platform.c */
===== drivers/base/core.c 1.78 vs edited =====
--- 1.78/drivers/base/core.c Mon Sep 29 16:20:44 2003
+++ edited/drivers/base/core.c Mon Jan 19 14:33:42 2004
@@ -400,6 +400,14 @@
return error;
}
+struct device *find_device(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(find_device);
EXPORT_SYMBOL(device_create_file);
EXPORT_SYMBOL(device_remove_file);
--
Hollis Blanchard
IBM Linux Technology Center
next prev parent reply other threads:[~2004-01-19 20:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 23:32 kobj_to_dev ? Hollis Blanchard
2004-01-17 0:17 ` Greg KH
2004-01-19 20:26 ` Hollis Blanchard [this message]
2004-01-20 0:04 ` Greg KH
2004-01-20 0:25 ` Hollis Blanchard
2004-01-20 0:53 ` Greg KH
2004-01-20 3:18 ` Hollis Blanchard
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=400C3D87.3010502@us.ibm.com \
--to=hollisb@us.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 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.