diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2008-01-22 01:00:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:44 -0500 |
commit | 71da890509fec13d54329485bf5e4ac16b992bb6 (patch) | |
tree | dc9fd8cac1ad04454c8709b93d9f63bcdcc48750 /drivers/rtc | |
parent | 443cad920a1c6894da3de917ce02a194cc6d80ea (diff) |
rtc: use class iteration api
Convert to use the class iteration api.
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | 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 f1e00ff54ce8..7e3ad4f3b343 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -251,20 +251,23 @@ void rtc_update_irq(struct rtc_device *rtc, | |||
251 | } | 251 | } |
252 | EXPORT_SYMBOL_GPL(rtc_update_irq); | 252 | EXPORT_SYMBOL_GPL(rtc_update_irq); |
253 | 253 | ||
254 | static int __rtc_match(struct device *dev, void *data) | ||
255 | { | ||
256 | char *name = (char *)data; | ||
257 | |||
258 | if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) | ||
259 | return 1; | ||
260 | return 0; | ||
261 | } | ||
262 | |||
254 | struct rtc_device *rtc_class_open(char *name) | 263 | struct rtc_device *rtc_class_open(char *name) |
255 | { | 264 | { |
256 | struct device *dev; | 265 | struct device *dev; |
257 | struct rtc_device *rtc = NULL; | 266 | struct rtc_device *rtc = NULL; |
258 | 267 | ||
259 | down(&rtc_class->sem); | 268 | dev = class_find_device(rtc_class, name, __rtc_match); |
260 | list_for_each_entry(dev, &rtc_class->devices, node) { | 269 | if (dev) |
261 | if (strncmp(dev->bus_id, name, BUS_ID_SIZE) == 0) { | 270 | rtc = to_rtc_device(dev); |
262 | dev = get_device(dev); | ||
263 | if (dev) | ||
264 | rtc = to_rtc_device(dev); | ||
265 | break; | ||
266 | } | ||
267 | } | ||
268 | 271 | ||
269 | if (rtc) { | 272 | if (rtc) { |
270 | if (!try_module_get(rtc->owner)) { | 273 | if (!try_module_get(rtc->owner)) { |
@@ -272,7 +275,6 @@ struct rtc_device *rtc_class_open(char *name) | |||
272 | rtc = NULL; | 275 | rtc = NULL; |
273 | } | 276 | } |
274 | } | 277 | } |
275 | up(&rtc_class->sem); | ||
276 | 278 | ||
277 | return rtc; | 279 | return rtc; |
278 | } | 280 | } |