All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Greg KH <greg@kroah.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [RESEND][PATCH 4/4] Driver core updates (needed for serio)
Date: Wed, 7 Jul 2004 20:41:32 -0500	[thread overview]
Message-ID: <200407072041.41497.dtor_core@ameritech.net> (raw)
In-Reply-To: <200407072040.48498.dtor_core@ameritech.net>


===================================================================


ChangeSet@1.1822, 2004-07-07 18:18:04-05:00, dtor_core@ameritech.net
  Driver core: add driver_find helper to find a driver by its name
  
  Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


 drivers/base/driver.c  |   19 +++++++++++++++++++
 include/linux/device.h |    1 +
 2 files changed, 20 insertions(+)


===================================================================



diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
--- a/drivers/base/driver.c	2004-07-07 19:56:21 -05:00
+++ b/drivers/base/driver.c	2004-07-07 19:56:21 -05:00
@@ -111,10 +111,29 @@
 	up(&drv->unload_sem);
 }
 
+/**
+ *	driver_find - locate driver on a bus by its name.
+ *	@name:	name of the driver.
+ *	@bus:	bus to scan for the driver.
+ *
+ *	Call kset_find_obj() to iterate over list of drivers on
+ *	a bus to find driver by name. Return driver if found.
+ *
+ *	Note that kset_find_obj increments driver's reference count.
+ */
+struct device_driver *driver_find(const char *name, struct bus_type *bus)
+{
+	struct kobject *k = kset_find_obj(&bus->drivers, name);
+	if (k)
+		return to_drv(k);
+	return NULL;
+}
+
 EXPORT_SYMBOL(driver_register);
 EXPORT_SYMBOL(driver_unregister);
 EXPORT_SYMBOL(get_driver);
 EXPORT_SYMBOL(put_driver);
+EXPORT_SYMBOL(driver_find);
 
 EXPORT_SYMBOL(driver_create_file);
 EXPORT_SYMBOL(driver_remove_file);
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	2004-07-07 19:56:21 -05:00
+++ b/include/linux/device.h	2004-07-07 19:56:21 -05:00
@@ -120,6 +120,7 @@
 
 extern struct device_driver * get_driver(struct device_driver * drv);
 extern void put_driver(struct device_driver * drv);
+extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
 
 
 /* driverfs interface for exporting driver attributes */

  reply	other threads:[~2004-07-08  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-08  1:38 [RESEND][PATCH 1/4] Driver core updates (needed for serio) Dmitry Torokhov
2004-07-08  1:40 ` [RESEND][PATCH 2/4] " Dmitry Torokhov
2004-07-08  1:40   ` [RESEND][PATCH 3/4] " Dmitry Torokhov
2004-07-08  1:41     ` Dmitry Torokhov [this message]
2004-07-08 23:45 ` [RESEND][PATCH 1/4] " 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=200407072041.41497.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --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.