diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-25 11:16:39 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-25 15:55:38 -0400 |
commit | 60741361c3ca229a1dbb18e05d11e97b7ea75d69 (patch) | |
tree | 71194fea29b7c5a5f21344fc5046c9464df55f46 | |
parent | d98be45b3657fc233f5a098279a4e42ab6f0fa4f (diff) |
mac802154: introduce hw_to_local function
This patch replace the mac802154_to_priv macro with a static inline
function named hw_to_local. This brings a similar naming convention like
mac80211 stack.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/mac802154/ieee802154_i.h | 8 | ||||
-rw-r--r-- | net/mac802154/main.c | 6 | ||||
-rw-r--r-- | net/mac802154/rx.c | 4 | ||||
-rw-r--r-- | net/mac802154/tx.c | 2 |
4 files changed, 12 insertions, 8 deletions
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h index b7cf41c989ec..41e29b00e7a0 100644 --- a/net/mac802154/ieee802154_i.h +++ b/net/mac802154/ieee802154_i.h | |||
@@ -99,10 +99,14 @@ struct ieee802154_sub_if_data { | |||
99 | struct mac802154_llsec sec; | 99 | struct mac802154_llsec sec; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | #define mac802154_to_priv(_hw) container_of(_hw, struct ieee802154_local, hw) | ||
103 | |||
104 | #define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ | 102 | #define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ |
105 | 103 | ||
104 | static inline struct ieee802154_local * | ||
105 | hw_to_local(struct ieee802154_hw *hw) | ||
106 | { | ||
107 | return container_of(hw, struct ieee802154_local, hw); | ||
108 | } | ||
109 | |||
106 | extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced; | 110 | extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced; |
107 | extern struct ieee802154_mlme_ops mac802154_mlme_wpan; | 111 | extern struct ieee802154_mlme_ops mac802154_mlme_wpan; |
108 | 112 | ||
diff --git a/net/mac802154/main.c b/net/mac802154/main.c index 34e7e617611a..c7799faf508b 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c | |||
@@ -289,7 +289,7 @@ EXPORT_SYMBOL(ieee802154_alloc_hw); | |||
289 | 289 | ||
290 | void ieee802154_free_hw(struct ieee802154_hw *hw) | 290 | void ieee802154_free_hw(struct ieee802154_hw *hw) |
291 | { | 291 | { |
292 | struct ieee802154_local *local = mac802154_to_priv(hw); | 292 | struct ieee802154_local *local = hw_to_local(hw); |
293 | 293 | ||
294 | BUG_ON(!list_empty(&local->interfaces)); | 294 | BUG_ON(!list_empty(&local->interfaces)); |
295 | 295 | ||
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(ieee802154_free_hw); | |||
301 | 301 | ||
302 | int ieee802154_register_hw(struct ieee802154_hw *hw) | 302 | int ieee802154_register_hw(struct ieee802154_hw *hw) |
303 | { | 303 | { |
304 | struct ieee802154_local *local = mac802154_to_priv(hw); | 304 | struct ieee802154_local *local = hw_to_local(hw); |
305 | int rc = -ENOSYS; | 305 | int rc = -ENOSYS; |
306 | 306 | ||
307 | if (hw->flags & IEEE802154_HW_TXPOWER) { | 307 | if (hw->flags & IEEE802154_HW_TXPOWER) { |
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(ieee802154_register_hw); | |||
381 | 381 | ||
382 | void ieee802154_unregister_hw(struct ieee802154_hw *hw) | 382 | void ieee802154_unregister_hw(struct ieee802154_hw *hw) |
383 | { | 383 | { |
384 | struct ieee802154_local *local = mac802154_to_priv(hw); | 384 | struct ieee802154_local *local = hw_to_local(hw); |
385 | struct ieee802154_sub_if_data *sdata, *next; | 385 | struct ieee802154_sub_if_data *sdata, *next; |
386 | 386 | ||
387 | flush_workqueue(local->dev_workqueue); | 387 | flush_workqueue(local->dev_workqueue); |
diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index dc01817a92c5..1b5e8e332b9b 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c | |||
@@ -49,7 +49,7 @@ struct rx_work { | |||
49 | static void | 49 | static void |
50 | mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) | 50 | mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) |
51 | { | 51 | { |
52 | struct ieee802154_local *local = mac802154_to_priv(hw); | 52 | struct ieee802154_local *local = hw_to_local(hw); |
53 | 53 | ||
54 | mac_cb(skb)->lqi = lqi; | 54 | mac_cb(skb)->lqi = lqi; |
55 | skb->protocol = htons(ETH_P_IEEE802154); | 55 | skb->protocol = htons(ETH_P_IEEE802154); |
@@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work) | |||
90 | void | 90 | void |
91 | ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) | 91 | ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) |
92 | { | 92 | { |
93 | struct ieee802154_local *local = mac802154_to_priv(hw); | 93 | struct ieee802154_local *local = hw_to_local(hw); |
94 | struct rx_work *work; | 94 | struct rx_work *work; |
95 | 95 | ||
96 | if (!skb) | 96 | if (!skb) |
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index b6039c75d175..36844264b20b 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -88,7 +88,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb, | |||
88 | goto err_tx; | 88 | goto err_tx; |
89 | } | 89 | } |
90 | 90 | ||
91 | mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb); | 91 | mac802154_monitors_rx(local, skb); |
92 | 92 | ||
93 | if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { | 93 | if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) { |
94 | u16 crc = crc_ccitt(0, skb->data, skb->len); | 94 | u16 crc = crc_ccitt(0, skb->data, skb->len); |