Commit d2b77871 authored by Somya Anand's avatar Somya Anand Committed by Greg Kroah-Hartman

Staging: android: Replace timeval with ktime_t in timed_gpio.c

'struct timeval t' is used to return remaining time in milliseconds.

32-bit systems using 'struct timeval' will break in the year 2038,
so we have to replace that code with more appropriate types.
This patch changes the android driver to use ktime_t.
Signed-off-by: default avatarSomya Anand <somyaanand214@gmail.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dd28153b
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/ktime.h>
#include "timed_output.h" #include "timed_output.h"
#include "timed_gpio.h" #include "timed_gpio.h"
...@@ -46,16 +47,16 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer) ...@@ -46,16 +47,16 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer *timer)
static int gpio_get_time(struct timed_output_dev *dev) static int gpio_get_time(struct timed_output_dev *dev)
{ {
struct timed_gpio_data *data; struct timed_gpio_data *data;
struct timeval t; ktime_t t;
data = container_of(dev, struct timed_gpio_data, dev); data = container_of(dev, struct timed_gpio_data, dev);
if (!hrtimer_active(&data->timer)) if (!hrtimer_active(&data->timer))
return 0; return 0;
t = ktime_to_timeval(hrtimer_get_remaining(&data->timer)); t = hrtimer_get_remaining(&data->timer);
return t.tv_sec * 1000 + t.tv_usec / 1000; return ktime_to_ms(t);
} }
static void gpio_enable(struct timed_output_dev *dev, int value) static void gpio_enable(struct timed_output_dev *dev, int value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment