diff options
Diffstat (limited to 'include/net/wpan-phy.h')
-rw-r--r-- | include/net/wpan-phy.h | 22 |
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 | |||
47 | struct wpan_phy *wpan_phy_alloc(size_t priv_size); | 53 | struct wpan_phy *wpan_phy_alloc(size_t priv_size); |
48 | int wpan_phy_register(struct device *parent, struct wpan_phy *phy); | 54 | static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) |
55 | { | ||
56 | phy->dev.parent = dev; | ||
57 | } | ||
58 | int wpan_phy_register(struct wpan_phy *phy); | ||
49 | void wpan_phy_unregister(struct wpan_phy *phy); | 59 | void wpan_phy_unregister(struct wpan_phy *phy); |
50 | void wpan_phy_free(struct wpan_phy *phy); | 60 | void wpan_phy_free(struct wpan_phy *phy); |
61 | /* Same semantics as for class_for_each_device */ | ||
62 | int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data); | ||
51 | 63 | ||
52 | static inline void *wpan_phy_priv(struct wpan_phy *phy) | 64 | static 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 | ||
58 | struct wpan_phy *wpan_phy_find(const char *str); | 70 | struct wpan_phy *wpan_phy_find(const char *str); |
71 | |||
72 | static inline void wpan_phy_put(struct wpan_phy *phy) | ||
73 | { | ||
74 | put_device(&phy->dev); | ||
75 | } | ||
76 | |||
59 | static inline const char *wpan_phy_name(struct wpan_phy *phy) | 77 | static inline const char *wpan_phy_name(struct wpan_phy *phy) |
60 | { | 78 | { |
61 | return dev_name(&phy->dev); | 79 | return dev_name(&phy->dev); |