Skip to content

Commit

Permalink
ieee802154: add an mlme_ops call to retrieve PHY object
Browse files Browse the repository at this point in the history
ops->get_phy should increment reference to wpan-phy. As we return
the external structure, we should do refcounting correctly.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
  • Loading branch information
Dmitry Eremin-Solenikov committed Nov 6, 2009
1 parent 478e87c commit 4272344
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/net/ieee802154_netdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ static inline int mac_cb_type(struct sk_buff *skb)
#define IEEE802154_MAC_SCAN_PASSIVE 2
#define IEEE802154_MAC_SCAN_ORPHAN 3

struct wpan_phy;
/*
* This should be located at net_device->ml_priv
*
* get_phy should increment the reference counting on returned phy.
* Use wpan_wpy_put to put that reference.
*/
struct ieee802154_mlme_ops {
int (*assoc_req)(struct net_device *dev,
Expand All @@ -94,6 +98,8 @@ struct ieee802154_mlme_ops {
int (*scan_req)(struct net_device *dev,
u8 type, u32 channels, u8 page, u8 duration);

struct wpan_phy *(*get_phy)(const struct net_device *dev);

/*
* FIXME: these should become the part of PIB/MIB interface.
* However we still don't have IB interface of any kind
Expand Down
2 changes: 2 additions & 0 deletions include/net/wpan-phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct wpan_phy {
char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
};

#define to_phy(_dev) container_of(_dev, struct wpan_phy, dev)

struct wpan_phy *wpan_phy_alloc(size_t priv_size);
static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev)
{
Expand Down

0 comments on commit 4272344

Please sign in to comment.