From patchwork Fri Dec 30 12:47:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 89354 Delivered-To: patches@linaro.org Received: by 10.140.20.101 with SMTP id 92csp6424869qgi; Fri, 30 Dec 2016 04:48:45 -0800 (PST) X-Received: by 10.25.72.209 with SMTP id v200mr14472562lfa.74.1483102125155; Fri, 30 Dec 2016 04:48:45 -0800 (PST) Return-Path: Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com. [2a00:1450:4010:c07::236]) by mx.google.com with ESMTPS id 18si33048342ljh.17.2016.12.30.04.48.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Dec 2016 04:48:45 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::236 as permitted sender) client-ip=2a00:1450:4010:c07::236; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::236 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x236.google.com with SMTP id b14so236444253lfg.2 for ; Fri, 30 Dec 2016 04:48:44 -0800 (PST) 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=3zRcm0S43ugEOtEy/zo/O1ONS4bauzFrqYcRRcFniZ0=; b=LnFvhb7akpTyJsJIdStAo5OFWZO5Aac44XIU3n+n7GsMA3KBQe/J6Z99eSpOKcOkho vh1SJ+u73Jo1T5PXnXD7mQmFR7X3PMF5eR5AltLv6l0V8Z7/Ajy+XTUbZRlVOFCbAEdI eCrMUIXYW6vudQkyxYcXO9Gk5QKDwPgvcHBR8= 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=3zRcm0S43ugEOtEy/zo/O1ONS4bauzFrqYcRRcFniZ0=; b=Si2lVVF+OKzePIJtcBe/DaKieq52yCIOhN2svYRji9wQRMpgT3QlXWKycOhri/DONU KZuOkLNlLlCJF82VzrOd9+WMKPyZq0VoCYgOE72ilsZdrP4qgKWu5iwNcG9+yxFANAH+ d+z+ynA0wVrCZ1UXfQtFZ3mySt81QQ73kVMPTprU3cpRAz2QlT7nKGgSBp3FTChbs1/o vg7DAQ3aP4kWKasE1F/s/RwNdnT2JpYEXABT273RHX+yDElpAmSxrG0XKsvoWmB56pPJ RN1f4Vklr10/fR5A3z7alVFgW2w0cyUydqGWhQm+wIc8k17BMWWcn+/Akdz22z6JrSj3 MDDA== X-Gm-Message-State: AIkVDXJaD3BDl2Jds6wNFMPrx31zACCUbIlzA0aWlzYsyiIgZCwFUwNcJF6PVwp8QoDIWH8YFYA= X-Received: by 10.25.56.80 with SMTP id d16mr16134018lfj.2.1483102124660; Fri, 30 Dec 2016 04:48:44 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id a79sm7450069ljb.46.2016.12.30.04.48.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Dec 2016 04:48:43 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Linus Walleij Subject: [PATCH 20/21] mmc: core: Move public functions from host.h to private headers Date: Fri, 30 Dec 2016 13:47:33 +0100 Message-Id: <1483102054-1752-21-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483102054-1752-1-git-send-email-ulf.hansson@linaro.org> References: <1483102054-1752-1-git-send-email-ulf.hansson@linaro.org> A significant amount of functions are available through the public mmc host.h header file. Let's slim down this public mmc interface, as to prevent users from abusing it, by moving some of the functions to private mmc host.h header file. This change concentrates on moving the functions into private mmc headers, following changes may continue with additional clean-ups. Signed-off-by: Ulf Hansson --- drivers/mmc/core/block.c | 1 + drivers/mmc/core/bus.c | 1 + drivers/mmc/core/debugfs.c | 1 + drivers/mmc/core/host.h | 49 ++++++++++++++++++++++++++++++++++++++++++++- drivers/mmc/core/mmc_test.c | 1 + drivers/mmc/core/sd.c | 1 + drivers/mmc/core/sdio.c | 1 + include/linux/mmc/host.h | 48 ++------------------------------------------ 8 files changed, 56 insertions(+), 47 deletions(-) -- 1.9.1 Reviewed-by: Linus Walleij diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 095a0f0..a2764a3 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -49,6 +49,7 @@ #include "block.h" #include "core.h" #include "card.h" +#include "host.h" #include "bus.h" #include "mmc_ops.h" #include "sd_ops.h" diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 3be2e6a..3012465 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -24,6 +24,7 @@ #include "core.h" #include "card.h" +#include "host.h" #include "sdio_cis.h" #include "bus.h" diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 2843e6a..a1fba57 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -21,6 +21,7 @@ #include "core.h" #include "card.h" +#include "host.h" #include "mmc_ops.h" #ifdef CONFIG_FAIL_MMC_REQUEST diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h index 366ce79..fb6a76a 100644 --- a/drivers/mmc/core/host.h +++ b/drivers/mmc/core/host.h @@ -11,7 +11,7 @@ #ifndef _MMC_CORE_HOST_H #define _MMC_CORE_HOST_H -struct mmc_host; +#include int mmc_register_host_class(void); void mmc_unregister_host_class(void); @@ -21,6 +21,53 @@ void mmc_retune_hold(struct mmc_host *host); void mmc_retune_release(struct mmc_host *host); int mmc_retune(struct mmc_host *host); +void mmc_retune_pause(struct mmc_host *host); +void mmc_retune_unpause(struct mmc_host *host); + +static inline void mmc_retune_recheck(struct mmc_host *host) +{ + if (host->hold_retune <= 1) + host->retune_now = 1; +} + +static inline int mmc_host_cmd23(struct mmc_host *host) +{ + return host->caps & MMC_CAP_CMD23; +} + +static inline int mmc_boot_partition_access(struct mmc_host *host) +{ + return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); +} + +static inline int mmc_host_uhs(struct mmc_host *host) +{ + return host->caps & + (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | + MMC_CAP_UHS_DDR50); +} + +static inline bool mmc_card_hs200(struct mmc_card *card) +{ + return card->host->ios.timing == MMC_TIMING_MMC_HS200; +} + +static inline bool mmc_card_ddr52(struct mmc_card *card) +{ + return card->host->ios.timing == MMC_TIMING_MMC_DDR52; +} + +static inline bool mmc_card_hs400(struct mmc_card *card) +{ + return card->host->ios.timing == MMC_TIMING_MMC_HS400; +} + +static inline bool mmc_card_hs400es(struct mmc_card *card) +{ + return card->host->ios.enhanced_strobe; +} + #endif diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 46adb04..3d307b3 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -24,6 +24,7 @@ #include "core.h" #include "card.h" +#include "host.h" #include "bus.h" #define RESULT_OK 0 diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index d66b08d..8b4f139 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -23,6 +23,7 @@ #include "core.h" #include "card.h" +#include "host.h" #include "bus.h" #include "mmc_ops.h" #include "sd.h" diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 558ddfc..2b47f02 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -21,6 +21,7 @@ #include "core.h" #include "card.h" +#include "host.h" #include "bus.h" #include "sd.h" #include "sdio_bus.h" diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 7de0519..97699d5 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -473,56 +473,20 @@ static inline int mmc_card_wake_sdio_irq(struct mmc_host *host) return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ; } -static inline int mmc_host_cmd23(struct mmc_host *host) -{ - return host->caps & MMC_CAP_CMD23; -} - -static inline int mmc_boot_partition_access(struct mmc_host *host) -{ - return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); -} - -static inline int mmc_host_uhs(struct mmc_host *host) -{ - return host->caps & - (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | - MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | - MMC_CAP_UHS_DDR50); -} - +/* TODO: Move to private header */ static inline int mmc_card_hs(struct mmc_card *card) { return card->host->ios.timing == MMC_TIMING_SD_HS || card->host->ios.timing == MMC_TIMING_MMC_HS; } +/* TODO: Move to private header */ static inline int mmc_card_uhs(struct mmc_card *card) { return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 && card->host->ios.timing <= MMC_TIMING_UHS_DDR50; } -static inline bool mmc_card_hs200(struct mmc_card *card) -{ - return card->host->ios.timing == MMC_TIMING_MMC_HS200; -} - -static inline bool mmc_card_ddr52(struct mmc_card *card) -{ - return card->host->ios.timing == MMC_TIMING_MMC_DDR52; -} - -static inline bool mmc_card_hs400(struct mmc_card *card) -{ - return card->host->ios.timing == MMC_TIMING_MMC_HS400; -} - -static inline bool mmc_card_hs400es(struct mmc_card *card) -{ - return card->host->ios.enhanced_strobe; -} - void mmc_retune_timer_stop(struct mmc_host *host); static inline void mmc_retune_needed(struct mmc_host *host) @@ -531,12 +495,6 @@ static inline void mmc_retune_needed(struct mmc_host *host) host->need_retune = 1; } -static inline void mmc_retune_recheck(struct mmc_host *host) -{ - if (host->hold_retune <= 1) - host->retune_now = 1; -} - static inline bool mmc_can_retune(struct mmc_host *host) { return host->can_retune == 1; @@ -544,7 +502,5 @@ static inline bool mmc_can_retune(struct mmc_host *host) int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); int mmc_abort_tuning(struct mmc_host *host, u32 opcode); -void mmc_retune_pause(struct mmc_host *host); -void mmc_retune_unpause(struct mmc_host *host); #endif /* LINUX_MMC_HOST_H */