c383bd93fbcb0ebc23c64f6a60408ca3c9993277
[openwrt/staging/dedeckeh.git] / target / linux / generic / backport-5.15 / 765-2-net-next-net-dsa-merge-rtnl_lock-sections-in-dsa_slave_create.patch
1 From e31dbd3b6aba585231cd84a87adeb22e7c6a8c19 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Thu, 6 Jan 2022 01:11:13 +0200
4 Subject: [PATCH 2/6] net: dsa: merge rtnl_lock sections in dsa_slave_create
5
6 Currently dsa_slave_create() has two sequences of rtnl_lock/rtnl_unlock
7 in a row. Remove the rtnl_unlock() and rtnl_lock() in between, such that
8 the operation can execute slighly faster.
9
10 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
11 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14 net/dsa/slave.c | 4 +---
15 1 file changed, 1 insertion(+), 3 deletions(-)
16
17 diff --git a/net/dsa/slave.c b/net/dsa/slave.c
18 index 88bcdba92fa7..22241afcac81 100644
19 --- a/net/dsa/slave.c
20 +++ b/net/dsa/slave.c
21 @@ -2022,14 +2022,12 @@ int dsa_slave_create(struct dsa_port *port)
22 }
23
24 rtnl_lock();
25 +
26 ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
27 - rtnl_unlock();
28 if (ret && ret != -EOPNOTSUPP)
29 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
30 ret, ETH_DATA_LEN, port->index);
31
32 - rtnl_lock();
33 -
34 ret = register_netdevice(slave_dev);
35 if (ret) {
36 netdev_err(master, "error %d registering interface %s\n",
37 --
38 2.34.1
39