Commit 71da8905 authored by Dave Young's avatar Dave Young Committed by Greg Kroah-Hartman

rtc: use class iteration api

Convert to use the class iteration api.
Signed-off-by: default avatarDave Young <hidave.darkstar@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 443cad92
...@@ -251,20 +251,23 @@ void rtc_update_irq(struct rtc_device *rtc, ...@@ -251,20 +251,23 @@ void rtc_update_irq(struct rtc_device *rtc,
} }
EXPORT_SYMBOL_GPL(rtc_update_irq); 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 rtc_device *rtc_class_open(char *name)
{ {
struct device *dev; struct device *dev;
struct rtc_device *rtc = NULL; struct rtc_device *rtc = NULL;
down(&rtc_class->sem); dev = class_find_device(rtc_class, name, __rtc_match);
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) if (dev)
rtc = to_rtc_device(dev); rtc = to_rtc_device(dev);
break;
}
}
if (rtc) { if (rtc) {
if (!try_module_get(rtc->owner)) { if (!try_module_get(rtc->owner)) {
...@@ -272,7 +275,6 @@ struct rtc_device *rtc_class_open(char *name) ...@@ -272,7 +275,6 @@ struct rtc_device *rtc_class_open(char *name)
rtc = NULL; rtc = NULL;
} }
} }
up(&rtc_class->sem);
return rtc; return rtc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment