From patchwork Mon Jun 5 12:15:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9766097 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 4582960353 for ; Mon, 5 Jun 2017 12:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 438FB269A3 for ; Mon, 5 Jun 2017 12:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 387F627F3E; Mon, 5 Jun 2017 12:15:40 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2074B269A3 for ; Mon, 5 Jun 2017 12:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbdFEMPi (ORCPT ); Mon, 5 Jun 2017 08:15:38 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33531 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290AbdFEMPh (ORCPT ); Mon, 5 Jun 2017 08:15:37 -0400 Received: by mail-lf0-f46.google.com with SMTP id a136so55610121lfa.0 for ; Mon, 05 Jun 2017 05:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U0eLormYoyD+m43n1gcl/yJ262JNbvjR5zip72VLPoY=; b=ks/iU/565mTFUZKj0yW83K/7qHhAK/+YRv17xOKw8wXGzE3WOfSOItab5PupgGrfJ5 7JWE0kD/g3Zs7V7DXMdFF6pbp/YIQL7DHi/qRhYahrrwASS704FdNp2hJkCKun+b8qoY 0r/g517rwN8kj5el9liwoog19Y13k9ApnYUJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U0eLormYoyD+m43n1gcl/yJ262JNbvjR5zip72VLPoY=; b=lK4MGbIwK9CGTKEb5t2ihr0E/ESRIpPyIAfmxH0/JBl/QIYBma5iZDOU0JxExe6TMN ciToJ3hqylrnIQDmw2ofsvzfoFvoEwTjiyzhakIScHyxW+4n8w9z0apf0p2aFYOlhKFz 5Hj9a0gqteVx5aO8DGwtAZ1ESKEsdVYIGfLjumUn3C34S+rU7g3oCgG2jB5V/EA8Tyn7 q6uQvkEtSVclEeBIk1v9XBSA9MS884mCrR3qH6eYkZ/PJKbedQzPlHcNTytPJEXuiC0Q D570m1jxG0q6uFjqb6qYNbLJEesHaibVqNd9bRHz0M5MXEXVFSJlNKq1myEo2Va3yDji S7gQ== X-Gm-Message-State: AODbwcDRjyIZejKDZ68+XVmvx2Qd8oCHp8g1eQkvJxjG+Y/w2Ad/Prmd 91r3bBPoqX4dJHXaHuMesg== X-Received: by 10.46.1.155 with SMTP id f27mr1136230lji.55.1496664936036; Mon, 05 Jun 2017 05:15:36 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z10sm6797124lja.24.2017.06.05.05.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 05:15:34 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij Subject: [PATCH 2/4 v2] mmc: debugfs: No blocklayer = no card status and extcsd Date: Mon, 5 Jun 2017 14:15:20 +0200 Message-Id: <20170605121522.27678-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170605121522.27678-1-linus.walleij@linaro.org> References: <20170605121522.27678-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we don't have the block layer enabled, we do not present card status and extcsd in the debugfs. Debugfs is not ABI, and maintaining files of no relevance for non-block devices comes at a high maintenance cost if we shall support it with the block layer compiled out. The expected number of debugfs users utilizing these two debugfs files is already low as there is an ioctl() to get the same information using the mmc-tools, and of these few users the expected number of people using it on SDIO or combo cards are expected to be zero. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - New patch, just numbered v2 to keep the series together. --- drivers/mmc/core/debugfs.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index a1fba5732d66..b176932b8092 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -281,6 +281,8 @@ void mmc_remove_host_debugfs(struct mmc_host *host) debugfs_remove_recursive(host->debugfs_root); } +#if IS_ENABLED(CONFIG_MMC_BLOCK) + static int mmc_dbg_card_status_get(void *data, u64 *val) { struct mmc_card *card = data; @@ -360,6 +362,32 @@ static const struct file_operations mmc_dbg_ext_csd_fops = { .llseek = default_llseek, }; +static int mmc_add_block_debugfs(struct mmc_card *card, struct dentry *root) +{ + if (mmc_card_mmc(card) || mmc_card_sd(card)) { + if (!debugfs_create_file("status", S_IRUSR, root, card, + &mmc_dbg_card_status_fops)) + return -EIO; + } + + if (mmc_card_mmc(card)) { + if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, + &mmc_dbg_ext_csd_fops)) + return -EIO; + } + + return 0; +} + +#else /* !IS_ENABLED(CONFIG_MMC_BLOCK) */ + +static int mmc_add_block_debugfs(struct mmc_card *card, struct dentry *root) +{ + return 0; +} + +#endif + void mmc_add_card_debugfs(struct mmc_card *card) { struct mmc_host *host = card->host; @@ -382,15 +410,8 @@ void mmc_add_card_debugfs(struct mmc_card *card) if (!debugfs_create_x32("state", S_IRUSR, root, &card->state)) goto err; - if (mmc_card_mmc(card) || mmc_card_sd(card)) - if (!debugfs_create_file("status", S_IRUSR, root, card, - &mmc_dbg_card_status_fops)) - goto err; - - if (mmc_card_mmc(card)) - if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, - &mmc_dbg_ext_csd_fops)) - goto err; + if (mmc_add_block_debugfs(card, root)) + goto err; return;