* [PATCH] staging: rtl8723au: multiple condition with no effect - if identical to else
@ 2015-02-03 13:08 Nicholas Mc Guire
2015-02-03 13:21 ` Jes Sorensen
0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Mc Guire @ 2015-02-03 13:08 UTC (permalink / raw)
To: Larry Finger
Cc: Jes Sorensen, Greg Kroah-Hartman, Anjana Sasindran,
Roberta Dobrescu, linux-wireless, devel, linux-kernel,
Nicholas Mc Guire
A number if/else if/else branches are identical - so the condition has no
effect on the effective code and can be significantly simplified - this
patch removes the condition and the duplicated code.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
This looks like the output of some broken code-generator - unlikely someone
wrote this by hand. In any case it needs a review by someone that knows the
details of the driver.
Anyway the number of useless code repetition is potentially record breaking !
Patch was compile tested for x86_64_defconfig + CONFIG_STAGING=y
CONFIG_R8723AU=m, CONFIG_8723AU_BT_COEXIST=y
Patch is against 3.0.19-rc7 (localversoin = -next-20150203)
.../staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 60 +++-----------------
1 file changed, 8 insertions(+), 52 deletions(-)
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
index 412d8cf..73cfddd 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
@@ -7255,63 +7255,19 @@ btdm_2AntTdmaDurationAdjust(struct rtw_adapter *padapter, u8 bScoHid,
RTPRINT(FBT, BT_TRACE, ("[BTCoex], first run TdmaDurationAdjust()!!\n"));
if (bScoHid) {
if (bTxPause) {
- if (maxInterval == 1) {
- btdm_2AntPsTdma(padapter, true, 15);
- pBtdm8723->psTdmaDuAdjType = 15;
- } else if (maxInterval == 2) {
- btdm_2AntPsTdma(padapter, true, 15);
- pBtdm8723->psTdmaDuAdjType = 15;
- } else if (maxInterval == 3) {
- btdm_2AntPsTdma(padapter, true, 15);
- pBtdm8723->psTdmaDuAdjType = 15;
- } else {
- btdm_2AntPsTdma(padapter, true, 15);
- pBtdm8723->psTdmaDuAdjType = 15;
- }
+ btdm_2AntPsTdma(padapter, true, 15);
+ pBtdm8723->psTdmaDuAdjType = 15;
} else {
- if (maxInterval == 1) {
- btdm_2AntPsTdma(padapter, true, 11);
- pBtdm8723->psTdmaDuAdjType = 11;
- } else if (maxInterval == 2) {
- btdm_2AntPsTdma(padapter, true, 11);
- pBtdm8723->psTdmaDuAdjType = 11;
- } else if (maxInterval == 3) {
- btdm_2AntPsTdma(padapter, true, 11);
- pBtdm8723->psTdmaDuAdjType = 11;
- } else {
- btdm_2AntPsTdma(padapter, true, 11);
- pBtdm8723->psTdmaDuAdjType = 11;
- }
+ btdm_2AntPsTdma(padapter, true, 11);
+ pBtdm8723->psTdmaDuAdjType = 11;
}
} else {
if (bTxPause) {
- if (maxInterval == 1) {
- btdm_2AntPsTdma(padapter, true, 7);
- pBtdm8723->psTdmaDuAdjType = 7;
- } else if (maxInterval == 2) {
- btdm_2AntPsTdma(padapter, true, 7);
- pBtdm8723->psTdmaDuAdjType = 7;
- } else if (maxInterval == 3) {
- btdm_2AntPsTdma(padapter, true, 7);
- pBtdm8723->psTdmaDuAdjType = 7;
- } else {
- btdm_2AntPsTdma(padapter, true, 7);
- pBtdm8723->psTdmaDuAdjType = 7;
- }
+ btdm_2AntPsTdma(padapter, true, 7);
+ pBtdm8723->psTdmaDuAdjType = 7;
} else {
- if (maxInterval == 1) {
- btdm_2AntPsTdma(padapter, true, 3);
- pBtdm8723->psTdmaDuAdjType = 3;
- } else if (maxInterval == 2) {
- btdm_2AntPsTdma(padapter, true, 3);
- pBtdm8723->psTdmaDuAdjType = 3;
- } else if (maxInterval == 3) {
- btdm_2AntPsTdma(padapter, true, 3);
- pBtdm8723->psTdmaDuAdjType = 3;
- } else {
- btdm_2AntPsTdma(padapter, true, 3);
- pBtdm8723->psTdmaDuAdjType = 3;
- }
+ btdm_2AntPsTdma(padapter, true, 3);
+ pBtdm8723->psTdmaDuAdjType = 3;
}
}
up = 0;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8723au: multiple condition with no effect - if identical to else
2015-02-03 13:08 [PATCH] staging: rtl8723au: multiple condition with no effect - if identical to else Nicholas Mc Guire
@ 2015-02-03 13:21 ` Jes Sorensen
2015-02-03 14:31 ` Nicholas Mc Guire
0 siblings, 1 reply; 3+ messages in thread
From: Jes Sorensen @ 2015-02-03 13:21 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: Larry Finger, Greg Kroah-Hartman, Anjana Sasindran,
Roberta Dobrescu, linux-wireless, devel, linux-kernel
Nicholas Mc Guire <hofrat@osadl.org> writes:
> A number if/else if/else branches are identical - so the condition has no
> effect on the effective code and can be significantly simplified - this
> patch removes the condition and the duplicated code.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
>
> This looks like the output of some broken code-generator - unlikely someone
> wrote this by hand. In any case it needs a review by someone that knows the
> details of the driver.
>
> Anyway the number of useless code repetition is potentially record breaking !
>
> Patch was compile tested for x86_64_defconfig + CONFIG_STAGING=y
> CONFIG_R8723AU=m, CONFIG_8723AU_BT_COEXIST=y
>
> Patch is against 3.0.19-rc7 (localversoin = -next-20150203)
>
> .../staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 60 +++-----------------
> 1 file changed, 8 insertions(+), 52 deletions(-)
Why make it simple if you can make it complicated :)
I presume it's against 3.19-rc7 since a 3.0.19 would be rather obsolete.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8723au: multiple condition with no effect - if identical to else
2015-02-03 13:21 ` Jes Sorensen
@ 2015-02-03 14:31 ` Nicholas Mc Guire
0 siblings, 0 replies; 3+ messages in thread
From: Nicholas Mc Guire @ 2015-02-03 14:31 UTC (permalink / raw)
To: Jes Sorensen
Cc: Nicholas Mc Guire, Larry Finger, Greg Kroah-Hartman,
Anjana Sasindran, Roberta Dobrescu, linux-wireless, devel,
linux-kernel
On Tue, 03 Feb 2015, Jes Sorensen wrote:
> Nicholas Mc Guire <hofrat@osadl.org> writes:
> > A number if/else if/else branches are identical - so the condition has no
> > effect on the effective code and can be significantly simplified - this
> > patch removes the condition and the duplicated code.
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> > ---
> >
> > This looks like the output of some broken code-generator - unlikely someone
> > wrote this by hand. In any case it needs a review by someone that knows the
> > details of the driver.
> >
> > Anyway the number of useless code repetition is potentially record breaking !
> >
> > Patch was compile tested for x86_64_defconfig + CONFIG_STAGING=y
> > CONFIG_R8723AU=m, CONFIG_8723AU_BT_COEXIST=y
> >
> > Patch is against 3.0.19-rc7 (localversoin = -next-20150203)
> >
> > .../staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 60 +++-----------------
> > 1 file changed, 8 insertions(+), 52 deletions(-)
>
> Why make it simple if you can make it complicated :)
>
> I presume it's against 3.19-rc7 since a 3.0.19 would be rather obsolete.
>
yes - thats a typo - sorry for that.
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-03 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 13:08 [PATCH] staging: rtl8723au: multiple condition with no effect - if identical to else Nicholas Mc Guire
2015-02-03 13:21 ` Jes Sorensen
2015-02-03 14:31 ` Nicholas Mc Guire
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).