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 <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
c7420c367d
commit
7445764155
1 changed files with 4 additions and 3 deletions
|
@ -166,19 +166,19 @@ static int mac802154_slave_open(struct net_device *dev)
|
||||||
|
|
||||||
set_bit(SDATA_STATE_RUNNING, &sdata->state);
|
set_bit(SDATA_STATE_RUNNING, &sdata->state);
|
||||||
|
|
||||||
if (local->open_count++ == 0) {
|
if (!local->open_count) {
|
||||||
res = drv_start(local);
|
res = drv_start(local);
|
||||||
WARN_ON(res);
|
WARN_ON(res);
|
||||||
if (res)
|
if (res)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local->open_count++;
|
||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
/* might already be clear but that doesn't matter */
|
/* might already be clear but that doesn't matter */
|
||||||
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
|
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
|
||||||
sdata->local->open_count--;
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -252,10 +252,11 @@ static int mac802154_slave_close(struct net_device *dev)
|
||||||
ASSERT_RTNL();
|
ASSERT_RTNL();
|
||||||
|
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
local->open_count--;
|
||||||
|
|
||||||
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
|
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
|
||||||
|
|
||||||
if (!--local->open_count)
|
if (!local->open_count)
|
||||||
drv_stop(local);
|
drv_stop(local);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue