From: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [PATCH] drivers/usb/input/ati_remote.c : Use of time_after and
Date: Wed, 13 Jul 2005 05:51:34 +0000 [thread overview]
Message-ID: <42D4ABE6.6010601@feitoza.com.br> (raw)
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: ati_remote.patch --]
[-- Type: text/x-patch, Size: 1917 bytes --]
Use of time_after and time_before macros, defined at linux/jiffies.h, which deal
with wrapping correctly and are nicer to read.
Signed-off-by: Marcelo Feitoza Parisi <marcelo@feitoza.com.br>
--- linux/drivers/usb/input/ati_remote.c 2005-07-07 19:11:55.000000000 -0300
+++ linux-kj/drivers/usb/input/ati_remote.c 2005-07-13 02:49:17.210994184 -0300
@@ -95,6 +95,7 @@
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/wait.h>
+#include <linux/jiffies.h>
/*
* Module and Version Information, Module Parameters
@@ -510,16 +511,22 @@
* pad down, so we increase acceleration, ramping up over two seconds to
* a maximum speed. The acceleration curve is #defined above.
*/
- if ((jiffies - ati_remote->old_jiffies) > (HZ >> 2)) {
+ if (time_after(jiffies, ati_remote->old_jiffies + (HZ >> 2))) {
acc = 1;
ati_remote->acc_jiffies = jiffies;
}
- else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 3)) acc = accel[0];
- else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 2)) acc = accel[1];
- else if ((jiffies - ati_remote->acc_jiffies) < (HZ >> 1)) acc = accel[2];
- else if ((jiffies - ati_remote->acc_jiffies) < HZ ) acc = accel[3];
- else if ((jiffies - ati_remote->acc_jiffies) < HZ+(HZ>>1)) acc = accel[4];
- else if ((jiffies - ati_remote->acc_jiffies) < (HZ << 1)) acc = accel[5];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 3)))
+ acc = accel[0];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 2)))
+ acc = accel[1];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ >> 1)))
+ acc = accel[2];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + HZ ))
+ acc = accel[3];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + HZ+(HZ>>1)))
+ acc = accel[4];
+ else if (time_before(jiffies, ati_remote->acc_jiffies + (HZ << 1)))
+ acc = accel[5];
else acc = accel[6];
input_regs(dev, regs);
[-- Attachment #3: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next reply other threads:[~2005-07-13 5:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-13 5:51 Marcelo Feitoza Parisi [this message]
2005-07-16 7:04 ` [KJ] [PATCH] drivers/usb/input/ati_remote.c : Use of the Marcelo Feitoza Parisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42D4ABE6.6010601@feitoza.com.br \
--to=marcelo@feitoza.com.br \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.