From patchwork Sun Jul 19 10:15:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6821721 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 34ED4C05AC for ; Sun, 19 Jul 2015 10:16:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52E432053B for ; Sun, 19 Jul 2015 10:16:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E0A2820531 for ; Sun, 19 Jul 2015 10:16:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7AB862605A1; Sun, 19 Jul 2015 12:16:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 5A7DA260577; Sun, 19 Jul 2015 12:15:57 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0B85826057A; Sun, 19 Jul 2015 12:15:36 +0200 (CEST) Received: from smtp-out-068.synserver.de (smtp-out-068.synserver.de [212.40.185.68]) by alsa0.perex.cz (Postfix) with ESMTP id D1F92260566 for ; Sun, 19 Jul 2015 12:15:28 +0200 (CEST) Received: (qmail 11907 invoked by uid 0); 19 Jul 2015 10:15:23 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 11774 Received: from ppp-188-174-127-204.dynamic.mnet-online.de (HELO lars-laptop.fritz.box) [188.174.127.204] by 217.119.54.81 with SMTP; 19 Jul 2015 10:15:23 -0000 From: Lars-Peter Clausen To: Mark Brown , Liam Girdwood Date: Sun, 19 Jul 2015 12:15:17 +0200 Message-Id: <1437300918-4612-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Cc: Brian Austin , Lars-Peter Clausen , alsa-devel@alsa-project.org, Paul Handrigan , Tim Howe Subject: [alsa-devel] [PATCH 1/2] ASoC: cs4349: Fix suspend/resume X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP dev_get_drvdata() will not return the snd_soc_runtime to which this CODEC is attached, so the current code will result in undefined behavior. To fix this just use regmap_update_bits(cs4349->regmap, ...) directly instead of snd_soc_update_bits(rtd->codec, ...). Signed-off-by: Lars-Peter Clausen Acked-by: Tim Howe --- sound/soc/codecs/cs4349.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c index a8df8a74..db18799 100644 --- a/sound/soc/codecs/cs4349.c +++ b/sound/soc/codecs/cs4349.c @@ -328,10 +328,9 @@ static int cs4349_i2c_remove(struct i2c_client *client) static int cs4349_runtime_suspend(struct device *dev) { struct cs4349_private *cs4349 = dev_get_drvdata(dev); - struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); int ret; - ret = snd_soc_update_bits(rtd->codec, CS4349_MISC, PWR_DWN, 1); + ret = regmap_update_bits(cs4349->regmap, CS4349_MISC, PWR_DWN, 1); if (ret < 0) return ret; @@ -347,10 +346,9 @@ static int cs4349_runtime_suspend(struct device *dev) static int cs4349_runtime_resume(struct device *dev) { struct cs4349_private *cs4349 = dev_get_drvdata(dev); - struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); int ret; - ret = snd_soc_update_bits(rtd->codec, CS4349_MISC, PWR_DWN, 0); + ret = regmap_update_bits(cs4349->regmap, CS4349_MISC, PWR_DWN, 0); if (ret < 0) return ret;