]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: merge rtnl_lock sections in dsa_slave_create
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 5 Jan 2022 23:11:13 +0000 (01:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Jan 2022 11:59:09 +0000 (11:59 +0000)
Currently dsa_slave_create() has two sequences of rtnl_lock/rtnl_unlock
in a row. Remove the rtnl_unlock() and rtnl_lock() in between, such that
the operation can execute slighly faster.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c

index 88bcdba92fa72efa845854ee93a97b4a44ed617a..22241afcac815a2046bbae2781e9625e3d3b8af5 100644 (file)
@@ -2022,14 +2022,12 @@ int dsa_slave_create(struct dsa_port *port)
        }
 
        rtnl_lock();
+
        ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN);
-       rtnl_unlock();
        if (ret && ret != -EOPNOTSUPP)
                dev_warn(ds->dev, "nonfatal error %d setting MTU to %d on port %d\n",
                         ret, ETH_DATA_LEN, port->index);
 
-       rtnl_lock();
-
        ret = register_netdevice(slave_dev);
        if (ret) {
                netdev_err(master, "error %d registering interface %s\n",