Commit 2e197586 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

kernel/time/clocksource.c: Use list_for_each_entry instead of list_for_each

kernel/time/clocksource.c: Convert list_for_each to
list_for_each_entry in clocksource_resume(),
sysfs_override_clocksource() and show_available_clocksources()
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 03ff1797
...@@ -207,15 +207,12 @@ static inline void clocksource_resume_watchdog(void) { } ...@@ -207,15 +207,12 @@ static inline void clocksource_resume_watchdog(void) { }
*/ */
void clocksource_resume(void) void clocksource_resume(void)
{ {
struct list_head *tmp; struct clocksource *cs;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&clocksource_lock, flags); spin_lock_irqsave(&clocksource_lock, flags);
list_for_each(tmp, &clocksource_list) { list_for_each_entry(cs, &clocksource_list, list) {
struct clocksource *cs;
cs = list_entry(tmp, struct clocksource, list);
if (cs->resume) if (cs->resume)
cs->resume(); cs->resume();
} }
...@@ -369,7 +366,6 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, ...@@ -369,7 +366,6 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct clocksource *ovr = NULL; struct clocksource *ovr = NULL;
struct list_head *tmp;
size_t ret = count; size_t ret = count;
int len; int len;
...@@ -389,12 +385,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, ...@@ -389,12 +385,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
len = strlen(override_name); len = strlen(override_name);
if (len) { if (len) {
ovr = clocksource_override;
/* try to select it: */
list_for_each(tmp, &clocksource_list) {
struct clocksource *cs; struct clocksource *cs;
cs = list_entry(tmp, struct clocksource, list); ovr = clocksource_override;
/* try to select it: */
list_for_each_entry(cs, &clocksource_list, list) {
if (strlen(cs->name) == len && if (strlen(cs->name) == len &&
!strcmp(cs->name, override_name)) !strcmp(cs->name, override_name))
ovr = cs; ovr = cs;
...@@ -422,14 +417,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, ...@@ -422,14 +417,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
static ssize_t static ssize_t
sysfs_show_available_clocksources(struct sys_device *dev, char *buf) sysfs_show_available_clocksources(struct sys_device *dev, char *buf)
{ {
struct list_head *tmp; struct clocksource *src;
char *curr = buf; char *curr = buf;
spin_lock_irq(&clocksource_lock); spin_lock_irq(&clocksource_lock);
list_for_each(tmp, &clocksource_list) { list_for_each_entry(src, &clocksource_list, list) {
struct clocksource *src;
src = list_entry(tmp, struct clocksource, list);
curr += sprintf(curr, "%s ", src->name); curr += sprintf(curr, "%s ", src->name);
} }
spin_unlock_irq(&clocksource_lock); spin_unlock_irq(&clocksource_lock);
......
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