From patchwork Wed May 29 06:22:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 10966063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C111D1575 for ; Wed, 29 May 2019 06:23:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1C6C286B9 for ; Wed, 29 May 2019 06:23:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5C0B28776; Wed, 29 May 2019 06:23:42 +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.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E7475286B9 for ; Wed, 29 May 2019 06:23:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DE53C1684; Wed, 29 May 2019 08:22:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DE53C1684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1559111020; bh=sYqJi6fWwFZDwrKS/RJFvtqAJ8dG9rCJmgmho8CO2+c=; h=Date:From:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=KPXcaCd313XgKZgyjk7krc9mZe8c5fAvwjTu52XcvKmxwYngaasfzN0EaCXKqlagt jtZcl1b8OdQYXZ7L3L5VGQMPoLdgfY0bHqReijAOoEAN+QwrLleIs7qQr//vdzgNPj VqB2xgK0hUB5o4S8KQ3SRg3qC5HV6zNPgf22MZsg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6F100F896E0; Wed, 29 May 2019 08:22:49 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EB2B5F896E4; Wed, 29 May 2019 08:22:47 +0200 (CEST) Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4E323F8072E for ; Wed, 29 May 2019 08:22:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E323F8072E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CfEVihCB" Received: by mail-yb1-xb49.google.com with SMTP id h83so1159249ybh.15 for ; Tue, 28 May 2019 23:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=JwBx2vunQtX6lqgCjOmlTdaj2y97xN03Mr7VsNFDB4k=; b=CfEVihCBWuc4w00tTo7X4IbMIxHaC7WvbD90x1puqyV6+xm1VQcUeN0UeqLaCuN4/S gaex6ZKbplZE+3osDCp5ftp2QIqyzMuPiNqQeDlemENeFtEv2k4W9++DWyBglBKRXHI5 L/iICKqm/jMZUDgtYIfrr0xM921e8KsCX22s59gNqK2by/a67O5SsiBBmFW0V7d/xdNc zSmMqQpCSrqy5fSx/fzK9gFmvOgWYrNo8BOJwHmTFr/q/5nE+G1nm/GX5RmTA4ceFXTD Ernnor574Mvs/9TzhE0JH//pl1Ev8KjYZPpxmVEMIhbnicbzhRmSZ0tuopOhFJszyPAO eMSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=JwBx2vunQtX6lqgCjOmlTdaj2y97xN03Mr7VsNFDB4k=; b=hcMImUGQGvkkggc0dFNSpzacpsRH3OU7xP+H7kwSQ3lfndXV/838rUsBKKOOpOIHC3 Kt1vJGWDxOP61rOptTopPcN9IzHIBju4PPGQwPaCCPbmA0X518lOo7biXBUu1qpSHh2D csnQcwDi920qW22solALeoaTG8lNOE28NEmfhjBA+hGe9E72Oi8d8lK/J3TPotcmQh02 u+j0AGxYQijf1ql3AdDguE81hV7TrcvE9RxYwUy0WjAAKynbKVxtImGC4GdOr4ZXHQhO dKuwUaF6PcfMGaB9Z005/YCgz0hi/M7y3FCgtcfTHi6ZlqSQf2rSnxqT4//NqZ4/9+/0 IvFQ== X-Gm-Message-State: APjAAAVMcFzgh7d4EHr9xmppAGdYmwL2Xn7jiSd5c0Wiw992iTC/ShIO mJH9brnfT4E5jDNL1ALK75czHaVvbJZx X-Google-Smtp-Source: APXvYqxA4rHtOvM573aTvEMfHHoeDYFk11YJeJsMuPA8DkHOIucDM/Ptuz2HkRO5pCI3OnCklc5yGqBSBoao X-Received: by 2002:a81:a48c:: with SMTP id b134mr61097477ywh.130.1559110963217; Tue, 28 May 2019 23:22:43 -0700 (PDT) Date: Wed, 29 May 2019 14:22:14 +0800 Message-Id: <20190529062214.225874-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, dgreid@google.com, cychiang@google.com Subject: [alsa-devel] [PATCH] ASoC: core: use component driver name as component name X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP fmt_single_name() uses device name to determine component name. If multiple components bind to the same device, the debugfs creation in soc_init_component_debugfs() would fail due to duplicated entity names. Name provided by component driver is unique enough to represent each component. Use component driver name as the component name to avoid name duplication. Signed-off-by: Tzung-Bi Shih --- Hi, We got "Failed to create component debugfs directory" in our environment. But the patch does not resolve the issue. (https://mailman.alsa-project.org/pipermail/alsa-devel/2018-February/132391.html) The entity name duplicated when creating the debugfs directory, because there is a device registered 2 components in mt8183_afe_pcm_dev_probe() in sound/soc/mediatek/mt8183/mt8183-afe-pcm.c. sound/soc/soc-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 7abb017a83f3..2d3520fca613 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3113,7 +3113,10 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, { struct snd_soc_dapm_context *dapm; - component->name = fmt_single_name(dev, &component->id); + if (driver->name) + component->name = kstrdup(driver->name, GFP_KERNEL); + else + component->name = fmt_single_name(dev, &component->id); if (!component->name) { dev_err(dev, "ASoC: Failed to allocate name\n"); return -ENOMEM;