[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510025755.19047-1-xiaolinkui@kylinos.cn>
Date: Tue, 10 May 2022 10:57:55 +0800
From: xiaolinkui <xiaolinkui@...il.com>
To: jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, intel-wired-lan@...ts.osuosl.org,
netdev@...r.kernel.org, Linkui Xiao <xiaolinkui@...inos.cn>
Subject: [PATCH] igb: Convert a series of if statements to switch case
From: Linkui Xiao<xiaolinkui@...inos.cn>
Convert a series of if statements that handle different events to
a switch case statement to simplify the code.
Signed-off-by: Linkui Xiao<xiaolinkui@...inos.cn>
---
drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 34b33b21e0dc..4ce0718eeff6 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4588,13 +4588,17 @@ static inline void igb_set_vf_vlan_strip(struct igb_adapter *adapter,
struct e1000_hw *hw = &adapter->hw;
u32 val, reg;
- if (hw->mac.type < e1000_82576)
+ switch (hw->mac.type) {
+ case e1000_undefined:
+ case e1000_82575:
return;
-
- if (hw->mac.type == e1000_i350)
+ case e1000_i350:
reg = E1000_DVMOLR(vfn);
- else
+ break;
+ default:
reg = E1000_VMOLR(vfn);
+ break;
+ }
val = rd32(reg);
if (enable)
--
2.17.1
Powered by blists - more mailing lists