All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: <ath10k@lists.infradead.org>
Cc: <linux-wireless@vger.kernel.org>,
	Michal Kazior <michal.kazior@tieto.com>
Subject: [PATCH v4 07/10] ath10k: make sure all resources are freed upon ath10k_stop()
Date: Tue, 16 Jul 2013 09:38:56 +0200	[thread overview]
Message-ID: <1373960339-8525-8-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1373960339-8525-1-git-send-email-michal.kazior@tieto.com>

This is necessary for proper hw reconfiguration
and to avoid memory leaks.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index febba7d..b9663e9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -369,6 +369,20 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
 	spin_unlock_bh(&ar->data_lock);
 }
 
+static void ath10k_peer_cleanup_all(struct ath10k *ar)
+{
+	struct ath10k_peer *peer, *tmp;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	spin_lock_bh(&ar->data_lock);
+	list_for_each_entry_safe(peer, tmp, &ar->peers, list) {
+		list_del(&peer->list);
+		kfree(peer);
+	}
+	spin_unlock_bh(&ar->data_lock);
+}
+
 /************************/
 /* Interface management */
 /************************/
@@ -1753,7 +1767,18 @@ static void ath10k_stop(struct ieee80211_hw *hw)
 	struct ath10k *ar = hw->priv;
 
 	mutex_lock(&ar->conf_mutex);
+	del_timer_sync(&ar->scan.timeout);
 	ath10k_offchan_tx_purge(ar);
+	ath10k_peer_cleanup_all(ar);
+
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.in_progress) {
+		del_timer(&ar->scan.timeout);
+		ar->scan.in_progress = false;
+		ieee80211_scan_completed(ar->hw, true);
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	ar->state = ATH10K_STATE_OFF;
 	mutex_unlock(&ar->conf_mutex);
 
-- 
1.7.9.5


WARNING: multiple messages have this Message-ID (diff)
From: Michal Kazior <michal.kazior@tieto.com>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Michal Kazior <michal.kazior@tieto.com>
Subject: [PATCH v4 07/10] ath10k: make sure all resources are freed upon ath10k_stop()
Date: Tue, 16 Jul 2013 09:38:56 +0200	[thread overview]
Message-ID: <1373960339-8525-8-git-send-email-michal.kazior@tieto.com> (raw)
In-Reply-To: <1373960339-8525-1-git-send-email-michal.kazior@tieto.com>

This is necessary for proper hw reconfiguration
and to avoid memory leaks.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index febba7d..b9663e9 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -369,6 +369,20 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
 	spin_unlock_bh(&ar->data_lock);
 }
 
+static void ath10k_peer_cleanup_all(struct ath10k *ar)
+{
+	struct ath10k_peer *peer, *tmp;
+
+	lockdep_assert_held(&ar->conf_mutex);
+
+	spin_lock_bh(&ar->data_lock);
+	list_for_each_entry_safe(peer, tmp, &ar->peers, list) {
+		list_del(&peer->list);
+		kfree(peer);
+	}
+	spin_unlock_bh(&ar->data_lock);
+}
+
 /************************/
 /* Interface management */
 /************************/
@@ -1753,7 +1767,18 @@ static void ath10k_stop(struct ieee80211_hw *hw)
 	struct ath10k *ar = hw->priv;
 
 	mutex_lock(&ar->conf_mutex);
+	del_timer_sync(&ar->scan.timeout);
 	ath10k_offchan_tx_purge(ar);
