Merge tag 'iio-fixes-for-3.14a' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / net / batman-adv / hard-interface.c
index 57c2a19dcb5c8e19c410b27528f22eb671ed528a..3d417d3641c6d83a4ecb4f87bdf48d4f26d48242 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors:
+/* Copyright (C) 2007-2014 B.A.T.M.A.N. contributors:
  *
  * Marek Lindner, Simon Wunderlich
  *
@@ -12,9 +12,7 @@
  * General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "main.h"
@@ -25,6 +23,7 @@
 #include "translation-table.h"
 #include "routing.h"
 #include "sysfs.h"
+#include "debugfs.h"
 #include "originator.h"
 #include "hash.h"
 #include "bridge_loop_avoidance.h"
@@ -88,15 +87,13 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
                return false;
 
        /* recurse over the parent device */
-       parent_dev = dev_get_by_index(&init_net, net_dev->iflink);
+       parent_dev = __dev_get_by_index(&init_net, net_dev->iflink);
        /* if we got a NULL parent_dev there is something broken.. */
        if (WARN(!parent_dev, "Cannot find parent device"))
                return false;
 
        ret = batadv_is_on_batman_iface(parent_dev);
 
-       if (parent_dev)
-               dev_put(parent_dev);
        return ret;
 }
 
@@ -541,6 +538,7 @@ static void batadv_hardif_remove_interface_finish(struct work_struct *work)
        hard_iface = container_of(work, struct batadv_hard_iface,
                                  cleanup_work);
 
+       batadv_debugfs_del_hardif(hard_iface);
        batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
        batadv_hardif_free_ref(hard_iface);
 }
@@ -571,6 +569,11 @@ batadv_hardif_add_interface(struct net_device *net_dev)
        hard_iface->net_dev = net_dev;
        hard_iface->soft_iface = NULL;
        hard_iface->if_status = BATADV_IF_NOT_IN_USE;
+
+       ret = batadv_debugfs_add_hardif(hard_iface);
+       if (ret)
+               goto free_sysfs;
+
        INIT_LIST_HEAD(&hard_iface->list);
        INIT_WORK(&hard_iface->cleanup_work,
                  batadv_hardif_remove_interface_finish);
@@ -587,6 +590,8 @@ batadv_hardif_add_interface(struct net_device *net_dev)
 
        return hard_iface;
 
+free_sysfs:
+       batadv_sysfs_del_hardif(&hard_iface->hardif_obj);
 free_if:
        kfree(hard_iface);
 release_dev: