From patchwork Sun Oct 21 11:06:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 149362 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1443855lji; Sun, 21 Oct 2018 04:06:20 -0700 (PDT) X-Google-Smtp-Source: AJdET5ddQUW7/z+UV4yuwCwaj0uvtk8i1GDO4yPPYW/pZhDRWzySCqX0VFlzNC1Ebpd3JCo9ubIn X-Received: by 2002:adf:f6c1:: with SMTP id y1-v6mr42029wrp.261.1540119980104; Sun, 21 Oct 2018 04:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540119980; cv=none; d=google.com; s=arc-20160816; b=EDrbpUnpfZhXFlboQ+1uSWOPQDw8ZkjDhkdJsz3Zt6TkAHXJUO+8WlB8MOSZFz0AhK OWNKofs1trDK2jOOYCCOQ8NnkWLA5w3NcfLLz52fDY1Ft1c5HbBtwDdV0gFkQDUqGs8o ACWcmh86qeuE6xqt9cxEUEqJnSbr9A5ZPSnvIX+8gTbHco0rISBDqtubxeBaeoG9lDZ2 2RTdiWwUwznW9UPDMlvi2Uv+8C9hS1FHwADJel7lzeBP3Ks6UfKMi7g/S+iCkCev/egF YFukAJ2pxTqAc0b9U92MEFETFe3p/AA97AFcw0T+HxIdri0yZtoUBBN4dI+sZ0prCzDR nPig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to; bh=3KseudXUGsr8ymfjOFbQkoblklM5FD1OPaDnk2eNhNE=; b=T4MAZxOeTNo7GsJdG/knJE5kQTWDmwuKCPAV9OGMJBUyFKsmMGEkf2Rk9joKVE1CVG okCiU3CibNiiT9yrkCe0ewFGpUQDl+MRqZWIHnB0OFyYQ/fuFZnm91XtO3NUZcoT6xFf /iYZeYm1/2jqZEpssRh+q31da/kiwH6eOzZ3KWhMQlUfGxjZ5ebterOq5v0xMnmM2dk7 Ub5WKhdGBNTXBhHShZSIZMcoXU/vR1ycYy669z57rZI3w0hgnHs+lxo1PKSkZtgXeC5X zDqCKNUTa9NWHl2XFlFzNt7sKOmIX/EEyCqfLLG7pRUiax4vpAQBRc+v+fvWAawnKddQ 9+RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=w2III3Ae; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id n8-v6si7273397wmd.195.2018.10.21.04.06.19; Sun, 21 Oct 2018 04:06:20 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=w2III3Ae; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C0F5C2677E4; Sun, 21 Oct 2018 13:06:17 +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 6E8C5267987; Sun, 21 Oct 2018 13:06:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 292172677D1 for ; Sun, 21 Oct 2018 13:06:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=mPiB3w63knDT/ncorbjMgi2x6VBXdA9zbAtL8Y1+Iq0=; b=w2III3AeqdAb OiHxRubl2usKyWXqkbB3sz6z7L4qIvIHWTcZIoarsZpElXyFQ1HbJ7ECfHYi+3WXchb1R3aFo4Vnd LgALz5R75aEAZbQRwKGQjK6Gk1VH8u1tA7yMJo6qIGpPGmyknZnq1ZqUZM2Ws5kYfv4otWJ6z6DOJ 0waGs=; Received: from [87.246.76.36] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEBYh-0003rc-Dw; Sun, 21 Oct 2018 11:06:11 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id A7921440078; Sun, 21 Oct 2018 13:06:10 +0200 (CEST) From: Mark Brown To: Lucas Tanure In-Reply-To: Message-Id: <20181021110610.A7921440078@finisterre.ee.mobilebroadband> Date: Sun, 21 Oct 2018 13:06:10 +0200 (CEST) Cc: alsa-devel@alsa-project.org, Mark Brown , Charles Keepax Subject: [alsa-devel] Applied "ASoC: wm2000: Remove wm2000_read helper function" to the asoc tree 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 The patch ASoC: wm2000: Remove wm2000_read helper function has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From c5d09485def41cab9e75ba23abbf87080183183c Mon Sep 17 00:00:00 2001 From: Lucas Tanure Date: Fri, 19 Oct 2018 17:44:22 +0100 Subject: [PATCH] ASoC: wm2000: Remove wm2000_read helper function The return type "unsigned int" was used by the wm2000_read() function despite of the aspect that it will eventually return a negative error code. The resulting function doesn't add much to the code, so replace wm2000_read with regmap_read. Signed-off-by: Lucas Tanure Acked-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm2000.c | 54 ++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-) -- 2.19.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index c5ae07234a00..bba330e30162 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -88,19 +88,6 @@ static int wm2000_write(struct i2c_client *i2c, unsigned int reg, return regmap_write(wm2000->regmap, reg, value); } -static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r) -{ - struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c); - unsigned int val; - int ret; - - ret = regmap_read(wm2000->regmap, r, &val); - if (ret < 0) - return -1; - - return val; -} - static void wm2000_reset(struct wm2000_priv *wm2000) { struct i2c_client *i2c = wm2000->i2c; @@ -115,14 +102,15 @@ static void wm2000_reset(struct wm2000_priv *wm2000) static int wm2000_poll_bit(struct i2c_client *i2c, unsigned int reg, u8 mask) { + struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c); int timeout = 4000; - int val; + unsigned int val; - val = wm2000_read(i2c, reg); + regmap_read(wm2000->regmap, reg, &val); while (!(val & mask) && --timeout) { msleep(1); - val = wm2000_read(i2c, reg); + regmap_read(wm2000->regmap, reg, &val); } if (timeout == 0) @@ -135,6 +123,7 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) { struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); unsigned long rate; + unsigned int val; int ret; if (WARN_ON(wm2000->anc_mode != ANC_OFF)) @@ -213,12 +202,17 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) WM2000_MODE_THERMAL_ENABLE); } - ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); + ret = regmap_read(wm2000->regmap, WM2000_REG_SPEECH_CLARITY, &val); + if (ret != 0) { + dev_err(&i2c->dev, "Unable to read Speech Clarity: %d\n", ret); + regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); + return ret; + } if (wm2000->speech_clarity) - ret |= WM2000_SPEECH_CLARITY; + val |= WM2000_SPEECH_CLARITY; else - ret &= ~WM2000_SPEECH_CLARITY; - wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); + val &= ~WM2000_SPEECH_CLARITY; + wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, val); wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); wm2000_write(i2c, WM2000_REG_SYS_START1, 0x02); @@ -824,7 +818,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, const char *filename; const struct firmware *fw = NULL; int ret, i; - int reg; + unsigned int reg; u16 id; wm2000 = devm_kzalloc(&i2c->dev, sizeof(*wm2000), GFP_KERNEL); @@ -860,9 +854,17 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, } /* Verify that this is a WM2000 */ - reg = wm2000_read(i2c, WM2000_REG_ID1); + ret = regmap_read(wm2000->regmap, WM2000_REG_ID1, ®); + if (ret != 0) { + dev_err(&i2c->dev, "Unable to read ID1: %d\n", ret); + return ret; + } id = reg << 8; - reg = wm2000_read(i2c, WM2000_REG_ID2); + ret = regmap_read(wm2000->regmap, WM2000_REG_ID2, ®); + if (ret != 0) { + dev_err(&i2c->dev, "Unable to read ID2: %d\n", ret); + return ret; + } id |= reg & 0xff; if (id != 0x2000) { @@ -871,7 +873,11 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, goto err_supplies; } - reg = wm2000_read(i2c, WM2000_REG_REVISON); + ret = regmap_read(wm2000->regmap, WM2000_REG_REVISON, ®); + if (ret != 0) { + dev_err(&i2c->dev, "Unable to read Revision: %d\n", ret); + return ret; + } dev_info(&i2c->dev, "revision %c\n", reg + 'A'); wm2000->mclk = devm_clk_get(&i2c->dev, "MCLK");