Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=71da890509fec13d54329485bf5e4ac16b992bb6
Commit:     71da890509fec13d54329485bf5e4ac16b992bb6
Parent:     443cad920a1c6894da3de917ce02a194cc6d80ea
Author:     Dave Young <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 14:00:34 2008 +0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Jan 24 20:40:44 2008 -0800

    rtc: use class iteration api
    
    Convert to use the class iteration api.
    
    Signed-off-by: Dave Young <[EMAIL PROTECTED]>
    Cc: Alessandro Zummo <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/rtc/interface.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index f1e00ff..7e3ad4f 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -251,20 +251,23 @@ void rtc_update_irq(struct rtc_device *rtc,
 }
 EXPORT_SYMBOL_GPL(rtc_update_irq);
 
+static int __rtc_match(struct device *dev, void *data)
+{
+       char *name = (char *)data;
+
+       if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0)
+               return 1;
+       return 0;
+}
+
 struct rtc_device *rtc_class_open(char *name)
 {
        struct device *dev;
        struct rtc_device *rtc = NULL;
 
-       down(&rtc_class->sem);
-       list_for_each_entry(dev, &rtc_class->devices, node) {
-               if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) {
-                       dev = get_device(dev);
-                       if (dev)
-                               rtc = to_rtc_device(dev);
-                       break;
-               }
-       }
+       dev = class_find_device(rtc_class, name, __rtc_match);
+       if (dev)
+               rtc = to_rtc_device(dev);
 
        if (rtc) {
                if (!try_module_get(rtc->owner)) {
@@ -272,7 +275,6 @@ struct rtc_device *rtc_class_open(char *name)
                        rtc = NULL;
                }
        }
-       up(&rtc_class->sem);
 
        return rtc;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to