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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo _at_ vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Follow-Ups:
- Re: kobj_to_dev ?Greg KH
- kobj_to_dev ?Hollis Blanchard
- Re: kobj_to_dev ?Greg KH
- Prev by Date: [PATCH] IBM PowerPC Virtual Ethernet Driver
- Next by Date: [PATCH 2.6.1] Net device error logging
- Previous by thread: Re: kobj_to_dev ?
- Next by thread: Re: kobj_to_dev ?
- Indexes:[Main][Thread]