From: Alexander Aring Date: Wed, 5 Nov 2014 19:51:19 +0000 (+0100) Subject: mac802154: add default interface registration X-Git-Tag: v3.19-rc1~118^2~134^2~66^2~14 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e4962a14435e15c0c070e8aa1b010454c9292c02;p=karo-tx-linux.git mac802154: add default interface registration This patch adds a default interface registration for a wpan interface type. Currently the 802.15.4 subsystem need to call userspace tools to add an interface. This patch is like mac80211 handling for registration a station interface type by default. Signed-off-by: Alexander Aring Signed-off-by: Marcel Holtmann --- diff --git a/net/mac802154/main.c b/net/mac802154/main.c index a371eb5fa053..7d0ff7fd2cd4 100644 --- a/net/mac802154/main.c +++ b/net/mac802154/main.c @@ -126,6 +126,7 @@ EXPORT_SYMBOL(ieee802154_free_hw); int ieee802154_register_hw(struct ieee802154_hw *hw) { struct ieee802154_local *local = hw_to_local(hw); + struct net_device *dev; int rc = -ENOSYS; local->workqueue = @@ -141,6 +142,17 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) if (rc < 0) goto out_wq; + rtnl_lock(); + + dev = ieee802154_if_add(local, "wpan%d", NULL, IEEE802154_DEV_WPAN); + if (IS_ERR(dev)) { + rtnl_unlock(); + rc = PTR_ERR(dev); + goto out_wq; + } + + rtnl_unlock(); + return 0; out_wq: