From patchwork Fri Jan 12 01:28:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10159295 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 13DE0602D8 for ; Fri, 12 Jan 2018 01:38:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0292C28769 for ; Fri, 12 Jan 2018 01:38:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB20C287DE; Fri, 12 Jan 2018 01:38:09 +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 CF70C28769 for ; Fri, 12 Jan 2018 01:38:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 73F2F267FCC; Fri, 12 Jan 2018 02:38:07 +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 DE0AE267FC9; Fri, 12 Jan 2018 02:38:05 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 165232679CE for ; Fri, 12 Jan 2018 02:28:46 +0100 (CET) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 12 Jan 2018 10:28:45 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 9DEFB6A581; Fri, 12 Jan 2018 10:28:45 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.46,346,1511794800"; d="scan'208";a="268008445" Received: from mail-hk2apc01lp0210.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.210]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 12 Jan 2018 10:28:44 +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=CHnh1GjEno7W2DBmORcJWM/s/xzN/ecSSmqu/KPctps=; b=KxhZW+1WSTwNkmR2AXupfx7Hu4qECAmKN1Q2MTeNZycTYXg7GOahJZCwZO3c4CqGXpG+zI3ZXEpgw7FVR+KO+N38W+I8NqRgrKXgdB8Qhxd5ryz2w8KBoJTKSXZmXQ7z7SAofoQzDEabimPb/qtWh+zwoxz1uVJKHx9gA11HdsY= 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 PS1PR0601MB1882.apcprd06.prod.outlook.com (2603:1096:803:8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 12 Jan 2018 01:28:42 +0000 Message-ID: <87inc7amt6.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: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> References: <87bmhzevk9.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 12 Jan 2018 01:28:42 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: KAXPR01CA0034.jpnprd01.prod.outlook.com (2603:1096:402:1a::20) To PS1PR0601MB1882.apcprd06.prod.outlook.com (2603:1096:803:8::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 805c7cee-60e6-40d2-ffba-08d5595bd146 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020074)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:PS1PR0601MB1882; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 3:ry48mpFPJAmuK9YKC/5YoU9FnBDMcwvr9+0U0LFGXLd8BRzTPq4oqlJLVQGoRjTG0v9RzTLS+5WXoIpqZUXO9glPyA3sKNf57GOuoMVN3vSABTJFM+5TSpbOoe6VhIeX9CMfkrm6uNgPkilCusats3Ce0bjdFh6dRHgs9ctWGiFrEbsH3j+f9R9cyQwsppt73gotNkjPxtwVJ3CfndaKTAVHLyulKh9jp5muKjbp2rjBHLUwx82ZdEeh9QIB+yjg; 25:MVTGVhGueyPT9GJlLhKtH0JAzFCSabFCH2D5tB+AV2IaBIvH2FGlZd8HII7ZjmV7a7BOrKbCKp7d314xAHcTKUU/w7potKERKEF+rY3WKpt95ISWcwOA90g8SpBtDNCQuZ6E+Jw4pxHlwdXVXoc0U3gbyCF/kDSMf64WYQuM4gvf397nfpKQSrmj6sGgC2qkqv2SQX1B4j9M7VJIxSHUQICzSiqYFFO99ifLQe2qFpbPQLGtIABiqkaiO8CkwfB4bF9ou6842MozhyyFuItpuDxN+qCigRMJg+A22GuYh6Iib9KsNaq/8haE8g4XdOcS9OFtXhsUw8Of7/tal0uVJQ==; 31:33f+uy8UnvWRhgvpME3M5PhShHeuiafcXDI5lFSj8jRC8OaJA/QNJwC1c6AG+7+PjE9HAgyJpHFozpKIjYSfRyp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oft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(944501138)(10201501046)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:PS1PR0601MB1882; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:PS1PR0601MB1882; X-Forefront-PRVS: 0550778858 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(39380400002)(376002)(39860400002)(346002)(396003)(189003)(199004)(478600001)(52116002)(54906003)(7696005)(53936002)(59450400001)(16526018)(105586002)(76176011)(6486002)(4326008)(47776003)(5660300001)(106356001)(58126008)(66066001)(16586007)(2950100002)(6916009)(83506002)(316002)(25786009)(81156014)(8676002)(305945005)(7736002)(23726003)(3846002)(97736004)(68736007)(8936002)(86362001)(81166006)(50466002)(69596002)(386003)(53416004)(6116002)(2906002)(36756003)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1882; 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; PS1PR0601MB1882; 23:EjobCjDTZcG0YudTfRQfM8CxUhG/XSNmyts7+u+?= =?us-ascii?Q?AEFnJr9f90aNv2TN1ewRdwo/qxZb4rTr38d1vjlroe0HYAza7MoBxIC+10uO?= =?us-ascii?Q?JUXiIh1IgysvKV9JUv8T1rDKrgxpcsYT0xxsym+cbUcwWRIYDpZjFS1yT8my?= =?us-ascii?Q?9qkhZ+6tc/RUAKMy54E7yFsR+8NglCWDFJiMrLWuE8kP+kgzBvxS0l8/yckP?= =?us-ascii?Q?qj7sMVCJD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SPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1882; 20:j7xQusdLWdspZ85UD11H8wOFqw4QedEeU/izIE/mTEYZ6cWWmNQ3lk9ACU3r7w5/43hRz19/Vt5oI5tNMQoi9YHwXfl6v3OBNadR9xbODvudQAppr+8oxbaqJ+YLwcs578AkH8xTQoa+Ex/MVPH3grf/P/hM1Rln6UjBnB8ITwc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2018 01:28:42.7499 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 805c7cee-60e6-40d2-ffba-08d5595bd146 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1882 Cc: Linux-ALSA , Simon Subject: [alsa-devel] [PATCH 071/187] ASoC: cs4270: replace codec to component 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 Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto --- sound/soc/codecs/cs4270.c | 124 ++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 69 deletions(-) diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 84f8674..d5c1751 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -254,8 +254,8 @@ static bool cs4270_reg_is_volatile(struct device *dev, unsigned int reg) static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); cs4270->mclk = freq; return 0; @@ -277,8 +277,8 @@ static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { - struct snd_soc_codec *codec = codec_dai->codec; - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); /* set DAI format */ switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -287,7 +287,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK; break; default: - dev_err(codec->dev, "invalid dai format\n"); + dev_err(component->dev, "invalid dai format\n"); return -EINVAL; } @@ -301,7 +301,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai, break; default: /* all other modes are unsupported by the hardware */ - dev_err(codec->dev, "Unknown master/slave configuration\n"); + dev_err(component->dev, "Unknown master/slave configuration\n"); return -EINVAL; } @@ -326,8 +326,8 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int ret; unsigned int i; unsigned int rate; @@ -346,13 +346,13 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, if (i == NUM_MCLK_RATIOS) { /* We did not find a matching ratio */ - dev_err(codec->dev, "could not find matching ratio\n"); + dev_err(component->dev, "could not find matching ratio\n"); return -EINVAL; } /* Set the sample rate */ - reg = snd_soc_read(codec, CS4270_MODE); + reg = snd_soc_component_read32(component, CS4270_MODE); reg &= ~(CS4270_MODE_SPEED_MASK | CS4270_MODE_DIV_MASK); reg |= cs4270_mode_ratios[i].mclk; @@ -361,15 +361,15 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, else reg |= cs4270_mode_ratios[i].speed_mode; - ret = snd_soc_write(codec, CS4270_MODE, reg); + ret = snd_soc_component_write(component, CS4270_MODE, reg); if (ret < 0) { - dev_err(codec->dev, "i2c write failed\n"); + dev_err(component->dev, "i2c write failed\n"); return ret; } /* Set the DAI format */ - reg = snd_soc_read(codec, CS4270_FORMAT); + reg = snd_soc_component_read32(component, CS4270_FORMAT); reg &= ~(CS4270_FORMAT_DAC_MASK | CS4270_FORMAT_ADC_MASK); switch (cs4270->mode) { @@ -380,13 +380,13 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, reg |= CS4270_FORMAT_DAC_LJ | CS4270_FORMAT_ADC_LJ; break; default: - dev_err(codec->dev, "unknown dai format\n"); + dev_err(component->dev, "unknown dai format\n"); return -EINVAL; } - ret = snd_soc_write(codec, CS4270_FORMAT, reg); + ret = snd_soc_component_write(component, CS4270_FORMAT, reg); if (ret < 0) { - dev_err(codec->dev, "i2c write failed\n"); + dev_err(component->dev, "i2c write failed\n"); return ret; } @@ -405,11 +405,11 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream, */ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int reg6; - reg6 = snd_soc_read(codec, CS4270_MUTE); + reg6 = snd_soc_component_read32(component, CS4270_MUTE); if (mute) reg6 |= CS4270_MUTE_DAC_A | CS4270_MUTE_DAC_B; @@ -418,7 +418,7 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) reg6 |= cs4270->manual_mute; } - return snd_soc_write(codec, CS4270_MUTE, reg6); + return snd_soc_component_write(component, CS4270_MUTE, reg6); } /** @@ -438,8 +438,8 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute) static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int left = !ucontrol->value.integer.value[0]; int right = !ucontrol->value.integer.value[1]; @@ -501,9 +501,9 @@ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, * This function is called when ASoC has all the pieces it needs to * instantiate a sound driver. */ -static int cs4270_probe(struct snd_soc_codec *codec) +static int cs4270_probe(struct snd_soc_component *component) { - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int ret; /* Disable auto-mute. This feature appears to be buggy. In some @@ -511,9 +511,9 @@ static int cs4270_probe(struct snd_soc_codec *codec) * this feature disabled by default. An application (e.g. alsactl) can * re-enabled it by using the controls. */ - ret = snd_soc_update_bits(codec, CS4270_MUTE, CS4270_MUTE_AUTO, 0); + ret = snd_soc_component_update_bits(component, CS4270_MUTE, CS4270_MUTE_AUTO, 0); if (ret < 0) { - dev_err(codec->dev, "i2c write failed\n"); + dev_err(component->dev, "i2c write failed\n"); return ret; } @@ -522,10 +522,10 @@ static int cs4270_probe(struct snd_soc_codec *codec) * playback has started. An application (e.g. alsactl) can * re-enabled it by using the controls. */ - ret = snd_soc_update_bits(codec, CS4270_TRANS, + ret = snd_soc_component_update_bits(component, CS4270_TRANS, CS4270_TRANS_SOFT | CS4270_TRANS_ZERO, 0); if (ret < 0) { - dev_err(codec->dev, "i2c write failed\n"); + dev_err(component->dev, "i2c write failed\n"); return ret; } @@ -541,13 +541,11 @@ static int cs4270_probe(struct snd_soc_codec *codec) * * This function is the counterpart to cs4270_probe(). */ -static int cs4270_remove(struct snd_soc_codec *codec) +static void cs4270_remove(struct snd_soc_component *component) { - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies); - - return 0; }; #ifdef CONFIG_PM @@ -561,16 +559,16 @@ static int cs4270_remove(struct snd_soc_codec *codec) * and all registers are written back to the hardware when resuming. */ -static int cs4270_soc_suspend(struct snd_soc_codec *codec) +static int cs4270_soc_suspend(struct snd_soc_component *component) { - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int reg, ret; - reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; + reg = snd_soc_component_read32(component, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; if (reg < 0) return reg; - ret = snd_soc_write(codec, CS4270_PWRCTL, reg); + ret = snd_soc_component_write(component, CS4270_PWRCTL, reg); if (ret < 0) return ret; @@ -580,9 +578,9 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec) return 0; } -static int cs4270_soc_resume(struct snd_soc_codec *codec) +static int cs4270_soc_resume(struct snd_soc_component *component) { - struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); + struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); int reg, ret; ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), @@ -598,10 +596,10 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec) regcache_sync(cs4270->regmap); /* ... then disable the power-down bits */ - reg = snd_soc_read(codec, CS4270_PWRCTL); + reg = snd_soc_component_read32(component, CS4270_PWRCTL); reg &= ~CS4270_PWRCTL_PDN_ALL; - return snd_soc_write(codec, CS4270_PWRCTL, reg); + return snd_soc_component_write(component, CS4270_PWRCTL, reg); } #else #define cs4270_soc_suspend NULL @@ -611,20 +609,21 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec) /* * ASoC codec driver structure */ -static const struct snd_soc_codec_driver soc_codec_device_cs4270 = { - .probe = cs4270_probe, - .remove = cs4270_remove, - .suspend = cs4270_soc_suspend, - .resume = cs4270_soc_resume, - - .component_driver = { - .controls = cs4270_snd_controls, - .num_controls = ARRAY_SIZE(cs4270_snd_controls), - .dapm_widgets = cs4270_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(cs4270_dapm_widgets), - .dapm_routes = cs4270_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(cs4270_dapm_routes), - }, +static const struct snd_soc_component_driver soc_component_device_cs4270 = { + .probe = cs4270_probe, + .remove = cs4270_remove, + .suspend = cs4270_soc_suspend, + .resume = cs4270_soc_resume, + .controls = cs4270_snd_controls, + .num_controls = ARRAY_SIZE(cs4270_snd_controls), + .dapm_widgets = cs4270_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs4270_dapm_widgets), + .dapm_routes = cs4270_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(cs4270_dapm_routes), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, }; /* @@ -718,23 +717,11 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client, i2c_set_clientdata(i2c_client, cs4270); - ret = snd_soc_register_codec(&i2c_client->dev, - &soc_codec_device_cs4270, &cs4270_dai, 1); + ret = devm_snd_soc_register_component(&i2c_client->dev, + &soc_component_device_cs4270, &cs4270_dai, 1); return ret; } -/** - * cs4270_i2c_remove - remove an I2C device - * @i2c_client: the I2C client object - * - * This function is the counterpart to cs4270_i2c_probe(). - */ -static int cs4270_i2c_remove(struct i2c_client *i2c_client) -{ - snd_soc_unregister_codec(&i2c_client->dev); - return 0; -} - /* * cs4270_id - I2C device IDs supported by this driver */ @@ -757,7 +744,6 @@ static int cs4270_i2c_remove(struct i2c_client *i2c_client) }, .id_table = cs4270_id, .probe = cs4270_i2c_probe, - .remove = cs4270_i2c_remove, }; module_i2c_driver(cs4270_i2c_driver);