diff options
Diffstat (limited to 'net/mac802154/mib.c')
-rw-r--r-- | net/mac802154/mib.c | 55 |
1 files changed, 9 insertions, 46 deletions
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c index 3fbc217dbdcc..0184fced2f62 100644 --- a/net/mac802154/mib.c +++ b/net/mac802154/mib.c @@ -26,11 +26,6 @@ #include "ieee802154_i.h" #include "driver-ops.h" -struct phy_chan_notify_work { - struct work_struct work; - struct net_device *dev; -}; - struct hw_addr_filt_notify_work { struct work_struct work; struct net_device *dev; @@ -161,54 +156,22 @@ u8 mac802154_dev_get_dsn(const struct net_device *dev) return sdata->dsn++; } -static void phy_chan_notify(struct work_struct *work) -{ - struct phy_chan_notify_work *nw = container_of(work, - struct phy_chan_notify_work, work); - struct net_device *dev = nw->dev; - struct ieee802154_local *local = mac802154_slave_get_priv(dev); - struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); - int res; - - mutex_lock(&sdata->local->phy->pib_lock); - res = drv_set_channel(local, sdata->page, sdata->chan); - if (res) { - pr_debug("set_channel failed\n"); - } else { - sdata->local->phy->current_channel = sdata->chan; - sdata->local->phy->current_page = sdata->page; - } - mutex_unlock(&sdata->local->phy->pib_lock); - - kfree(nw); -} - void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) { struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); - struct phy_chan_notify_work *work; + struct ieee802154_local *local = sdata->local; + int res; BUG_ON(dev->type != ARPHRD_IEEE802154); - spin_lock_bh(&sdata->mib_lock); - sdata->page = page; - sdata->chan = chan; - spin_unlock_bh(&sdata->mib_lock); - - mutex_lock(&sdata->local->phy->pib_lock); - if (sdata->local->phy->current_channel != sdata->chan || - sdata->local->phy->current_page != sdata->page) { - mutex_unlock(&sdata->local->phy->pib_lock); - - work = kzalloc(sizeof(*work), GFP_ATOMIC); - if (!work) - return; - - INIT_WORK(&work->work, phy_chan_notify); - work->dev = dev; - queue_work(sdata->local->workqueue, &work->work); + res = drv_set_channel(local, page, chan); + if (res) { + pr_debug("set_channel failed\n"); } else { - mutex_unlock(&sdata->local->phy->pib_lock); + mutex_lock(&local->phy->pib_lock); + local->phy->current_channel = chan; + local->phy->current_page = page; + mutex_unlock(&local->phy->pib_lock); } } |