From patchwork Thu Jun 26 14:22:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 4428511 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A76EBBEEAA for ; Thu, 26 Jun 2014 16:41:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53BC82024C for ; Thu, 26 Jun 2014 16:41:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1EA87201BB for ; Thu, 26 Jun 2014 16:41:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 06EA92651C8; Thu, 26 Jun 2014 18:41:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 68B242651D5; Thu, 26 Jun 2014 18:22:57 +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 D39A32651D5; Thu, 26 Jun 2014 18:22:52 +0200 (CEST) Received: from pandora.arm.linux.org.uk (gw-1.arm.linux.org.uk [78.32.30.217]) by alsa0.perex.cz (Postfix) with ESMTP id 3371E2657A3 for ; Thu, 26 Jun 2014 16:22:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=2kQijKp+H9GczjPxZDHhYBxixGdr7RF3r4eE66N6HQ0=; b=o8aoYFYcT2JaAky7EGejcG3gHp0ha42SReKrPOexm5cmbiPJVO9xDWAt3WsbPXj+38Z0lYSQq/egjT8wQDjwYy3Mj1iUTWvaWPemiPt8kjyXgDpMnTnBju33uqTLHWm84V2zv0/n3doR+NYP/Q7hADawZFkcOIZe4OZ4AgOtQpo=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:58452 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1X0AZe-0002u9-Cj; Thu, 26 Jun 2014 15:22:50 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1X0AZe-0003i7-0z; Thu, 26 Jun 2014 15:22:50 +0100 In-Reply-To: <20140626142231.GR32514@n2100.arm.linux.org.uk> References: <20140626142231.GR32514@n2100.arm.linux.org.uk> From: Russell King To: Mark Brown Message-Id: Date: Thu, 26 Jun 2014 15:22:50 +0100 Cc: Takashi Iwai , alsa-devel@alsa-project.org, Liam Girdwood , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH 1/7] ASoC: fix debugfs directory creation bug 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid creating duplicate directories by prefixing codecs and platforms with their separate identifiers. This avoids snd-soc-dummy (which can appear both as a dummy platform and a dummy codec on the same card) from clashing. Signed-off-by: Russell King --- sound/soc/soc-core.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b87d7d882e6d..91120b8e283e 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -270,12 +270,32 @@ static const struct file_operations codec_reg_fops = { .llseek = default_llseek, }; +static struct dentry *soc_debugfs_create_dir(struct dentry *parent, + const char *fmt, ...) +{ + struct dentry *de; + va_list ap; + char *s; + + va_start(ap, fmt); + s = kvasprintf(GFP_KERNEL, fmt, ap); + va_end(ap); + + if (!s) + return NULL; + + de = debugfs_create_dir(s, parent); + kfree(s); + + return de; +} + static void soc_init_codec_debugfs(struct snd_soc_codec *codec) { struct dentry *debugfs_card_root = codec->card->debugfs_card_root; - codec->debugfs_codec_root = debugfs_create_dir(codec->name, - debugfs_card_root); + codec->debugfs_codec_root = soc_debugfs_create_dir(debugfs_card_root, + "codec:%s", codec->name); if (!codec->debugfs_codec_root) { dev_warn(codec->dev, "ASoC: Failed to create codec debugfs directory\n"); @@ -306,8 +326,8 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform) { struct dentry *debugfs_card_root = platform->card->debugfs_card_root; - platform->debugfs_platform_root = debugfs_create_dir(platform->name, - debugfs_card_root); + platform->debugfs_platform_root = soc_debugfs_create_dir(debugfs_card_root, + "platform:%s", platform->name); if (!platform->debugfs_platform_root) { dev_warn(platform->dev, "ASoC: Failed to create platform debugfs directory\n");