From patchwork Mon Apr 9 02:14:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 10329725 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 767F2604D4 for ; Mon, 9 Apr 2018 02:15:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6722728821 for ; Mon, 9 Apr 2018 02:15:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DCD42886D; Mon, 9 Apr 2018 02:15:13 +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=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham 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 BDA3428821 for ; Mon, 9 Apr 2018 02:15:11 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9EE5D2673E8; Mon, 9 Apr 2018 04:15:10 +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 E83722673E8; Mon, 9 Apr 2018 04:15:07 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id AAB092673F2 for ; Mon, 9 Apr 2018 04:15:02 +0200 (CEST) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie1.idc.renesas.com with ESMTP; 09 Apr 2018 11:15:01 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 32D6A6F49C; Mon, 9 Apr 2018 11:15:01 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.48,426,1517842800"; d="scan'208";a="276198774" Received: from mail-ty1jpn01lp0177.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.177]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 09 Apr 2018 11:15:01 +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=LIDAwilCffG4fE4m8Mc+WKXhX4PdDyO08F4KMn59dDU=; b=Gt+Na4aFmUIP7dH5lNsTkEyDOfFAq8ngaBqbnCQSAMWpAwOu7T+q5U1W8VPMreuEu5HG5YZgDpMwJeeOXyyUP2AmL8yDKFU2nq2VbiSdYAAtYP+UwSkmytadvkLOSoSLYTvX/xFpZ2MBe15lUFcxpGpc10DwIO0yROgSQPEEIwI= 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 OSBPR01MB2069.jpnprd01.prod.outlook.com (2603:1096:603:22::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Mon, 9 Apr 2018 02:14:58 +0000 Message-ID: <87k1thf7ri.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87muydf7t2.wl%kuninori.morimoto.gx@renesas.com> References: <87muydf7t2.wl%kuninori.morimoto.gx@renesas.com> Date: Mon, 9 Apr 2018 02:14:58 +0000 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: SG2PR06CA0128.apcprd06.prod.outlook.com (2603:1096:1:1d::30) To OSBPR01MB2069.jpnprd01.prod.outlook.com (2603:1096:603:22::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cd0ba97c-e799-4303-306c-08d59dbfb216 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:OSBPR01MB2069; X-Microsoft-Exchange-Diagnostics: 1; OSBPR01MB2069; 3:7itv+hhbMuZR0bQdwcp1+3k60FpACKY99HymYM51pKJPha92Cgn9Ab11bcFrMKNo0yzctEROhDSxNkB+Lvhd3G9EvsTo/b/OJYuo68bTxyJlkJZIuO4zwI4Uf0Dpdso1bc4JjydjPpbuWz8c2MoPA0Riqyy05WPDZE1X5FniEOoH6oZsRjd/Idp8lAtkOHfUcBT5klmB6TPudIw8FvAVeRMZ/DKGJgalEP0yCZ9dEnQuNPeMwMoBjdzboTDeLR3a; 25:BT8aLr7ZuU264RRdYn5vvtPSNrRLR4+D8sraCvuIUEyMAIk7X6/V0gCOQ4wOzUkI8alB/2Qz7m8GFvfmxQCPR0XDDR2p4r0u8/xL7GFQPH9GdimKhwJ3KmBE9Dtb/DuSqH4q0onn2cM5MSvzlculRN440TAZMQ9UsuDnmE2TH2XX1uaP85p27BCw/8sUzDXwh4ZrUct5t78MkeUwaE76RdH9ZDoGRSVMNowVAaEDRNwgIzBzpzwDhvzziT7K51Wc+Rq4rwOZj0xF3uR0Gt2StVK7VqFPWlkDx3PhqRlsSGbStL96YJeycGdUMt0EmApwP1WcF7HUR4vVPYsWwxHpQg==; 31:TAPpRcmqa50GOycgHtObmVBxEpyfAIvYPXSAAf2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X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231221)(944501327)(52105095)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:OSBPR01MB2069; BCL:0; PCL:0; RULEID:; SRVR:OSBPR01MB2069; X-Forefront-PRVS: 0637FCE711 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(396003)(39380400002)(39860400002)(189003)(199004)(105586002)(8936002)(5660300001)(386003)(25786009)(478600001)(186003)(2616005)(16526019)(446003)(476003)(11346002)(23726003)(6916009)(7736002)(956004)(53416004)(305945005)(486006)(86362001)(26005)(6486002)(58126008)(16586007)(50466002)(316002)(81156014)(81166006)(69596002)(106356001)(66066001)(4326008)(8676002)(68736007)(59450400001)(76176011)(47776003)(6116002)(36756003)(52116002)(7696005)(97736004)(53936002)(2906002)(3846002)(2004002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:OSBPR01MB2069; H:morimoto-PC.renesas.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; OSBPR01MB2069; 23:lhMXm3v8GeNsq3nX7n7xCDeC8KJYflnaSgAdoFyor?= =?us-ascii?Q?1B1hmsTeljY/DevfdCJAxBjB2Q2Zte+APPEK7wA57Zj9LxXF2o/aIkYi0Sno?= =?us-ascii?Q?jlta0gCO1K0St2GwjEPUpIP9AinSGTk2rbEx/bhUNDxUOPvdJb3ecGChWT3E?= =?us-ascii?Q?jkWXBltVRtXDRo8aRQM1m/a9A6WqBkFuIIGpAFWBXijAHIsqC0+P63CiL7vG?= =?us-ascii?Q?X/0lAGec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W00B+uJWPHrO3utOYKMhoB18nZ6ASVrJXqP2XBv9ZzuGHrFyshRerkkybEyZWdmu3z9IUof8BQLqrOjtThT2+wvRk+jeLiUK5q2AD9lUI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; OSBPR01MB2069; 7:CzYxQgdiK50/W4NojwLh2299lfo2Cq58paXbpyAkx4CKbxhubFTcfiB6u3Kq5jHWSGBne+0l6nCIOssTQtw07QnogqK8Kd09aonPfCX2oePBakvvxakjtilLUkKmOzGmVT2YavJW8v6aKSiWn1jWhx83oE7+A/OLXgUSMgcIxWqqyNLXack8cEz+mZOdS8SKQiuQE5GFoyN90d7N4T8egZifrRtFxXsaj0a9mmbxgShAAlMSnWxJPiKEkzXhFYkj; 20:tkgjCVOuu9Ct7qga7/IHJaa6lPYEYvgfuRanbLGDabCOkCgWQDFR9VueuZjf5B+oNEyeGwMuWs+kjLsdawOXj6yFmE5BJxjrIrg7oezcHq+ja56XzW7899hdiql4DLWZFOZuz1wM2JE11+XdfCSLqCs5gEKbWn0YcxHj3MtOQy0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2018 02:14:58.7406 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd0ba97c-e799-4303-306c-08d59dbfb216 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSBPR01MB2069 Cc: Linux-ALSA Subject: [alsa-devel] [PATCH 2/5][RFC] ASoC: remove codec reg_cache 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 Codec reg_cache is legacy feature, almost all driver are now using common regmap, and very few driver had been used this legacy feature. Because of this background, it is now implemented on each driver internally now. So now, no one is using codec reg_cache. Let's remove it. Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 13 ---- sound/soc/Makefile | 2 +- sound/soc/soc-cache.c | 53 ------------- sound/soc/soc-core.c | 207 -------------------------------------------------- 4 files changed, 1 insertion(+), 274 deletions(-) delete mode 100644 sound/soc/soc-cache.c diff --git a/include/sound/soc.h b/include/sound/soc.h index 356c9bd..8e50a39 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -482,8 +482,6 @@ int devm_snd_soc_register_component(struct device *dev, void snd_soc_unregister_component(struct device *dev); struct snd_soc_component *snd_soc_lookup_component(struct device *dev, const char *driver_name); -int snd_soc_cache_init(struct snd_soc_codec *codec); -int snd_soc_cache_exit(struct snd_soc_codec *codec); int snd_soc_platform_read(struct snd_soc_platform *platform, unsigned int reg); @@ -921,7 +919,6 @@ struct snd_soc_component { int (*init)(struct snd_soc_component *component); #ifdef CONFIG_DEBUG_FS - void (*init_debugfs)(struct snd_soc_component *component); const char *debugfs_prefix; #endif }; @@ -945,12 +942,6 @@ struct snd_soc_codec { struct list_head list; - /* runtime */ - unsigned int cache_init:1; /* codec cache has been initialized */ - - /* codec IO */ - void *reg_cache; - /* component */ struct snd_soc_component component; }; @@ -977,10 +968,6 @@ struct snd_soc_codec_driver { struct regmap *(*get_regmap)(struct device *); unsigned int (*read)(struct snd_soc_codec *, unsigned int); int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); - unsigned int reg_cache_size; - short reg_cache_step; - short reg_word_size; - const void *reg_cache_default; /* codec bias level */ int (*set_bias_level)(struct snd_soc_codec *, diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 8d92492..06389a5 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o +snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-utils.o snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c deleted file mode 100644 index 07f4335..0000000 --- a/sound/soc/soc-cache.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * soc-cache.c -- ASoC register cache helpers - * - * Copyright 2009 Wolfson Microelectronics PLC. - * - * Author: Mark Brown - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include - -int snd_soc_cache_init(struct snd_soc_codec *codec) -{ - const struct snd_soc_codec_driver *codec_drv = codec->driver; - size_t reg_size; - - reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size; - - if (!reg_size) - return 0; - - dev_dbg(codec->dev, "ASoC: Initializing cache for %s codec\n", - codec->component.name); - - if (codec_drv->reg_cache_default) - codec->reg_cache = kmemdup(codec_drv->reg_cache_default, - reg_size, GFP_KERNEL); - else - codec->reg_cache = kzalloc(reg_size, GFP_KERNEL); - if (!codec->reg_cache) - return -ENOMEM; - - return 0; -} - -/* - * NOTE: keep in mind that this function might be called - * multiple times. - */ -int snd_soc_cache_exit(struct snd_soc_codec *codec) -{ - dev_dbg(codec->dev, "ASoC: Destroying cache for %s codec\n", - codec->component.name); - kfree(codec->reg_cache); - codec->reg_cache = NULL; - return 0; -} diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bf7ca32a..5f6e009 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -83,98 +83,6 @@ NULL, /* terminator */ }; -/* returns the minimum number of bytes needed to represent - * a particular given value */ -static int min_bytes_needed(unsigned long val) -{ - int c = 0; - int i; - - for (i = (sizeof val * 8) - 1; i >= 0; --i, ++c) - if (val & (1UL << i)) - break; - c = (sizeof val * 8) - c; - if (!c || (c % 8)) - c = (c + 8) / 8; - else - c /= 8; - return c; -} - -/* fill buf which is 'len' bytes with a formatted - * string of the form 'reg: value\n' */ -static int format_register_str(struct snd_soc_codec *codec, - unsigned int reg, char *buf, size_t len) -{ - int wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2; - int regsize = codec->driver->reg_word_size * 2; - int ret; - - /* +2 for ': ' and + 1 for '\n' */ - if (wordsize + regsize + 2 + 1 != len) - return -EINVAL; - - sprintf(buf, "%.*x: ", wordsize, reg); - buf += wordsize + 2; - - ret = snd_soc_read(codec, reg); - if (ret < 0) - memset(buf, 'X', regsize); - else - sprintf(buf, "%.*x", regsize, ret); - buf[regsize] = '\n'; - /* no NUL-termination needed */ - return 0; -} - -/* codec register dump */ -static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf, - size_t count, loff_t pos) -{ - int i, step = 1; - int wordsize, regsize; - int len; - size_t total = 0; - loff_t p = 0; - - wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2; - regsize = codec->driver->reg_word_size * 2; - - len = wordsize + regsize + 2 + 1; - - if (!codec->driver->reg_cache_size) - return 0; - - if (codec->driver->reg_cache_step) - step = codec->driver->reg_cache_step; - - for (i = 0; i < codec->driver->reg_cache_size; i += step) { - /* only support larger than PAGE_SIZE bytes debugfs - * entries for the default case */ - if (p >= pos) { - if (total + len >= count - 1) - break; - format_register_str(codec, i, buf + total, len); - total += len; - } - p += len; - } - - total = min(total, count - 1); - - return total; -} - -static ssize_t codec_reg_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); - - return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); -} - -static DEVICE_ATTR_RO(codec_reg); - static ssize_t pmdown_time_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -200,7 +108,6 @@ static ssize_t pmdown_time_set(struct device *dev, static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); static struct attribute *soc_dev_attrs[] = { - &dev_attr_codec_reg.attr, &dev_attr_pmdown_time.attr, NULL }; @@ -233,71 +140,6 @@ static umode_t soc_dev_attr_is_visible(struct kobject *kobj, }; #ifdef CONFIG_DEBUG_FS -static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - ssize_t ret; - struct snd_soc_codec *codec = file->private_data; - char *buf; - - if (*ppos < 0 || !count) - return -EINVAL; - - buf = kmalloc(count, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - ret = soc_codec_reg_show(codec, buf, count, *ppos); - if (ret >= 0) { - if (copy_to_user(user_buf, buf, ret)) { - kfree(buf); - return -EFAULT; - } - *ppos += ret; - } - - kfree(buf); - return ret; -} - -static ssize_t codec_reg_write_file(struct file *file, - const char __user *user_buf, size_t count, loff_t *ppos) -{ - char buf[32]; - size_t buf_size; - char *start = buf; - unsigned long reg, value; - struct snd_soc_codec *codec = file->private_data; - int ret; - - buf_size = min(count, (sizeof(buf)-1)); - if (copy_from_user(buf, user_buf, buf_size)) - return -EFAULT; - buf[buf_size] = 0; - - while (*start == ' ') - start++; - reg = simple_strtoul(start, &start, 16); - while (*start == ' ') - start++; - ret = kstrtoul(start, 16, &value); - if (ret) - return ret; - - /* Userspace has been fiddling around behind the kernel's back */ - add_taint(TAINT_USER, LOCKDEP_NOW_UNRELIABLE); - - snd_soc_write(codec, reg, value); - return buf_size; -} - -static const struct file_operations codec_reg_fops = { - .open = simple_open, - .read = codec_reg_read_file, - .write = codec_reg_write_file, - .llseek = default_llseek, -}; - static void soc_init_component_debugfs(struct snd_soc_component *component) { if (!component->card->debugfs_card_root) @@ -326,9 +168,6 @@ static void soc_init_component_debugfs(struct snd_soc_component *component) snd_soc_dapm_debugfs_init(snd_soc_component_get_dapm(component), component->debugfs_root); - - if (component->init_debugfs) - component->init_debugfs(component); } static void soc_cleanup_component_debugfs(struct snd_soc_component *component) @@ -336,19 +175,6 @@ static void soc_cleanup_component_debugfs(struct snd_soc_component *component) debugfs_remove_recursive(component->debugfs_root); } -static void soc_init_codec_debugfs(struct snd_soc_component *component) -{ - struct snd_soc_codec *codec = snd_soc_component_to_codec(component); - struct dentry *debugfs_reg; - - debugfs_reg = debugfs_create_file("codec_reg", 0644, - codec->component.debugfs_root, - codec, &codec_reg_fops); - if (!debugfs_reg) - dev_warn(codec->dev, - "ASoC: Failed to create codec register debugfs file\n"); -} - static int codec_list_show(struct seq_file *m, void *v) { struct snd_soc_codec *codec; @@ -451,8 +277,6 @@ static void snd_soc_debugfs_exit(void) #else -#define soc_init_codec_debugfs NULL - static inline void soc_init_component_debugfs( struct snd_soc_component *component) { @@ -1838,24 +1662,6 @@ static void soc_remove_aux_devices(struct snd_soc_card *card) } } -static int snd_soc_init_codec_cache(struct snd_soc_codec *codec) -{ - int ret; - - if (codec->cache_init) - return 0; - - ret = snd_soc_cache_init(codec); - if (ret < 0) { - dev_err(codec->dev, - "ASoC: Failed to set cache compression type: %d\n", - ret); - return ret; - } - codec->cache_init = 1; - return 0; -} - /** * snd_soc_runtime_set_dai_fmt() - Change DAI link format for a ASoC runtime * @rtd: The runtime for which the DAI link format should be changed @@ -2078,7 +1884,6 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) static int snd_soc_instantiate_card(struct snd_soc_card *card) { - struct snd_soc_codec *codec; struct snd_soc_pcm_runtime *rtd; struct snd_soc_dai_link *dai_link; int ret, i, order; @@ -2104,15 +1909,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) for (i = 0; i < card->num_links; i++) snd_soc_add_dai_link(card, card->dai_link+i); - /* initialize the register cache for each available codec */ - list_for_each_entry(codec, &codec_list, list) { - if (codec->cache_init) - continue; - ret = snd_soc_init_codec_cache(codec); - if (ret < 0) - goto base_error; - } - /* card bind complete so register a sound card */ ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, card->owner, 0, &card->snd_card); @@ -3800,10 +3596,8 @@ int snd_soc_register_codec(struct device *dev, dapm->set_bias_level = snd_soc_codec_set_bias_level; codec->dev = dev; codec->driver = codec_drv; - codec->component.val_bytes = codec_drv->reg_word_size; #ifdef CONFIG_DEBUG_FS - codec->component.init_debugfs = soc_init_codec_debugfs; codec->component.debugfs_prefix = "codec"; #endif @@ -3867,7 +3661,6 @@ void snd_soc_unregister_codec(struct device *dev) codec->component.name); snd_soc_component_cleanup(&codec->component); - snd_soc_cache_exit(codec); kfree(codec); } EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);