提交 9a8f99fa 编写于 作者: C Christian Dietrich 提交者: Benjamin Herrenschmidt

powerpc/rtas-rtc: remove sideeffects of printk_ratelimit

Don't use printk_ratelimit() as an additional condition for returning
on an error. Because when the ratelimit is reached, printk_ratelimit
will return 0 and e.g. in rtas_get_boot_time won't check for an error
condition.
Signed-off-by: NChristian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 937c190c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ratelimit.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/rtas.h> #include <asm/rtas.h>
#include <asm/time.h> #include <asm/time.h>
...@@ -29,8 +30,9 @@ unsigned long __init rtas_get_boot_time(void) ...@@ -29,8 +30,9 @@ unsigned long __init rtas_get_boot_time(void)
} }
} while (wait_time && (get_tb() < max_wait_tb)); } while (wait_time && (get_tb() < max_wait_tb));
if (error != 0 && printk_ratelimit()) { if (error != 0) {
printk(KERN_WARNING "error: reading the clock failed (%d)\n", printk_ratelimited(KERN_WARNING
"error: reading the clock failed (%d)\n",
error); error);
return 0; return 0;
} }
...@@ -55,18 +57,20 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm) ...@@ -55,18 +57,20 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm)
wait_time = rtas_busy_delay_time(error); wait_time = rtas_busy_delay_time(error);
if (wait_time) { if (wait_time) {
if (in_interrupt() && printk_ratelimit()) { if (in_interrupt()) {
memset(rtc_tm, 0, sizeof(struct rtc_time)); memset(rtc_tm, 0, sizeof(struct rtc_time));
printk(KERN_WARNING "error: reading clock" printk_ratelimited(KERN_WARNING
" would delay interrupt\n"); "error: reading clock "
"would delay interrupt\n");
return; /* delay not allowed */ return; /* delay not allowed */
} }
msleep(wait_time); msleep(wait_time);
} }
} while (wait_time && (get_tb() < max_wait_tb)); } while (wait_time && (get_tb() < max_wait_tb));
if (error != 0 && printk_ratelimit()) { if (error != 0) {
printk(KERN_WARNING "error: reading the clock failed (%d)\n", printk_ratelimited(KERN_WARNING
"error: reading the clock failed (%d)\n",
error); error);
return; return;
} }
...@@ -99,8 +103,9 @@ int rtas_set_rtc_time(struct rtc_time *tm) ...@@ -99,8 +103,9 @@ int rtas_set_rtc_time(struct rtc_time *tm)
} }
} while (wait_time && (get_tb() < max_wait_tb)); } while (wait_time && (get_tb() < max_wait_tb));
if (error != 0 && printk_ratelimit()) if (error != 0)
printk(KERN_WARNING "error: setting the clock failed (%d)\n", printk_ratelimited(KERN_WARNING
"error: setting the clock failed (%d)\n",
error); error);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册