* [PATCH] stmmac: platform: Remove unnecessary conditions
@ 2019-12-11 10:31 Xu Wang
2019-12-14 20:10 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Xu Wang @ 2019-12-11 10:31 UTC (permalink / raw)
To: peppe.cavallaro
Cc: alexandre.torgue, joabreu, davem, mcoquelin.stm32, netdev,
linux-stm32, linux-arm-kernel, linux-kernel
Remove conditions where if and else branch are identical.
This issue is detected by coccinelle.
Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index bedaff0..1d26691 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -229,8 +229,6 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WFQ;
else if (of_property_read_bool(tx_node, "snps,tx-sched-dwrr"))
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_DWRR;
- else if (of_property_read_bool(tx_node, "snps,tx-sched-sp"))
- plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
else
plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] stmmac: platform: Remove unnecessary conditions
2019-12-11 10:31 [PATCH] stmmac: platform: Remove unnecessary conditions Xu Wang
@ 2019-12-14 20:10 ` Jakub Kicinski
2019-12-16 9:22 ` Jose Abreu
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2019-12-14 20:10 UTC (permalink / raw)
To: Xu Wang
Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem,
mcoquelin.stm32, netdev, linux-stm32, linux-arm-kernel,
linux-kernel
On Wed, 11 Dec 2019 10:31:24 +0000, Xu Wang wrote:
> Remove conditions where if and else branch are identical.
> This issue is detected by coccinelle.
>
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index bedaff0..1d26691 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -229,8 +229,6 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
> plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WFQ;
> else if (of_property_read_bool(tx_node, "snps,tx-sched-dwrr"))
> plat->tx_sched_algorithm = MTL_TX_ALGORITHM_DWRR;
> - else if (of_property_read_bool(tx_node, "snps,tx-sched-sp"))
> - plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
> else
> plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
>
Thanks for the patch but in this case it looks like this code is
intentionally written this way to enumerate all options. Maintainers -
please speak up if you prefer to have the patch applied, otherwise
I'm dropping it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] stmmac: platform: Remove unnecessary conditions
2019-12-14 20:10 ` Jakub Kicinski
@ 2019-12-16 9:22 ` Jose Abreu
0 siblings, 0 replies; 3+ messages in thread
From: Jose Abreu @ 2019-12-16 9:22 UTC (permalink / raw)
To: Jakub Kicinski, Xu Wang
Cc: peppe.cavallaro, alexandre.torgue, davem, mcoquelin.stm32,
netdev, linux-stm32, linux-arm-kernel, linux-kernel
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Dec/14/2019, 20:10:49 (UTC+00:00)
> On Wed, 11 Dec 2019 10:31:24 +0000, Xu Wang wrote:
> > Remove conditions where if and else branch are identical.
> > This issue is detected by coccinelle.
> >
> > Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
> > ---
> > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > index bedaff0..1d26691 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> > @@ -229,8 +229,6 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
> > plat->tx_sched_algorithm = MTL_TX_ALGORITHM_WFQ;
> > else if (of_property_read_bool(tx_node, "snps,tx-sched-dwrr"))
> > plat->tx_sched_algorithm = MTL_TX_ALGORITHM_DWRR;
> > - else if (of_property_read_bool(tx_node, "snps,tx-sched-sp"))
> > - plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
> > else
> > plat->tx_sched_algorithm = MTL_TX_ALGORITHM_SP;
> >
>
> Thanks for the patch but in this case it looks like this code is
> intentionally written this way to enumerate all options. Maintainers -
> please speak up if you prefer to have the patch applied, otherwise
> I'm dropping it.
I rather prefer having all options clearly enumerated so I agree with
Jakub on this.
---
Thanks,
Jose Miguel Abreu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-16 9:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 10:31 [PATCH] stmmac: platform: Remove unnecessary conditions Xu Wang
2019-12-14 20:10 ` Jakub Kicinski
2019-12-16 9:22 ` Jose Abreu
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).