Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171253
b: refs/heads/master
c: 1c889f4
h: refs/heads/master
i:
  171251: afb12cc
v: v3
  • Loading branch information
Dmitry Eremin-Solenikov committed Nov 6, 2009
1 parent 0008641 commit 7c98dfe
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69d9ab96f983720b7794e91437bd9c5f83bae9f7
refs/heads/master: 1c889f4db6b2f8f8429e62011ba622642faba019
2 changes: 2 additions & 0 deletions trunk/include/net/wpan-phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size);
int wpan_phy_register(struct device *parent, struct wpan_phy *phy);
void wpan_phy_unregister(struct wpan_phy *phy);
void wpan_phy_free(struct wpan_phy *phy);
/* Same semantics as for class_for_each_device */
int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), void *data);

static inline void *wpan_phy_priv(struct wpan_phy *phy)
{
Expand Down
25 changes: 25 additions & 0 deletions trunk/net/ieee802154/wpan-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,31 @@ struct wpan_phy *wpan_phy_find(const char *str)
}
EXPORT_SYMBOL(wpan_phy_find);

struct wpan_phy_iter_data {
int (*fn)(struct wpan_phy *phy, void *data);
void *data;
};

static int wpan_phy_iter(struct device *dev, void *_data)
{
struct wpan_phy_iter_data *wpid = _data;
struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev);
return wpid->fn(phy, wpid->data);
}

int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data),
void *data)
{
struct wpan_phy_iter_data wpid = {
.fn = fn,
.data = data,
};

return class_for_each_device(&wpan_phy_class, NULL,
&wpid, wpan_phy_iter);
}
EXPORT_SYMBOL(wpan_phy_for_each);

static int wpan_phy_idx_valid(int idx)
{
return idx >= 0;
Expand Down

0 comments on commit 7c98dfe

Please sign in to comment.