summaryrefslogtreecommitdiffstats
path: root/net/wimax/stack.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-06 16:42:19 -0700
committerDavid S. Miller <davem@davemloft.net>2009-05-06 16:42:19 -0700
commita860820dce09080dc3df05064b659e931ff35a29 (patch)
tree3a13abb743ed5235313f41f4cf33eb190d7d476a /net/wimax/stack.c
parent457ca7bb6bdf39d0832d3f88c65fa367a3b20de6 (diff)
parent94c7f2d49521b0bb3ab91cbeb3518ac34355d47f (diff)
Merge branch 'linux-2.6.30.y' of git://git.kernel.org/pub/scm/linux/kernel/git/inaky/wimax
Diffstat (limited to 'net/wimax/stack.c')
-rw-r--r--net/wimax/stack.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index a0ee76b5251..933e1422b09 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -338,8 +338,21 @@ out:
*/
void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
{
+ /*
+ * A driver cannot take the wimax_dev out of the
+ * __WIMAX_ST_NULL state unless by calling wimax_dev_add(). If
+ * the wimax_dev's state is still NULL, we ignore any request
+ * to change its state because it means it hasn't been yet
+ * registered.
+ *
+ * There is no need to complain about it, as routines that
+ * call this might be shared from different code paths that
+ * are called before or after wimax_dev_add() has done its
+ * job.
+ */
mutex_lock(&wimax_dev->mutex);
- __wimax_state_change(wimax_dev, new_state);
+ if (wimax_dev->state > __WIMAX_ST_NULL)
+ __wimax_state_change(wimax_dev, new_state);
mutex_unlock(&wimax_dev->mutex);
return;
}
@@ -376,7 +389,7 @@ EXPORT_SYMBOL_GPL(wimax_state_get);
void wimax_dev_init(struct wimax_dev *wimax_dev)
{
INIT_LIST_HEAD(&wimax_dev->id_table_node);
- __wimax_state_set(wimax_dev, WIMAX_ST_UNINITIALIZED);
+ __wimax_state_set(wimax_dev, __WIMAX_ST_NULL);
mutex_init(&wimax_dev->mutex);
mutex_init(&wimax_dev->mutex_reset);
}