Skip to content

Commit

Permalink
[PATCH] drivers/char/lp.c : Use of the time_after() macro
Browse files Browse the repository at this point in the history
Use of the time_after() macro, defined at linux/jiffies.h, which deals with
wrapping correctly and are nicer to read.

Signed-off-by: Marcelo Feitoza Parisi <[email protected]>
Signed-off-by: Domen Puncer <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
feitnomore authored and Linus Torvalds committed Sep 10, 2005
1 parent 82b4442 commit 9675770
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/char/lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
#include <linux/console.h>
#include <linux/device.h>
#include <linux/wait.h>
#include <linux/jiffies.h>

#include <linux/parport.h>
#undef LP_STATS
Expand Down Expand Up @@ -307,7 +308,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
(LP_F(minor) & LP_ABORT));

#ifdef LP_STATS
if (jiffies-lp_table[minor].lastcall > LP_TIME(minor))
if (time_after(jiffies, lp_table[minor].lastcall + LP_TIME(minor)))
lp_table[minor].runchars = 0;

lp_table[minor].lastcall = jiffies;
Expand Down

0 comments on commit 9675770

Please sign in to comment.