Re: [PATCH 1/1] IB: sw: rdmavt: mr: use 'time_left' variable with wait_for_completion_timeout()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/2/24 5:05 PM, Wolfram Sang wrote:
> There is a confusing pattern in the kernel to use a variable named 'timeout' to
> store the result of wait_for_completion_timeout() causing patterns like:
> 
> 	timeout = wait_for_completion_timeout(...)
> 	if (!timeout) return -ETIMEDOUT;
> 
> with all kinds of permutations. Use 'time_left' as a variable to make the code
> self explaining.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/infiniband/sw/rdmavt/mr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c
> index 7a9afd5231d5..689e708032fd 100644
> --- a/drivers/infiniband/sw/rdmavt/mr.c
> +++ b/drivers/infiniband/sw/rdmavt/mr.c
> @@ -441,7 +441,7 @@ static void rvt_dereg_clean_qps(struct rvt_mregion *mr)
>   */
>  static int rvt_check_refs(struct rvt_mregion *mr, const char *t)
>  {
> -	unsigned long timeout;
> +	unsigned long time_left;
>  	struct rvt_dev_info *rdi = ib_to_rvt(mr->pd->device);
>  
>  	if (mr->lkey) {
> @@ -451,8 +451,8 @@ static int rvt_check_refs(struct rvt_mregion *mr, const char *t)
>  		synchronize_rcu();
>  	}
>  
> -	timeout = wait_for_completion_timeout(&mr->comp, 5 * HZ);
> -	if (!timeout) {
> +	time_left = wait_for_completion_timeout(&mr->comp, 5 * HZ);
> +	if (!time_left) {
>  		rvt_pr_err(rdi,
>  			   "%s timeout mr %p pd %p lkey %x refcount %ld\n",
>  			   t, mr, mr->pd, mr->lkey,

Nah. Disagree. I think the code is just fine as it is.

-Denny




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux