From patchwork Thu Nov 9 01:04:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10049893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 541D5601EB for ; Thu, 9 Nov 2017 01:04:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4430229A16 for ; Thu, 9 Nov 2017 01:04:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3822629A26; Thu, 9 Nov 2017 01:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 384EA29A16 for ; Thu, 9 Nov 2017 01:04:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 84F91266F2E; Thu, 9 Nov 2017 02:04:24 +0100 (CET) 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 602A32675BD; Thu, 9 Nov 2017 02:04:23 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 8AB92266F1E for ; Thu, 9 Nov 2017 02:04:15 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 09 Nov 2017 10:04:11 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id E4CBF6A170; Thu, 9 Nov 2017 10:04:11 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.44,365,1505746800"; d="scan'208";a="262914847" Received: from mail-sg2apc01lp0245.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.245]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 09 Nov 2017 10:04:11 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+pVQzc+pIaX8s0/d0DEgvYaBgHNaJLsrT0k4u4uTcvo=; b=Od4VnW6aQX1Zq6poyABdZyiv7vY/QyAO+KtXaAbwjOEQdI5QS4yqkto9EgnJw6dj2vHR0yIJUYow+0z+wXwZ+5VxlqjC8XCQ8sA0A5HCoJ4f3IsrIeofbJxO2OGabGFdEwhYAtBWgV+N/XJB7tJ/sjW056YTAhJqy+IRLG69h1c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.138) by KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Thu, 9 Nov 2017 01:04:09 +0000 Message-ID: <871sl8qni5.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <877ev0qpmc.wl%kuninori.morimoto.gx@renesas.com> References: <877ev0qpmc.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 9 Nov 2017 01:04:09 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAWPR01CA0055.jpnprd01.prod.outlook.com (2603:1096:402:b::15) To KL1PR0601MB1879.apcprd06.prod.outlook.com (2603:1096:802:8::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53403c44-041d-4b7f-9bb8-08d5270dc8c0 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:KL1PR0601MB1879; X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 3:IB/sP2WnNjWmVnWLLG1E5K4I39n4VRfKdVRsmRpd3ckHDm5QYiFom0R7bNbaGjLmGAgbGEv2p9jmlD940WjC+ZJZ5MA+3uC/UTMN2HLiIISiU012j3+WlEXQELT9KABb7Un8LyzttW6MLgh9ZJeIW86VVayH+gNSpkpNLTIyl5rM6mFIu7bLoe5gfMj6FUrQWOO00EreL9i5/QqmvncIF5tzkizSEWPRuOslIfO8G47kJe6ErWsygNd3Wf/9devz; 25:QBEAv+qRparIdafXidol6YEO1TVrsTFpR0F2mcoBa5DTzZE5SjlBp6sJKYh3R1DXiDFdiBkWowg6XaCdaZPdoaqqjOYHYXurQvoFuamroyE2pvqq68u31UaDvNLHXJ2C9InyHffl2GXFStY979dfcA1nHkinLw34UTHrrEoms3Ap5HUoKcZYDlGd4As6SltY8B+vx9uGd273zhUbV5AjaiRNpP7/sgH9aI3/G+Ozp7Pot3p9sBtQ+pwAs9BzCqJVgPkUT0LUEUWQxa7VMPVpOm8wxVYHt15lxyIvxGAqwWg6EwfrEi59Ey/npn/v5uBDhi8aXsXoyiR/di6B88R67w==; 31:di21J5FZqBGXdWE0FWP5t8UymDDU+EJbtr6hnF0b5zIZLbWmjrHY9IAYOrHQbzp0mpeJKxn4X14h2KTnPmJrtjFtEZ2e1TWHImG1tTOUKaa1G+ukhSWmmsnQGMLcQXtDQiwu2QK+DEym+/SYdeX/2zDsUgRI58liN29m7G6pEIXuL3545IAItgLqIkgNNlsEjej7ODqOPkISlq2+OjSVHUgvYXYOkbYVRiUZWKGKCqE= X-MS-TrafficTypeDiagnostic: KL1PR0601MB1879: X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 20:527tBF/FBr1To6cY3CF7g8AWOfrpCcMDESvU6PMI/tbriFb4IhFAt6/oYDp4m3eBTBObDZZFkHcxhf3fvsSSaoQrWS5T22ZcO1ailsdPwCm/Gfp+BpM+uZCqpNuXr56Bhc+ifgJOi6oCiswexyJKROTRGMf58X7GZB3cwV+Cu+fI1rgtkKWVjlX4wczA5+1Lr5lwEu54VvZ380kB64jTpm7Vl/cOCKYtLvmMpPtmSJfDLZdLk4DLGl1QzZfhVjTs/WF0t0flI+FA5hGzyjr8EUG8Qcx5l1Dnkq6kVn87h7ghCvAW8Et7zKFVTjN7BOhi41nJkv5T5UVmAvvK8xWmGquQIwyvRGQdtXTpfSPEboJ5x/0UXGym49BcsyLRSnvYI1y9JhDTdzhU6In94NO03hJgug5vgWN9fJ5PtaLMM2xphMuJ99upt1N9b+lv/MQtk0Hcbq8arOtPN94UjJG1iks6p4FXuxN0M3opR+WcYu1pdvSizpfaRPKzce4DWVEz; 4:Xfdxrj/wgZFNNxDQpbtvqHqHjcp4yG5UXUXWzHC6Sxg3hzxuGIfG106i5vdsPB4RnvMTvmaNUPrUNGpK79wvlAEQkrQwJbnyzdcZCOswRdLZrJlujU+8bVjzG1hnFm+2UgiARJjpV7hsCGj/Y9bZkduxyPHTdj3XraXEallxDiyqwozyjFfwsckOk0lOdfw4jUiMXmliZhawPk7SfYaHg/sjmCdMozSj9lrqn+iDDAJB9rnHIdRjgkBpwmZyR/oy30zjMJFgEGG0JJcE+jMc2Q== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231021)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:KL1PR0601MB1879; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:KL1PR0601MB1879; X-Forefront-PRVS: 0486A0CB86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(346002)(376002)(189002)(199003)(316002)(33646002)(53416004)(54906003)(16586007)(81166006)(105586002)(8676002)(58126008)(106356001)(81156014)(230783001)(8936002)(305945005)(7736002)(2906002)(36756003)(50986999)(101416001)(54356999)(76176999)(3846002)(6116002)(23726003)(68736007)(69596002)(50466002)(86362001)(83506002)(97736004)(66066001)(478600001)(47776003)(4326008)(53936002)(6916009)(25786009)(16526018)(2950100002)(6486002)(5660300001)(189998001)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR0601MB1879; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; KL1PR0601MB1879; 23:gqtfYTPM82TvH8U2ovwoMEGODLYab8opcYK7ARi?= =?us-ascii?Q?TjXUWnAZnEAreCoK9bUKjPU5QG2luRxjMaH34lCG06wK6v8/3RrqG4cq2lnL?= =?us-ascii?Q?k98HZFAAQXDmj8DrxNiZtCU6yODpd8FhnBqmNjhOn+5uaaoZug4BLCaZzEwy?= =?us-ascii?Q?JJJk9po+6tCJqXP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mkQZ68Yc2Bfc7XwbL0IfRAQOU5nDf2ElYqOf2OldZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; KL1PR0601MB1879; 20:vOWa0nG/08SxKqo7uqvB7wN1N7ueSAeVtfQmkVqzpYaRCCawX0Dg6EXgaYZdJRjouHb+aasIHvzVSrxKOZbPrDks/P6AJxzyAiwyiPGHA6P1xhnvXehQV5p1/N2USKjEQOGvWtyRKj8fI0MNPbAlSp/JB8AaZ+XT6Hg0ztJfQMo= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 01:04:09.3292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53403c44-041d-4b7f-9bb8-08d5270dc8c0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB1879 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 3/6] ASoC: don't use codec hw_write on cx20442/omap-ams-delta 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto cx20442/omap-ams-delta driver is using codec hw_write/control_data, but it is redundant code. This patch cleanup these Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/cx20442.c | 23 ++++++++++------------- sound/soc/omap/ams-delta.c | 4 ++-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 46b1fbb..2083f7e 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -26,7 +26,7 @@ struct cx20442_priv { - void *control_data; + struct tty_struct *tty; struct regulator *por; }; @@ -163,9 +163,9 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, if (reg >= codec->driver->reg_cache_size) return -EINVAL; - /* hw_write and control_data pointers required for talking to the modem + /* tty and write pointers required for talking to the modem * are expected to be set by the line discipline initialization code */ - if (!codec->hw_write || !cx20442->control_data) + if (!cx20442->tty || !cx20442->tty->ops->write) return -EIO; old = reg_cache[reg]; @@ -194,7 +194,7 @@ static int cx20442_write(struct snd_soc_codec *codec, unsigned int reg, return -ENOMEM; dev_dbg(codec->dev, "%s: %s\n", __func__, buf); - if (codec->hw_write(cx20442->control_data, buf, len) != len) + if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len) return -EIO; return 0; @@ -252,8 +252,7 @@ static void v253_close(struct tty_struct *tty) cx20442 = snd_soc_codec_get_drvdata(codec); /* Prevent the codec driver from further accessing the modem */ - codec->hw_write = NULL; - cx20442->control_data = NULL; + cx20442->tty = NULL; codec->component.card->pop_time = 0; } @@ -276,12 +275,11 @@ static void v253_receive(struct tty_struct *tty, cx20442 = snd_soc_codec_get_drvdata(codec); - if (!cx20442->control_data) { + if (!cx20442->tty) { /* First modem response, complete setup procedure */ /* Set up codec driver access to modem controls */ - cx20442->control_data = tty; - codec->hw_write = (hw_write_t)tty->ops->write; + cx20442->tty = tty; codec->component.card->pop_time = 1; } } @@ -367,10 +365,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) cx20442->por = regulator_get(codec->dev, "POR"); if (IS_ERR(cx20442->por)) dev_warn(codec->dev, "failed to get the regulator"); - cx20442->control_data = NULL; + cx20442->tty = NULL; snd_soc_codec_set_drvdata(codec, cx20442); - codec->hw_write = NULL; codec->component.card->pop_time = 0; return 0; @@ -381,8 +378,8 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) { struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); - if (cx20442->control_data) { - struct tty_struct *tty = cx20442->control_data; + if (cx20442->tty) { + struct tty_struct *tty = cx20442->tty; tty_hangup(tty); } diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 6c49f3d..faf85d0 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol, int pin, changed = 0; /* Refuse any mode changes if we are not able to control the codec. */ - if (!cx20442_codec->hw_write) + if (!cx20442_codec->component.card->pop_time) return -EUNATCH; if (ucontrol->value.enumerated.item[0] >= control->items) @@ -345,7 +345,7 @@ static void cx81801_receive(struct tty_struct *tty, if (!codec) return; - if (!codec->hw_write) { + if (!codec->component.card->pop_time) { /* First modem response, complete setup procedure */ /* Initialize timer used for config pulse generation */