+	ath10k_peer_cleanup_all(ar);
+
+	spin_lock_bh(&ar->data_lock);
+	if (ar->scan.in_progress) {
+		del_timer(&ar->scan.timeout);
+		ar->scan.in_progress = false;
+		ieee80211_scan_completed(ar->hw, true);
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	ar->state = ATH10K_STATE_OFF;
 	mutex_unlock(&ar->conf_mutex);
 
-- 
1.7.9.5


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

  parent reply	other threads:[~2013-07-16  7:39 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 12:53 [ath9k-devel] [PATCH v2 00/10] ath10k: device setup refactor Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 01/10] ath10k: decouple pci init/deinit logic Michal Kazior
2013-06-13 18:09   ` Kalle Valo
2013-06-14 12:02     ` Michal Kazior
2013-06-14 12:14       ` Kalle Valo
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 02/10] ath10k: decouple core start/stop logic Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 03/10] ath10k: allow deferred regd update Michal Kazior
2013-06-13 18:08   ` Kalle Valo
2013-06-14 12:03     ` Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 05/10] ath10k: decouple suspend code Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-06-12 12:53 ` [ath9k-devel] [PATCH v2 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-06-14 12:23   ` Kalle Valo
2013-06-14 12:43     ` Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 09/10] ath10k: skip updating some params during resume Michal Kazior
2013-06-12 12:54 ` [ath9k-devel] [PATCH v2 10/10] ath10k: store firmware files in memory Michal Kazior
2013-06-25  7:59 ` [ath9k-devel] [PATCH v3 0/9] ath10k: device setup refactor Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 1/9] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-05  6:29     ` Kalle Valo
2013-07-05  7:05       ` Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 2/9] ath10k: decouple core " Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 3/9] ath10k: allow deferred regd update Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 4/9] ath10k: reset BMI state upon init Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 5/9] ath10k: decouple suspend code Michal Kazior
2013-07-05  6:51     ` Kalle Valo
2013-07-05  7:12       ` Michal Kazior
2013-07-05  7:20         ` Kalle Valo
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 6/9] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-05  7:03     ` Kalle Valo
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 7/9] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 8/9] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-06-25  7:59   ` [ath9k-devel] [PATCH v3 9/9] ath10k: store firmware files in memory Michal Kazior
2013-06-25  8:09     ` [ath9k-devel] [PATCH v3 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-05  7:09       ` Kalle Valo
2013-07-16  7:19 ` [PATCH v3 00/10] ath10k: device setup refactor Michal Kazior
2013-07-16  7:19   ` [PATCH v3 01/10] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-16  7:19   ` [PATCH v3 02/10] ath10k: decouple core " Michal Kazior
2013-07-16  7:19   ` [PATCH v3 03/10] ath10k: allow deferred regd update Michal Kazior
2013-07-16  7:19   ` [PATCH v3 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-07-16  7:19   ` [PATCH v3 05/10] ath10k: decouple suspend code Michal Kazior
2013-07-16  7:19   ` [PATCH v3 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-16  7:19   ` [PATCH v3 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-07-16  7:19   ` [PATCH v3 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-07-16  7:19   ` [PATCH v3 09/10] ath10k: store firmware files in memory Michal Kazior
2013-07-16  7:19   ` [PATCH v3 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-16  7:27   ` [PATCH v3 00/10] ath10k: device setup refactor Michal Kazior
2013-07-16  7:38 ` [PATCH v4 " Michal Kazior
2013-07-16  7:38   ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 01/10] ath10k: decouple pci start/stop logic Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 02/10] ath10k: decouple core " Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 03/10] ath10k: allow deferred regd update Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 04/10] ath10k: reset BMI state upon init Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 05/10] ath10k: decouple suspend code Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 06/10] ath10k: move free_vdev_map initialization Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` Michal Kazior [this message]
2013-07-16  7:38     ` [PATCH v4 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-07-16  7:38   ` [PATCH v4 08/10] ath10k: defer hw setup to start/stop mac80211 hooks Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 09/10] ath10k: store firmware files in memory Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-16  7:38   ` [PATCH v4 10/10] ath10k: skip fw stats debugfs interface if device is down Michal Kazior
2013-07-16  7:38     ` Michal Kazior
2013-07-19 10:18   ` [PATCH v4 00/10] ath10k: device setup refactor Kalle Valo
2013-07-19 10:18     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373960339-8525-8-git-send-email-michal.kazior@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.