From 50e2fdd306c253deae97a6bbf6be20f7502eba86 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 20 Jun 2017 09:43:55 +0300 Subject: gpu: nvgpu: fix double jiffies conversion The gk20a_channel_wait() ioctl still considers a timeout value type to be jiffies, but NVGPU_COND_WAIT_INTERRUPTIBLE takes milliseconds. Pass the millisecond value from args directly to the cond wait. NVGPU_NO_TIMEOUT is the max unsigned value that fits in 32 bits, so it does not need to be tested explicitly. Jira NVGPU-83 Change-Id: If7979c015696b2d1e0bbe9612c546410a0f41f2e Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1505422 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index a083cb81..08e483a3 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -401,7 +401,7 @@ int nvgpu_channel_ioctl_alloc_gpfifo(struct channel_gk20a *c, static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, ulong id, u32 offset, - u32 payload, long timeout) + u32 payload, u32 timeout) { struct dma_buf *dmabuf; void *data; @@ -448,7 +448,6 @@ static int gk20a_channel_wait(struct channel_gk20a *ch, u64 jiffies; ulong id; u32 offset; - unsigned long timeout; int remain, ret = 0; u64 end; @@ -457,11 +456,6 @@ static int gk20a_channel_wait(struct channel_gk20a *ch, if (ch->has_timedout) return -ETIMEDOUT; - if (args->timeout == NVGPU_NO_TIMEOUT) - timeout = MAX_SCHEDULE_TIMEOUT; - else - timeout = (u32)msecs_to_jiffies(args->timeout); - switch (args->type) { case NVGPU_WAIT_TYPE_NOTIFIER: id = args->condition.notifier.dmabuf_fd; @@ -494,7 +488,7 @@ static int gk20a_channel_wait(struct channel_gk20a *ch, remain = NVGPU_COND_WAIT_INTERRUPTIBLE( &ch->notifier_wq, notif->status == 0 || ch->has_timedout, - timeout); + args->timeout); if (remain == 0 && notif->status != 0) { ret = -ETIMEDOUT; @@ -521,7 +515,7 @@ notif_clean_up: args->condition.semaphore.dmabuf_fd, args->condition.semaphore.offset, args->condition.semaphore.payload, - timeout); + args->timeout); break; -- cgit v1.2.2