iface.c (a543c5989d7711d984608f4e12a73218642ca865) iface.c (0ea3da64fa602efa0a89502eefdb396be84d2eba)
1/*
2 * Copyright 2007-2012 Siemens AG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 142 unchanged lines hidden (view full) ---

151 int res = 0;
152
153 ASSERT_RTNL();
154
155 if (sdata->type == IEEE802154_DEV_WPAN) {
156 mutex_lock(&sdata->local->iflist_mtx);
157 list_for_each_entry(subif, &sdata->local->interfaces, list) {
158 if (subif != sdata && subif->type == sdata->type &&
1/*
2 * Copyright 2007-2012 Siemens AG
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,

--- 142 unchanged lines hidden (view full) ---

151 int res = 0;
152
153 ASSERT_RTNL();
154
155 if (sdata->type == IEEE802154_DEV_WPAN) {
156 mutex_lock(&sdata->local->iflist_mtx);
157 list_for_each_entry(subif, &sdata->local->interfaces, list) {
158 if (subif != sdata && subif->type == sdata->type &&
159 subif->running) {
159 ieee802154_sdata_running(subif)) {
160 mutex_unlock(&sdata->local->iflist_mtx);
161 return -EBUSY;
162 }
163 }
164 mutex_unlock(&sdata->local->iflist_mtx);
165 }
166
160 mutex_unlock(&sdata->local->iflist_mtx);
161 return -EBUSY;
162 }
163 }
164 mutex_unlock(&sdata->local->iflist_mtx);
165 }
166
167 mutex_lock(&sdata->local->iflist_mtx);
168 sdata->running = true;
169 mutex_unlock(&sdata->local->iflist_mtx);
167 set_bit(SDATA_STATE_RUNNING, &sdata->state);
170
171 if (local->open_count++ == 0) {
172 res = drv_start(local);
173 WARN_ON(res);
174 if (res)
175 goto err;
176 }
177
178 netif_start_queue(dev);
179 return 0;
180err:
168
169 if (local->open_count++ == 0) {
170 res = drv_start(local);
171 WARN_ON(res);
172 if (res)
173 goto err;
174 }
175
176 netif_start_queue(dev);
177 return 0;
178err:
179 /* might already be clear but that doesn't matter */
180 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
181 sdata->local->open_count--;
182
183 return res;
184}
185
186static int mac802154_wpan_open(struct net_device *dev)
187{
188 int rc;

--- 59 unchanged lines hidden (view full) ---

248{
249 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
250 struct ieee802154_local *local = sdata->local;
251
252 ASSERT_RTNL();
253
254 netif_stop_queue(dev);
255
181 sdata->local->open_count--;
182
183 return res;
184}
185
186static int mac802154_wpan_open(struct net_device *dev)
187{
188 int rc;

--- 59 unchanged lines hidden (view full) ---

248{
249 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
250 struct ieee802154_local *local = sdata->local;
251
252 ASSERT_RTNL();
253
254 netif_stop_queue(dev);
255
256 mutex_lock(&sdata->local->iflist_mtx);
257 sdata->running = false;
258 mutex_unlock(&sdata->local->iflist_mtx);
256 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
259
260 if (!--local->open_count)
261 drv_stop(local);
262
263 return 0;
264}
265
266static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,

--- 201 unchanged lines hidden ---
257
258 if (!--local->open_count)
259 drv_stop(local);
260
261 return 0;
262}
263
264static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,

--- 201 unchanged lines hidden ---