Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1004955pxb; Wed, 1 Sep 2021 15:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW45iKtXjZ5tQqia5D4b2O1m0n3Xjnk8SzlDd9cjSR/ElrjlW+h5WW/Ggk2DqE91I//y7X X-Received: by 2002:a05:6602:1503:: with SMTP id g3mr20264iow.25.1630533878809; Wed, 01 Sep 2021 15:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630533878; cv=none; d=google.com; s=arc-20160816; b=fqDEZBfqeiCRtYXCRNXiJALMYLmak6j+w9A0bY8KCrfBKBnFCVgFPAHLBDf9fc9g75 RdNjAyKtav+l5jp/qDSch1gh/VXbaGeFeuG2t8HKJVrGt/Z8hyWYgXhtANZUiZNPPYxv RGfgVZpnES1/0vKgzX7OXkN5VQHSfNikFV6FJD1JXugyxRfO01GDjP/CYByfg6Ahv+4I vtOU08qgoOsI4axDVRYc93dHHNmjI5cQVhiBxNss04Mg1LtYRy6/xUVmmM7fnQDhiHtQ 2FRLOVPxhiUc2isDF98XgKqcsMze9fH84AvSv7d2QKJoPPgqP6Iq6f2hQ8uekV1IDShP Us/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0Vt4SNfK14V5CPinAu/2Z4V6tfP0oOIxH2pDfcqFWE8=; b=M8yppYP+TXwI+cnoo9LDG9EILZB5TzDoK2+yluJ6Ou2SUTwuALnVHZ/POU/Ruwtk4g 7FfvLDQWDANjL7Y07VZFpRGwbQKv/Wha5UnoS9hU+DeiOp9+8Rr9Q02RcuoDwwENpZ2H d196Dom1x3efic4pD4nuXsMpE6wrpmZBEpeyN6BbsdXQbegeRjHSApPU2EHYMzLr4aNB XiASNkM/wnyFsr9SDyXePrxi+PtpW0jqXxkx+phcAHFUNW9m6VrYcGgZrXyySloOe6eD l7WS4LstwNkmLyKkD6glv1Rk0l5rfrTgpej0Ev2hWqJRBoK2alnYalKNRZdsmmgkyDbl d2jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTEKWQS6; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si697009ior.56.2021.09.01.15.04.24; Wed, 01 Sep 2021 15:04:38 -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=@linuxfoundation.org header.s=korg header.b=RTEKWQS6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345354AbhIAMrF (ORCPT + 99 others); Wed, 1 Sep 2021 08:47:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:44058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345275AbhIAMmz (ORCPT ); Wed, 1 Sep 2021 08:42:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 828906120C; Wed, 1 Sep 2021 12:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499897; bh=d6nwFUt6VjHfJhTwsTeTPvBApRxDuqUwS984hXWMpVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTEKWQS6eG7iHN3HWTi0h9xQlcSseveVbVAYLmyPb3gskXM+AqLQqmGWSeVzjeEx/ bQkYXYKfJUpZK/rpyr66ymyEEBV1vATEBOZPA1DxA1aYfIfQAApNXnc0L1+HZXLRMX p5Bn9WotN92p7zd7uO9sT110fSIAbOaN9kpfa+78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Mark Brown , Lucas Tanure , Sasha Levin Subject: [PATCH 5.13 004/113] ASoC: component: Remove misplaced prefix handling in pin control functions Date: Wed, 1 Sep 2021 14:27:19 +0200 Message-Id: <20210901122302.124183185@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122301.984263453@linuxfoundation.org> References: <20210901122301.984263453@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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