generic: 5.15: replace ramips AR8033 fiber patch with 5.18 patches
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 765-v5.17-02-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 --- a/net/dsa/slave.c
18 +++ b/net/dsa/slave.c
19 @@ -1988,14 +1988,12 @@ int dsa_slave_create(struct dsa_port *po
20 }
21
22 rtnl_lock();
23 +
24 ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
25 - rtnl_unlock();
26 if (ret && ret != -EOPNOTSUPP)
27 dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
28 ret, ETH_DATA_LEN, port->index);
29
30 - rtnl_lock();
31 -
32 ret = register_netdevice(slave_dev);
33 if (ret) {
34 netdev_err(master, "error %d registering interface %s\n",