Skip to content

Commit

Permalink
kmsg: use do_div() to divide 64bit integer
Browse files Browse the repository at this point in the history
On Tue, May 8, 2012 at 10:02 AM, Stephen Rothwell <[email protected]> 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 <[email protected]>
Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
kaysievers authored and gregkh committed May 8, 2012
1 parent a9e7321 commit 5fc3249
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
{
struct devkmsg_user *user = file->private_data;
struct log *msg;
u64 ts_usec;
size_t i;
size_t len;
ssize_t ret;
Expand Down Expand Up @@ -441,8 +442,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
}

msg = log_from_idx(user->idx);
ts_usec = msg->ts_nsec;
do_div(ts_usec, 1000);
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 */
for (i = 0; i < msg->text_len; i++) {
Expand Down

0 comments on commit 5fc3249

Please sign in to comment.