gpu: nvgpu: simplify nvgpu_timeout_init

nvgpu_timeout_init() returns an error code only when the flags parameter
is invalid. There are very few possible values for flags, so extract the
two most common cases - cpu clock based and a retry based timeout - to
functions that cannot fail and thus return nothing. Adjust all callers
to use those, simplfying error handling quite a bit.

Change-Id: I985fe7fa988ebbae25601d15cf57fd48eda0c677
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2613833
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2021-10-20 18:01:06 +03:00
committed by mobile promotions
parent 9b3f3ea4be
commit f4ec400d5f
65 changed files with 222 additions and 510 deletions

View File

@@ -774,8 +774,7 @@ int gk20a_block_new_jobs_and_idle(struct gk20a *g)
nvgpu_mutex_acquire(&platform->railgate_lock);
nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
NVGPU_TIMER_CPU_TIMER);
nvgpu_timeout_init_cpu_timer(g, &timeout, GK20A_WAIT_FOR_IDLE_MS);
/* check and wait until GPU is idle (with a timeout) */
do {
@@ -1395,8 +1394,7 @@ static int gk20a_pm_suspend(struct device *dev)
return ret;
}
nvgpu_timeout_init(g, &timeout, GK20A_WAIT_FOR_IDLE_MS,
NVGPU_TIMER_CPU_TIMER);
nvgpu_timeout_init_cpu_timer(g, &timeout, GK20A_WAIT_FOR_IDLE_MS);
/*
* Hold back deterministic submits and changes to deterministic
* channels - this must be outside the power busy locks.