This driver uses 'struct timeval' which we are trying to remove since 32 bit time types will break in the year 2038 by replacing it with ktime_t.
This patch changes do_gettimeofday() to ktime_get() because ktime_get() returns ktime_t while do_gettimeofday() returns struct timeval.
This patch also uses ktime_ms_delta() to get the elapsed time in milliseconds.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com --- Changes in v2: -Removed trailing whitespace
drivers/staging/media/lirc/lirc_sasem.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index bc78da0..37f9997 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -38,6 +38,7 @@
#include <linux/errno.h> #include <linux/kernel.h> +#include <linux/ktime.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h> @@ -111,7 +112,7 @@ struct sasem_context { } tx;
/* for dealing with repeat codes (wish there was a toggle bit!) */ - struct timeval presstime; + ktime_t presstime; char lastcode[8]; int codesaved; }; @@ -567,7 +568,7 @@ static void incoming_packet(struct sasem_context *context, int len = urb->actual_length; unsigned char *buf = urb->transfer_buffer; long ms; - struct timeval tv; + ktime_t timestamp;
if (len != 8) { dev_warn(&context->dev->dev, @@ -584,9 +585,7 @@ static void incoming_packet(struct sasem_context *context, */
/* get the time since the last button press */ - do_gettimeofday(&tv); - ms = (tv.tv_sec - context->presstime.tv_sec) * 1000 + - (tv.tv_usec - context->presstime.tv_usec) / 1000; + ms = ktime_ms_delta(timestamp, context->presstime);
if (memcmp(buf, "\x08\0\0\0\0\0\0\0", 8) == 0) { /* @@ -602,8 +601,7 @@ static void incoming_packet(struct sasem_context *context, */ if ((ms < 250) && (context->codesaved != 0)) { memcpy(buf, &context->lastcode, 8); - context->presstime.tv_sec = tv.tv_sec; - context->presstime.tv_usec = tv.tv_usec; + context->presstime = timestamp; } } else { /* save the current valid code for repeats */ @@ -613,8 +611,7 @@ static void incoming_packet(struct sasem_context *context, * just for safety reasons */ context->codesaved = 1; - context->presstime.tv_sec = tv.tv_sec; - context->presstime.tv_usec = tv.tv_usec; + context->presstime = timestamp; }
lirc_buffer_write(context->driver->rbuf, buf);
On Tuesday 27 October 2015 13:17:02 Amitoj Kaur Chawla wrote:
This driver uses 'struct timeval' which we are trying to remove since 32 bit time types will break in the year 2038 by replacing it with ktime_t.
This patch changes do_gettimeofday() to ktime_get() because ktime_get() returns ktime_t while do_gettimeofday() returns struct timeval.
This patch also uses ktime_ms_delta() to get the elapsed time in milliseconds.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com
The patch looks good to me, but after checking an old tree of mine, I found that I already have a patch from Tapasweni Pathak for the same thing. For some reason Greg did not apply it to staging back then. I'll send it out to the list for Greg to apply now to ensure this doesn't happen again.
Arnd
On Tue, Nov 03, 2015 at 05:39:00PM +0100, Arnd Bergmann wrote:
On Tuesday 27 October 2015 13:17:02 Amitoj Kaur Chawla wrote:
This driver uses 'struct timeval' which we are trying to remove since 32 bit time types will break in the year 2038 by replacing it with ktime_t.
This patch changes do_gettimeofday() to ktime_get() because ktime_get() returns ktime_t while do_gettimeofday() returns struct timeval.
This patch also uses ktime_ms_delta() to get the elapsed time in milliseconds.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com
The patch looks good to me, but after checking an old tree of mine, I found that I already have a patch from Tapasweni Pathak for the same thing. For some reason Greg did not apply it to staging back then. I'll send it out to the list for Greg to apply now to ensure this doesn't happen again.
Greg is not in charge of drivers/staging/media/* so don't send it to him, he will just ignore it :)
On Tuesday 03 November 2015 09:32:10 Greg KH wrote:
On Tue, Nov 03, 2015 at 05:39:00PM +0100, Arnd Bergmann wrote:
On Tuesday 27 October 2015 13:17:02 Amitoj Kaur Chawla wrote:
This driver uses 'struct timeval' which we are trying to remove since 32 bit time types will break in the year 2038 by replacing it with ktime_t.
This patch changes do_gettimeofday() to ktime_get() because ktime_get() returns ktime_t while do_gettimeofday() returns struct timeval.
This patch also uses ktime_ms_delta() to get the elapsed time in milliseconds.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com
The patch looks good to me, but after checking an old tree of mine, I found that I already have a patch from Tapasweni Pathak for the same thing. For some reason Greg did not apply it to staging back then. I'll send it out to the list for Greg to apply now to ensure this doesn't happen again.
Greg is not in charge of drivers/staging/media/* so don't send it to him, he will just ignore it
Sorry about forgetting that, I'm sure you've told me several times now.
Anyway, I'll take all patches that I have in my old branch and send them to whoever is responsible for merging them.
Arnd
On Tue, Nov 03, 2015 at 09:00:38PM +0100, Arnd Bergmann wrote:
On Tuesday 03 November 2015 09:32:10 Greg KH wrote:
On Tue, Nov 03, 2015 at 05:39:00PM +0100, Arnd Bergmann wrote:
On Tuesday 27 October 2015 13:17:02 Amitoj Kaur Chawla wrote:
This driver uses 'struct timeval' which we are trying to remove since 32 bit time types will break in the year 2038 by replacing it with ktime_t.
This patch changes do_gettimeofday() to ktime_get() because ktime_get() returns ktime_t while do_gettimeofday() returns struct timeval.
This patch also uses ktime_ms_delta() to get the elapsed time in milliseconds.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com
The patch looks good to me, but after checking an old tree of mine, I found that I already have a patch from Tapasweni Pathak for the same thing. For some reason Greg did not apply it to staging back then. I'll send it out to the list for Greg to apply now to ensure this doesn't happen again.
Greg is not in charge of drivers/staging/media/* so don't send it to him, he will just ignore it
Sorry about forgetting that, I'm sure you've told me several times now.
Anyway, I'll take all patches that I have in my old branch and send them to whoever is responsible for merging them.
get_maintainer.pl is your friend :)