diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-26 04:37:03 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-26 12:24:02 -0400 |
commit | e89e45f22a382d14d5e2362cd4f4d12d77ee4935 (patch) | |
tree | d3ef421aeba8b49f75138d9359355e8f0bbd4b16 /net/mac802154 | |
parent | fe24371d6645b766c59ec664c59d0a9c310ad455 (diff) |
mac802154: tx: squash multiple dereferencing
This patch introduce some new stack variables to avoid multiple
dereferencing inside the xmit worker function.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/tx.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 513e760a8557..d0ceb46134d9 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -48,37 +48,38 @@ static inline struct wpan_xmit_cb *wpan_xmit_cb(const struct sk_buff *skb) | |||
48 | static void mac802154_xmit_worker(struct work_struct *work) | 48 | static void mac802154_xmit_worker(struct work_struct *work) |
49 | { | 49 | { |
50 | struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work); | 50 | struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work); |
51 | struct ieee802154_local *local = cb->local; | ||
51 | struct ieee802154_sub_if_data *sdata; | 52 | struct ieee802154_sub_if_data *sdata; |
53 | struct sk_buff *skb = cb->skb; | ||
52 | int res; | 54 | int res; |
53 | 55 | ||
54 | mutex_lock(&cb->local->phy->pib_lock); | 56 | mutex_lock(&local->phy->pib_lock); |
55 | if (cb->local->phy->current_channel != cb->chan || | 57 | if (local->phy->current_channel != cb->chan || |
56 | cb->local->phy->current_page != cb->page) { | 58 | local->phy->current_page != cb->page) { |
57 | res = cb->local->ops->set_channel(&cb->local->hw, cb->page, | 59 | res = local->ops->set_channel(&local->hw, cb->page, cb->chan); |
58 | cb->chan); | ||
59 | if (res) { | 60 | if (res) { |
60 | pr_debug("set_channel failed\n"); | 61 | pr_debug("set_channel failed\n"); |
61 | goto out; | 62 | goto out; |
62 | } | 63 | } |
63 | 64 | ||
64 | cb->local->phy->current_channel = cb->chan; | 65 | local->phy->current_channel = cb->chan; |
65 | cb->local->phy->current_page = cb->page; | 66 | local->phy->current_page = cb->page; |
66 | } | 67 | } |
67 | 68 | ||
68 | res = cb->local->ops->xmit(&cb->local->hw, cb->skb); | 69 | res = local->ops->xmit(&local->hw, skb); |
69 | if (res) | 70 | if (res) |
70 | pr_debug("transmission failed\n"); | 71 | pr_debug("transmission failed\n"); |
71 | 72 | ||
72 | out: | 73 | out: |
73 | mutex_unlock(&cb->local->phy->pib_lock); | 74 | mutex_unlock(&local->phy->pib_lock); |
74 | 75 | ||
75 | /* Restart the netif queue on each sub_if_data object. */ | 76 | /* Restart the netif queue on each sub_if_data object. */ |
76 | rcu_read_lock(); | 77 | rcu_read_lock(); |
77 | list_for_each_entry_rcu(sdata, &cb->local->interfaces, list) | 78 | list_for_each_entry_rcu(sdata, &local->interfaces, list) |
78 | netif_wake_queue(sdata->dev); | 79 | netif_wake_queue(sdata->dev); |
79 | rcu_read_unlock(); | 80 | rcu_read_unlock(); |
80 | 81 | ||
81 | dev_kfree_skb(cb->skb); | 82 | dev_kfree_skb(skb); |
82 | } | 83 | } |
83 | 84 | ||
84 | static netdev_tx_t mac802154_tx(struct ieee802154_local *local, | 85 | static netdev_tx_t mac802154_tx(struct ieee802154_local *local, |