From patchwork Thu Mar 28 07:50:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 231922 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F0A12C00B0 for ; Thu, 28 Mar 2013 18:52:47 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756720Ab3C1Hwm (ORCPT ); Thu, 28 Mar 2013 03:52:42 -0400 Received: from diserzione.investici.org ([82.221.99.153]:33284 "EHLO diserzione.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756527Ab3C1HwI (ORCPT ); Thu, 28 Mar 2013 03:52:08 -0400 Received: from [82.221.99.153] (diserzione [82.221.99.153]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id AAA10180F50; Thu, 28 Mar 2013 07:52:06 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 diserzione.investici.org AAA10180F50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1364457127; bh=Pjk3wIjH9nECNQjPFPIts0dE2Q3Oquq5EhtZD48MYjc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TYGH7azHRWDXKfvoSEqMPR8u1NwcFE6L0Bd7pXZDr80EH+shFX8nSJppK4JUiJKIK 41vkZVxRgKltemz4oB9mSlIwiFFwlpsJ0Ybt1x6BbK7koaISrEeuDVPSM7ll1419am xpR7Hnd4bP1+B/Ba1llEravZM82iQdYDkbkpkftM= From: Antonio Quartulli To: davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , Marek Lindner , Antonio Quartulli Subject: [PATCH 03/11] batman-adv: Move deinitialization of soft-interface to destructor Date: Thu, 28 Mar 2013 08:50:23 +0100 Message-Id: <1364457031-3194-4-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1364457031-3194-1-git-send-email-ordex@autistici.org> References: <1364457031-3194-1-git-send-email-ordex@autistici.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sven Eckelmann The deinitialization of the soft-interface created in ndo_init/constructor should be done in the destructor and not directly before calling unregister_netdevice Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner Acked-by: Antonio Quartulli Signed-off-by: Antonio Quartulli --- net/batman-adv/soft-interface.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index c5cb0a7..e889bfb 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c @@ -417,7 +417,6 @@ static void batadv_softif_destroy_finish(struct work_struct *work) cleanup_work); soft_iface = bat_priv->soft_iface; - batadv_debugfs_del_meshif(soft_iface); batadv_sysfs_del_meshif(soft_iface); rtnl_lock(); @@ -522,6 +521,17 @@ static const struct net_device_ops batadv_netdev_ops = { }; /** + * batadv_softif_free - Deconstructor of batadv_soft_interface + * @dev: Device to cleanup and remove + */ +static void batadv_softif_free(struct net_device *dev) +{ + batadv_debugfs_del_meshif(dev); + batadv_mesh_free(dev); + free_netdev(dev); +} + +/** * batadv_softif_init_early - early stage initialization of soft interface * @dev: registered network device to modify */ @@ -532,7 +542,7 @@ static void batadv_softif_init_early(struct net_device *dev) ether_setup(dev); dev->netdev_ops = &batadv_netdev_ops; - dev->destructor = free_netdev; + dev->destructor = batadv_softif_free; dev->tx_queue_len = 0; /* can't call min_mtu, because the needed variables @@ -575,7 +585,6 @@ void batadv_softif_destroy(struct net_device *soft_iface) { struct batadv_priv *bat_priv = netdev_priv(soft_iface); - batadv_mesh_free(soft_iface); queue_work(batadv_event_workqueue, &bat_priv->cleanup_work); }