Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp763789pxb; Mon, 16 Aug 2021 17:37:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ008VG1YjHeUBP8Q75wguOWqLZK0vo7TA8Mag9qkw44rv14egp2MJiGPfmHa9hDUOUE3O X-Received: by 2002:aa7:c956:: with SMTP id h22mr945398edt.378.1629160650613; Mon, 16 Aug 2021 17:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629160650; cv=none; d=google.com; s=arc-20160816; b=RdyCeoqk+PQapTV+VcIplXq+wT9ZX+FBjK8ozvjUrloPgE/xnDC/+mHkzEqSQn6fOG yKn3hM42LWZyN9Ixm9z1Eh+JLPB1YZwcipB7EK6HT6rFtyuGVpOubX/GE4yVJpvB1kNz P9qWQn67pl8L2NcDH5nDTrRqlICjbyBiJZGRQc9TMjq41S1rCXz1/u+FmAhDWH4QZcXB bxmu6jlQCddiaK8Cqq9JNzkWLi9cRiWlzNwfWk9NTrbRTO66C1HWO3ukQpLAzTWqmlSu YNnZjRiCA1TUqTUIZgdKVPwHqwp1gzIgGN1S61TshnZGrydf5ua5LXiHFfmOWkymVwIR q3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Vt4SNfK14V5CPinAu/2Z4V6tfP0oOIxH2pDfcqFWE8=; b=XUFP4fHvi+Gmf5hgOpPgrJpCB5oZPTBcHxKVaUsqwBx1E3uG2NiUfFB0jR+WbiZxFf 21FTgeAlTEF+aTajatriJWeE+WrGzSobAOeAU3Z8BnGt2cpZcPtoXxYKA+pzIdP6UPoK 0m7bn4Hi5S8lTX6d1zHP/DtkfalP65odGiRJ+MXj7+lm/veadNolz893eFkVDY3Wylue O0EuzMC+KNHB83qDnK9165WjBzFo7hiKryC4PLGgvvj5pwvSjmfMhlv0qWm+9GFDXhm4 9xIghLTEPLDKpLES29hduLMMP6rSFuqDkzVOYFNRUSQoblxvfR8qN5ZseBBzCNhhoKgn JVNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gFEgwmkG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne20si612984ejc.429.2021.08.16.17.37.07; Mon, 16 Aug 2021 17:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gFEgwmkG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235391AbhHQAgP (ORCPT + 99 others); Mon, 16 Aug 2021 20:36:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:34894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235363AbhHQAgM (ORCPT ); Mon, 16 Aug 2021 20:36:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 391F060FA0; Tue, 17 Aug 2021 00:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629160540; bh=d6nwFUt6VjHfJhTwsTeTPvBApRxDuqUwS984hXWMpVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFEgwmkGLmTjwxZJ4XL0cM+dpO52CMYP7GrmroAyg+8WYxwyw7rd3xVB5o7z3cpca 1xIaFt+1AYxrj4Vi90oF95Em2iNAOn6MHFzjrEyzV9tCAnnJSoFrLRLtj/Bh7KkoEk 8EAO7ZLRJco0hRvUWV0H818K7UDOteVX+C9Y+oM4kaHueQGkxseWF/wRDnT0IUVV5P CGqX5hGzpHimuxSix+V65Msqom/+vP9+z1QuR4xhGa923ZS/E8r/NtYia4tBfWltYZ O1uDrwrb3rmEQ5rJGnUz2OORaRusnagPL4yC1bO6x53iackEQEkKcNyDSX1wKT9Pcs XLL7bnN+zyiCg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mark Brown , Richard Fitzgerald , Lucas Tanure , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.13 02/12] ASoC: component: Remove misplaced prefix handling in pin control functions Date: Mon, 16 Aug 2021 20:35:26 -0400 Message-Id: <20210817003536.83063-2-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210817003536.83063-1-sashal@kernel.org> References: <20210817003536.83063-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Brown [ Upstream commit 31428c78748cafdd9352e1f622eb89bf453d9700 ] When the component level pin control functions were added they for some no longer obvious reason handled adding prefixing of widget names. This meant that when the lack of prefix handling in the DAPM level pin operations was fixed by ae4fc532244b3bb4d (ASoC: dapm: use component prefix when checking widget names) the one device using the component level API ended up with the prefix being applied twice, causing all lookups to fail. Fix this by removing the redundant prefixing from the component code, which has the nice side effect of also making that code much simpler. Reported-by: Richard Fitzgerald Signed-off-by: Mark Brown Tested-by: Lucas Tanure Link: https://lore.kernel.org/r/20210726194123.54585-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-component.c | 63 +++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 3a5e84e16a87..c8dfd0de30e4 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -148,86 +148,75 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component, return soc_component_ret(component, ret); } -static int soc_component_pin(struct snd_soc_component *component, - const char *pin, - int (*pin_func)(struct snd_soc_dapm_context *dapm, - const char *pin)) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - char *full_name; - int ret; - - if (!component->name_prefix) { - ret = pin_func(dapm, pin); - goto end; - } - - full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin); - if (!full_name) { - ret = -ENOMEM; - goto end; - } - - ret = pin_func(dapm, full_name); - kfree(full_name); -end: - return soc_component_ret(component, ret); -} - int snd_soc_component_enable_pin(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_enable_pin); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_enable_pin(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin); int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_enable_pin_unlocked); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_enable_pin_unlocked(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked); int snd_soc_component_disable_pin(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_disable_pin); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_disable_pin(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin); int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_disable_pin_unlocked); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_disable_pin_unlocked(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked); int snd_soc_component_nc_pin(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_nc_pin); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_nc_pin(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin); int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_nc_pin_unlocked); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_nc_pin_unlocked(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked); int snd_soc_component_get_pin_status(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_get_pin_status); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_get_pin_status(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status); int snd_soc_component_force_enable_pin(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_force_enable_pin(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin); @@ -235,7 +224,9 @@ int snd_soc_component_force_enable_pin_unlocked( struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin_unlocked); + struct snd_soc_dapm_context *dapm = + snd_soc_component_get_dapm(component); + return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); } EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked); -- 2.30.2