aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-28 13:21:31 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-10-28 18:19:09 -0400
commit74457641558baded3c9f05bc3fb81293a2c02b2e (patch)
tree1c44bfe9006769028481efa56766b7e0de121a18 /net
parentc7420c367d63a7e1414e010afb52c3837fd9134e (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/mac802154/iface.c7
1 files changed, 4 insertions, 3 deletions
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)
166 166
167 set_bit(SDATA_STATE_RUNNING, &sdata->state); 167 set_bit(SDATA_STATE_RUNNING, &sdata->state);
168 168
169 if (local->open_count++ == 0) { 169 if (!local->open_count) {
170 res = drv_start(local); 170 res = drv_start(local);
171 WARN_ON(res); 171 WARN_ON(res);
172 if (res) 172 if (res)
173 goto err; 173 goto err;
174 } 174 }
175 175
176 local->open_count++;
176 netif_start_queue(dev); 177 netif_start_queue(dev);
177 return 0; 178 return 0;
178err: 179err:
179 /* might already be clear but that doesn't matter */ 180 /* might already be clear but that doesn't matter */
180 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 181 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
181 sdata->local->open_count--;
182 182
183 return res; 183 return res;
184} 184}
@@ -252,10 +252,11 @@ static int mac802154_slave_close(struct net_device *dev)
252 ASSERT_RTNL(); 252 ASSERT_RTNL();
253 253
254 netif_stop_queue(dev); 254 netif_stop_queue(dev);
255 local->open_count--;
255 256
256 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 257 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
257 258
258 if (!--local->open_count) 259 if (!local->open_count)
259 drv_stop(local); 260 drv_stop(local);
260 261
261 return 0; 262 return 0;