diff options
Diffstat (limited to 'net/mac802154/mib.c')
-rw-r--r-- | net/mac802154/mib.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c index f47781ab0ccc..8ded97cf1c33 100644 --- a/net/mac802154/mib.c +++ b/net/mac802154/mib.c | |||
@@ -159,6 +159,15 @@ void mac802154_dev_set_pan_id(struct net_device *dev, u16 val) | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | u8 mac802154_dev_get_dsn(const struct net_device *dev) | ||
163 | { | ||
164 | struct mac802154_sub_if_data *priv = netdev_priv(dev); | ||
165 | |||
166 | BUG_ON(dev->type != ARPHRD_IEEE802154); | ||
167 | |||
168 | return priv->dsn++; | ||
169 | } | ||
170 | |||
162 | static void phy_chan_notify(struct work_struct *work) | 171 | static void phy_chan_notify(struct work_struct *work) |
163 | { | 172 | { |
164 | struct phy_chan_notify_work *nw = container_of(work, | 173 | struct phy_chan_notify_work *nw = container_of(work, |
@@ -167,9 +176,15 @@ static void phy_chan_notify(struct work_struct *work) | |||
167 | struct mac802154_sub_if_data *priv = netdev_priv(nw->dev); | 176 | struct mac802154_sub_if_data *priv = netdev_priv(nw->dev); |
168 | int res; | 177 | int res; |
169 | 178 | ||
179 | mutex_lock(&priv->hw->phy->pib_lock); | ||
170 | res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan); | 180 | res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan); |
171 | if (res) | 181 | if (res) |
172 | pr_debug("set_channel failed\n"); | 182 | pr_debug("set_channel failed\n"); |
183 | else { | ||
184 | priv->hw->phy->current_channel = priv->chan; | ||
185 | priv->hw->phy->current_page = priv->page; | ||
186 | } | ||
187 | mutex_unlock(&priv->hw->phy->pib_lock); | ||
173 | 188 | ||
174 | kfree(nw); | 189 | kfree(nw); |
175 | } | 190 | } |
@@ -186,8 +201,11 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) | |||
186 | priv->chan = chan; | 201 | priv->chan = chan; |
187 | spin_unlock_bh(&priv->mib_lock); | 202 | spin_unlock_bh(&priv->mib_lock); |
188 | 203 | ||
204 | mutex_lock(&priv->hw->phy->pib_lock); | ||
189 | if (priv->hw->phy->current_channel != priv->chan || | 205 | if (priv->hw->phy->current_channel != priv->chan || |
190 | priv->hw->phy->current_page != priv->page) { | 206 | priv->hw->phy->current_page != priv->page) { |
207 | mutex_unlock(&priv->hw->phy->pib_lock); | ||
208 | |||
191 | work = kzalloc(sizeof(*work), GFP_ATOMIC); | 209 | work = kzalloc(sizeof(*work), GFP_ATOMIC); |
192 | if (!work) | 210 | if (!work) |
193 | return; | 211 | return; |
@@ -195,5 +213,6 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) | |||
195 | INIT_WORK(&work->work, phy_chan_notify); | 213 | INIT_WORK(&work->work, phy_chan_notify); |
196 | work->dev = dev; | 214 | work->dev = dev; |
197 | queue_work(priv->hw->dev_workqueue, &work->work); | 215 | queue_work(priv->hw->dev_workqueue, &work->work); |
198 | } | 216 | } else |
217 | mutex_unlock(&priv->hw->phy->pib_lock); | ||
199 | } | 218 | } |