diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-05-17 15:45:02 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-05-19 05:44:45 -0400 |
commit | 3335d98c69b1b09b963d09c8475c40bd8988c994 (patch) | |
tree | 0502357284327c47ab0012c444587459a720ec32 /drivers/net | |
parent | 9f8b97f888445b737ea3716ca53498663e18d971 (diff) |
fakelb: declare rwlock static
This patch moves the rwlock declarition into a static variable.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ieee802154/fakelb.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c index d5fb77678349..43370fb48cf6 100644 --- a/drivers/net/ieee802154/fakelb.c +++ b/drivers/net/ieee802154/fakelb.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <net/cfg802154.h> | 28 | #include <net/cfg802154.h> |
29 | 29 | ||
30 | static int numlbs = 2; | 30 | static int numlbs = 2; |
31 | static DEFINE_RWLOCK(fakelb_lock); | ||
31 | 32 | ||
32 | struct fakelb_phy { | 33 | struct fakelb_phy { |
33 | struct ieee802154_hw *hw; | 34 | struct ieee802154_hw *hw; |
@@ -41,7 +42,6 @@ struct fakelb_phy { | |||
41 | 42 | ||
42 | struct fakelb_priv { | 43 | struct fakelb_priv { |
43 | struct list_head list; | 44 | struct list_head list; |
44 | rwlock_t lock; | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int | 47 | static int |
@@ -79,10 +79,9 @@ static int | |||
79 | fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) | 79 | fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) |
80 | { | 80 | { |
81 | struct fakelb_phy *current_phy = hw->priv; | 81 | struct fakelb_phy *current_phy = hw->priv; |
82 | struct fakelb_priv *fake = current_phy->fake; | ||
83 | struct fakelb_phy *phy; | 82 | struct fakelb_phy *phy; |
84 | 83 | ||
85 | read_lock_bh(&fake->lock); | 84 | read_lock_bh(&fakelb_lock); |
86 | list_for_each_entry(phy, ¤t_phy->fake->list, list) { | 85 | list_for_each_entry(phy, ¤t_phy->fake->list, list) { |
87 | if (current_phy == phy) | 86 | if (current_phy == phy) |
88 | continue; | 87 | continue; |
@@ -91,7 +90,7 @@ fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb) | |||
91 | current_phy->hw->phy->current_channel) | 90 | current_phy->hw->phy->current_channel) |
92 | fakelb_hw_deliver(phy, skb); | 91 | fakelb_hw_deliver(phy, skb); |
93 | } | 92 | } |
94 | read_unlock_bh(&fake->lock); | 93 | read_unlock_bh(&fakelb_lock); |
95 | 94 | ||
96 | return 0; | 95 | return 0; |
97 | } | 96 | } |
@@ -188,9 +187,9 @@ static int fakelb_add_one(struct device *dev, struct fakelb_priv *fake) | |||
188 | if (err) | 187 | if (err) |
189 | goto err_reg; | 188 | goto err_reg; |
190 | 189 | ||
191 | write_lock_bh(&fake->lock); | 190 | write_lock_bh(&fakelb_lock); |
192 | list_add_tail(&phy->list, &fake->list); | 191 | list_add_tail(&phy->list, &fake->list); |
193 | write_unlock_bh(&fake->lock); | 192 | write_unlock_bh(&fakelb_lock); |
194 | 193 | ||
195 | return 0; | 194 | return 0; |
196 | 195 | ||
@@ -201,9 +200,9 @@ err_reg: | |||
201 | 200 | ||
202 | static void fakelb_del(struct fakelb_phy *phy) | 201 | static void fakelb_del(struct fakelb_phy *phy) |
203 | { | 202 | { |
204 | write_lock_bh(&phy->fake->lock); | 203 | write_lock_bh(&fakelb_lock); |
205 | list_del(&phy->list); | 204 | list_del(&phy->list); |
206 | write_unlock_bh(&phy->fake->lock); | 205 | write_unlock_bh(&fakelb_lock); |
207 | 206 | ||
208 | ieee802154_unregister_hw(phy->hw); | 207 | ieee802154_unregister_hw(phy->hw); |
209 | ieee802154_free_hw(phy->hw); | 208 | ieee802154_free_hw(phy->hw); |
@@ -222,7 +221,6 @@ static int fakelb_probe(struct platform_device *pdev) | |||
222 | goto err_alloc; | 221 | goto err_alloc; |
223 | 222 | ||
224 | INIT_LIST_HEAD(&priv->list); | 223 | INIT_LIST_HEAD(&priv->list); |
225 | rwlock_init(&priv->lock); | ||
226 | 224 | ||
227 | for (i = 0; i < numlbs; i++) { | 225 | for (i = 0; i < numlbs; i++) { |
228 | err = fakelb_add_one(&pdev->dev, priv); | 226 | err = fakelb_add_one(&pdev->dev, priv); |