diff options
author | Ying Xue <ying.xue@windriver.com> | 2013-06-17 10:54:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-17 15:53:01 -0700 |
commit | 2537af9dcabbdd6c93c041a955d3a9ae42c0c008 (patch) | |
tree | 5130503fa11ba0c7ec74174165ba332ed513b88a /net/tipc/eth_media.c | |
parent | 126c0524648631a0f6fba4d016586b236209fe6f (diff) | |
download | op-kernel-dev-2537af9dcabbdd6c93c041a955d3a9ae42c0c008.zip op-kernel-dev-2537af9dcabbdd6c93c041a955d3a9ae42c0c008.tar.gz |
tipc: remove dev_base_lock use from enable_bearer
Convert enable_bearer() to RCU locking with dev_get_by_name().
Based on a similar changeset in commit 840a185d ["aoe: remove
dev_base_lock use from aoecmd_cfg_pkts()"] -- quoting that:
"dev_base_lock is the legacy way to lock the device list,
and is planned to disappear. (writers hold RTNL, readers
hold RCU lock)"
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/eth_media.c')
-rw-r--r-- | net/tipc/eth_media.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index c1aa37f..40ea40c 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -162,8 +162,7 @@ static void setup_bearer(struct work_struct *work) */ static int enable_bearer(struct tipc_bearer *tb_ptr) { - struct net_device *dev = NULL; - struct net_device *pdev = NULL; + struct net_device *dev; struct eth_bearer *eb_ptr = ð_bearers[0]; struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; @@ -178,15 +177,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) } /* Find device with specified name */ - read_lock(&dev_base_lock); - for_each_netdev(&init_net, pdev) { - if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) { - dev = pdev; - dev_hold(dev); - break; - } - } - read_unlock(&dev_base_lock); + dev = dev_get_by_name(&init_net, driver_name); if (!dev) return -ENODEV; |