summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuhee Kang <claudiajkang@gmail.com>2022-08-31 14:58:45 +0200
committerJakub Kicinski <kuba@kernel.org>2022-09-02 05:09:23 +0200
commitabbc79280abc5e57fc52a7671d1388f1f54c946f (patch)
tree908ddf7577269ceb6103597565b0818e9c63cc6e
parentnet: sched: etf: remove true check in etf_enable_offload() (diff)
downloadlinux-abbc79280abc5e57fc52a7671d1388f1f54c946f.tar.xz
linux-abbc79280abc5e57fc52a7671d1388f1f54c946f.zip
net: rtnetlink: use netif_oper_up instead of open code
The open code is defined as a new helper function(netif_oper_up) on netdev.h, the code is dev->operstate == IF_OPER_UP || dev->operstate == IF_OPER_UNKNOWN. Thus, replace the open code to netif_oper_up. This patch doesn't change logic. Signed-off-by: Juhee Kang <claudiajkang@gmail.com> Link: https://lore.kernel.org/r/20220831125845.1333-1-claudiajkang@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/core/rtnetlink.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4b5b15c684ed..f5e87fe57c83 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -866,14 +866,12 @@ static void set_operstate(struct net_device *dev, unsigned char transition)
break;
case IF_OPER_TESTING:
- if (operstate == IF_OPER_UP ||
- operstate == IF_OPER_UNKNOWN)
+ if (netif_oper_up(dev))
operstate = IF_OPER_TESTING;
break;
case IF_OPER_DORMANT:
- if (operstate == IF_OPER_UP ||
- operstate == IF_OPER_UNKNOWN)
+ if (netif_oper_up(dev))
operstate = IF_OPER_DORMANT;
break;
}