Skip to content

Commit 6074136

Browse files
alexaringholtmann
authored andcommitted
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>
1 parent d98be45 commit 6074136

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎net/mac802154/ieee802154_i.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ struct ieee802154_sub_if_data {
9999
struct mac802154_llsec sec;
100100
};
101101

102-
#define mac802154_to_priv(_hw) container_of(_hw, struct ieee802154_local, hw)
103-
104102
#define MAC802154_CHAN_NONE 0xff /* No channel is assigned */
105103

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+
106110
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
107111
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
108112

‎net/mac802154/main.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ EXPORT_SYMBOL(ieee802154_alloc_hw);
289289

290290
void ieee802154_free_hw(struct ieee802154_hw *hw)
291291
{
292-
struct ieee802154_local *local = mac802154_to_priv(hw);
292+
struct ieee802154_local *local = hw_to_local(hw);
293293

294294
BUG_ON(!list_empty(&local->interfaces));
295295

@@ -301,7 +301,7 @@ EXPORT_SYMBOL(ieee802154_free_hw);
301301

302302
int ieee802154_register_hw(struct ieee802154_hw *hw)
303303
{
304-
struct ieee802154_local *local = mac802154_to_priv(hw);
304+
struct ieee802154_local *local = hw_to_local(hw);
305305
int rc = -ENOSYS;
306306

307307
if (hw->flags & IEEE802154_HW_TXPOWER) {
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);
381381

382382
void ieee802154_unregister_hw(struct ieee802154_hw *hw)
383383
{
384-
struct ieee802154_local *local = mac802154_to_priv(hw);
384+
struct ieee802154_local *local = hw_to_local(hw);
385385
struct ieee802154_sub_if_data *sdata, *next;
386386

387387
flush_workqueue(local->dev_workqueue);

‎net/mac802154/rx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct rx_work {
4949
static void
5050
mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
5151
{
52-
struct ieee802154_local *local = mac802154_to_priv(hw);
52+
struct ieee802154_local *local = hw_to_local(hw);
5353

5454
mac_cb(skb)->lqi = lqi;
5555
skb->protocol = htons(ETH_P_IEEE802154);
@@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work)
9090
void
9191
ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
9292
{
93-
struct ieee802154_local *local = mac802154_to_priv(hw);
93+
struct ieee802154_local *local = hw_to_local(hw);
9494
struct rx_work *work;
9595

9696
if (!skb)

‎net/mac802154/tx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
8888
goto err_tx;
8989
}
9090

91-
mac802154_monitors_rx(mac802154_to_priv(&local->hw), skb);
91+
mac802154_monitors_rx(local, skb);
9292

9393
if (!(local->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
9494
u16 crc = crc_ccitt(0, skb->data, skb->len);

0 commit comments

Comments
 (0)