diff options
author | Kay Sievers <kay@vrfy.org> | 2012-05-08 07:04:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-08 11:55:26 -0400 |
commit | 5fc3249068c1ed87c6fd485f42ced24132405629 (patch) | |
tree | 31b2c682930b03e45fe27bc34c8b376e00da408e /kernel/printk.c | |
parent | a9e73211fb0fc875637793a8af770f3678b6c278 (diff) |
kmsg: use do_div() to divide 64bit integer
On Tue, May 8, 2012 at 10:02 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> kernel/built-in.o: In function `devkmsg_read':
> printk.c:(.text+0x27e8): undefined reference to `__udivdi3'
> Most probably the "msg->ts_nsec / 1000" since
> ts_nsec is a u64 and this is a 32 bit build ...
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 1ccc6d986cb3..96d4cc892255 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -407,6 +407,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
407 | { | 407 | { |
408 | struct devkmsg_user *user = file->private_data; | 408 | struct devkmsg_user *user = file->private_data; |
409 | struct log *msg; | 409 | struct log *msg; |
410 | u64 ts_usec; | ||
410 | size_t i; | 411 | size_t i; |
411 | size_t len; | 412 | size_t len; |
412 | ssize_t ret; | 413 | ssize_t ret; |
@@ -441,8 +442,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
441 | } | 442 | } |
442 | 443 | ||
443 | msg = log_from_idx(user->idx); | 444 | msg = log_from_idx(user->idx); |
445 | ts_usec = msg->ts_nsec; | ||
446 | do_div(ts_usec, 1000); | ||
444 | len = sprintf(user->buf, "%u,%llu,%llu;", | 447 | len = sprintf(user->buf, "%u,%llu,%llu;", |
445 | msg->level, user->seq, msg->ts_nsec / 1000); | 448 | msg->level, user->seq, ts_usec); |
446 | 449 | ||
447 | /* escape non-printable characters */ | 450 | /* escape non-printable characters */ |
448 | for (i = 0; i < msg->text_len; i++) { | 451 | for (i = 0; i < msg->text_len; i++) { |