diff options
author | Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de> | 2011-06-04 01:35:47 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-06-29 01:30:43 -0400 |
commit | 9a8f99fab02db296815d7f0ae8ba8ce169df0063 (patch) | |
tree | 5f1bfc1bf3febaded62f6ab64afe1b7a6b3d15ba /arch/powerpc | |
parent | 937c190ccdd29855828529fc2b4b3e5f1282ff23 (diff) |
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: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/rtas-rtc.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/powerpc/kernel/rtas-rtc.c b/arch/powerpc/kernel/rtas-rtc.c index 77578c093dda..c57c19358a26 100644 --- a/arch/powerpc/kernel/rtas-rtc.c +++ b/arch/powerpc/kernel/rtas-rtc.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/rtc.h> | 5 | #include <linux/rtc.h> |
6 | #include <linux/delay.h> | 6 | #include <linux/delay.h> |
7 | #include <linux/ratelimit.h> | ||
7 | #include <asm/prom.h> | 8 | #include <asm/prom.h> |
8 | #include <asm/rtas.h> | 9 | #include <asm/rtas.h> |
9 | #include <asm/time.h> | 10 | #include <asm/time.h> |
@@ -29,9 +30,10 @@ unsigned long __init rtas_get_boot_time(void) | |||
29 | } | 30 | } |
30 | } while (wait_time && (get_tb() < max_wait_tb)); | 31 | } while (wait_time && (get_tb() < max_wait_tb)); |
31 | 32 | ||
32 | if (error != 0 && printk_ratelimit()) { | 33 | if (error != 0) { |
33 | printk(KERN_WARNING "error: reading the clock failed (%d)\n", | 34 | printk_ratelimited(KERN_WARNING |
34 | error); | 35 | "error: reading the clock failed (%d)\n", |
36 | error); | ||
35 | return 0; | 37 | return 0; |
36 | } | 38 | } |
37 | 39 | ||
@@ -55,19 +57,21 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm) | |||
55 | 57 | ||
56 | wait_time = rtas_busy_delay_time(error); | 58 | wait_time = rtas_busy_delay_time(error); |
57 | if (wait_time) { | 59 | if (wait_time) { |
58 | if (in_interrupt() && printk_ratelimit()) { | 60 | if (in_interrupt()) { |
59 | memset(rtc_tm, 0, sizeof(struct rtc_time)); | 61 | memset(rtc_tm, 0, sizeof(struct rtc_time)); |
60 | printk(KERN_WARNING "error: reading clock" | 62 | printk_ratelimited(KERN_WARNING |
61 | " would delay interrupt\n"); | 63 | "error: reading clock " |
64 | "would delay interrupt\n"); | ||
62 | return; /* delay not allowed */ | 65 | return; /* delay not allowed */ |
63 | } | 66 | } |
64 | msleep(wait_time); | 67 | msleep(wait_time); |
65 | } | 68 | } |
66 | } while (wait_time && (get_tb() < max_wait_tb)); | 69 | } while (wait_time && (get_tb() < max_wait_tb)); |
67 | 70 | ||
68 | if (error != 0 && printk_ratelimit()) { | 71 | if (error != 0) { |
69 | printk(KERN_WARNING "error: reading the clock failed (%d)\n", | 72 | printk_ratelimited(KERN_WARNING |
70 | error); | 73 | "error: reading the clock failed (%d)\n", |
74 | error); | ||
71 | return; | 75 | return; |
72 | } | 76 | } |
73 | 77 | ||
@@ -99,9 +103,10 @@ int rtas_set_rtc_time(struct rtc_time *tm) | |||
99 | } | 103 | } |
100 | } while (wait_time && (get_tb() < max_wait_tb)); | 104 | } while (wait_time && (get_tb() < max_wait_tb)); |
101 | 105 | ||
102 | if (error != 0 && printk_ratelimit()) | 106 | if (error != 0) |
103 | printk(KERN_WARNING "error: setting the clock failed (%d)\n", | 107 | printk_ratelimited(KERN_WARNING |
104 | error); | 108 | "error: setting the clock failed (%d)\n", |
109 | error); | ||
105 | 110 | ||
106 | return 0; | 111 | return 0; |
107 | } | 112 | } |