All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH v3 5/9] ath10k: decouple suspend code
Date: Fri, 5 Jul 2013 09:51:17 +0300	[thread overview]
Message-ID: <87vc4ph53u.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1372147152-26799-6-git-send-email-michal.kazior@tieto.com> (Michal Kazior's message of "Tue, 25 Jun 2013 09:59:08 +0200")

Michal Kazior <michal.kazior@tieto.com> writes:

> Split up fw-related and hw-related suspension code.
>
> Although we don't advertise WoW support to
> mac80211 yet it's useful to keep the code in
> suspend/resume hooks.
>
> At this point there's no need to keep pci pm ops.
> In case of WoW mac80211 calls ath10k_suspend()
> which should take care of entering low-power mode.
> In case WoW is not available mac80211 will go
> through regular interface teradown and use start/stop.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

[...]

> +#ifdef CONFIG_PM
> +static int ath10k_suspend(struct ieee80211_hw *hw,
> +			  struct cfg80211_wowlan *wowlan)
> +{
> +	struct ath10k *ar = hw->priv;
> +	int ret;
> +
> +	ar->is_target_paused = false;
> +
> +	ret = ath10k_wmi_pdev_suspend_target(ar);
> +	if (ret) {
> +		ath10k_warn("could not suspend target (%d)\n", ret);
> +		return 1;
> +	}
> +
> +	ret = wait_event_interruptible_timeout(ar->event_queue,
> +					       ar->is_target_paused == true,
> +					       1 * HZ);
> +	if (ret < 0) {
> +		ath10k_warn("suspend interrupted (%d)\n", ret);
> +		goto resume;
> +	} else if (ret == 0) {
> +		ath10k_warn("suspend timed out - target pause event never came\n");
> +		goto resume;
> +	}
> +
> +	ret = ath10k_hif_suspend(ar);
> +	if (ret) {
> +		ath10k_warn("could not suspend hif (%d)\n", ret);
> +		goto resume;
> +	}
> +
> +	return 0;
> +resume:
> +	ret = ath10k_wmi_pdev_resume_target(ar);
> +	if (ret)
> +		ath10k_warn("could not resume target (%d)\n", ret);
> +	return 1;
> +}

No need to change anything now, it's just moving code around anyway, but
from a quick look this function looks racy. Can we trust that there's no
other code path which could create problems during suspend? Or should we
properly serialise this, eg. by using conf_mutex and adding a new state?

I hope I didn't ask this already before, I just came back from vacation :)

-- 
Kalle Valo

  reply	other threads:[~2013-07-05  6:51 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 [this message]
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   ` [PATCH v4 07/10] ath10k: make sure all resources are freed upon ath10k_stop() Michal Kazior
2013-07-16  7:38     ` 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=87vc4ph53u.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath9k-devel@lists.ath9k.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.