aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154/wpan-class.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee802154/wpan-class.c')
-rw-r--r--net/ieee802154/wpan-class.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c
index f306604da67a..0cec13842916 100644
--- a/net/ieee802154/wpan-class.c
+++ b/net/ieee802154/wpan-class.c
@@ -91,6 +91,31 @@ struct wpan_phy *wpan_phy_find(const char *str)
91} 91}
92EXPORT_SYMBOL(wpan_phy_find); 92EXPORT_SYMBOL(wpan_phy_find);
93 93
94struct wpan_phy_iter_data {
95 int (*fn)(struct wpan_phy *phy, void *data);
96 void *data;
97};
98
99static int wpan_phy_iter(struct device *dev, void *_data)
100{
101 struct wpan_phy_iter_data *wpid = _data;
102 struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev);
103 return wpid->fn(phy, wpid->data);
104}
105
106int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data),
107 void *data)
108{
109 struct wpan_phy_iter_data wpid = {
110 .fn = fn,
111 .data = data,
112 };
113
114 return class_for_each_device(&wpan_phy_class, NULL,
115 &wpid, wpan_phy_iter);
116}
117EXPORT_SYMBOL(wpan_phy_for_each);
118
94static int wpan_phy_idx_valid(int idx) 119static int wpan_phy_idx_valid(int idx)
95{ 120{
96 return idx >= 0; 121 return idx >= 0;