mac802154: main: move open and close into iface
authorAlexander Aring <alex.aring@gmail.com>
Tue, 28 Oct 2014 17:21:17 +0000 (18:21 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 28 Oct 2014 22:19:06 +0000 (23:19 +0100)
These functions can be static inside the iface file, because it's not
used anywhere else. This patch moves these functions into iface file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/ieee802154_i.h
net/mac802154/iface.c
net/mac802154/main.c

index ac907d943bae1fac31e7953d789965efd3596390..4408c463af3501c978a50c1b10da3c1e73ced195 100644 (file)
@@ -123,9 +123,6 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
 extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
 extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
 
-int mac802154_slave_open(struct net_device *dev);
-int mac802154_slave_close(struct net_device *dev);
-
 void mac802154_monitor_setup(struct net_device *dev);
 netdev_tx_t
 ieee802154_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
index dafb2c3ac1091cd5f7326314be8ec25245e428ce..0b21413081f1459a28b53e3ab8288cce49a60ae3 100644 (file)
@@ -142,6 +142,46 @@ void mac802154_get_mac_params(struct net_device *dev,
        mutex_unlock(&sdata->local->iflist_mtx);
 }
 
+static int mac802154_slave_open(struct net_device *dev)
+{
+       struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+       struct ieee802154_sub_if_data *subif;
+       struct ieee802154_local *local = sdata->local;
+       int res = 0;
+
+       ASSERT_RTNL();
+
+       if (sdata->type == IEEE802154_DEV_WPAN) {
+               mutex_lock(&sdata->local->iflist_mtx);
+               list_for_each_entry(subif, &sdata->local->interfaces, list) {
+                       if (subif != sdata && subif->type == sdata->type &&
+                           subif->running) {
+                               mutex_unlock(&sdata->local->iflist_mtx);
+                               return -EBUSY;
+                       }
+               }
+               mutex_unlock(&sdata->local->iflist_mtx);
+       }
+
+       mutex_lock(&sdata->local->iflist_mtx);
+       sdata->running = true;
+       mutex_unlock(&sdata->local->iflist_mtx);
+
+       if (local->open_count++ == 0) {
+               res = local->ops->start(&local->hw);
+               WARN_ON(res);
+               if (res)
+                       goto err;
+       }
+
+       netif_start_queue(dev);
+       return 0;
+err:
+       sdata->local->open_count--;
+
+       return res;
+}
+
 static int mac802154_wpan_open(struct net_device *dev)
 {
        int rc;
@@ -201,6 +241,25 @@ out:
        return rc;
 }
 
+static int mac802154_slave_close(struct net_device *dev)
+{
+       struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+       struct ieee802154_local *local = sdata->local;
+
+       ASSERT_RTNL();
+
+       netif_stop_queue(dev);
+
+       mutex_lock(&sdata->local->iflist_mtx);
+       sdata->running = false;
+       mutex_unlock(&sdata->local->iflist_mtx);
+
+       if (!--local->open_count)
+               local->ops->stop(&local->hw);
+
+       return 0;
+}
+
 static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
                                         struct ieee802154_hdr *hdr,
                                         const struct ieee802154_mac_cb *cb)
index ff0de0f990cb42dc3dd58ba5ec929cb82a5c255e..2c6d7725982292a98d2e995ea369da4771b0237b 100644 (file)
 
 #include "ieee802154_i.h"
 
-int mac802154_slave_open(struct net_device *dev)
-{
-       struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-       struct ieee802154_sub_if_data *subif;
-       struct ieee802154_local *local = sdata->local;
-       int res = 0;
-
-       ASSERT_RTNL();
-
-       if (sdata->type == IEEE802154_DEV_WPAN) {
-               mutex_lock(&sdata->local->iflist_mtx);
-               list_for_each_entry(subif, &sdata->local->interfaces, list) {
-                       if (subif != sdata && subif->type == sdata->type &&
-                           subif->running) {
-                               mutex_unlock(&sdata->local->iflist_mtx);
-                               return -EBUSY;
-                       }
-               }
-               mutex_unlock(&sdata->local->iflist_mtx);
-       }
-
-       mutex_lock(&sdata->local->iflist_mtx);
-       sdata->running = true;
-       mutex_unlock(&sdata->local->iflist_mtx);
-
-       if (local->open_count++ == 0) {
-               res = local->ops->start(&local->hw);
-               WARN_ON(res);
-               if (res)
-                       goto err;
-       }
-
-       netif_start_queue(dev);
-       return 0;
-err:
-       sdata->local->open_count--;
-
-       return res;
-}
-
-int mac802154_slave_close(struct net_device *dev)
-{
-       struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-       struct ieee802154_local *local = sdata->local;
-
-       ASSERT_RTNL();
-
-       netif_stop_queue(dev);
-
-       mutex_lock(&sdata->local->iflist_mtx);
-       sdata->running = false;
-       mutex_unlock(&sdata->local->iflist_mtx);
-
-       if (!--local->open_count)
-               local->ops->stop(&local->hw);
-
-       return 0;
-}
-
 static int
 mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
 {
This page took 0.032845 seconds and 5 git commands to generate.