diff options
-rw-r--r-- | include/net/cfg802154.h | 8 | ||||
-rw-r--r-- | net/mac802154/ieee802154_i.h | 3 | ||||
-rw-r--r-- | net/mac802154/main.c | 2 | ||||
-rw-r--r-- | net/mac802154/util.c | 3 |
4 files changed, 16 insertions, 0 deletions
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h index e5570e011116..369515231302 100644 --- a/include/net/cfg802154.h +++ b/include/net/cfg802154.h | |||
@@ -42,6 +42,14 @@ struct cfg802154_ops { | |||
42 | struct wpan_phy { | 42 | struct wpan_phy { |
43 | struct mutex pib_lock; | 43 | struct mutex pib_lock; |
44 | 44 | ||
45 | /* If multiple wpan_phys are registered and you're handed e.g. | ||
46 | * a regular netdev with assigned ieee802154_ptr, you won't | ||
47 | * know whether it points to a wpan_phy your driver has registered | ||
48 | * or not. Assign this to something global to your driver to | ||
49 | * help determine whether you own this wpan_phy or not. | ||
50 | */ | ||
51 | const void *privid; | ||
52 | |||
45 | /* | 53 | /* |
46 | * This is a PIB according to 802.15.4-2011. | 54 | * This is a PIB according to 802.15.4-2011. |
47 | * We do not provide timing-related variables, as they | 55 | * We do not provide timing-related variables, as they |
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h index abb19701d494..4be5e23c7e8b 100644 --- a/net/mac802154/ieee802154_i.h +++ b/net/mac802154/ieee802154_i.h | |||
@@ -96,6 +96,9 @@ struct ieee802154_sub_if_data { | |||
96 | 96 | ||
97 | #define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ | 97 | #define MAC802154_CHAN_NONE 0xff /* No channel is assigned */ |
98 | 98 | ||
99 | /* utility functions/constants */ | ||
100 | extern const void *const mac802154_wpan_phy_privid; /* for wpan_phy privid */ | ||
101 | |||
99 | static inline struct ieee802154_local * | 102 | static inline struct ieee802154_local * |
100 | hw_to_local(struct ieee802154_hw *hw) | 103 | hw_to_local(struct ieee802154_hw *hw) |
101 | { | 104 | { |
diff --git a/net/mac802154/main.c b/net/mac802154/main.c index 709dcc5f7f17..24e8ca6a669d 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c | |||
@@ -92,6 +92,8 @@ ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops) | |||
92 | return NULL; | 92 | return NULL; |
93 | } | 93 | } |
94 | 94 | ||
95 | phy->privid = mac802154_wpan_phy_privid; | ||
96 | |||
95 | local = wpan_phy_priv(phy); | 97 | local = wpan_phy_priv(phy); |
96 | local->phy = phy; | 98 | local->phy = phy; |
97 | local->hw.phy = local->phy; | 99 | local->hw.phy = local->phy; |
diff --git a/net/mac802154/util.c b/net/mac802154/util.c index 117e4eff4ca8..9a04e4a8e50f 100644 --- a/net/mac802154/util.c +++ b/net/mac802154/util.c | |||
@@ -15,6 +15,9 @@ | |||
15 | 15 | ||
16 | #include "ieee802154_i.h" | 16 | #include "ieee802154_i.h" |
17 | 17 | ||
18 | /* privid for wpan_phys to determine whether they belong to us or not */ | ||
19 | const void *const mac802154_wpan_phy_privid = &mac802154_wpan_phy_privid; | ||
20 | |||
18 | void ieee802154_wake_queue(struct ieee802154_hw *hw) | 21 | void ieee802154_wake_queue(struct ieee802154_hw *hw) |
19 | { | 22 | { |
20 | struct ieee802154_local *local = hw_to_local(hw); | 23 | struct ieee802154_local *local = hw_to_local(hw); |