All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ath11k: simplify if-if to if-else
@ 2022-04-15 12:58 ` Yihao Han
  0 siblings, 0 replies; 6+ messages in thread
From: Yihao Han @ 2022-04-15 12:58 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
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

Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
v2:edit commit message
---
 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] 6+ messages in thread

* [PATCH v2] ath11k: simplify if-if to if-else
@ 2022-04-15 12:58 ` Yihao Han
  0 siblings, 0 replies; 6+ messages in thread
From: Yihao Han @ 2022-04-15 12:58 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
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

Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
v2:edit commit message
---
 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


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath11k: simplify if-if to if-else
  2022-04-15 12:58 ` Yihao Han
@ 2022-04-15 23:02   ` Jeff Johnson
  -1 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2022-04-15 23:02 UTC (permalink / raw)
  To: Yihao Han, Kalle Valo, David S. Miller, Jakub Kicinski,
	Paolo Abeni, ath11k, linux-wireless, netdev, linux-kernel
  Cc: kernel

On 4/15/2022 5:58 AM, Yihao Han wrote:
> Replace `if (!ab->is_reset)` with `else` for simplification
> 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

why are you referring to braces when your patch has nothing to do with 
braces?

changing if (foo) X;if (!foo) Y; to if (foo) X else Y; is not a design 
pattern referenced in the coding style

> 
> Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
> v2:edit commit message
> ---
>   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);
>   }
>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath11k: simplify if-if to if-else
@ 2022-04-15 23:02   ` Jeff Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Johnson @ 2022-04-15 23:02 UTC (permalink / raw)
  To: Yihao Han, Kalle Valo, David S. Miller, Jakub Kicinski,
	Paolo Abeni, ath11k, linux-wireless, netdev, linux-kernel
  Cc: kernel

On 4/15/2022 5:58 AM, Yihao Han wrote:
> Replace `if (!ab->is_reset)` with `else` for simplification
> 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

why are you referring to braces when your patch has nothing to do with 
braces?

changing if (foo) X;if (!foo) Y; to if (foo) X else Y; is not a design 
pattern referenced in the coding style

> 
> Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
> v2:edit commit message
> ---
>   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);
>   }
>   


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath11k: simplify if-if to if-else
  2022-04-15 23:02   ` Jeff Johnson
@ 2022-04-16  1:50     ` Benjamin Poirier
  -1 siblings, 0 replies; 6+ messages in thread
From: Benjamin Poirier @ 2022-04-16  1:50 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: Yihao Han, Kalle Valo, David S. Miller, Jakub Kicinski,
	Paolo Abeni, ath11k, linux-wireless, netdev, linux-kernel,
	kernel

On 2022-04-15 16:02 -0700, Jeff Johnson wrote:
> On 4/15/2022 5:58 AM, Yihao Han wrote:
> > Replace `if (!ab->is_reset)` with `else` for simplification
> > 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
> 
> why are you referring to braces when your patch has nothing to do with
> braces?
> 
> changing if (foo) X;if (!foo) Y; to if (foo) X else Y; is not a design
> pattern referenced in the coding style
> 
> > 
> > Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>

I did not suggest this change. Please remove this tag.

> > Signed-off-by: Yihao Han <hanyihao@vivo.com>
> > ---
> > v2:edit commit message
> > ---
> >   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);
> >   }
> 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] ath11k: simplify if-if to if-else
@ 2022-04-16  1:50     ` Benjamin Poirier
  0 siblings, 0 replies; 6+ messages in thread
From: Benjamin Poirier @ 2022-04-16  1:50 UTC (permalink / raw)
  To: Jeff Johnson
  Cc: Yihao Han, Kalle Valo, David S. Miller, Jakub Kicinski,
	Paolo Abeni, ath11k, linux-wireless, netdev, linux-kernel,
	kernel

On 2022-04-15 16:02 -0700, Jeff Johnson wrote:
> On 4/15/2022 5:58 AM, Yihao Han wrote:
> > Replace `if (!ab->is_reset)` with `else` for simplification
> > 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
> 
> why are you referring to braces when your patch has nothing to do with
> braces?
> 
> changing if (foo) X;if (!foo) Y; to if (foo) X else Y; is not a design
> pattern referenced in the coding style
> 
> > 
> > Suggested-by: Benjamin Poirier <benjamin.poirier@gmail.com>

I did not suggest this change. Please remove this tag.

> > Signed-off-by: Yihao Han <hanyihao@vivo.com>
> > ---
> > v2:edit commit message
> > ---
> >   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);
> >   }
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-16  2:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 12:58 [PATCH v2] ath11k: simplify if-if to if-else Yihao Han
2022-04-15 12:58 ` Yihao Han
2022-04-15 23:02 ` Jeff Johnson
2022-04-15 23:02   ` Jeff Johnson
2022-04-16  1:50   ` Benjamin Poirier
2022-04-16  1:50     ` Benjamin Poirier

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.