* [PATCH] ath11k: simplify if-if to if-else
@ 2022-04-14 9:20 Yihao Han
2022-04-15 6:16 ` Benjamin Poirier
0 siblings, 1 reply; 3+ messages in thread
From: Yihao Han @ 2022-04-14 9:20 UTC (permalink / raw)
To: Kalle Valo, David S. Miller, Jakub Kicinski, Paolo Abeni, ath11k,
linux-wireless, netdev, linux-kernel
Cc: kernel, Yihao Han
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
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);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ath11k: simplify if-if to if-else
2022-04-14 9:20 [PATCH] ath11k: simplify if-if to if-else Yihao Han
@ 2022-04-15 6:16 ` Benjamin Poirier
2022-04-15 6:56 ` Wen Gong
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Poirier @ 2022-04-15 6:16 UTC (permalink / raw)
To: Yihao Han, Wen Gong
Cc: Kalle Valo, David S. Miller, Jakub Kicinski, Paolo Abeni, ath11k,
linux-wireless, netdev, linux-kernel, kernel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ath11k: simplify if-if to if-else
2022-04-15 6:16 ` Benjamin Poirier
@ 2022-04-15 6:56 ` Wen Gong
0 siblings, 0 replies; 3+ messages in thread
From: Wen Gong @ 2022-04-15 6:56 UTC (permalink / raw)
To: Benjamin Poirier, Yihao Han
Cc: Kalle Valo, David S. Miller, Jakub Kicinski, Paolo Abeni, ath11k,
linux-wireless, netdev, linux-kernel, kernel
On 4/15/2022 2:16 PM, Benjamin Poirier wrote:
> On 2022-04-14 02:20 -0700, Yihao Han wrote:
...
> 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_core_reset() has logic to avoid muti-reset in the same time.
it means it has one recovery work doing for each time.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-15 6:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 9:20 [PATCH] ath11k: simplify if-if to if-else Yihao Han
2022-04-15 6:16 ` Benjamin Poirier
2022-04-15 6:56 ` Wen Gong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).