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: 103348 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2337013qgd; Thu, 8 Jun 2017 01:54:21 -0700 (PDT) X-Received: by 10.98.197.130 with SMTP id j124mr23243428pfg.239.1496912061050; Thu, 08 Jun 2017 01:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496912061; cv=none; d=google.com; s=arc-20160816; b=wjbkZPSXnKUMeC1bwRPcsz9f1s1LQstlsSsmSwA6mGrvJ+bRj3e8eXCH/zD1HDQpsV 3hmQzaUPZQuLZbIA0/IKB8CjVTIcR3WINJkJnIIK5Sd0jJJ+6o+fUeaQF71Mm2EDkojU wH8b+wYXdESd2T2oGz1mW1aywobLkyBov84NYlJimiipTza4B0gpWmnn/uSZCjRH/TbV VDvu+cw+uVZ4aX9TUI/0YNKP42yQLaqXMEjAe5iU12bT44JpcFTYQywNFHiZPmLzG7Rg uAXvfH2tCW66Pf04PEyrXIChA7cg8ALo9+Q/N+VvW/qKVk60/itTSngbGg23odSA1Hx9 r2uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PAzJ3vx/QoMRq0snxGnrEPFydAQZ4wAzSFfjBZoCuC4=; b=kbB2albMVx3b5Uul+h8bx4q601QF/9Ly8q+53Xdyq5iHgvanIAxiCRBEaPSWlb2XgV JlNTYrGIp6tn/IjYkDthtb4fQe9oPK4ellpa4hwEgoe2Jow8Vw39uxh/QemzZYKal/vZ dun81Scm02rz21hREfoDYA6zgkEs5IycaqtGoFPy4mGQmO3W+IlftbB2OMbYFhxqzYuS 9GHiiQ0NUpW1YYRgN7cs8qOSTvrfXbX9SIL3wGrMjAzgPXPahhUIG8axV5zMzhZuS/mS myeNuX27mnIh5svXHMpRE7VznOQjNuY2nBrmIgfgGizyWgB4nv4T9e1OCK9aIMmvcwf+ AkpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x196si4121624pgx.147.2017.06.08.01.54.20; Thu, 08 Jun 2017 01:54:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbdFHIyU (ORCPT + 6 others); 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 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(-) -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;