All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 20/21] mmc: core: Move public functions from host.h to private headers
Date: Fri, 30 Dec 2016 13:47:33 +0100	[thread overview]
Message-ID: <1483102054-1752-21-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <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 <ulf.hansson@linaro.org>
---
 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(-)

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 <linux/mmc/host.h>
 
 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 */
-- 
1.9.1


  parent reply	other threads:[~2016-12-30 12:48 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
2016-12-30 12:47 ` [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS* Ulf Hansson
2016-12-30 12:47   ` Ulf Hansson
2017-01-03  9:24   ` Simon Horman
2017-01-03  9:24     ` Simon Horman
2017-01-09 15:00   ` Linus Walleij
2017-01-09 15:00     ` Linus Walleij
2017-01-10 15:28     ` Ulf Hansson
2017-01-10 15:28       ` Ulf Hansson
2016-12-30 12:47 ` [PATCH 02/21] mmc: Removed the unused public mmc boot.h header Ulf Hansson
2017-01-09 15:01   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 03/21] mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data Ulf Hansson
2017-01-09 15:03   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 04/21] mmc: sh_mmcif: Remove unused ->get_cd() platform callback Ulf Hansson
2017-01-09 15:04   ` Linus Walleij
2017-01-09 15:48     ` Geert Uytterhoeven
2016-12-30 12:47 ` [PATCH 05/21] mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data Ulf Hansson
2017-01-09 15:05   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 06/21] mmc: sh_mmcif: Remove unused clk_ctrl2_present " Ulf Hansson
2017-01-09 15:06   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 07/21] mmc: dw_mmc: Remove the public dw_mmc header file Ulf Hansson
2017-01-09 15:13   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 08/21] mmc: sdhci-cadence: Include mmc.h Ulf Hansson
2017-01-09 15:14   ` Linus Walleij
2017-01-10  8:35   ` Adrian Hunter
2016-12-30 12:47 ` [PATCH 09/21] mmc: sdhci: Include leds.h Ulf Hansson
2016-12-30 13:35   ` Mateusz Nowak
2017-01-10 15:32     ` Ulf Hansson
2017-01-09 15:15   ` Linus Walleij
2017-01-10  8:32   ` Adrian Hunter
2016-12-30 12:47 ` [PATCH 10/21] mmc: host: Include interrupt.h in mmc host drivers that depends on it Ulf Hansson
2017-01-09 15:18   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 11/21] mmc: core: First step in cleaning up public mmc header files Ulf Hansson
2016-12-30 14:52   ` kbuild test robot
2016-12-30 15:11   ` kbuild test robot
2016-12-30 12:47 ` [PATCH 12/21] mmc: core: First step in cleaning up private " Ulf Hansson
2016-12-30 12:47 ` [PATCH 13/21] mmc: core: Move public functions from core.h to private headers Ulf Hansson
2017-01-09 18:19   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 14/21] mmc: core: Move some host specific public functions to host.h Ulf Hansson
2017-01-09 18:21   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 15/21] mmc: core: Move erase/trim/discard defines from public core.h to mmc.h Ulf Hansson
2017-01-09 18:22   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 16/21] mmc: core: Remove unused struct _mmc_csd from public mmc.h header Ulf Hansson
2017-01-09 18:23   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 17/21] mmc: omap: Don't use mmc_card_present() when validating for inserted card Ulf Hansson
2017-01-02 17:11   ` Tony Lindgren
2017-01-09 18:24   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 18/21] mmc: vub300: " Ulf Hansson
2017-01-09 18:24   ` Linus Walleij
2016-12-30 12:47 ` [PATCH 19/21] mmc: core: Move public functions from card.h to private headers Ulf Hansson
2017-01-09 18:26   ` Linus Walleij
2016-12-30 12:47 ` Ulf Hansson [this message]
2017-01-09 18:26   ` [PATCH 20/21] mmc: core: Move public functions from host.h " Linus Walleij
2016-12-30 12:47 ` [PATCH 21/21] mmc: core: Don't use extern declarations of public mmc functions Ulf Hansson
2017-01-09 18:27   ` Linus Walleij
2017-01-10 15:37 ` [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483102054-1752-21-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=jh80.chung@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.