From: Alexander Aring Date: Tue, 28 Oct 2014 17:21:31 +0000 (+0100) Subject: mac802154: cleanup open count handling X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=74457641558baded3c9f05bc3fb81293a2c02b2e;p=openwrt%2Fstaging%2Fblogic.git mac802154: cleanup open count handling This patch cleanups the open_count variable increment in open and close calls of netdev. Signed-off-by: Alexander Aring Signed-off-by: Marcel Holtmann --- diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index 1c0274ed9370..c0bf5f9b9953 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -166,19 +166,19 @@ static int mac802154_slave_open(struct net_device *dev) set_bit(SDATA_STATE_RUNNING, &sdata->state); - if (local->open_count++ == 0) { + if (!local->open_count) { res = drv_start(local); WARN_ON(res); if (res) goto err; } + local->open_count++; netif_start_queue(dev); return 0; err: /* might already be clear but that doesn't matter */ clear_bit(SDATA_STATE_RUNNING, &sdata->state); - sdata->local->open_count--; return res; } @@ -252,10 +252,11 @@ static int mac802154_slave_close(struct net_device *dev) ASSERT_RTNL(); netif_stop_queue(dev); + local->open_count--; clear_bit(SDATA_STATE_RUNNING, &sdata->state); - if (!--local->open_count) + if (!local->open_count) drv_stop(local); return 0;