All of lore.kernel.org
 help / color / mirror / Atom feed
From: han.lu@intel.com
To: broonie@kernel.org, alsa-devel@alsa-project.org,
	liam.r.girdwood@intel.com
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH 1/1] Intel: ASoC: Add condition check before set param to waves
Date: Thu, 19 Mar 2015 08:38:00 +0800	[thread overview]
Message-ID: <1426725480-31645-1-git-send-email-han.lu@intel.com> (raw)

From: "Lu, Han" <han.lu@intel.com>

Check waves state before set parameter through ipc to prevent unexpected
operation. Also remove redundant check.

Signed-off-by: Lu, Han <han.lu@intel.com>

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index 43fb5f3..20b629a 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -2055,6 +2055,11 @@ int sst_hsw_launch_param_buf(struct sst_hsw *hsw)
 {
 	int ret, idx;
 
+	if (!sst_hsw_is_module_active(hsw, SST_HSW_MODULE_WAVES)) {
+		dev_dbg(hsw->dev, "module waves is not active\n");
+		return 0;
+	}
+
 	/* put all param lines to DSP through ipc */
 	for (idx = 0; idx < hsw->param_idx_w; idx++) {
 		ret = sst_hsw_module_set_param(hsw,
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index b40ec74..6c6229a 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -399,13 +399,9 @@ static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
 	if (ret < 0)
 		return ret;
 
-	if (sst_hsw_is_module_loaded(hsw, id)) {
-		if (!sst_hsw_is_module_active(hsw, id))
-			return 0;
-
+	if (sst_hsw_is_module_active(hsw, id))
 		ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
 				param_size, ucontrol->value.bytes.data);
-	}
 	return ret;
 }
 
-- 
1.9.1

             reply	other threads:[~2015-03-19  0:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  0:38 han.lu [this message]
2015-03-19  0:49 ` [PATCH 1/1] Intel: ASoC: Add condition check before set param to waves Mark Brown

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=1426725480-31645-1-git-send-email-han.lu@intel.com \
    --to=han.lu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    /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.