提交 5fc32490 编写于 作者: K Kay Sievers 提交者: Greg Kroah-Hartman

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: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NKay Sievers <kay@vrfy.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a9e73211
...@@ -407,6 +407,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, ...@@ -407,6 +407,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
{ {
struct devkmsg_user *user = file->private_data; struct devkmsg_user *user = file->private_data;
struct log *msg; struct log *msg;
u64 ts_usec;
size_t i; size_t i;
size_t len; size_t len;
ssize_t ret; ssize_t ret;
...@@ -441,8 +442,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, ...@@ -441,8 +442,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
} }
msg = log_from_idx(user->idx); msg = log_from_idx(user->idx);
ts_usec = msg->ts_nsec;
do_div(ts_usec, 1000);
len = sprintf(user->buf, "%u,%llu,%llu;", len = sprintf(user->buf, "%u,%llu,%llu;",
msg->level, user->seq, msg->ts_nsec / 1000); msg->level, user->seq, ts_usec);
/* escape non-printable characters */ /* escape non-printable characters */
for (i = 0; i < msg->text_len; i++) { for (i = 0; i < msg->text_len; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册