aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/wpan-phy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/wpan-phy.h')
-rw-r--r--include/net/wpan-phy.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index 547b1e271ac9..85926231c07a 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -34,20 +34,32 @@ struct wpan_phy {
34 */ 34 */
35 u8 current_channel; 35 u8 current_channel;
36 u8 current_page; 36 u8 current_page;
37 u32 channels_supported; 37 u32 channels_supported[32];
38 u8 transmit_power; 38 u8 transmit_power;
39 u8 cca_mode; 39 u8 cca_mode;
40 40
41 struct device dev; 41 struct device dev;
42 int idx; 42 int idx;
43 43
44 struct net_device *(*add_iface)(struct wpan_phy *phy,
45 const char *name);
46 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
47
44 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 48 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
45}; 49};
46 50
51#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)
52
47struct wpan_phy *wpan_phy_alloc(size_t priv_size); 53struct wpan_phy *wpan_phy_alloc(size_t priv_size);
48int wpan_phy_register(struct device *parent, struct wpan_phy *phy); 54static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
55{
56 phy->dev.parent = dev;
57}
58int wpan_phy_register(struct wpan_phy *phy);
49void wpan_phy_unregister(struct wpan_phy *phy); 59void wpan_phy_unregister(struct wpan_phy *phy);
50void wpan_phy_free(struct wpan_phy *phy); 60void wpan_phy_free(struct wpan_phy *phy);
61/* Same semantics as for class_for_each_device */
62int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);
51 63
52static inline void *wpan_phy_priv(struct wpan_phy *phy) 64static inline void *wpan_phy_priv(struct wpan_phy *phy)
53{ 65{
@@ -56,6 +68,12 @@ static inline void *wpan_phy_priv(struct wpan_phy *phy)
56} 68}
57 69
58struct wpan_phy *wpan_phy_find(const char *str); 70struct wpan_phy *wpan_phy_find(const char *str);
71
72static inline void wpan_phy_put(struct wpan_phy *phy)
73{
74 put_device(&phy->dev);
75}
76
59static inline const char *wpan_phy_name(struct wpan_phy *phy) 77static inline const char *wpan_phy_name(struct wpan_phy *phy)
60{ 78{
61 return dev_name(&phy->dev); 79 return dev_name(&phy->dev);