Skip to content

Commit

Permalink
net: rtnetlink: use netif_oper_up instead of open code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Juhee Kang authored and Jakub Kicinski committed Sep 2, 2022
1 parent 75aad41 commit abbc792
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit abbc792

Please sign in to comment.