All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Poirier <benjamin.poirier@gmail.com>
To: Yihao Han <hanyihao@vivo.com>, Wen Gong <quic_wgong@quicinc.com>
Cc: Kalle Valo <kvalo@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@vivo.com
Subject: Re: [PATCH] ath11k: simplify if-if to if-else
Date: Fri, 15 Apr 2022 15:16:52 +0900	[thread overview]
Message-ID: <YlkN1FsTd0Bozz0K@d3> (raw)
In-Reply-To: <20220414092042.78152-1-hanyihao@vivo.com>

On 2022-04-14 02:20 -0700, Yihao Han wrote:
> Replace `if (!ab->is_reset)` with `else` for simplification
> and add curly brackets according to the kernel coding style:
> 
> "Do not unnecessarily use braces where a single statement will do."
> 
> ...
> 
> "This does not apply if only one branch of a conditional statement is
> a single statement; in the latter case use braces in both branches"
> 
> Please refer to:
> https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html

Same comment about the curly brackets part of the log as for the qlcnic
patch, it doesn't match the changes.

> 
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>  drivers/net/wireless/ath/ath11k/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
> index cbac1919867f..80009482165a 100644
> --- a/drivers/net/wireless/ath/ath11k/core.c
> +++ b/drivers/net/wireless/ath/ath11k/core.c
> @@ -1532,8 +1532,7 @@ static void ath11k_core_restart(struct work_struct *work)
>  
>  	if (ab->is_reset)
>  		complete_all(&ab->reconfigure_complete);
> -
> -	if (!ab->is_reset)
> +	else
>  		ath11k_core_post_reconfigure_recovery(ab);
>  }

It seems there is no synchronization around is_reset but is it
guaranteed that it cannot be changed by ath11k_core_reset() between the
two tests? I'm not familiar with the driver.

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Poirier <benjamin.poirier@gmail.com>
To: Yihao Han <hanyihao@vivo.com>, Wen Gong <quic_wgong@quicinc.com>
Cc: Kalle Valo <kvalo@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@vivo.com
Subject: Re: [PATCH] ath11k: simplify if-if to if-else
Date: Fri, 15 Apr 2022 15:16:52 +0900	[thread overview]
Message-ID: <YlkN1FsTd0Bozz0K@d3> (raw)
In-Reply-To: <20220414092042.78152-1-hanyihao@vivo.com>

On 2022-04-14 02:20 -0700, Yihao Han wrote:
> Replace `if (!ab->is_reset)` with `else` for simplification
> and add curly brackets according to the kernel coding style:
> 
> "Do not unnecessarily use braces where a single statement will do."
> 
> ...
> 
> "This does not apply if only one branch of a conditional statement is
> a single statement; in the latter case use braces in both branches"
> 
> Please refer to:
> https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html

Same comment about the curly brackets part of the log as for the qlcnic
patch, it doesn't match the changes.

> 
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>  drivers/net/wireless/ath/ath11k/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
> index cbac1919867f..80009482165a 100644
> --- a/drivers/net/wireless/ath/ath11k/core.c
> +++ b/drivers/net/wireless/ath/ath11k/core.c
> @@ -1532,8 +1532,7 @@ static void ath11k_core_restart(struct work_struct *work)
>  
>  	if (ab->is_reset)
>  		complete_all(&ab->reconfigure_complete);
> -
> -	if (!ab->is_reset)
> +	else
>  		ath11k_core_post_reconfigure_recovery(ab);
>  }

It seems there is no synchronization around is_reset but is it
guaranteed that it cannot be changed by ath11k_core_reset() between the
two tests? I'm not familiar with the driver.

  reply	other threads:[~2022-04-15  6:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14  9:20 [PATCH] ath11k: simplify if-if to if-else Yihao Han
2022-04-14  9:20 ` Yihao Han
2022-04-15  6:16 ` Benjamin Poirier [this message]
2022-04-15  6:16   ` Benjamin Poirier
2022-04-15  6:56   ` Wen Gong
2022-04-15  6:56     ` Wen Gong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YlkN1FsTd0Bozz0K@d3 \
    --to=benjamin.poirier@gmail.com \
    --cc=ath11k@lists.infradead.org \
    --cc=davem@davemloft.net \
    --cc=hanyihao@vivo.com \
    --cc=kernel@vivo.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_wgong@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.