* [PATCH] timekeeping: check params before use them
@ 2014-03-27 8:12 Neil Zhang
2014-03-27 17:26 ` John Stultz
0 siblings, 1 reply; 3+ messages in thread
From: Neil Zhang @ 2014-03-27 8:12 UTC (permalink / raw)
To: john.stultz, tglx; +Cc: linux-kernel, Neil Zhang
Sometimes we won't need all the information from
get_xtime_and_monotonic_and_sleep_offset(),
so let's check the params before assign the value to them.
Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
kernel/time/timekeeping.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 0aa4ce8..f0e8f53 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1598,9 +1598,12 @@ void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
do {
seq = read_seqcount_begin(&timekeeper_seq);
- *xtim = tk_xtime(tk);
- *wtom = tk->wall_to_monotonic;
- *sleep = tk->total_sleep_time;
+ if (xtim)
+ *xtim = tk_xtime(tk);
+ if (wtom)
+ *wtom = tk->wall_to_monotonic;
+ if (sleep)
+ *sleep = tk->total_sleep_time;
} while (read_seqcount_retry(&timekeeper_seq, seq));
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] timekeeping: check params before use them
2014-03-27 8:12 [PATCH] timekeeping: check params before use them Neil Zhang
@ 2014-03-27 17:26 ` John Stultz
2014-03-28 1:13 ` Neil Zhang
0 siblings, 1 reply; 3+ messages in thread
From: John Stultz @ 2014-03-27 17:26 UTC (permalink / raw)
To: Neil Zhang, tglx; +Cc: linux-kernel
On 03/27/2014 01:12 AM, Neil Zhang wrote:
> Sometimes we won't need all the information from
> get_xtime_and_monotonic_and_sleep_offset(),
> so let's check the params before assign the value to them.
So I think the single in-kernel user of this function does use all of
the information.
Can you expand on how your using this and why the extra conditionals are
worth while?
thanks
-john
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] timekeeping: check params before use them
2014-03-27 17:26 ` John Stultz
@ 2014-03-28 1:13 ` Neil Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Neil Zhang @ 2014-03-28 1:13 UTC (permalink / raw)
To: John Stultz, tglx@linutronix.de; +Cc: linux-kernel@vger.kernel.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 977 bytes --]
> -----Original Message-----
> From: John Stultz [mailto:john.stultz@linaro.org]
> Sent: 2014Äê3ÔÂ28ÈÕ 1:26
> To: Neil Zhang; tglx@linutronix.de
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] timekeeping: check params before use them
>
> On 03/27/2014 01:12 AM, Neil Zhang wrote:
> > Sometimes we won't need all the information from
> > get_xtime_and_monotonic_and_sleep_offset(),
> > so let's check the params before assign the value to them.
>
> So I think the single in-kernel user of this function does use all of the
> information.
>
> Can you expand on how your using this and why the extra conditionals are
> worth while?
>
Please refer to my another patch.
printk: add sleep time into timestamp
I want to add sleep time into printk's timestamp.
> thanks
> -john
Best Regards,
Neil Zhang
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-28 1:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 8:12 [PATCH] timekeeping: check params before use them Neil Zhang
2014-03-27 17:26 ` John Stultz
2014-03-28 1:13 ` Neil Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox