From patchwork Thu Jun 8 08:53:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9774227 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 0584760350 for ; Thu, 8 Jun 2017 08:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E732128536 for ; Thu, 8 Jun 2017 08:54:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC1B928548; Thu, 8 Jun 2017 08:54:21 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 D0BD828536 for ; Thu, 8 Jun 2017 08:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbdFHIyU (ORCPT ); Thu, 8 Jun 2017 04:54:20 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33792 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825AbdFHIyT (ORCPT ); Thu, 8 Jun 2017 04:54:19 -0400 Received: by mail-lf0-f46.google.com with SMTP id v20so15272755lfa.1 for ; Thu, 08 Jun 2017 01:54:18 -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=1OErFe9am+abmCiTO0P4wDRTo0yOSN9mo9yy3WB2upE=; b=hv3L25CVFyCmFVr/KzZ3FHWIje+gW3O6Hh/XF27v6cVITLnGJJDt1yVDU9Y1d3QhbD nEiqCWJ6BYM4Wj/Mjd36/UdRrDO/E4S8AYcTPQgSGUFYwQQVtL4dj+61jM6AGs+DXAYr jqdWS9CZQGV/CHA9nvM5PqFb70gReVnD8gJ7g= 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=1OErFe9am+abmCiTO0P4wDRTo0yOSN9mo9yy3WB2upE=; b=Eyq15nnGi48YeoS6U3R/zR9G4je6lRsRbzD7QWO2RVRdmDabEj7dYbdlJA8v3/62l7 Mr771v0HbucGS0ecN/XKVybnzWMWbOdyCH+zYKBqiUVWJIjminnUiuqG/g3veiTa+rzM Vu2DxCOEODPQ7jP4I8ghB46xnHecnR3BRl+KE/AM+MoLGq0PhLIRyffR/q0LUomLuwNg 10FDzKG4SGU1O2nSB7B4FjNRcaGemMno7q6suDWpfaoAIQhYFI/GR6Fpo+k0ZWpwhaI9 Nyu7Zsa0szJiUkj0n8Q5OT5rvQeQGIacpEKvn+Jks1GfQq1mYUQqu4Yi9dblizTN6kBK sGog== X-Gm-Message-State: AODbwcCSHI7lvBdz/huKNMj51rOzA/RGbTDhsX3EPiXBslfMIGJQlddA EQfkajphn/d9nwY+Jwr3Vg== X-Received: by 10.46.33.164 with SMTP id h36mr4519101lji.86.1496912057443; Thu, 08 Jun 2017 01:54:17 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n71sm878356lje.14.2017.06.08.01.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 01:54:16 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij Subject: [PATCH 2/6 v3] mmc: debugfs: No blocklayer = no card status and extcsd Date: Thu, 8 Jun 2017 10:53:59 +0200 Message-Id: <20170608085403.11795-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170608085403.11795-1-linus.walleij@linaro.org> References: <20170608085403.11795-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 v2->v3: - No changes just resending --- 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;