Staging: android: timed_gpio.c: improved logic of gpio_get_time()
This patch improves the logic of gpio_get_time() and, thereafter, makes checkpatch.pl happy. Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d746cb55b0
commit
80039faa88
@ -45,16 +45,17 @@ 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;
|
||||||
container_of(dev, struct timed_gpio_data, dev);
|
struct timeval t;
|
||||||
|
|
||||||
if (hrtimer_active(&data->timer)) {
|
data = container_of(dev, struct timed_gpio_data, dev);
|
||||||
ktime_t r = hrtimer_get_remaining(&data->timer);
|
|
||||||
struct timeval t = ktime_to_timeval(r);
|
|
||||||
|
|
||||||
return t.tv_sec * 1000 + t.tv_usec / 1000;
|
if (!hrtimer_active(&data->timer))
|
||||||
} else
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
t = ktime_to_timeval(hrtimer_get_remaining(&data->timer));
|
||||||
|
|
||||||
|
return t.tv_sec * 1000 + t.tv_usec / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gpio_enable(struct timed_output_dev *dev, int value)
|
static void gpio_enable(struct timed_output_dev *dev, int value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user