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: 101385 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp881367qgd; Mon, 5 Jun 2017 05:15:39 -0700 (PDT) X-Received: by 10.98.141.71 with SMTP id z68mr19875570pfd.124.1496664939280; Mon, 05 Jun 2017 05:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496664939; cv=none; d=google.com; s=arc-20160816; b=vCUdeDn8mJw4k55qGHkvAAjxoDHOQSu+M3o22mguC52ur1c/w2wnwzdVi9EshzRfZ6 VDm4F/nSc5UtAuIII+3bxLYNZP+N2BW2jntq2vqAIUhtEyWQUaLKa0K1RFQKY/pvEphN he8LYzV7deiprcO9yO1fvwoFD/9Hs94D4sMRno6yW7sO6Chkj/gY/62UxYA6KZgexgPL vYZAGCRkQaFy0o+QnlLTJE56xgx73TMVrgna7D7h/0VqHlIVH5Lz3hujN5goSZ3KXz0T Bfl/6qpchGTezcHsF+HOY45IVD83wGfV1roWbVWl/0JafDWoovIiBtZ54qMDwN9bvEXU lz3w== 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=0s6LLUvSwSh7rxymgYhgWNPDcF5UDErJW4xcI6fAT9c=; b=QFAlgJN5v6TSndjr2PGNsBY2XPSVP8BiNHVCbAwIxmGZJpnB/n8iGIblH7gmk4yvMy 5q1Y70ENq/uxUke0sII64DQBGVPc8dkMmr9FwUaCoyLe9dUXOTBN+EVAvGSQ3YBd0wSv 5m3ECS+EudMPloJjGnvB3f16zkexJffXErWjZ+jiGboufr1PQe3bUmdrJdBrKd7sbZZg uiWLiJLYJg5P6JHPY/8wQqiHFrpieMPuiARUz3IlwDuYVJDV1vlzxp6mj6MAzeethNUs tbbresBTUILTFA4KedTLzc49EKDHYVg2N0Jugh1GD+miL87pz/8rC8qcnxX1ykxjkEFX xTDw== 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 g15si7234976plm.413.2017.06.05.05.15.39; Mon, 05 Jun 2017 05:15:39 -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 S1751364AbdFEMPi (ORCPT + 6 others); 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 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(-) -- 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;