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

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -36,7 +36,7 @@
*
* Test Type: Feature
*
* Targets: nvgpu_timeout_init
* Targets: nvgpu_timeout_init_flags
*
* Inputs:
* 1) The type of timer to be tested is passed as an argument to the test.
@@ -69,7 +69,7 @@ int test_timer_init(struct unit_module *m,
*
* Test Type: Boundary values
*
* Targets: nvgpu_timeout_init
* Targets: nvgpu_timeout_init_flags
*
* Inputs:
* 1) Global nvgpu_timeout structure instance.
@@ -98,7 +98,7 @@ int test_timer_init_err(struct unit_module *m,
*
* Test Type: Feature
*
* Targets: nvgpu_timeout_init, nvgpu_timeout_expired,
* Targets: nvgpu_timeout_init_retry, nvgpu_timeout_expired,
* nvgpu_timeout_peek_expired
*
* Input:
@@ -131,7 +131,7 @@ int test_timer_counter(struct unit_module *m,
*
* Test Type: Feature
*
* Targets: nvgpu_timeout_init, nvgpu_timeout_expired,
* Targets: nvgpu_timeout_init_cpu_timer, nvgpu_timeout_expired,
* nvgpu_timeout_peek_expired
*
* Input: