All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamey Hicks <jamey.hicks@hp.com>
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: PATCH: add class_device_find
Date: Tue, 02 Mar 2004 10:49:04 -0500	[thread overview]
Message-ID: <4044ACF0.1030909@hp.com> (raw)


This patch adds:

struct class_device * class_device_find(struct class *class, const char 
*class_id)

to find a class device by name so that drivers that match up class 
devices by ID do not need to reach into the internals of class 
implementation.  RMK recommended that I take this approach, and it seems 
reasonable to me.  Please let me know what you think.

-Jamey Hicks


--- linux-2.6.3/drivers/base/class.c    2004-03-02 10:44:56.000000000 -0500
+++ linux-2.6.3-hh1/drivers/base/class.c    2004-03-02 
10:45:14.000000000 -0500
@@ -372,6 +372,19 @@
     return 0;
 }
 
+struct class_device * class_device_find(struct class *class, const char 
*class_id)
+{
+    struct list_head * entry;
+    list_for_each(entry, &class->children) {
+        struct class_device *class_dev = container_of(entry, struct 
class_device, node);
+        if (class_dev) {
+            if (strcmp(class_dev->class_id, class_id) == 0)
+                return class_dev;
+        }
+    }
+    return NULL;
+}
+
 struct class_device * class_device_get(struct class_device *class_dev)
 {
     if (class_dev)
@@ -463,6 +476,7 @@
 EXPORT_SYMBOL(class_device_put);
 EXPORT_SYMBOL(class_device_create_file);
 EXPORT_SYMBOL(class_device_remove_file);
+EXPORT_SYMBOL(class_device_find);
 
 EXPORT_SYMBOL(class_interface_register);
 EXPORT_SYMBOL(class_interface_unregister);



             reply	other threads:[~2004-03-02 15:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 15:49 Jamey Hicks [this message]
2004-03-02 20:06 ` PATCH: add class_device_find 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=4044ACF0.1030909@hp.com \
    --to=jamey.hicks@hp.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.