diff options
Diffstat (limited to 'net/ieee802154/core.c')
-rw-r--r-- | net/ieee802154/core.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index 3ee00bf0e514..ae5ecbc2ca0a 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c | |||
@@ -21,11 +21,12 @@ | |||
21 | #include <net/rtnetlink.h> | 21 | #include <net/rtnetlink.h> |
22 | 22 | ||
23 | #include "ieee802154.h" | 23 | #include "ieee802154.h" |
24 | #include "nl802154.h" | ||
24 | #include "sysfs.h" | 25 | #include "sysfs.h" |
25 | #include "core.h" | 26 | #include "core.h" |
26 | 27 | ||
27 | /* RCU-protected (and RTNL for writers) */ | 28 | /* RCU-protected (and RTNL for writers) */ |
28 | static LIST_HEAD(cfg802154_rdev_list); | 29 | LIST_HEAD(cfg802154_rdev_list); |
29 | static int cfg802154_rdev_list_generation; | 30 | static int cfg802154_rdev_list_generation; |
30 | 31 | ||
31 | static int wpan_phy_match(struct device *dev, const void *data) | 32 | static int wpan_phy_match(struct device *dev, const void *data) |
@@ -74,6 +75,23 @@ int wpan_phy_for_each(int (*fn)(struct wpan_phy *phy, void *data), | |||
74 | } | 75 | } |
75 | EXPORT_SYMBOL(wpan_phy_for_each); | 76 | EXPORT_SYMBOL(wpan_phy_for_each); |
76 | 77 | ||
78 | struct cfg802154_registered_device * | ||
79 | cfg802154_rdev_by_wpan_phy_idx(int wpan_phy_idx) | ||
80 | { | ||
81 | struct cfg802154_registered_device *result = NULL, *rdev; | ||
82 | |||
83 | ASSERT_RTNL(); | ||
84 | |||
85 | list_for_each_entry(rdev, &cfg802154_rdev_list, list) { | ||
86 | if (rdev->wpan_phy_idx == wpan_phy_idx) { | ||
87 | result = rdev; | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | return result; | ||
93 | } | ||
94 | |||
77 | struct wpan_phy * | 95 | struct wpan_phy * |
78 | wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size) | 96 | wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size) |
79 | { | 97 | { |
@@ -270,8 +288,15 @@ static int __init wpan_phy_class_init(void) | |||
270 | if (rc) | 288 | if (rc) |
271 | goto err_notifier; | 289 | goto err_notifier; |
272 | 290 | ||
291 | rc = nl802154_init(); | ||
292 | if (rc) | ||
293 | goto err_ieee802154_nl; | ||
294 | |||
273 | return 0; | 295 | return 0; |
274 | 296 | ||
297 | err_ieee802154_nl: | ||
298 | ieee802154_nl_exit(); | ||
299 | |||
275 | err_notifier: | 300 | err_notifier: |
276 | unregister_netdevice_notifier(&cfg802154_netdev_notifier); | 301 | unregister_netdevice_notifier(&cfg802154_netdev_notifier); |
277 | err_nl: | 302 | err_nl: |
@@ -283,6 +308,7 @@ subsys_initcall(wpan_phy_class_init); | |||
283 | 308 | ||
284 | static void __exit wpan_phy_class_exit(void) | 309 | static void __exit wpan_phy_class_exit(void) |
285 | { | 310 | { |
311 | nl802154_exit(); | ||
286 | ieee802154_nl_exit(); | 312 | ieee802154_nl_exit(); |
287 | unregister_netdevice_notifier(&cfg802154_netdev_notifier); | 313 | unregister_netdevice_notifier(&cfg802154_netdev_notifier); |
288 | wpan_phy_sysfs_exit(); | 314 | wpan_phy_sysfs_exit(); |