All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/21] mmc: core: A start to slim down public mmc headers
@ 2016-12-30 12:47 Ulf Hansson
  2016-12-30 12:47   ` Ulf Hansson
                   ` (21 more replies)
  0 siblings, 22 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Ideally we should not expose functions nor structures as being public available
as the interface for mmc - unless they really are intended to be used like that.

Unfortunate this is not the case today and which has lead to the mmc interface
in some cases being abused. That of course has its own problems, but we can
still move things in the right direction, which is what this series intend to
do. More precisely, it moves things that can be easily moved from the public mmc
headers to the private mmc headers.

This should be considered as a first step of improving the situation, further
additional changes will have to continue this path.


Ulf Hansson (21):
  sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
  mmc: Removed the unused public mmc boot.h header
  mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data
  mmc: sh_mmcif: Remove unused ->get_cd() platform callback
  mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data
  mmc: sh_mmcif: Remove unused clk_ctrl2_present from the platform data
  mmc: dw_mmc: Remove the public dw_mmc header file
  mmc: sdhci-cadence: Include mmc.h
  mmc: sdhci: Include leds.h
  mmc: host: Include interrupt.h in mmc host drivers that depends on it
  mmc: core: First step in cleaning up public mmc header files
  mmc: core: First step in cleaning up private mmc header files
  mmc: core: Move public functions from core.h to private headers
  mmc: core: Move some host specific public functions to host.h
  mmc: core: Move erase/trim/discard defines from public core.h to mmc.h
  mmc: core: Remove unused struct _mmc_csd from public mmc.h header
  mmc: omap: Don't use mmc_card_present() when validating for inserted
    card
  mmc: vub300: Don't use mmc_card_present() when validating for inserted
    card
  mmc: core: Move public functions from card.h to private headers
  mmc: core: Move public functions from host.h to private headers
  mmc: core: Don't use extern declarations of public mmc functions

 MAINTAINERS                          |   1 -
 arch/sh/boot/romimage/mmcif-sh7724.c |  16 +-
 drivers/mmc/core/block.c             |   6 +
 drivers/mmc/core/block.h             |   8 +
 drivers/mmc/core/bus.c               |   2 +
 drivers/mmc/core/bus.h               |  16 +-
 drivers/mmc/core/card.h              | 223 ++++++++++++++++++++++++++++
 drivers/mmc/core/core.c              |   1 +
 drivers/mmc/core/core.h              |  41 +++++-
 drivers/mmc/core/debugfs.c           |   2 +
 drivers/mmc/core/host.h              |  48 ++++++
 drivers/mmc/core/mmc.c               |  13 ++
 drivers/mmc/core/mmc_ops.h           |  14 ++
 drivers/mmc/core/mmc_test.c          |   5 +
 drivers/mmc/core/pwrseq.h            |   6 +-
 drivers/mmc/core/queue.c             |   2 +
 drivers/mmc/core/queue.h             |   6 +-
 drivers/mmc/core/quirks.c            |   2 +
 drivers/mmc/core/sd.c                |   2 +
 drivers/mmc/core/sd.h                |   5 +-
 drivers/mmc/core/sd_ops.h            |   9 ++
 drivers/mmc/core/sdio.c              |   2 +
 drivers/mmc/core/sdio_bus.c          |   1 +
 drivers/mmc/core/sdio_bus.h          |   3 +
 drivers/mmc/core/sdio_cis.h          |   3 +
 drivers/mmc/core/sdio_io.c           |   2 +
 drivers/mmc/core/sdio_irq.c          |   2 +
 drivers/mmc/core/sdio_ops.h          |   5 +
 drivers/mmc/core/slot-gpio.h         |   2 +
 drivers/mmc/host/davinci_mmc.c       |   1 +
 drivers/mmc/host/dw_mmc-exynos.c     |   1 -
 drivers/mmc/host/dw_mmc-k3.c         |   1 -
 drivers/mmc/host/dw_mmc-pci.c        |   1 -
 drivers/mmc/host/dw_mmc-pltfm.c      |   1 -
 drivers/mmc/host/dw_mmc-rockchip.c   |   1 -
 drivers/mmc/host/dw_mmc.c            |   1 -
 drivers/mmc/host/dw_mmc.h            | 258 +++++++++++++++++++++++++++++++++
 drivers/mmc/host/meson-gx-mmc.c      |   1 +
 drivers/mmc/host/mtk-sd.c            |   1 +
 drivers/mmc/host/omap.c              |   2 +-
 drivers/mmc/host/sdhci-cadence.c     |   1 +
 drivers/mmc/host/sdhci.h             |   2 +
 drivers/mmc/host/sh_mmcif.c          |  28 +---
 drivers/mmc/host/tmio_mmc.h          |   1 +
 drivers/mmc/host/via-sdmmc.c         |   1 +
 drivers/mmc/host/vub300.c            |   6 +-
 drivers/mmc/host/wmt-sdmmc.c         |   1 +
 include/linux/mmc/boot.h             |   7 -
 include/linux/mmc/card.h             | 242 -------------------------------
 include/linux/mmc/core.h             |  86 ++---------
 include/linux/mmc/dw_mmc.h           | 274 -----------------------------------
 include/linux/mmc/host.h             |  63 ++------
 include/linux/mmc/mmc.h              |  59 ++------
 include/linux/mmc/sh_mmcif.h         |   5 -
 include/linux/mmc/slot-gpio.h        |   3 +
 55 files changed, 747 insertions(+), 749 deletions(-)
 create mode 100644 drivers/mmc/core/card.h
 delete mode 100644 include/linux/mmc/boot.h
 delete mode 100644 include/linux/mmc/dw_mmc.h

-- 
1.9.1


^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
  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   ` Ulf Hansson
  2016-12-30 12:47 ` [PATCH 02/21] mmc: Removed the unused public mmc boot.h header Ulf Hansson
                     ` (20 subsequent siblings)
  21 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, linux-sh,
	Simon Horman, Yoshinori Sato, Rich Felker

The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
thing and has no relevance in a public mmc header. Currently it's used only
by the sh romImage MMCIF boot, so let's instead define the enum in there
and rename the types to MMCIF_* to show this.

Cc: linux-sh@vger.kernel.org
Cc: Simon Horman <horms@verge.net.au>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 arch/sh/boot/romimage/mmcif-sh7724.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/sh/boot/romimage/mmcif-sh7724.c b/arch/sh/boot/romimage/mmcif-sh7724.c
index 16b1225..6595b6b4 100644
--- a/arch/sh/boot/romimage/mmcif-sh7724.c
+++ b/arch/sh/boot/romimage/mmcif-sh7724.c
@@ -9,7 +9,6 @@
  */
 
 #include <linux/mmc/sh_mmcif.h>
-#include <linux/mmc/boot.h>
 #include <mach/romimage.h>
 
 #define MMCIF_BASE      (void __iomem *)0xa4ca0000
@@ -22,6 +21,13 @@
 #define HIZCRC		0xa405015c
 #define DRVCRA		0xa405018a
 
+enum {
+	MMCIF_PROGRESS_ENTER,
+	MMCIF_PROGRESS_INIT,
+	MMCIF_PROGRESS_LOAD,
+	MMCIF_PROGRESS_DONE
+};
+
 /* SH7724 specific MMCIF loader
  *
  * loads the romImage from an MMC card starting from block 512
@@ -30,7 +36,7 @@
  */
 asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 {
-	mmcif_update_progress(MMC_PROGRESS_ENTER);
+	mmcif_update_progress(MMCIF_PROGRESS_ENTER);
 
 	/* enable clock to the MMCIF hardware block */
 	__raw_writel(__raw_readl(MSTPCR2) & ~0x20000000, MSTPCR2);
@@ -53,12 +59,12 @@ asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 	/* high drive capability for MMC pins */
 	__raw_writew(__raw_readw(DRVCRA) | 0x3000, DRVCRA);
 
-	mmcif_update_progress(MMC_PROGRESS_INIT);
+	mmcif_update_progress(MMCIF_PROGRESS_INIT);
 
 	/* setup MMCIF hardware */
 	sh_mmcif_boot_init(MMCIF_BASE);
 
-	mmcif_update_progress(MMC_PROGRESS_LOAD);
+	mmcif_update_progress(MMCIF_PROGRESS_LOAD);
 
 	/* load kernel via MMCIF interface */
 	sh_mmcif_boot_do_read(MMCIF_BASE, 512,
@@ -68,5 +74,5 @@ asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 	/* disable clock to the MMCIF hardware block */
 	__raw_writel(__raw_readl(MSTPCR2) | 0x20000000, MSTPCR2);
 
-	mmcif_update_progress(MMC_PROGRESS_DONE);
+	mmcif_update_progress(MMCIF_PROGRESS_DONE);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
@ 2016-12-30 12:47   ` Ulf Hansson
  0 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, linux-sh,
	Simon Horman, Yoshinori Sato, Rich Felker

The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
thing and has no relevance in a public mmc header. Currently it's used only
by the sh romImage MMCIF boot, so let's instead define the enum in there
and rename the types to MMCIF_* to show this.

Cc: linux-sh@vger.kernel.org
Cc: Simon Horman <horms@verge.net.au>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 arch/sh/boot/romimage/mmcif-sh7724.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/sh/boot/romimage/mmcif-sh7724.c b/arch/sh/boot/romimage/mmcif-sh7724.c
index 16b1225..6595b6b4 100644
--- a/arch/sh/boot/romimage/mmcif-sh7724.c
+++ b/arch/sh/boot/romimage/mmcif-sh7724.c
@@ -9,7 +9,6 @@
  */
 
 #include <linux/mmc/sh_mmcif.h>
-#include <linux/mmc/boot.h>
 #include <mach/romimage.h>
 
 #define MMCIF_BASE      (void __iomem *)0xa4ca0000
@@ -22,6 +21,13 @@
 #define HIZCRC		0xa405015c
 #define DRVCRA		0xa405018a
 
+enum {
+	MMCIF_PROGRESS_ENTER,
+	MMCIF_PROGRESS_INIT,
+	MMCIF_PROGRESS_LOAD,
+	MMCIF_PROGRESS_DONE
+};
+
 /* SH7724 specific MMCIF loader
  *
  * loads the romImage from an MMC card starting from block 512
@@ -30,7 +36,7 @@
  */
 asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 {
-	mmcif_update_progress(MMC_PROGRESS_ENTER);
+	mmcif_update_progress(MMCIF_PROGRESS_ENTER);
 
 	/* enable clock to the MMCIF hardware block */
 	__raw_writel(__raw_readl(MSTPCR2) & ~0x20000000, MSTPCR2);
@@ -53,12 +59,12 @@ asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 	/* high drive capability for MMC pins */
 	__raw_writew(__raw_readw(DRVCRA) | 0x3000, DRVCRA);
 
-	mmcif_update_progress(MMC_PROGRESS_INIT);
+	mmcif_update_progress(MMCIF_PROGRESS_INIT);
 
 	/* setup MMCIF hardware */
 	sh_mmcif_boot_init(MMCIF_BASE);
 
-	mmcif_update_progress(MMC_PROGRESS_LOAD);
+	mmcif_update_progress(MMCIF_PROGRESS_LOAD);
 
 	/* load kernel via MMCIF interface */
 	sh_mmcif_boot_do_read(MMCIF_BASE, 512,
@@ -68,5 +74,5 @@ asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
 	/* disable clock to the MMCIF hardware block */
 	__raw_writel(__raw_readl(MSTPCR2) | 0x20000000, MSTPCR2);
 
-	mmcif_update_progress(MMC_PROGRESS_DONE);
+	mmcif_update_progress(MMCIF_PROGRESS_DONE);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 02/21] mmc: Removed the unused public mmc boot.h header
  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   ` Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/boot.h | 7 -------
 1 file changed, 7 deletions(-)
 delete mode 100644 include/linux/mmc/boot.h

diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
deleted file mode 100644
index 23acc3b..0000000
--- a/include/linux/mmc/boot.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef LINUX_MMC_BOOT_H
-#define LINUX_MMC_BOOT_H
-
-enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
-       MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
-
-#endif /* LINUX_MMC_BOOT_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 03/21] mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data
  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   ` Ulf Hansson
  2016-12-30 12:47 ` [PATCH 02/21] mmc: Removed the unused public mmc boot.h header Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, Kuninori Morimoto

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sh_mmcif.c  | 6 ------
 include/linux/mmc/sh_mmcif.h | 2 --
 2 files changed, 8 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 9007784..5f97055 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1509,12 +1509,6 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (pd && pd->use_cd_gpio) {
-		ret = mmc_gpio_request_cd(mmc, pd->cd_gpio, 0);
-		if (ret < 0)
-			goto err_clk;
-	}
-
 	mutex_init(&host->thread_lock);
 
 	ret = mmc_add_host(mmc);
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index ccd8fb2..5ce5a2c 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -35,10 +35,8 @@ struct sh_mmcif_plat_data {
 	int (*get_cd)(struct platform_device *pdef);
 	unsigned int		slave_id_tx;	/* embedded slave_id_[tr]x */
 	unsigned int		slave_id_rx;
-	bool			use_cd_gpio : 1;
 	bool			ccs_unsupported : 1;
 	bool			clk_ctrl2_present : 1;
-	unsigned int		cd_gpio;
 	u8			sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
 	unsigned long		caps;
 	u32			ocr;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 04/21] mmc: sh_mmcif: Remove unused ->get_cd() platform callback
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (2 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 03/21] mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data Ulf Hansson
@ 2016-12-30 12:47 ` Ulf Hansson
  2017-01-09 15:04   ` Linus Walleij
  2016-12-30 12:47 ` [PATCH 05/21] mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data Ulf Hansson
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, Kuninori Morimoto

Removing the callback also enables us to remove the sh_mmcif_get_cd()
altogether, as we convert to use mmc_gpio_get_cd() to the same kind of
work.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sh_mmcif.c  | 18 +-----------------
 include/linux/mmc/sh_mmcif.h |  1 -
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 5f97055..7ba92a4 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1079,26 +1079,10 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	host->state = STATE_IDLE;
 }
 
-static int sh_mmcif_get_cd(struct mmc_host *mmc)
-{
-	struct sh_mmcif_host *host = mmc_priv(mmc);
-	struct device *dev = sh_mmcif_host_to_dev(host);
-	struct sh_mmcif_plat_data *p = dev->platform_data;
-	int ret = mmc_gpio_get_cd(mmc);
-
-	if (ret >= 0)
-		return ret;
-
-	if (!p || !p->get_cd)
-		return -ENOSYS;
-	else
-		return p->get_cd(host->pd);
-}
-
 static struct mmc_host_ops sh_mmcif_ops = {
 	.request	= sh_mmcif_request,
 	.set_ios	= sh_mmcif_set_ios,
-	.get_cd		= sh_mmcif_get_cd,
+	.get_cd		= mmc_gpio_get_cd,
 };
 
 static bool sh_mmcif_end_cmd(struct sh_mmcif_host *host)
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 5ce5a2c..7cafc95 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -32,7 +32,6 @@
  */
 
 struct sh_mmcif_plat_data {
-	int (*get_cd)(struct platform_device *pdef);
 	unsigned int		slave_id_tx;	/* embedded slave_id_[tr]x */
 	unsigned int		slave_id_rx;
 	bool			ccs_unsupported : 1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 05/21] mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (3 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 04/21] mmc: sh_mmcif: Remove unused ->get_cd() platform callback Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, Kuninori Morimoto

There are currently no users of the ccs_unsupported member from the
platform data, so let's remove it.

Note, as some of the sh_mmcif variants may not support ccs, let's keep the
current code in the driver, which deals with this. For future support, we
should invent a DT binding instead, but let's leave that until it's needed.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sh_mmcif.c  | 2 +-
 include/linux/mmc/sh_mmcif.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 7ba92a4..9fa8ce3 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1427,7 +1427,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	host->mmc	= mmc;
 	host->addr	= reg;
 	host->timeout	= msecs_to_jiffies(10000);
-	host->ccs_enable = !pd || !pd->ccs_unsupported;
+	host->ccs_enable = true;
 	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;
 
 	host->pd = pdev;
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 7cafc95..384b86b 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -34,7 +34,6 @@
 struct sh_mmcif_plat_data {
 	unsigned int		slave_id_tx;	/* embedded slave_id_[tr]x */
 	unsigned int		slave_id_rx;
-	bool			ccs_unsupported : 1;
 	bool			clk_ctrl2_present : 1;
 	u8			sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
 	unsigned long		caps;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 06/21] mmc: sh_mmcif: Remove unused clk_ctrl2_present from the platform data
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (4 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 05/21] mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (15 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, Kuninori Morimoto

There are currently no users of the clk_ctrl2_present member from the
platform data, so let's remove it.

Note, as some of the sh_mmcif variants may support clk_ctrl2, let's keep
the current code in the driver, which deals with this. For future support,
we should invent a DT binding instead, but let's leave that until it's
needed.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sh_mmcif.c  | 2 +-
 include/linux/mmc/sh_mmcif.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 9fa8ce3..4062d6b 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1428,7 +1428,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	host->addr	= reg;
 	host->timeout	= msecs_to_jiffies(10000);
 	host->ccs_enable = true;
-	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;
+	host->clk_ctrl2_enable = false;
 
 	host->pd = pdev;
 
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 384b86b..a7baa29 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -34,7 +34,6 @@
 struct sh_mmcif_plat_data {
 	unsigned int		slave_id_tx;	/* embedded slave_id_[tr]x */
 	unsigned int		slave_id_rx;
-	bool			clk_ctrl2_present : 1;
 	u8			sup_pclk;	/* 1 :SH7757, 0: SH7724/SH7372 */
 	unsigned long		caps;
 	u32			ocr;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 07/21] mmc: dw_mmc: Remove the public dw_mmc header file
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (5 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 06/21] mmc: sh_mmcif: Remove unused clk_ctrl2_present " Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (14 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

There are currently no external users of the public dw_mmc header file,
except the dw_mmc driver itself. Therefore let's move the definitions from
the public dw_mmc header file into the existing private dw_mmc header file
and then remove the public one.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 MAINTAINERS                        |   1 -
 drivers/mmc/host/dw_mmc-exynos.c   |   1 -
 drivers/mmc/host/dw_mmc-k3.c       |   1 -
 drivers/mmc/host/dw_mmc-pci.c      |   1 -
 drivers/mmc/host/dw_mmc-pltfm.c    |   1 -
 drivers/mmc/host/dw_mmc-rockchip.c |   1 -
 drivers/mmc/host/dw_mmc.c          |   1 -
 drivers/mmc/host/dw_mmc.h          | 257 ++++++++++++++++++++++++++++++++++
 include/linux/mmc/dw_mmc.h         | 274 -------------------------------------
 9 files changed, 257 insertions(+), 281 deletions(-)
 delete mode 100644 include/linux/mmc/dw_mmc.h

diff --git a/MAINTAINERS b/MAINTAINERS
index cfff2c9..b09febe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10862,7 +10862,6 @@ SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
 M:	Jaehoon Chung <jh80.chung@samsung.com>
 L:	linux-mmc@vger.kernel.org
 S:	Maintained
-F:	include/linux/mmc/dw_mmc.h
 F:	drivers/mmc/host/dw_mmc*
 
 SYSTEM TRACE MODULE CLASS
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index e133528..25691cc 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -13,7 +13,6 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/mmc/host.h>
-#include <linux/mmc/dw_mmc.h>
 #include <linux/mmc/mmc.h>
 #include <linux/of.h>
 #include <linux/of_gpio.h>
diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c
index 9821e6b..e38fb00 100644
--- a/drivers/mmc/host/dw_mmc-k3.c
+++ b/drivers/mmc/host/dw_mmc-k3.c
@@ -11,7 +11,6 @@
 #include <linux/clk.h>
 #include <linux/mfd/syscon.h>
 #include <linux/mmc/host.h>
-#include <linux/mmc/dw_mmc.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c
index ab82796..ab87132 100644
--- a/drivers/mmc/host/dw_mmc-pci.c
+++ b/drivers/mmc/host/dw_mmc-pci.c
@@ -18,7 +18,6 @@
 #include <linux/slab.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
-#include <linux/mmc/dw_mmc.h>
 #include "dw_mmc.h"
 
 #define PCI_BAR_NO 2
diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 1236d49b..58c13e2 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -20,7 +20,6 @@
 #include <linux/slab.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
-#include <linux/mmc/dw_mmc.h>
 #include <linux/of.h>
 #include <linux/clk.h>
 
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index 9a46e46..372fb6e 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -11,7 +11,6 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/mmc/host.h>
-#include <linux/mmc/dw_mmc.h>
 #include <linux/of_address.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/pm_runtime.h>
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index b44306b..c2242cd 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -32,7 +32,6 @@
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
 #include <linux/mmc/sdio.h>
-#include <linux/mmc/dw_mmc.h>
 #include <linux/bitops.h>
 #include <linux/regulator/consumer.h>
 #include <linux/of.h>
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index c594658..9601461 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -14,6 +14,263 @@
 #ifndef _DW_MMC_H_
 #define _DW_MMC_H_
 
+#include <linux/scatterlist.h>
+#include <linux/mmc/core.h>
+#include <linux/dmaengine.h>
+#include <linux/reset.h>
+
+#define MAX_MCI_SLOTS	2
+
+enum dw_mci_state {
+	STATE_IDLE = 0,
+	STATE_SENDING_CMD,
+	STATE_SENDING_DATA,
+	STATE_DATA_BUSY,
+	STATE_SENDING_STOP,
+	STATE_DATA_ERROR,
+	STATE_SENDING_CMD11,
+	STATE_WAITING_CMD11_DONE,
+};
+
+enum {
+	EVENT_CMD_COMPLETE = 0,
+	EVENT_XFER_COMPLETE,
+	EVENT_DATA_COMPLETE,
+	EVENT_DATA_ERROR,
+};
+
+enum dw_mci_cookie {
+	COOKIE_UNMAPPED,
+	COOKIE_PRE_MAPPED,	/* mapped by pre_req() of dwmmc */
+	COOKIE_MAPPED,		/* mapped by prepare_data() of dwmmc */
+};
+
+struct mmc_data;
+
+enum {
+	TRANS_MODE_PIO = 0,
+	TRANS_MODE_IDMAC,
+	TRANS_MODE_EDMAC
+};
+
+struct dw_mci_dma_slave {
+	struct dma_chan *ch;
+	enum dma_transfer_direction direction;
+};
+
+/**
+ * struct dw_mci - MMC controller state shared between all slots
+ * @lock: Spinlock protecting the queue and associated data.
+ * @irq_lock: Spinlock protecting the INTMASK setting.
+ * @regs: Pointer to MMIO registers.
+ * @fifo_reg: Pointer to MMIO registers for data FIFO
+ * @sg: Scatterlist entry currently being processed by PIO code, if any.
+ * @sg_miter: PIO mapping scatterlist iterator.
+ * @cur_slot: The slot which is currently using the controller.
+ * @mrq: The request currently being processed on @cur_slot,
+ *	or NULL if the controller is idle.
+ * @cmd: The command currently being sent to the card, or NULL.
+ * @data: The data currently being transferred, or NULL if no data
+ *	transfer is in progress.
+ * @stop_abort: The command currently prepared for stoping transfer.
+ * @prev_blksz: The former transfer blksz record.
+ * @timing: Record of current ios timing.
+ * @use_dma: Whether DMA channel is initialized or not.
+ * @using_dma: Whether DMA is in use for the current transfer.
+ * @dma_64bit_address: Whether DMA supports 64-bit address mode or not.
+ * @sg_dma: Bus address of DMA buffer.
+ * @sg_cpu: Virtual address of DMA buffer.
+ * @dma_ops: Pointer to platform-specific DMA callbacks.
+ * @cmd_status: Snapshot of SR taken upon completion of the current
+ * @ring_size: Buffer size for idma descriptors.
+ *	command. Only valid when EVENT_CMD_COMPLETE is pending.
+ * @dms: structure of slave-dma private data.
+ * @phy_regs: physical address of controller's register map
+ * @data_status: Snapshot of SR taken upon completion of the current
+ *	data transfer. Only valid when EVENT_DATA_COMPLETE or
+ *	EVENT_DATA_ERROR is pending.
+ * @stop_cmdr: Value to be loaded into CMDR when the stop command is
+ *	to be sent.
+ * @dir_status: Direction of current transfer.
+ * @tasklet: Tasklet running the request state machine.
+ * @pending_events: Bitmask of events flagged by the interrupt handler
+ *	to be processed by the tasklet.
+ * @completed_events: Bitmask of events which the state machine has
+ *	processed.
+ * @state: Tasklet state.
+ * @queue: List of slots waiting for access to the controller.
+ * @bus_hz: The rate of @mck in Hz. This forms the basis for MMC bus
+ *	rate and timeout calculations.
+ * @current_speed: Configured rate of the controller.
+ * @num_slots: Number of slots available.
+ * @fifoth_val: The value of FIFOTH register.
+ * @verid: Denote Version ID.
+ * @dev: Device associated with the MMC controller.
+ * @pdata: Platform data associated with the MMC controller.
+ * @drv_data: Driver specific data for identified variant of the controller
+ * @priv: Implementation defined private data.
+ * @biu_clk: Pointer to bus interface unit clock instance.
+ * @ciu_clk: Pointer to card interface unit clock instance.
+ * @slot: Slots sharing this MMC controller.
+ * @fifo_depth: depth of FIFO.
+ * @data_shift: log2 of FIFO item size.
+ * @part_buf_start: Start index in part_buf.
+ * @part_buf_count: Bytes of partial data in part_buf.
+ * @part_buf: Simple buffer for partial fifo reads/writes.
+ * @push_data: Pointer to FIFO push function.
+ * @pull_data: Pointer to FIFO pull function.
+ * @vqmmc_enabled: Status of vqmmc, should be true or false.
+ * @irq_flags: The flags to be passed to request_irq.
+ * @irq: The irq value to be passed to request_irq.
+ * @sdio_id0: Number of slot0 in the SDIO interrupt registers.
+ * @cmd11_timer: Timer for SD3.0 voltage switch over scheme.
+ * @dto_timer: Timer for broken data transfer over scheme.
+ *
+ * Locking
+ * =======
+ *
+ * @lock is a softirq-safe spinlock protecting @queue as well as
+ * @cur_slot, @mrq and @state. These must always be updated
+ * at the same time while holding @lock.
+ *
+ * @irq_lock is an irq-safe spinlock protecting the INTMASK register
+ * to allow the interrupt handler to modify it directly.  Held for only long
+ * enough to read-modify-write INTMASK and no other locks are grabbed when
+ * holding this one.
+ *
+ * The @mrq field of struct dw_mci_slot is also protected by @lock,
+ * and must always be written at the same time as the slot is added to
+ * @queue.
+ *
+ * @pending_events and @completed_events are accessed using atomic bit
+ * operations, so they don't need any locking.
+ *
+ * None of the fields touched by the interrupt handler need any
+ * locking. However, ordering is important: Before EVENT_DATA_ERROR or
+ * EVENT_DATA_COMPLETE is set in @pending_events, all data-related
+ * interrupts must be disabled and @data_status updated with a
+ * snapshot of SR. Similarly, before EVENT_CMD_COMPLETE is set, the
+ * CMDRDY interrupt must be disabled and @cmd_status updated with a
+ * snapshot of SR, and before EVENT_XFER_COMPLETE can be set, the
+ * bytes_xfered field of @data must be written. This is ensured by
+ * using barriers.
+ */
+struct dw_mci {
+	spinlock_t		lock;
+	spinlock_t		irq_lock;
+	void __iomem		*regs;
+	void __iomem		*fifo_reg;
+
+	struct scatterlist	*sg;
+	struct sg_mapping_iter	sg_miter;
+
+	struct dw_mci_slot	*cur_slot;
+	struct mmc_request	*mrq;
+	struct mmc_command	*cmd;
+	struct mmc_data		*data;
+	struct mmc_command	stop_abort;
+	unsigned int		prev_blksz;
+	unsigned char		timing;
+
+	/* DMA interface members*/
+	int			use_dma;
+	int			using_dma;
+	int			dma_64bit_address;
+
+	dma_addr_t		sg_dma;
+	void			*sg_cpu;
+	const struct dw_mci_dma_ops	*dma_ops;
+	/* For idmac */
+	unsigned int		ring_size;
+
+	/* For edmac */
+	struct dw_mci_dma_slave *dms;
+	/* Registers's physical base address */
+	resource_size_t		phy_regs;
+
+	u32			cmd_status;
+	u32			data_status;
+	u32			stop_cmdr;
+	u32			dir_status;
+	struct tasklet_struct	tasklet;
+	unsigned long		pending_events;
+	unsigned long		completed_events;
+	enum dw_mci_state	state;
+	struct list_head	queue;
+
+	u32			bus_hz;
+	u32			current_speed;
+	u32			num_slots;
+	u32			fifoth_val;
+	u16			verid;
+	struct device		*dev;
+	struct dw_mci_board	*pdata;
+	const struct dw_mci_drv_data	*drv_data;
+	void			*priv;
+	struct clk		*biu_clk;
+	struct clk		*ciu_clk;
+	struct dw_mci_slot	*slot[MAX_MCI_SLOTS];
+
+	/* FIFO push and pull */
+	int			fifo_depth;
+	int			data_shift;
+	u8			part_buf_start;
+	u8			part_buf_count;
+	union {
+		u16		part_buf16;
+		u32		part_buf32;
+		u64		part_buf;
+	};
+	void (*push_data)(struct dw_mci *host, void *buf, int cnt);
+	void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
+
+	bool			vqmmc_enabled;
+	unsigned long		irq_flags; /* IRQ flags */
+	int			irq;
+
+	int			sdio_id0;
+
+	struct timer_list       cmd11_timer;
+	struct timer_list       dto_timer;
+};
+
+/* DMA ops for Internal/External DMAC interface */
+struct dw_mci_dma_ops {
+	/* DMA Ops */
+	int (*init)(struct dw_mci *host);
+	int (*start)(struct dw_mci *host, unsigned int sg_len);
+	void (*complete)(void *host);
+	void (*stop)(struct dw_mci *host);
+	void (*cleanup)(struct dw_mci *host);
+	void (*exit)(struct dw_mci *host);
+};
+
+struct dma_pdata;
+
+/* Board platform data */
+struct dw_mci_board {
+	u32 num_slots;
+
+	unsigned int bus_hz; /* Clock speed at the cclk_in pad */
+
+	u32 caps;	/* Capabilities */
+	u32 caps2;	/* More capabilities */
+	u32 pm_caps;	/* PM capabilities */
+	/*
+	 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
+	 * but note that this may not be reliable after a bootloader has used
+	 * it.
+	 */
+	unsigned int fifo_depth;
+
+	/* delay in mS before detecting cards after interrupt */
+	u32 detect_delay_ms;
+
+	struct reset_control *rstc;
+	struct dw_mci_dma_ops *dma_ops;
+	struct dma_pdata *data;
+};
+
 #define DW_MMC_240A		0x240a
 #define DW_MMC_280A		0x280a
 
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
deleted file mode 100644
index 15db6f8..0000000
--- a/include/linux/mmc/dw_mmc.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Synopsys DesignWare Multimedia Card Interface driver
- *  (Based on NXP driver for lpc 31xx)
- *
- * Copyright (C) 2009 NXP Semiconductors
- * Copyright (C) 2009, 2010 Imagination Technologies Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef LINUX_MMC_DW_MMC_H
-#define LINUX_MMC_DW_MMC_H
-
-#include <linux/scatterlist.h>
-#include <linux/mmc/core.h>
-#include <linux/dmaengine.h>
-#include <linux/reset.h>
-
-#define MAX_MCI_SLOTS	2
-
-enum dw_mci_state {
-	STATE_IDLE = 0,
-	STATE_SENDING_CMD,
-	STATE_SENDING_DATA,
-	STATE_DATA_BUSY,
-	STATE_SENDING_STOP,
-	STATE_DATA_ERROR,
-	STATE_SENDING_CMD11,
-	STATE_WAITING_CMD11_DONE,
-};
-
-enum {
-	EVENT_CMD_COMPLETE = 0,
-	EVENT_XFER_COMPLETE,
-	EVENT_DATA_COMPLETE,
-	EVENT_DATA_ERROR,
-};
-
-enum dw_mci_cookie {
-	COOKIE_UNMAPPED,
-	COOKIE_PRE_MAPPED,	/* mapped by pre_req() of dwmmc */
-	COOKIE_MAPPED,		/* mapped by prepare_data() of dwmmc */
-};
-
-struct mmc_data;
-
-enum {
-	TRANS_MODE_PIO = 0,
-	TRANS_MODE_IDMAC,
-	TRANS_MODE_EDMAC
-};
-
-struct dw_mci_dma_slave {
-	struct dma_chan *ch;
-	enum dma_transfer_direction direction;
-};
-
-/**
- * struct dw_mci - MMC controller state shared between all slots
- * @lock: Spinlock protecting the queue and associated data.
- * @irq_lock: Spinlock protecting the INTMASK setting.
- * @regs: Pointer to MMIO registers.
- * @fifo_reg: Pointer to MMIO registers for data FIFO
- * @sg: Scatterlist entry currently being processed by PIO code, if any.
- * @sg_miter: PIO mapping scatterlist iterator.
- * @cur_slot: The slot which is currently using the controller.
- * @mrq: The request currently being processed on @cur_slot,
- *	or NULL if the controller is idle.
- * @cmd: The command currently being sent to the card, or NULL.
- * @data: The data currently being transferred, or NULL if no data
- *	transfer is in progress.
- * @stop_abort: The command currently prepared for stoping transfer.
- * @prev_blksz: The former transfer blksz record.
- * @timing: Record of current ios timing.
- * @use_dma: Whether DMA channel is initialized or not.
- * @using_dma: Whether DMA is in use for the current transfer.
- * @dma_64bit_address: Whether DMA supports 64-bit address mode or not.
- * @sg_dma: Bus address of DMA buffer.
- * @sg_cpu: Virtual address of DMA buffer.
- * @dma_ops: Pointer to platform-specific DMA callbacks.
- * @cmd_status: Snapshot of SR taken upon completion of the current
- * @ring_size: Buffer size for idma descriptors.
- *	command. Only valid when EVENT_CMD_COMPLETE is pending.
- * @dms: structure of slave-dma private data.
- * @phy_regs: physical address of controller's register map
- * @data_status: Snapshot of SR taken upon completion of the current
- *	data transfer. Only valid when EVENT_DATA_COMPLETE or
- *	EVENT_DATA_ERROR is pending.
- * @stop_cmdr: Value to be loaded into CMDR when the stop command is
- *	to be sent.
- * @dir_status: Direction of current transfer.
- * @tasklet: Tasklet running the request state machine.
- * @pending_events: Bitmask of events flagged by the interrupt handler
- *	to be processed by the tasklet.
- * @completed_events: Bitmask of events which the state machine has
- *	processed.
- * @state: Tasklet state.
- * @queue: List of slots waiting for access to the controller.
- * @bus_hz: The rate of @mck in Hz. This forms the basis for MMC bus
- *	rate and timeout calculations.
- * @current_speed: Configured rate of the controller.
- * @num_slots: Number of slots available.
- * @fifoth_val: The value of FIFOTH register.
- * @verid: Denote Version ID.
- * @dev: Device associated with the MMC controller.
- * @pdata: Platform data associated with the MMC controller.
- * @drv_data: Driver specific data for identified variant of the controller
- * @priv: Implementation defined private data.
- * @biu_clk: Pointer to bus interface unit clock instance.
- * @ciu_clk: Pointer to card interface unit clock instance.
- * @slot: Slots sharing this MMC controller.
- * @fifo_depth: depth of FIFO.
- * @data_shift: log2 of FIFO item size.
- * @part_buf_start: Start index in part_buf.
- * @part_buf_count: Bytes of partial data in part_buf.
- * @part_buf: Simple buffer for partial fifo reads/writes.
- * @push_data: Pointer to FIFO push function.
- * @pull_data: Pointer to FIFO pull function.
- * @vqmmc_enabled: Status of vqmmc, should be true or false.
- * @irq_flags: The flags to be passed to request_irq.
- * @irq: The irq value to be passed to request_irq.
- * @sdio_id0: Number of slot0 in the SDIO interrupt registers.
- * @cmd11_timer: Timer for SD3.0 voltage switch over scheme.
- * @dto_timer: Timer for broken data transfer over scheme.
- *
- * Locking
- * =======
- *
- * @lock is a softirq-safe spinlock protecting @queue as well as
- * @cur_slot, @mrq and @state. These must always be updated
- * at the same time while holding @lock.
- *
- * @irq_lock is an irq-safe spinlock protecting the INTMASK register
- * to allow the interrupt handler to modify it directly.  Held for only long
- * enough to read-modify-write INTMASK and no other locks are grabbed when
- * holding this one.
- *
- * The @mrq field of struct dw_mci_slot is also protected by @lock,
- * and must always be written at the same time as the slot is added to
- * @queue.
- *
- * @pending_events and @completed_events are accessed using atomic bit
- * operations, so they don't need any locking.
- *
- * None of the fields touched by the interrupt handler need any
- * locking. However, ordering is important: Before EVENT_DATA_ERROR or
- * EVENT_DATA_COMPLETE is set in @pending_events, all data-related
- * interrupts must be disabled and @data_status updated with a
- * snapshot of SR. Similarly, before EVENT_CMD_COMPLETE is set, the
- * CMDRDY interrupt must be disabled and @cmd_status updated with a
- * snapshot of SR, and before EVENT_XFER_COMPLETE can be set, the
- * bytes_xfered field of @data must be written. This is ensured by
- * using barriers.
- */
-struct dw_mci {
-	spinlock_t		lock;
-	spinlock_t		irq_lock;
-	void __iomem		*regs;
-	void __iomem		*fifo_reg;
-
-	struct scatterlist	*sg;
-	struct sg_mapping_iter	sg_miter;
-
-	struct dw_mci_slot	*cur_slot;
-	struct mmc_request	*mrq;
-	struct mmc_command	*cmd;
-	struct mmc_data		*data;
-	struct mmc_command	stop_abort;
-	unsigned int		prev_blksz;
-	unsigned char		timing;
-
-	/* DMA interface members*/
-	int			use_dma;
-	int			using_dma;
-	int			dma_64bit_address;
-
-	dma_addr_t		sg_dma;
-	void			*sg_cpu;
-	const struct dw_mci_dma_ops	*dma_ops;
-	/* For idmac */
-	unsigned int		ring_size;
-
-	/* For edmac */
-	struct dw_mci_dma_slave *dms;
-	/* Registers's physical base address */
-	resource_size_t		phy_regs;
-
-	u32			cmd_status;
-	u32			data_status;
-	u32			stop_cmdr;
-	u32			dir_status;
-	struct tasklet_struct	tasklet;
-	unsigned long		pending_events;
-	unsigned long		completed_events;
-	enum dw_mci_state	state;
-	struct list_head	queue;
-
-	u32			bus_hz;
-	u32			current_speed;
-	u32			num_slots;
-	u32			fifoth_val;
-	u16			verid;
-	struct device		*dev;
-	struct dw_mci_board	*pdata;
-	const struct dw_mci_drv_data	*drv_data;
-	void			*priv;
-	struct clk		*biu_clk;
-	struct clk		*ciu_clk;
-	struct dw_mci_slot	*slot[MAX_MCI_SLOTS];
-
-	/* FIFO push and pull */
-	int			fifo_depth;
-	int			data_shift;
-	u8			part_buf_start;
-	u8			part_buf_count;
-	union {
-		u16		part_buf16;
-		u32		part_buf32;
-		u64		part_buf;
-	};
-	void (*push_data)(struct dw_mci *host, void *buf, int cnt);
-	void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
-
-	bool			vqmmc_enabled;
-	unsigned long		irq_flags; /* IRQ flags */
-	int			irq;
-
-	int			sdio_id0;
-
-	struct timer_list       cmd11_timer;
-	struct timer_list       dto_timer;
-};
-
-/* DMA ops for Internal/External DMAC interface */
-struct dw_mci_dma_ops {
-	/* DMA Ops */
-	int (*init)(struct dw_mci *host);
-	int (*start)(struct dw_mci *host, unsigned int sg_len);
-	void (*complete)(void *host);
-	void (*stop)(struct dw_mci *host);
-	void (*cleanup)(struct dw_mci *host);
-	void (*exit)(struct dw_mci *host);
-};
-
-struct dma_pdata;
-
-/* Board platform data */
-struct dw_mci_board {
-	u32 num_slots;
-
-	unsigned int bus_hz; /* Clock speed at the cclk_in pad */
-
-	u32 caps;	/* Capabilities */
-	u32 caps2;	/* More capabilities */
-	u32 pm_caps;	/* PM capabilities */
-	/*
-	 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
-	 * but note that this may not be reliable after a bootloader has used
-	 * it.
-	 */
-	unsigned int fifo_depth;
-
-	/* delay in mS before detecting cards after interrupt */
-	u32 detect_delay_ms;
-
-	struct reset_control *rstc;
-	struct dw_mci_dma_ops *dma_ops;
-	struct dma_pdata *data;
-};
-
-#endif /* LINUX_MMC_DW_MMC_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 08/21] mmc: sdhci-cadence: Include mmc.h
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (6 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 07/21] mmc: dw_mmc: Remove the public dw_mmc header file Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (13 subsequent siblings)
  21 siblings, 2 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, Masahiro Yamada

Don't rely on host.h to include the mmc.h header, but instead include it
explicitly because the driver depends on it.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sdhci-cadence.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index 4b0ecb9..31e786d 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -17,6 +17,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
 
 #include "sdhci-pltfm.h"
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 09/21] mmc: sdhci: Include leds.h
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (7 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 08/21] mmc: sdhci-cadence: Include mmc.h Ulf Hansson
@ 2016-12-30 12:47 ` Ulf Hansson
  2016-12-30 13:35   ` Mateusz Nowak
                     ` (2 more replies)
  2016-12-30 12:47 ` [PATCH 10/21] mmc: host: Include interrupt.h in mmc host drivers that depends on it Ulf Hansson
                   ` (12 subsequent siblings)
  21 siblings, 3 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Don't rely on host.h to include the mmc.h header, but instead include it
explicitly because the driver depends on it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/sdhci.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0b66f21..a10a7b6 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -17,6 +17,7 @@
 #include <linux/compiler.h>
 #include <linux/types.h>
 #include <linux/io.h>
+#include <linux/leds.h>
 
 #include <linux/mmc/host.h>
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 10/21] mmc: host: Include interrupt.h in mmc host drivers that depends on it
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (8 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 09/21] mmc: sdhci: Include leds.h Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (11 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

An mmc host driver shouldn't rely on interrupt.h being included by another
public mmc header. Instead make that dependency explicit by including
interrupt.h in those host drivers that depends on it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/davinci_mmc.c  | 1 +
 drivers/mmc/host/dw_mmc.h       | 1 +
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 drivers/mmc/host/mtk-sd.c       | 1 +
 drivers/mmc/host/sdhci.h        | 1 +
 drivers/mmc/host/tmio_mmc.h     | 1 +
 drivers/mmc/host/via-sdmmc.c    | 1 +
 drivers/mmc/host/wmt-sdmmc.c    | 1 +
 8 files changed, 8 insertions(+)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 36b5af8..1e2600d 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -36,6 +36,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/mmc/slot-gpio.h>
+#include <linux/interrupt.h>
 
 #include <linux/platform_data/mmc-davinci.h>
 
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 9601461..231a46f 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -18,6 +18,7 @@
 #include <linux/mmc/core.h>
 #include <linux/dmaengine.h>
 #include <linux/reset.h>
+#include <linux/interrupt.h>
 
 #define MAX_MCI_SLOTS	2
 
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index b352760..22bfe5e 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -35,6 +35,7 @@
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/regulator/consumer.h>
+#include <linux/interrupt.h>
 
 #define DRIVER_NAME "meson-gx-mmc"
 
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 10ef2ae..d33828e 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -28,6 +28,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/interrupt.h>
 
 #include <linux/mmc/card.h>
 #include <linux/mmc/core.h>
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index a10a7b6..edf3adf 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -18,6 +18,7 @@
 #include <linux/types.h>
 #include <linux/io.h>
 #include <linux/leds.h>
+#include <linux/interrupt.h>
 
 #include <linux/mmc/host.h>
 
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9e20bcf..9b22844 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -24,6 +24,7 @@
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
 #include <linux/spinlock.h>
+#include <linux/interrupt.h>
 
 #define CTL_SD_CMD 0x00
 #define CTL_ARG_REG 0x04
diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c
index 63fac78..6380044 100644
--- a/drivers/mmc/host/via-sdmmc.c
+++ b/drivers/mmc/host/via-sdmmc.c
@@ -13,6 +13,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/highmem.h>
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 
 #include <linux/mmc/host.h>
 
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 5af0055..21ebba8 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -20,6 +20,7 @@
 #include <linux/irq.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
+#include <linux/interrupt.h>
 
 #include <linux/of.h>
 #include <linux/of_address.h>
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 11/21] mmc: core: First step in cleaning up public mmc header files
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (9 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 10/21] mmc: host: Include interrupt.h in mmc host drivers that depends on it Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (10 subsequent siblings)
  21 siblings, 2 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

This is the first step in cleaning up the public mmc header files. In this
change we makes sure each header file builds standalone, as that helps to
resolve dependencies.

While changing this, it also seems reasonable to stop including other
headers from inside a header itself which it don't depend upon.
Additionally, in some cases such dependencies are better resolved by
forward declaring the needed struct.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/card.h      | 2 --
 include/linux/mmc/core.h      | 3 +--
 include/linux/mmc/host.h      | 9 ++-------
 include/linux/mmc/mmc.h       | 2 ++
 include/linux/mmc/slot-gpio.h | 3 +++
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 00449e5..ca64f5b 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -11,7 +11,6 @@
 #define LINUX_MMC_CARD_H
 
 #include <linux/device.h>
-#include <linux/mmc/core.h>
 #include <linux/mod_devicetable.h>
 
 struct mmc_cid {
@@ -206,7 +205,6 @@ struct sdio_cis {
 };
 
 struct mmc_host;
-struct mmc_ios;
 struct sdio_func;
 struct sdio_func_tuple;
 
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index e33cc74..64e2ddf 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -8,10 +8,9 @@
 #ifndef LINUX_MMC_CORE_H
 #define LINUX_MMC_CORE_H
 
-#include <linux/interrupt.h>
 #include <linux/completion.h>
+#include <linux/types.h>
 
-struct request;
 struct mmc_data;
 struct mmc_request;
 
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8bc8841..8d38c76 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -10,16 +10,12 @@
 #ifndef LINUX_MMC_HOST_H
 #define LINUX_MMC_HOST_H
 
-#include <linux/leds.h>
-#include <linux/mutex.h>
-#include <linux/timer.h>
 #include <linux/sched.h>
 #include <linux/device.h>
 #include <linux/fault-inject.h>
 
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
-#include <linux/mmc/mmc.h>
 #include <linux/mmc/pm.h>
 
 struct mmc_ios {
@@ -82,6 +78,8 @@ struct mmc_ios {
 	bool enhanced_strobe;			/* hs400es selection */
 };
 
+struct mmc_host;
+
 struct mmc_host_ops {
 	/*
 	 * It is optional for the host to implement pre_req and post_req in
@@ -162,9 +160,6 @@ struct mmc_host_ops {
 				  unsigned int direction, int blk_size);
 };
 
-struct mmc_card;
-struct device;
-
 struct mmc_async_req {
 	/* active mmc request */
 	struct mmc_request	*mrq;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index a074082..261772e 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -24,6 +24,8 @@
 #ifndef LINUX_MMC_MMC_H
 #define LINUX_MMC_MMC_H
 
+#include <linux/types.h>
+
 /* Standard MMC commands (4.1)           type  argument     response */
    /* class 1 */
 #define MMC_GO_IDLE_STATE         0   /* bc                          */
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index a7972cd..82f0d28 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -11,6 +11,9 @@
 #ifndef MMC_SLOT_GPIO_H
 #define MMC_SLOT_GPIO_H
 
+#include <linux/types.h>
+#include <linux/irqreturn.h>
+
 struct mmc_host;
 
 int mmc_gpio_get_ro(struct mmc_host *host);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 12/21] mmc: core: First step in cleaning up private mmc header files
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (10 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 11/21] mmc: core: First step in cleaning up public mmc header files Ulf Hansson
@ 2016-12-30 12:47 ` Ulf Hansson
  2016-12-30 12:47 ` [PATCH 13/21] mmc: core: Move public functions from core.h to private headers Ulf Hansson
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

This is the first step in cleaning up the private mmc header files. In this
change we makes sure each header file builds standalone, as that helps to
resolve dependencies.

While changing this, it also seems reasonable to stop including other
headers from inside a header itself which it don't depend upon.
Additionally, in some cases such dependencies are better resolved by
forward declaring the needed struct.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/block.h     | 8 ++++++++
 drivers/mmc/core/bus.h       | 4 ++++
 drivers/mmc/core/core.h      | 4 ++++
 drivers/mmc/core/host.h      | 3 ++-
 drivers/mmc/core/mmc_ops.h   | 5 +++++
 drivers/mmc/core/pwrseq.h    | 6 +++++-
 drivers/mmc/core/queue.h     | 6 +++++-
 drivers/mmc/core/sd.h        | 5 ++++-
 drivers/mmc/core/sd_ops.h    | 5 +++++
 drivers/mmc/core/sdio_bus.h  | 3 +++
 drivers/mmc/core/sdio_cis.h  | 3 +++
 drivers/mmc/core/sdio_ops.h  | 4 ++++
 drivers/mmc/core/slot-gpio.h | 2 ++
 13 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/block.h b/drivers/mmc/core/block.h
index cdabb2e..00b7483 100644
--- a/drivers/mmc/core/block.h
+++ b/drivers/mmc/core/block.h
@@ -1 +1,9 @@
+#ifndef _MMC_CORE_BLOCK_H
+#define _MMC_CORE_BLOCK_H
+
+struct mmc_queue;
+struct request;
+
 int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req);
+
+#endif
diff --git a/drivers/mmc/core/bus.h b/drivers/mmc/core/bus.h
index 00a1971..93b516a 100644
--- a/drivers/mmc/core/bus.h
+++ b/drivers/mmc/core/bus.h
@@ -11,6 +11,10 @@
 #ifndef _MMC_CORE_BUS_H
 #define _MMC_CORE_BUS_H
 
+struct mmc_host;
+struct mmc_card;
+struct device_type;
+
 #define MMC_DEV_ATTR(name, fmt, args...)					\
 static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf)	\
 {										\
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 0fa86a2..29b91ae 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -12,6 +12,10 @@
 #define _MMC_CORE_CORE_H
 
 #include <linux/delay.h>
+#include <linux/sched.h>
+
+struct mmc_host;
+struct mmc_card;
 
 #define MMC_CMD_RETRIES        3
 
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 992bf53..366ce79 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -10,7 +10,8 @@
  */
 #ifndef _MMC_CORE_HOST_H
 #define _MMC_CORE_HOST_H
-#include <linux/mmc/host.h>
+
+struct mmc_host;
 
 int mmc_register_host_class(void);
 void mmc_unregister_host_class(void);
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
index abd525e..e76365a 100644
--- a/drivers/mmc/core/mmc_ops.h
+++ b/drivers/mmc/core/mmc_ops.h
@@ -12,6 +12,11 @@
 #ifndef _MMC_MMC_OPS_H
 #define _MMC_MMC_OPS_H
 
+#include <linux/types.h>
+
+struct mmc_host;
+struct mmc_card;
+
 int mmc_select_card(struct mmc_card *card);
 int mmc_deselect_cards(struct mmc_host *host);
 int mmc_set_dsr(struct mmc_host *host);
diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
index d69e751..39c911a 100644
--- a/drivers/mmc/core/pwrseq.h
+++ b/drivers/mmc/core/pwrseq.h
@@ -8,7 +8,11 @@
 #ifndef _MMC_CORE_PWRSEQ_H
 #define _MMC_CORE_PWRSEQ_H
 
-#include <linux/mmc/host.h>
+#include <linux/types.h>
+
+struct mmc_host;
+struct device;
+struct module;
 
 struct mmc_pwrseq_ops {
 	void (*pre_power_on)(struct mmc_host *host);
diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h
index dac8c3d..0cea02a 100644
--- a/drivers/mmc/core/queue.h
+++ b/drivers/mmc/core/queue.h
@@ -1,6 +1,11 @@
 #ifndef MMC_QUEUE_H
 #define MMC_QUEUE_H
 
+#include <linux/types.h>
+#include <linux/blkdev.h>
+#include <linux/mmc/core.h>
+#include <linux/mmc/host.h>
+
 static inline bool mmc_req_is_special(struct request *req)
 {
 	return req &&
@@ -9,7 +14,6 @@ static inline bool mmc_req_is_special(struct request *req)
 		 req_op(req) == REQ_OP_SECURE_ERASE);
 }
 
-struct request;
 struct task_struct;
 struct mmc_blk_data;
 
diff --git a/drivers/mmc/core/sd.h b/drivers/mmc/core/sd.h
index aab824a..1ada980 100644
--- a/drivers/mmc/core/sd.h
+++ b/drivers/mmc/core/sd.h
@@ -1,10 +1,13 @@
 #ifndef _MMC_CORE_SD_H
 #define _MMC_CORE_SD_H
 
-#include <linux/mmc/card.h>
+#include <linux/types.h>
 
 extern struct device_type sd_type;
 
+struct mmc_host;
+struct mmc_card;
+
 int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr);
 int mmc_sd_get_csd(struct mmc_host *host, struct mmc_card *card);
 void mmc_decode_cid(struct mmc_card *card);
diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h
index ffc2305..ac7223c 100644
--- a/drivers/mmc/core/sd_ops.h
+++ b/drivers/mmc/core/sd_ops.h
@@ -12,6 +12,11 @@
 #ifndef _MMC_SD_OPS_H
 #define _MMC_SD_OPS_H
 
+#include <linux/types.h>
+
+struct mmc_card;
+struct mmc_host;
+
 int mmc_app_set_bus_width(struct mmc_card *card, int width);
 int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
diff --git a/drivers/mmc/core/sdio_bus.h b/drivers/mmc/core/sdio_bus.h
index 567a768..b69a254 100644
--- a/drivers/mmc/core/sdio_bus.h
+++ b/drivers/mmc/core/sdio_bus.h
@@ -11,6 +11,9 @@
 #ifndef _MMC_CORE_SDIO_BUS_H
 #define _MMC_CORE_SDIO_BUS_H
 
+struct mmc_card;
+struct sdio_func;
+
 struct sdio_func *sdio_alloc_func(struct mmc_card *card);
 int sdio_add_func(struct sdio_func *func);
 void sdio_remove_func(struct sdio_func *func);
diff --git a/drivers/mmc/core/sdio_cis.h b/drivers/mmc/core/sdio_cis.h
index 4d903c2..16aa563 100644
--- a/drivers/mmc/core/sdio_cis.h
+++ b/drivers/mmc/core/sdio_cis.h
@@ -14,6 +14,9 @@
 #ifndef _MMC_SDIO_CIS_H
 #define _MMC_SDIO_CIS_H
 
+struct mmc_card;
+struct sdio_func;
+
 int sdio_read_common_cis(struct mmc_card *card);
 void sdio_free_common_cis(struct mmc_card *card);
 
diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h
index 5660c7f..e1c36d6 100644
--- a/drivers/mmc/core/sdio_ops.h
+++ b/drivers/mmc/core/sdio_ops.h
@@ -12,8 +12,12 @@
 #ifndef _MMC_SDIO_OPS_H
 #define _MMC_SDIO_OPS_H
 
+#include <linux/types.h>
 #include <linux/mmc/sdio.h>
 
+struct mmc_host;
+struct mmc_card;
+
 int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, u8 in, u8* out);
diff --git a/drivers/mmc/core/slot-gpio.h b/drivers/mmc/core/slot-gpio.h
index 8c1854d..a06fd84 100644
--- a/drivers/mmc/core/slot-gpio.h
+++ b/drivers/mmc/core/slot-gpio.h
@@ -8,6 +8,8 @@
 #ifndef _MMC_CORE_SLOTGPIO_H
 #define _MMC_CORE_SLOTGPIO_H
 
+struct mmc_host;
+
 int mmc_gpio_alloc(struct mmc_host *host);
 
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 13/21] mmc: core: Move public functions from core.h to private headers
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (11 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 12/21] mmc: core: First step in cleaning up private " Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (8 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

A significant amount of functions are available through the public mmc
core.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 header files.

This change concentrates on moving the functions into private mmc headers,
following changes may continue with additional clean-ups, as an example
some functions can be turned into static.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/block.c    |  3 +++
 drivers/mmc/core/core.h     | 37 ++++++++++++++++++++++++++++++++-
 drivers/mmc/core/mmc_ops.h  |  9 ++++++++
 drivers/mmc/core/mmc_test.c |  2 ++
 drivers/mmc/core/queue.c    |  1 +
 drivers/mmc/core/sd_ops.h   |  4 ++++
 drivers/mmc/core/sdio_io.c  |  1 +
 drivers/mmc/core/sdio_irq.c |  1 +
 drivers/mmc/core/sdio_ops.h |  1 +
 include/linux/mmc/core.h    | 50 ---------------------------------------------
 10 files changed, 58 insertions(+), 51 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 6648a17..7246995 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -47,6 +47,9 @@
 
 #include "queue.h"
 #include "block.h"
+#include "core.h"
+#include "mmc_ops.h"
+#include "sd_ops.h"
 
 MODULE_ALIAS("mmc:block");
 #ifdef MODULE_PARAM_PREFIX
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 29b91ae..8a95c825 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -16,6 +16,7 @@
 
 struct mmc_host;
 struct mmc_card;
+struct mmc_request;
 
 #define MMC_CMD_RETRIES        3
 
@@ -73,6 +74,7 @@ static inline void mmc_delay(unsigned int ms)
 void mmc_stop_host(struct mmc_host *host);
 
 int _mmc_detect_card_removed(struct mmc_host *host);
+int mmc_detect_card_removed(struct mmc_host *host);
 
 int mmc_attach_mmc(struct mmc_host *host);
 int mmc_attach_sd(struct mmc_host *host);
@@ -102,5 +104,38 @@ static inline void mmc_register_pm_notifier(struct mmc_host *host) { }
 static inline void mmc_unregister_pm_notifier(struct mmc_host *host) { }
 #endif
 
-#endif
+void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq);
+bool mmc_is_req_done(struct mmc_host *host, struct mmc_request *mrq);
+
+int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
+		unsigned int arg);
+int mmc_can_erase(struct mmc_card *card);
+int mmc_can_trim(struct mmc_card *card);
+int mmc_can_discard(struct mmc_card *card);
+int mmc_can_sanitize(struct mmc_card *card);
+int mmc_can_secure_erase_trim(struct mmc_card *card);
+int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
+			unsigned int nr);
+unsigned int mmc_calc_max_discard(struct mmc_card *card);
+
+int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
+int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
+			bool is_rel_write);
+
+int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
+void mmc_release_host(struct mmc_host *host);
+void mmc_get_card(struct mmc_card *card);
+void mmc_put_card(struct mmc_card *card);
+
+/**
+ *	mmc_claim_host - exclusively claim a host
+ *	@host: mmc host to claim
+ *
+ *	Claim a host for a set of operations.
+ */
+static inline void mmc_claim_host(struct mmc_host *host)
+{
+	__mmc_claim_host(host, NULL);
+}
 
+#endif
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
index e76365a..74beea8 100644
--- a/drivers/mmc/core/mmc_ops.h
+++ b/drivers/mmc/core/mmc_ops.h
@@ -31,12 +31,21 @@
 int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
 int mmc_bus_test(struct mmc_card *card, u8 bus_width);
 int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status);
+int mmc_interrupt_hpi(struct mmc_card *card);
 int mmc_can_ext_csd(struct mmc_card *card);
+int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
 int mmc_switch_status(struct mmc_card *card);
 int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
 int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
 		unsigned int timeout_ms, unsigned char timing,
 		bool use_busy_signal, bool send_status,	bool retry_crc_err);
+int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
+		unsigned int timeout_ms);
+int mmc_stop_bkops(struct mmc_card *card);
+int mmc_read_bkops_status(struct mmc_card *card);
+void mmc_start_bkops(struct mmc_card *card, bool from_exception);
+int mmc_can_reset(struct mmc_card *card);
+int mmc_flush_cache(struct mmc_card *card);
 
 #endif
 
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 3ab6e52..9f1c05d4 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -22,6 +22,8 @@
 #include <linux/seq_file.h>
 #include <linux/module.h>
 
+#include "core.h"
+
 #define RESULT_OK		0
 #define RESULT_FAIL		1
 #define RESULT_UNSUP_HOST	2
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index a6496d8..8be0a63 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -20,6 +20,7 @@
 
 #include "queue.h"
 #include "block.h"
+#include "core.h"
 
 #define MMC_QUEUE_BOUNCESZ	65536
 
diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h
index ac7223c..784f8e6 100644
--- a/drivers/mmc/core/sd_ops.h
+++ b/drivers/mmc/core/sd_ops.h
@@ -16,6 +16,7 @@
 
 struct mmc_card;
 struct mmc_host;
+struct mmc_command;
 
 int mmc_app_set_bus_width(struct mmc_card *card, int width);
 int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
@@ -25,6 +26,9 @@
 int mmc_sd_switch(struct mmc_card *card, int mode, int group,
 	u8 value, u8 *resp);
 int mmc_app_sd_status(struct mmc_card *card, void *ssr);
+int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
+int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
+	struct mmc_command *cmd, int retries);
 
 #endif
 
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 406e5f0..76fe6d5 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -16,6 +16,7 @@
 #include <linux/mmc/sdio_func.h>
 
 #include "sdio_ops.h"
+#include "core.h"
 
 /**
  *	sdio_claim_host - exclusively claim a bus for a certain SDIO function
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index f1faf9a..d084635 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -27,6 +27,7 @@
 #include <linux/mmc/sdio_func.h>
 
 #include "sdio_ops.h"
+#include "core.h"
 
 static int process_sdio_pending_irqs(struct mmc_host *host)
 {
diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h
index e1c36d6..bed8a83 100644
--- a/drivers/mmc/core/sdio_ops.h
+++ b/drivers/mmc/core/sdio_ops.h
@@ -24,6 +24,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
 int sdio_reset(struct mmc_host *host);
+unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz);
 
 static inline bool mmc_is_io_op(u32 opcode)
 {
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 64e2ddf..e679a86 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -158,25 +158,13 @@ struct mmc_request {
 struct mmc_card;
 struct mmc_async_req;
 
-extern int mmc_stop_bkops(struct mmc_card *);
-extern int mmc_read_bkops_status(struct mmc_card *);
 extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
 					   struct mmc_async_req *,
 					   enum mmc_blk_status *);
-extern int mmc_interrupt_hpi(struct mmc_card *);
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
-extern void mmc_wait_for_req_done(struct mmc_host *host,
-				  struct mmc_request *mrq);
-extern bool mmc_is_req_done(struct mmc_host *host, struct mmc_request *mrq);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
-extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
-extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
-	struct mmc_command *, int);
-extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
-extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
 extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
 extern int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
-extern int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
 
 #define MMC_ERASE_ARG		0x00000000
 #define MMC_SECURE_ERASE_ARG	0x80000000
@@ -188,46 +176,8 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
 #define MMC_SECURE_ARGS		0x80000000
 #define MMC_TRIM_ARGS		0x00008001
 
-extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
-		     unsigned int arg);
-extern int mmc_can_erase(struct mmc_card *card);
-extern int mmc_can_trim(struct mmc_card *card);
-extern int mmc_can_discard(struct mmc_card *card);
-extern int mmc_can_sanitize(struct mmc_card *card);
-extern int mmc_can_secure_erase_trim(struct mmc_card *card);
-extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
-				   unsigned int nr);
-extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
-
-extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
-extern int mmc_set_blockcount(struct mmc_card *card, unsigned int blockcount,
-			      bool is_rel_write);
 extern int mmc_hw_reset(struct mmc_host *host);
-extern int mmc_can_reset(struct mmc_card *card);
-
 extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
-extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
-
-extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
-extern void mmc_release_host(struct mmc_host *host);
-
-extern void mmc_get_card(struct mmc_card *card);
-extern void mmc_put_card(struct mmc_card *card);
-
-extern int mmc_flush_cache(struct mmc_card *);
-
-extern int mmc_detect_card_removed(struct mmc_host *host);
-
-/**
- *	mmc_claim_host - exclusively claim a host
- *	@host: mmc host to claim
- *
- *	Claim a host for a set of operations.
- */
-static inline void mmc_claim_host(struct mmc_host *host)
-{
-	__mmc_claim_host(host, NULL);
-}
 
 struct device_node;
 extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 14/21] mmc: core: Move some host specific public functions to host.h
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (12 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 13/21] mmc: core: Move public functions from core.h to private headers Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (7 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Ideally the public mmc header file, core.h, shouldn't contain interfaces
particularly intended to be used by host drivers. Instead those should
remain in the host.h header file. Therefore, let's move a couple functions
from core.h to host.h.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/core.h | 6 ------
 include/linux/mmc/host.h | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index e679a86..faacc90 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -163,8 +163,6 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
 					   enum mmc_blk_status *);
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
-extern int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
-extern int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
 
 #define MMC_ERASE_ARG		0x00000000
 #define MMC_SECURE_ERASE_ARG	0x80000000
@@ -179,8 +177,4 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
 extern int mmc_hw_reset(struct mmc_host *host);
 extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
 
-struct device_node;
-extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
-extern int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
-
 #endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 8d38c76..7de0519 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -392,11 +392,14 @@ struct mmc_host {
 	unsigned long		private[0] ____cacheline_aligned;
 };
 
+struct device_node;
+
 struct mmc_host *mmc_alloc_host(int extra, struct device *);
 int mmc_add_host(struct mmc_host *);
 void mmc_remove_host(struct mmc_host *);
 void mmc_free_host(struct mmc_host *);
 int mmc_of_parse(struct mmc_host *host);
+int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
 
 static inline void *mmc_priv(struct mmc_host *host)
 {
@@ -452,6 +455,7 @@ static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc,
 }
 #endif
 
+u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
 int mmc_regulator_get_supply(struct mmc_host *mmc);
 
 static inline int mmc_card_is_removable(struct mmc_host *host)
@@ -538,6 +542,8 @@ static inline bool mmc_can_retune(struct mmc_host *host)
 	return host->can_retune == 1;
 }
 
+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);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 15/21] mmc: core: Move erase/trim/discard defines from public core.h to mmc.h
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (13 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 14/21] mmc: core: Move some host specific public functions to host.h Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

As the public mmc.h header already contains similar defines for other mmc
commands and arguments, let's move those for erase/trim/discard into here
as well.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/core.h | 10 ----------
 include/linux/mmc/mmc.h  | 13 ++++++++++++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index faacc90..6440e10 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -164,16 +164,6 @@ extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
 extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
 
-#define MMC_ERASE_ARG		0x00000000
-#define MMC_SECURE_ERASE_ARG	0x80000000
-#define MMC_TRIM_ARG		0x00000001
-#define MMC_DISCARD_ARG		0x00000003
-#define MMC_SECURE_TRIM1_ARG	0x80000001
-#define MMC_SECURE_TRIM2_ARG	0x80008000
-
-#define MMC_SECURE_ARGS		0x80000000
-#define MMC_TRIM_ARGS		0x00008001
-
 extern int mmc_hw_reset(struct mmc_host *host);
 extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
 
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 261772e..8f78543 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -462,12 +462,23 @@ struct _mmc_csd {
 /*
  * MMC_SWITCH access modes
  */
-
 #define MMC_SWITCH_MODE_CMD_SET		0x00	/* Change the command set */
 #define MMC_SWITCH_MODE_SET_BITS	0x01	/* Set bits which are 1 in value */
 #define MMC_SWITCH_MODE_CLEAR_BITS	0x02	/* Clear bits which are 1 in value */
 #define MMC_SWITCH_MODE_WRITE_BYTE	0x03	/* Set target to value */
 
+/*
+ * Erase/trim/discard
+ */
+#define MMC_ERASE_ARG			0x00000000
+#define MMC_SECURE_ERASE_ARG		0x80000000
+#define MMC_TRIM_ARG			0x00000001
+#define MMC_DISCARD_ARG			0x00000003
+#define MMC_SECURE_TRIM1_ARG		0x80000001
+#define MMC_SECURE_TRIM2_ARG		0x80008000
+#define MMC_SECURE_ARGS			0x80000000
+#define MMC_TRIM_ARGS			0x00008001
+
 #define mmc_driver_type_mask(n)		(1 << (n))
 
 #endif /* LINUX_MMC_MMC_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 16/21] mmc: core: Remove unused struct _mmc_csd from public mmc.h header
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (14 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 15/21] mmc: core: Move erase/trim/discard defines from public core.h to mmc.h Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/mmc.h | 44 --------------------------------------------
 1 file changed, 44 deletions(-)

diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 8f78543..7406d9b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -184,50 +184,6 @@ static inline bool mmc_op_multi(u32 opcode)
 #define R2_SPI_OUT_OF_RANGE	(1 << 15)	/* or CSD overwrite */
 #define R2_SPI_CSD_OVERWRITE	R2_SPI_OUT_OF_RANGE
 
-/* These are unpacked versions of the actual responses */
-
-struct _mmc_csd {
-	u8  csd_structure;
-	u8  spec_vers;
-	u8  taac;
-	u8  nsac;
-	u8  tran_speed;
-	u16 ccc;
-	u8  read_bl_len;
-	u8  read_bl_partial;
-	u8  write_blk_misalign;
-	u8  read_blk_misalign;
-	u8  dsr_imp;
-	u16 c_size;
-	u8  vdd_r_curr_min;
-	u8  vdd_r_curr_max;
-	u8  vdd_w_curr_min;
-	u8  vdd_w_curr_max;
-	u8  c_size_mult;
-	union {
-		struct { /* MMC system specification version 3.1 */
-			u8  erase_grp_size;
-			u8  erase_grp_mult;
-		} v31;
-		struct { /* MMC system specification version 2.2 */
-			u8  sector_size;
-			u8  erase_grp_size;
-		} v22;
-	} erase;
-	u8  wp_grp_size;
-	u8  wp_grp_enable;
-	u8  default_ecc;
-	u8  r2w_factor;
-	u8  write_bl_len;
-	u8  write_bl_partial;
-	u8  file_format_grp;
-	u8  copy;
-	u8  perm_write_protect;
-	u8  tmp_write_protect;
-	u8  file_format;
-	u8  ecc;
-};
-
 /*
  * OCR bits are mostly in host.h
  */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 17/21] mmc: omap: Don't use mmc_card_present() when validating for inserted card
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (15 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 16/21] mmc: core: Remove unused struct _mmc_csd from public mmc.h header Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (4 subsequent siblings)
  21 siblings, 2 replies; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij, linux-omap,
	Tony Lindgren, Jarkko Nikula

The mmc_card_present() function helps the mmc core to track an internal
state of the card device. More importantly, it's not intended to be used by
mmc host drivers to check for an inserted card. Therefore, let's stop using
it and instead rely on checking for a valid pointer to a struct mmc_card,
as it should be good enough.

Cc: linux-omap@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>
Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index be3c49f..bd49f34 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -893,7 +893,7 @@ static void mmc_omap_cover_handler(unsigned long param)
 	 * If no card is inserted, we postpone polling until
 	 * the cover has been closed.
 	 */
-	if (slot->mmc->card == NULL || !mmc_card_present(slot->mmc->card))
+	if (slot->mmc->card == NULL)
 		return;
 
 	mod_timer(&slot->cover_timer,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 18/21] mmc: vub300: Don't use mmc_card_present() when validating for inserted card
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (16 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 17/21] mmc: omap: Don't use mmc_card_present() when validating for inserted card Ulf Hansson
@ 2016-12-30 12:47 ` 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
                   ` (3 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

The mmc_card_present() function helps the mmc core to track an internal
state of the card device. More importantly, it's not intended to be used by
mmc host drivers to check for an inserted card. Therefore, let's stop using
it and instead rely on checking for a valid pointer to a struct mmc_card,
as it should be good enough.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/host/vub300.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index bb3e0d1..0f49aba 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -728,8 +728,7 @@ static void vub300_deadwork_thread(struct work_struct *work)
 		 */
 	} else if (vub300->card_present) {
 		check_vub300_port_status(vub300);
-	} else if (vub300->mmc && vub300->mmc->card &&
-		   mmc_card_present(vub300->mmc->card)) {
+	} else if (vub300->mmc && vub300->mmc->card) {
 		/*
 		 * the MMC core must not have responded
 		 * to the previous indication - lets
@@ -1756,8 +1755,7 @@ static void vub300_cmndwork_thread(struct work_struct *work)
 		int data_length;
 		mutex_lock(&vub300->cmd_mutex);
 		init_completion(&vub300->command_complete);
-		if (likely(vub300->vub_name[0]) || !vub300->mmc->card ||
-		    !mmc_card_present(vub300->mmc->card)) {
+		if (likely(vub300->vub_name[0]) || !vub300->mmc->card) {
 			/*
 			 * the name of the EMPTY Pseudo firmware file
 			 * is used as a flag to indicate that the file
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 19/21] mmc: core: Move public functions from card.h to private headers
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (17 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 18/21] mmc: vub300: " Ulf Hansson
@ 2016-12-30 12:47 ` Ulf Hansson
  2017-01-09 18:26   ` Linus Walleij
  2016-12-30 12:47 ` [PATCH 20/21] mmc: core: Move public functions from host.h " Ulf Hansson
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

A significant amount of functions and other definitions are available
through the public mmc card.h header file. Let's slim down this public mmc
interface, as to prevent users from abusing it, by moving some of the
functions/definitions to private mmc header files.

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    |   2 +
 drivers/mmc/core/bus.c      |   1 +
 drivers/mmc/core/bus.h      |  14 ++-
 drivers/mmc/core/card.h     | 223 ++++++++++++++++++++++++++++++++++++++++
 drivers/mmc/core/core.c     |   1 +
 drivers/mmc/core/debugfs.c  |   1 +
 drivers/mmc/core/mmc.c      |  13 +++
 drivers/mmc/core/mmc_test.c |   2 +
 drivers/mmc/core/queue.c    |   1 +
 drivers/mmc/core/quirks.c   |   2 +
 drivers/mmc/core/sd.c       |   1 +
 drivers/mmc/core/sdio.c     |   1 +
 drivers/mmc/core/sdio_bus.c |   1 +
 drivers/mmc/core/sdio_io.c  |   1 +
 drivers/mmc/core/sdio_irq.c |   1 +
 include/linux/mmc/card.h    | 240 --------------------------------------------
 16 files changed, 263 insertions(+), 242 deletions(-)
 create mode 100644 drivers/mmc/core/card.h

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 7246995..095a0f0 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -48,6 +48,8 @@
 #include "queue.h"
 #include "block.h"
 #include "core.h"
+#include "card.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 c64266f..3be2e6a 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -23,6 +23,7 @@
 #include <linux/mmc/host.h>
 
 #include "core.h"
+#include "card.h"
 #include "sdio_cis.h"
 #include "bus.h"
 
diff --git a/drivers/mmc/core/bus.h b/drivers/mmc/core/bus.h
index 93b516a..72b0ef0 100644
--- a/drivers/mmc/core/bus.h
+++ b/drivers/mmc/core/bus.h
@@ -11,9 +11,10 @@
 #ifndef _MMC_CORE_BUS_H
 #define _MMC_CORE_BUS_H
 
+#include <linux/device.h>
+
 struct mmc_host;
 struct mmc_card;
-struct device_type;
 
 #define MMC_DEV_ATTR(name, fmt, args...)					\
 static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf)	\
@@ -31,5 +32,14 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host,
 int mmc_register_bus(void);
 void mmc_unregister_bus(void);
 
-#endif
+struct mmc_driver {
+	struct device_driver drv;
+	int (*probe)(struct mmc_card *card);
+	void (*remove)(struct mmc_card *card);
+	void (*shutdown)(struct mmc_card *card);
+};
 
+int mmc_register_driver(struct mmc_driver *drv);
+void mmc_unregister_driver(struct mmc_driver *drv);
+
+#endif
diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
new file mode 100644
index 0000000..95e8fc5
--- /dev/null
+++ b/drivers/mmc/core/card.h
@@ -0,0 +1,223 @@
+/*
+ * Private header for the mmc subsystem
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ *
+ * Author: Ulf Hansson <ulf.hansson@linaro.org>
+ *
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef _MMC_CORE_CARD_H
+#define _MMC_CORE_CARD_H
+
+#include <linux/mmc/card.h>
+
+#define mmc_card_name(c)	((c)->cid.prod_name)
+#define mmc_card_id(c)		(dev_name(&(c)->dev))
+#define mmc_dev_to_card(d)	container_of(d, struct mmc_card, dev)
+
+/* Card states */
+#define MMC_STATE_PRESENT	(1<<0)		/* present in sysfs */
+#define MMC_STATE_READONLY	(1<<1)		/* card is read-only */
+#define MMC_STATE_BLOCKADDR	(1<<2)		/* card uses block-addressing */
+#define MMC_CARD_SDXC		(1<<3)		/* card is SDXC */
+#define MMC_CARD_REMOVED	(1<<4)		/* card has been removed */
+#define MMC_STATE_DOING_BKOPS	(1<<5)		/* card is doing BKOPS */
+#define MMC_STATE_SUSPENDED	(1<<6)		/* card is suspended */
+
+#define mmc_card_present(c)	((c)->state & MMC_STATE_PRESENT)
+#define mmc_card_readonly(c)	((c)->state & MMC_STATE_READONLY)
+#define mmc_card_blockaddr(c)	((c)->state & MMC_STATE_BLOCKADDR)
+#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
+#define mmc_card_removed(c)	((c) && ((c)->state & MMC_CARD_REMOVED))
+#define mmc_card_doing_bkops(c)	((c)->state & MMC_STATE_DOING_BKOPS)
+#define mmc_card_suspended(c)	((c)->state & MMC_STATE_SUSPENDED)
+
+#define mmc_card_set_present(c)	((c)->state |= MMC_STATE_PRESENT)
+#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
+#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
+#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
+#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
+#define mmc_card_set_doing_bkops(c)	((c)->state |= MMC_STATE_DOING_BKOPS)
+#define mmc_card_clr_doing_bkops(c)	((c)->state &= ~MMC_STATE_DOING_BKOPS)
+#define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED)
+#define mmc_card_clr_suspended(c) ((c)->state &= ~MMC_STATE_SUSPENDED)
+
+/*
+ * The world is not perfect and supplies us with broken mmc/sdio devices.
+ * For at least some of these bugs we need a work-around.
+ */
+struct mmc_fixup {
+	/* CID-specific fields. */
+	const char *name;
+
+	/* Valid revision range */
+	u64 rev_start, rev_end;
+
+	unsigned int manfid;
+	unsigned short oemid;
+
+	/* SDIO-specific fields. You can use SDIO_ANY_ID here of course */
+	u16 cis_vendor, cis_device;
+
+	/* for MMC cards */
+	unsigned int ext_csd_rev;
+
+	void (*vendor_fixup)(struct mmc_card *card, int data);
+	int data;
+};
+
+#define CID_MANFID_ANY (-1u)
+#define CID_OEMID_ANY ((unsigned short) -1)
+#define CID_NAME_ANY (NULL)
+
+#define EXT_CSD_REV_ANY (-1u)
+
+#define CID_MANFID_SANDISK      0x2
+#define CID_MANFID_TOSHIBA      0x11
+#define CID_MANFID_MICRON       0x13
+#define CID_MANFID_SAMSUNG      0x15
+#define CID_MANFID_KINGSTON     0x70
+#define CID_MANFID_HYNIX	0x90
+
+#define END_FIXUP { NULL }
+
+#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end,	\
+		   _cis_vendor, _cis_device,				\
+		   _fixup, _data, _ext_csd_rev)				\
+	{						\
+		.name = (_name),			\
+		.manfid = (_manfid),			\
+		.oemid = (_oemid),			\
+		.rev_start = (_rev_start),		\
+		.rev_end = (_rev_end),			\
+		.cis_vendor = (_cis_vendor),		\
+		.cis_device = (_cis_device),		\
+		.vendor_fixup = (_fixup),		\
+		.data = (_data),			\
+		.ext_csd_rev = (_ext_csd_rev),		\
+	}
+
+#define MMC_FIXUP_REV(_name, _manfid, _oemid, _rev_start, _rev_end,	\
+		      _fixup, _data, _ext_csd_rev)			\
+	_FIXUP_EXT(_name, _manfid,					\
+		   _oemid, _rev_start, _rev_end,			\
+		   SDIO_ANY_ID, SDIO_ANY_ID,				\
+		   _fixup, _data, _ext_csd_rev)				\
+
+#define MMC_FIXUP(_name, _manfid, _oemid, _fixup, _data) \
+	MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data,	\
+		      EXT_CSD_REV_ANY)
+
+#define MMC_FIXUP_EXT_CSD_REV(_name, _manfid, _oemid, _fixup, _data,	\
+			      _ext_csd_rev)				\
+	MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data,	\
+		      _ext_csd_rev)
+
+#define SDIO_FIXUP(_vendor, _device, _fixup, _data)			\
+	_FIXUP_EXT(CID_NAME_ANY, CID_MANFID_ANY,			\
+		    CID_OEMID_ANY, 0, -1ull,				\
+		   _vendor, _device,					\
+		   _fixup, _data, EXT_CSD_REV_ANY)			\
+
+#define cid_rev(hwrev, fwrev, year, month)	\
+	(((u64) hwrev) << 40 |			\
+	 ((u64) fwrev) << 32 |			\
+	 ((u64) year) << 16 |			\
+	 ((u64) month))
+
+#define cid_rev_card(card)			\
+	cid_rev(card->cid.hwrev,		\
+		    card->cid.fwrev,		\
+		    card->cid.year,		\
+		    card->cid.month)
+
+/*
+ * Unconditionally quirk add/remove.
+ */
+static inline void __maybe_unused add_quirk(struct mmc_card *card, int data)
+{
+	card->quirks |= data;
+}
+
+static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
+{
+	card->quirks &= ~data;
+}
+
+/*
+ * Quirk add/remove for MMC products.
+ */
+static inline void __maybe_unused add_quirk_mmc(struct mmc_card *card, int data)
+{
+	if (mmc_card_mmc(card))
+		card->quirks |= data;
+}
+
+static inline void __maybe_unused remove_quirk_mmc(struct mmc_card *card,
+						   int data)
+{
+	if (mmc_card_mmc(card))
+		card->quirks &= ~data;
+}
+
+/*
+ * Quirk add/remove for SD products.
+ */
+static inline void __maybe_unused add_quirk_sd(struct mmc_card *card, int data)
+{
+	if (mmc_card_sd(card))
+		card->quirks |= data;
+}
+
+static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card,
+						   int data)
+{
+	if (mmc_card_sd(card))
+		card->quirks &= ~data;
+}
+
+static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_LENIENT_FN0;
+}
+
+static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
+}
+
+static inline int mmc_card_disable_cd(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_DISABLE_CD;
+}
+
+static inline int mmc_card_nonstd_func_interface(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF;
+}
+
+static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
+}
+
+static inline int mmc_card_long_read_time(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_LONG_READ_TIME;
+}
+
+static inline int mmc_card_broken_irq_polling(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_IRQ_POLLING;
+}
+
+static inline int mmc_card_broken_hpi(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_HPI;
+}
+
+void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table);
+
+#endif
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 1076b9d..3720d41 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -40,6 +40,7 @@
 #include <trace/events/mmc.h>
 
 #include "core.h"
+#include "card.h"
 #include "bus.h"
 #include "host.h"
 #include "sdio_bus.h"
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 30623b8..2843e6a 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -20,6 +20,7 @@
 #include <linux/mmc/host.h>
 
 #include "core.h"
+#include "card.h"
 #include "mmc_ops.h"
 
 #ifdef CONFIG_FAIL_MMC_REQUEST
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index c0e2507..d526625 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -21,6 +21,7 @@
 #include <linux/mmc/mmc.h>
 
 #include "core.h"
+#include "card.h"
 #include "host.h"
 #include "bus.h"
 #include "mmc_ops.h"
@@ -307,6 +308,18 @@ static void mmc_manage_enhanced_area(struct mmc_card *card, u8 *ext_csd)
 	}
 }
 
+static void mmc_part_add(struct mmc_card *card, unsigned int size,
+			 unsigned int part_cfg, char *name, int idx, bool ro,
+			 int area_type)
+{
+	card->part[card->nr_parts].size = size;
+	card->part[card->nr_parts].part_cfg = part_cfg;
+	sprintf(card->part[card->nr_parts].name, name, idx);
+	card->part[card->nr_parts].force_ro = ro;
+	card->part[card->nr_parts].area_type = area_type;
+	card->nr_parts++;
+}
+
 static void mmc_manage_gp_partitions(struct mmc_card *card, u8 *ext_csd)
 {
 	int idx;
diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 9f1c05d4..46adb04 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -23,6 +23,8 @@
 #include <linux/module.h>
 
 #include "core.h"
+#include "card.h"
+#include "bus.h"
 
 #define RESULT_OK		0
 #define RESULT_FAIL		1
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 8be0a63..0538aa5 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -21,6 +21,7 @@
 #include "queue.h"
 #include "block.h"
 #include "core.h"
+#include "card.h"
 
 #define MMC_QUEUE_BOUNCESZ	65536
 
diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c
index ca9cade..bf25a9c 100644
--- a/drivers/mmc/core/quirks.c
+++ b/drivers/mmc/core/quirks.c
@@ -15,6 +15,8 @@
 #include <linux/mmc/card.h>
 #include <linux/mmc/sdio_ids.h>
 
+#include "card.h"
+
 #ifndef SDIO_VENDOR_ID_TI
 #define SDIO_VENDOR_ID_TI		0x0097
 #endif
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index a614f37..d66b08d 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -22,6 +22,7 @@
 #include <linux/mmc/sd.h>
 
 #include "core.h"
+#include "card.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 ecbc529..558ddfc 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -20,6 +20,7 @@
 #include <linux/mmc/sdio_ids.h>
 
 #include "core.h"
+#include "card.h"
 #include "bus.h"
 #include "sd.h"
 #include "sdio_bus.h"
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 86f5b32..e992a7f 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -25,6 +25,7 @@
 #include <linux/of.h>
 
 #include "core.h"
+#include "card.h"
 #include "sdio_cis.h"
 #include "sdio_bus.h"
 
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c
index 76fe6d5..74195d7 100644
--- a/drivers/mmc/core/sdio_io.c
+++ b/drivers/mmc/core/sdio_io.c
@@ -17,6 +17,7 @@
 
 #include "sdio_ops.h"
 #include "core.h"
+#include "card.h"
 
 /**
  *	sdio_claim_host - exclusively claim a bus for a certain SDIO function
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index d084635..d29faf2 100644
--- a/drivers/mmc/core/sdio_irq.c
+++ b/drivers/mmc/core/sdio_irq.c
@@ -28,6 +28,7 @@
 
 #include "sdio_ops.h"
 #include "core.h"
+#include "card.h"
 
 static int process_sdio_pending_irqs(struct mmc_host *host)
 {
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index ca64f5b..29d00c9 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -248,13 +248,6 @@ struct mmc_card {
 #define MMC_TYPE_SDIO		2		/* SDIO card */
 #define MMC_TYPE_SD_COMBO	3		/* SD combo (IO+mem) card */
 	unsigned int		state;		/* (our) card state */
-#define MMC_STATE_PRESENT	(1<<0)		/* present in sysfs */
-#define MMC_STATE_READONLY	(1<<1)		/* card is read-only */
-#define MMC_STATE_BLOCKADDR	(1<<2)		/* card uses block-addressing */
-#define MMC_CARD_SDXC		(1<<3)		/* card is SDXC */
-#define MMC_CARD_REMOVED	(1<<4)		/* card has been removed */
-#define MMC_STATE_DOING_BKOPS	(1<<5)		/* card is doing BKOPS */
-#define MMC_STATE_SUSPENDED	(1<<6)		/* card is suspended */
 	unsigned int		quirks; 	/* card quirks */
 #define MMC_QUIRK_LENIENT_FN0	(1<<0)		/* allow SDIO FN0 writes outside of the VS CCCR range */
 #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1)	/* use func->cur_blksize */
@@ -273,7 +266,6 @@ struct mmc_card {
 #define MMC_QUIRK_TRIM_BROKEN	(1<<12)		/* Skip trim */
 #define MMC_QUIRK_BROKEN_HPI	(1<<13)		/* Disable broken HPI support */
 
-
 	unsigned int		erase_size;	/* erase size in sectors */
  	unsigned int		erase_shift;	/* if erase unit is power 2 */
  	unsigned int		pref_erase;	/* in sectors */
@@ -309,245 +301,13 @@ struct mmc_card {
 	unsigned int    nr_parts;
 };
 
-/*
- * This function fill contents in mmc_part.
- */
-static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
-			unsigned int part_cfg, char *name, int idx, bool ro,
-			int area_type)
-{
-	card->part[card->nr_parts].size = size;
-	card->part[card->nr_parts].part_cfg = part_cfg;
-	sprintf(card->part[card->nr_parts].name, name, idx);
-	card->part[card->nr_parts].force_ro = ro;
-	card->part[card->nr_parts].area_type = area_type;
-	card->nr_parts++;
-}
-
 static inline bool mmc_large_sector(struct mmc_card *card)
 {
 	return card->ext_csd.data_sector_size == 4096;
 }
 
-/*
- *  The world is not perfect and supplies us with broken mmc/sdio devices.
- *  For at least some of these bugs we need a work-around.
- */
-
-struct mmc_fixup {
-	/* CID-specific fields. */
-	const char *name;
-
-	/* Valid revision range */
-	u64 rev_start, rev_end;
-
-	unsigned int manfid;
-	unsigned short oemid;
-
-	/* SDIO-specfic fields. You can use SDIO_ANY_ID here of course */
-	u16 cis_vendor, cis_device;
-
-	/* for MMC cards */
-	unsigned int ext_csd_rev;
-
-	void (*vendor_fixup)(struct mmc_card *card, int data);
-	int data;
-};
-
-#define CID_MANFID_ANY (-1u)
-#define CID_OEMID_ANY ((unsigned short) -1)
-#define CID_NAME_ANY (NULL)
-
-#define EXT_CSD_REV_ANY (-1u)
-
-#define CID_MANFID_SANDISK      0x2
-#define CID_MANFID_TOSHIBA      0x11
-#define CID_MANFID_MICRON       0x13
-#define CID_MANFID_SAMSUNG      0x15
-#define CID_MANFID_KINGSTON     0x70
-#define CID_MANFID_HYNIX	0x90
-
-#define END_FIXUP { NULL }
-
-#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end,	\
-		   _cis_vendor, _cis_device,				\
-		   _fixup, _data, _ext_csd_rev)				\
-	{						   \
-		.name = (_name),			   \
-		.manfid = (_manfid),			   \
-		.oemid = (_oemid),			   \
-		.rev_start = (_rev_start),		   \
-		.rev_end = (_rev_end),			   \
-		.cis_vendor = (_cis_vendor),		   \
-		.cis_device = (_cis_device),		   \
-		.vendor_fixup = (_fixup),		   \
-		.data = (_data),			   \
-		.ext_csd_rev = (_ext_csd_rev),		   \
-	 }
-
-#define MMC_FIXUP_REV(_name, _manfid, _oemid, _rev_start, _rev_end,	\
-		      _fixup, _data, _ext_csd_rev)			\
-	_FIXUP_EXT(_name, _manfid,					\
-		   _oemid, _rev_start, _rev_end,			\
-		   SDIO_ANY_ID, SDIO_ANY_ID,				\
-		   _fixup, _data, _ext_csd_rev)				\
-
-#define MMC_FIXUP(_name, _manfid, _oemid, _fixup, _data) \
-	MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data,	\
-		      EXT_CSD_REV_ANY)
-
-#define MMC_FIXUP_EXT_CSD_REV(_name, _manfid, _oemid, _fixup, _data,	\
-			      _ext_csd_rev)				\
-	MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data,	\
-		      _ext_csd_rev)
-
-#define SDIO_FIXUP(_vendor, _device, _fixup, _data)			\
-	_FIXUP_EXT(CID_NAME_ANY, CID_MANFID_ANY,			\
-		    CID_OEMID_ANY, 0, -1ull,				\
-		   _vendor, _device,					\
-		   _fixup, _data, EXT_CSD_REV_ANY)			\
-
-#define cid_rev(hwrev, fwrev, year, month)	\
-	(((u64) hwrev) << 40 |                  \
-	 ((u64) fwrev) << 32 |                  \
-	 ((u64) year) << 16 |                   \
-	 ((u64) month))
-
-#define cid_rev_card(card)		  \
-	cid_rev(card->cid.hwrev,	  \
-		    card->cid.fwrev,      \
-		    card->cid.year,	  \
-		    card->cid.month)
-
-/*
- * Unconditionally quirk add/remove.
- */
-
-static inline void __maybe_unused add_quirk(struct mmc_card *card, int data)
-{
-	card->quirks |= data;
-}
-
-static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
-{
-	card->quirks &= ~data;
-}
-
 #define mmc_card_mmc(c)		((c)->type == MMC_TYPE_MMC)
 #define mmc_card_sd(c)		((c)->type == MMC_TYPE_SD)
 #define mmc_card_sdio(c)	((c)->type == MMC_TYPE_SDIO)
 
-#define mmc_card_present(c)	((c)->state & MMC_STATE_PRESENT)
-#define mmc_card_readonly(c)	((c)->state & MMC_STATE_READONLY)
-#define mmc_card_blockaddr(c)	((c)->state & MMC_STATE_BLOCKADDR)
-#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
-#define mmc_card_removed(c)	((c) && ((c)->state & MMC_CARD_REMOVED))
-#define mmc_card_doing_bkops(c)	((c)->state & MMC_STATE_DOING_BKOPS)
-#define mmc_card_suspended(c)	((c)->state & MMC_STATE_SUSPENDED)
-
-#define mmc_card_set_present(c)	((c)->state |= MMC_STATE_PRESENT)
-#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
-#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
-#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
-#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
-#define mmc_card_set_doing_bkops(c)	((c)->state |= MMC_STATE_DOING_BKOPS)
-#define mmc_card_clr_doing_bkops(c)	((c)->state &= ~MMC_STATE_DOING_BKOPS)
-#define mmc_card_set_suspended(c) ((c)->state |= MMC_STATE_SUSPENDED)
-#define mmc_card_clr_suspended(c) ((c)->state &= ~MMC_STATE_SUSPENDED)
-
-/*
- * Quirk add/remove for MMC products.
- */
-
-static inline void __maybe_unused add_quirk_mmc(struct mmc_card *card, int data)
-{
-	if (mmc_card_mmc(card))
-		card->quirks |= data;
-}
-
-static inline void __maybe_unused remove_quirk_mmc(struct mmc_card *card,
-						   int data)
-{
-	if (mmc_card_mmc(card))
-		card->quirks &= ~data;
-}
-
-/*
- * Quirk add/remove for SD products.
- */
-
-static inline void __maybe_unused add_quirk_sd(struct mmc_card *card, int data)
-{
-	if (mmc_card_sd(card))
-		card->quirks |= data;
-}
-
-static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card,
-						   int data)
-{
-	if (mmc_card_sd(card))
-		card->quirks &= ~data;
-}
-
-static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_LENIENT_FN0;
-}
-
-static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
-}
-
-static inline int mmc_card_disable_cd(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_DISABLE_CD;
-}
-
-static inline int mmc_card_nonstd_func_interface(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_NONSTD_FUNC_IF;
-}
-
-static inline int mmc_card_broken_byte_mode_512(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_BROKEN_BYTE_MODE_512;
-}
-
-static inline int mmc_card_long_read_time(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_LONG_READ_TIME;
-}
-
-static inline int mmc_card_broken_irq_polling(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_BROKEN_IRQ_POLLING;
-}
-
-static inline int mmc_card_broken_hpi(const struct mmc_card *c)
-{
-	return c->quirks & MMC_QUIRK_BROKEN_HPI;
-}
-
-#define mmc_card_name(c)	((c)->cid.prod_name)
-#define mmc_card_id(c)		(dev_name(&(c)->dev))
-
-#define mmc_dev_to_card(d)	container_of(d, struct mmc_card, dev)
-
-/*
- * MMC device driver (e.g., Flash card, I/O card...)
- */
-struct mmc_driver {
-	struct device_driver drv;
-	int (*probe)(struct mmc_card *);
-	void (*remove)(struct mmc_card *);
-	void (*shutdown)(struct mmc_card *);
-};
-
-extern int mmc_register_driver(struct mmc_driver *);
-extern void mmc_unregister_driver(struct mmc_driver *);
-
-extern void mmc_fixup_device(struct mmc_card *card,
-			     const struct mmc_fixup *table);
-
 #endif /* LINUX_MMC_CARD_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 20/21] mmc: core: Move public functions from host.h to private headers
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (18 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 19/21] mmc: core: Move public functions from card.h to private headers Ulf Hansson
@ 2016-12-30 12:47 ` Ulf Hansson
  2017-01-09 18:26   ` 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-10 15:37 ` [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

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


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 21/21] mmc: core: Don't use extern declarations of public mmc functions
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (19 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 20/21] mmc: core: Move public functions from host.h " Ulf Hansson
@ 2016-12-30 12:47 ` 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
  21 siblings, 1 reply; 56+ messages in thread
From: Ulf Hansson @ 2016-12-30 12:47 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Using extern when declaring functions in the public header, core.h, is
redundant. Let's just remove the use of it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/mmc/core.h | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 6440e10..6dcb339 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -158,13 +158,14 @@ struct mmc_request {
 struct mmc_card;
 struct mmc_async_req;
 
-extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
-					   struct mmc_async_req *,
-					   enum mmc_blk_status *);
-extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
-extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
-
-extern int mmc_hw_reset(struct mmc_host *host);
-extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
+struct mmc_async_req *mmc_start_req(struct mmc_host *host,
+				struct mmc_async_req *areq,
+				enum mmc_blk_status *ret_stat);
+void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq);
+int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
+		int retries);
+
+int mmc_hw_reset(struct mmc_host *host);
+void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);
 
 #endif /* LINUX_MMC_CORE_H */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [PATCH 09/21] mmc: sdhci: Include leds.h
  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
  2 siblings, 1 reply; 56+ messages in thread
From: Mateusz Nowak @ 2016-12-30 13:35 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

Hi Ulf,

On 12/30/2016 13:47, Ulf Hansson wrote:
> Don't rely on host.h to include the mmc.h header, but instead include it
> explicitly because the driver depends on it.
You refer in description to header file (mmc.h) not related to this patch.

>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/mmc/host/sdhci.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0b66f21..a10a7b6 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -17,6 +17,7 @@
>  #include <linux/compiler.h>
>  #include <linux/types.h>
>  #include <linux/io.h>
> +#include <linux/leds.h>
>
>  #include <linux/mmc/host.h>
>
>

Regards,
Mateusz.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 11/21] mmc: core: First step in cleaning up public mmc header files
  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
  1 sibling, 0 replies; 56+ messages in thread
From: kbuild test robot @ 2016-12-30 14:52 UTC (permalink / raw)
  Cc: kbuild-all, linux-mmc, Ulf Hansson, Jaehoon Chung, Adrian Hunter,
	Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 8765 bytes --]

Hi Ulf,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc1 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ulf-Hansson/mmc-core-A-start-to-slim-down-public-mmc-headers/20161230-205340
config: arm-multi_v5_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/mm-imx21.c:28:
>> include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
--
   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/devices-imx21.h:9,
                    from arch/arm/mach-imx/mach-mx21ads.c:28:
>> include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
>> arch/arm/mach-imx/mach-mx21ads.c:257:50: error: unknown type name 'irq_handler_t'
    static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
                                                     ^~~~~~~~~~~~~
   arch/arm/mach-imx/mach-mx21ads.c: In function 'mx21ads_sdhc_exit':
>> arch/arm/mach-imx/mach-mx21ads.c:272:2: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
     free_irq(gpio_to_irq(MX21ADS_MMC_CD), data);
     ^~~~~~~~
   arch/arm/mach-imx/mach-mx21ads.c: At top level:
>> arch/arm/mach-imx/mach-mx21ads.c:279:2: error: unknown field 'init' specified in initializer
     .init = mx21ads_sdhc_init,
     ^
>> arch/arm/mach-imx/mach-mx21ads.c:279:10: error: 'mx21ads_sdhc_init' undeclared here (not in a function)
     .init = mx21ads_sdhc_init,
             ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/devices-imx27.h:9,
                    from arch/arm/mach-imx/mach-mx27ads.c:36:
>> include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
>> arch/arm/mach-imx/mach-mx27ads.c:294:51: error: unknown type name 'irq_handler_t'
    static int mx27ads_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
                                                      ^~~~~~~~~~~~~
   arch/arm/mach-imx/mach-mx27ads.c:301:51: error: unknown type name 'irq_handler_t'
    static int mx27ads_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
                                                      ^~~~~~~~~~~~~
   arch/arm/mach-imx/mach-mx27ads.c: In function 'mx27ads_sdhc1_exit':
>> arch/arm/mach-imx/mach-mx27ads.c:310:2: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
     free_irq(gpio_to_irq(IMX_GPIO_NR(5, 21)), data);
     ^~~~~~~~
   arch/arm/mach-imx/mach-mx27ads.c: At top level:
>> arch/arm/mach-imx/mach-mx27ads.c:319:2: error: unknown field 'init' specified in initializer
     .init = mx27ads_sdhc1_init,
     ^
>> arch/arm/mach-imx/mach-mx27ads.c:319:10: error: 'mx27ads_sdhc1_init' undeclared here (not in a function)
     .init = mx27ads_sdhc1_init,
             ^~~~~~~~~~~~~~~~~~
   arch/arm/mach-imx/mach-mx27ads.c:324:2: error: unknown field 'init' specified in initializer
     .init = mx27ads_sdhc2_init,
     ^
>> arch/arm/mach-imx/mach-mx27ads.c:324:10: error: 'mx27ads_sdhc2_init' undeclared here (not in a function)
     .init = mx27ads_sdhc2_init,
             ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/devices-imx27.h:9,
                    from arch/arm/mach-imx/mach-imx27_visstrim_m10.c:45:
>> include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
>> arch/arm/mach-imx/mach-imx27_visstrim_m10.c:341:3: error: unknown type name 'irq_handler_t'
      irq_handler_t detect_irq, void *data)
      ^~~~~~~~~~~~~
   arch/arm/mach-imx/mach-imx27_visstrim_m10.c: In function 'visstrim_m10_sdhc1_exit':
>> arch/arm/mach-imx/mach-imx27_visstrim_m10.c:352:2: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
     free_irq(gpio_to_irq(SDHC1_IRQ_GPIO), data);
     ^~~~~~~~
   arch/arm/mach-imx/mach-imx27_visstrim_m10.c: At top level:
>> arch/arm/mach-imx/mach-imx27_visstrim_m10.c:356:2: error: unknown field 'init' specified in initializer
     .init = visstrim_m10_sdhc1_init,
     ^
>> arch/arm/mach-imx/mach-imx27_visstrim_m10.c:356:10: error: 'visstrim_m10_sdhc1_init' undeclared here (not in a function)
     .init = visstrim_m10_sdhc1_init,
             ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/irq_handler_t +24 include/linux/platform_data/mmc-mxcmmc.h

d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06   8  /* board specific SDHC data, optional.
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06   9   * If not present, a writable card with 3,3V is assumed.
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  10   */
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  11  struct imxmmc_platform_data {
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  12  	/* Return values for the get_ro callback should be:
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  13  	 *   0 for a read/write card
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  14  	 *   1 for a read-only card
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  15  	 *   -ENOSYS when not supported (equal to NULL callback)
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  16  	 *   or a negative errno value when something bad happened
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  17  	 */
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  18  	int (*get_ro)(struct device *);
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  19  
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  20  	/* board specific hook to (de)initialize the SD slot.
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  21  	 * The board code can call 'handler' on a card detection
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  22  	 * change giving data as argument.
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  23  	 */
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06 @24  	int (*init)(struct device *dev, irq_handler_t handler, void *data);
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  25  	void (*exit)(struct device *dev, void *data);
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  26  
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  27  	/* available voltages. If not given, assume
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  28  	 * MMC_VDD_32_33 | MMC_VDD_33_34
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  29  	 */
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  30  	unsigned int ocr_avail;
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  31  
d96be879 arch/arm/plat-mxc/include/mach/mmc.h Sascha Hauer 2009-01-06  32  	/* adjust slot voltage */

:::::: The code at line 24 was first introduced by commit
:::::: d96be879ff469759af6d7fcebdb66237c18da6f8 mmc: Add a MX2/MX3 specific SDHC driver

:::::: TO: Sascha Hauer <s.hauer@pengutronix.de>
:::::: CC: Pierre Ossman <drzeus@drzeus.cx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28268 bytes --]

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 11/21] mmc: core: First step in cleaning up public mmc header files
  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
  1 sibling, 0 replies; 56+ messages in thread
From: kbuild test robot @ 2016-12-30 15:11 UTC (permalink / raw)
  Cc: kbuild-all, linux-mmc, Ulf Hansson, Jaehoon Chung, Adrian Hunter,
	Linus Walleij

[-- Attachment #1: Type: text/plain, Size: 15430 bytes --]

Hi Ulf,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc1 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ulf-Hansson/mmc-core-A-start-to-slim-down-public-mmc-headers/20161230-205340
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/devices-imx31.h:9,
                    from arch/arm/mach-imx/mx31lilly-db.c:35:
   include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
>> arch/arm/mach-imx/mx31lilly-db.c:90:5: error: unknown type name 'irq_handler_t'
        irq_handler_t detect_irq, void *data)
        ^~~~~~~~~~~~~
   arch/arm/mach-imx/mx31lilly-db.c: In function 'mxc_mmc1_exit':
>> arch/arm/mach-imx/mx31lilly-db.c:136:2: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
     free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)), data);
     ^~~~~~~~
   arch/arm/mach-imx/mx31lilly-db.c: At top level:
>> arch/arm/mach-imx/mx31lilly-db.c:141:2: error: unknown field 'init' specified in initializer
     .init = mxc_mmc1_init,
     ^
>> arch/arm/mach-imx/mx31lilly-db.c:141:10: error: 'mxc_mmc1_init' undeclared here (not in a function)
     .init = mxc_mmc1_init,
             ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from arch/arm/mach-imx/devices/devices-common.h:216:0,
                    from arch/arm/mach-imx/devices-imx31.h:9,
                    from arch/arm/mach-imx/mx31lite-db.c:36:
   include/linux/platform_data/mmc-mxcmmc.h:24:34: error: unknown type name 'irq_handler_t'
     int (*init)(struct device *dev, irq_handler_t handler, void *data);
                                     ^~~~~~~~~~~~~
>> arch/arm/mach-imx/mx31lite-db.c:70:5: error: unknown type name 'irq_handler_t'
        irq_handler_t detect_irq, void *data)
        ^~~~~~~~~~~~~
   arch/arm/mach-imx/mx31lite-db.c: In function 'mxc_mmc1_exit':
>> arch/arm/mach-imx/mx31lite-db.c:122:2: error: implicit declaration of function 'free_irq' [-Werror=implicit-function-declaration]
     free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)), data);
     ^~~~~~~~
   arch/arm/mach-imx/mx31lite-db.c: At top level:
>> arch/arm/mach-imx/mx31lite-db.c:127:2: error: unknown field 'init' specified in initializer
     .init    = mxc_mmc1_init,
     ^
>> arch/arm/mach-imx/mx31lite-db.c:127:13: error: 'mxc_mmc1_init' undeclared here (not in a function)
     .init    = mxc_mmc1_init,
                ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/irq_handler_t +90 arch/arm/mach-imx/mx31lilly-db.c

1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   29  #include <asm/mach-types.h>
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   30  #include <asm/mach/arch.h>
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   31  #include <asm/mach/map.h>
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   32  
3ed0bcb4 arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2012-09-13   33  #include "board-mx31lilly.h"
e3372474 arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2012-09-13   34  #include "common.h"
16cf5c41 arch/arm/mach-mx3/mx31lilly-db.c Uwe Kleine-König   2010-06-23  @35  #include "devices-imx31.h"
50f2de61 arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2012-09-14   36  #include "hardware.h"
267dd34c arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2012-09-13   37  #include "iomux-mx3.h"
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   38  
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   39  /*
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   40   * This file contains board-specific initialization routines for the
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   41   * LILLY-1131 development board. If you design an own baseboard for the
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   42   * module, use this file as base for support code.
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   43   */
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   44  
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   45  static unsigned int lilly_db_board_pins[] __initdata = {
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   46  	MX31_PIN_SD1_DATA3__SD1_DATA3,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   47  	MX31_PIN_SD1_DATA2__SD1_DATA2,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   48  	MX31_PIN_SD1_DATA1__SD1_DATA1,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   49  	MX31_PIN_SD1_DATA0__SD1_DATA0,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   50  	MX31_PIN_SD1_CLK__SD1_CLK,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   51  	MX31_PIN_SD1_CMD__SD1_CMD,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   52  	MX31_PIN_LD0__LD0,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   53  	MX31_PIN_LD1__LD1,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   54  	MX31_PIN_LD2__LD2,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   55  	MX31_PIN_LD3__LD3,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   56  	MX31_PIN_LD4__LD4,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   57  	MX31_PIN_LD5__LD5,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   58  	MX31_PIN_LD6__LD6,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   59  	MX31_PIN_LD7__LD7,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   60  	MX31_PIN_LD8__LD8,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   61  	MX31_PIN_LD9__LD9,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   62  	MX31_PIN_LD10__LD10,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   63  	MX31_PIN_LD11__LD11,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   64  	MX31_PIN_LD12__LD12,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   65  	MX31_PIN_LD13__LD13,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   66  	MX31_PIN_LD14__LD14,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   67  	MX31_PIN_LD15__LD15,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   68  	MX31_PIN_LD16__LD16,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   69  	MX31_PIN_LD17__LD17,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   70  	MX31_PIN_VSYNC3__VSYNC3,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   71  	MX31_PIN_HSYNC__HSYNC,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   72  	MX31_PIN_FPSHIFT__FPSHIFT,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   73  	MX31_PIN_DRDY0__DRDY0,
b9923872 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   74  	MX31_PIN_CONTRAST__CONTRAST,
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   75  };
1bc34f79 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   76  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   77  /* MMC support */
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   78  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   79  static int mxc_mmc1_get_ro(struct device *dev)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   80  {
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   81  	return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0));
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   82  }
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   83  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   84  static int gpio_det, gpio_wp;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   85  
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   86  #define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   87  			PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   88  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   89  static int mxc_mmc1_init(struct device *dev,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  @90  			 irq_handler_t detect_irq, void *data)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   91  {
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   92  	int ret;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   93  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   94  	gpio_det = IOMUX_TO_GPIO(MX31_PIN_GPIO1_1);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   95  	gpio_wp = IOMUX_TO_GPIO(MX31_PIN_LCS0);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20   96  
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   97  	mxc_iomux_set_pad(MX31_PIN_SD1_DATA0, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   98  	mxc_iomux_set_pad(MX31_PIN_SD1_DATA1, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26   99  	mxc_iomux_set_pad(MX31_PIN_SD1_DATA2, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26  100  	mxc_iomux_set_pad(MX31_PIN_SD1_DATA3, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26  101  	mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26  102  	mxc_iomux_set_pad(MX31_PIN_SD1_CMD, MMC_PAD_CFG);
24fb8422 arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-10-26  103  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  104  	ret = gpio_request(gpio_det, "MMC detect");
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  105  	if (ret)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  106  		return ret;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  107  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  108  	ret = gpio_request(gpio_wp, "MMC w/p");
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  109  	if (ret)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  110  		goto exit_free_det;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  111  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  112  	gpio_direction_input(gpio_det);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  113  	gpio_direction_input(gpio_wp);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  114  
ed175343 arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2011-12-02  115  	ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)),
4c1dd3e5 arch/arm/mach-imx/mx31lilly-db.c Michael Opdenacker 2013-09-04  116  			  detect_irq, IRQF_TRIGGER_FALLING,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  117  			  "MMC detect", data);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  118  	if (ret)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  119  		goto exit_free_wp;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  120  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  121  	return 0;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  122  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  123  exit_free_wp:
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  124  	gpio_free(gpio_wp);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  125  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  126  exit_free_det:
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  127  	gpio_free(gpio_det);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  128  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  129  	return ret;
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  130  }
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  131  
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  132  static void mxc_mmc1_exit(struct device *dev, void *data)
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  133  {
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  134  	gpio_free(gpio_det);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  135  	gpio_free(gpio_wp);
ed175343 arch/arm/mach-imx/mx31lilly-db.c Shawn Guo          2011-12-02 @136  	free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)), data);
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  137  }
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  138  
6a697e3d arch/arm/mach-mx3/mx31lilly-db.c Uwe Kleine-König   2010-11-12  139  static const struct imxmmc_platform_data mmc_pdata __initconst = {
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  140  	.get_ro	= mxc_mmc1_get_ro,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20 @141  	.init	= mxc_mmc1_init,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  142  	.exit	= mxc_mmc1_exit,
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  143  };
d0b1eabc arch/arm/mach-mx3/mx31lilly-db.c Daniel Mack        2009-05-20  144  

:::::: The code at line 90 was first introduced by commit
:::::: d0b1eabc7b255daa978849229703b4d70a4c0555 ARM: MX3: add MMC suuport for lilly1131-db

:::::: TO: Daniel Mack <daniel@caiaq.de>
:::::: CC: Sascha Hauer <s.hauer@pengutronix.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60336 bytes --]

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 17/21] mmc: omap: Don't use mmc_card_present() when validating for inserted card
  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
  1 sibling, 0 replies; 56+ messages in thread
From: Tony Lindgren @ 2017-01-02 17:11 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Linus Walleij,
	linux-omap, Jarkko Nikula

* Ulf Hansson <ulf.hansson@linaro.org> [161230 04:49]:
> The mmc_card_present() function helps the mmc core to track an internal
> state of the card device. More importantly, it's not intended to be used by
> mmc host drivers to check for an inserted card. Therefore, let's stop using
> it and instead rely on checking for a valid pointer to a struct mmc_card,
> as it should be good enough.
> 
> Cc: linux-omap@vger.kernel.org
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  drivers/mmc/host/omap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
> index be3c49f..bd49f34 100644
> --- a/drivers/mmc/host/omap.c
> +++ b/drivers/mmc/host/omap.c
> @@ -893,7 +893,7 @@ static void mmc_omap_cover_handler(unsigned long param)
>  	 * If no card is inserted, we postpone polling until
>  	 * the cover has been closed.
>  	 */
> -	if (slot->mmc->card == NULL || !mmc_card_present(slot->mmc->card))
> +	if (slot->mmc->card == NULL)
>  		return;
>  
>  	mod_timer(&slot->cover_timer,

Makes sense to me:

Acked-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
  2016-12-30 12:47   ` Ulf Hansson
@ 2017-01-03  9:24     ` Simon Horman
  -1 siblings, 0 replies; 56+ messages in thread
From: Simon Horman @ 2017-01-03  9:24 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Linus Walleij, linux-sh,
	Yoshinori Sato, Rich Felker

On Fri, Dec 30, 2016 at 01:47:14PM +0100, Ulf Hansson wrote:
> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
> thing and has no relevance in a public mmc header. Currently it's used only
> by the sh romImage MMCIF boot, so let's instead define the enum in there
> and rename the types to MMCIF_* to show this.
> 
> Cc: linux-sh@vger.kernel.org
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

I assume there is also a patch to remove the enum from
include/linux/mmc/boot.h

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
@ 2017-01-03  9:24     ` Simon Horman
  0 siblings, 0 replies; 56+ messages in thread
From: Simon Horman @ 2017-01-03  9:24 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Linus Walleij, linux-sh,
	Yoshinori Sato, Rich Felker

On Fri, Dec 30, 2016 at 01:47:14PM +0100, Ulf Hansson wrote:
> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
> thing and has no relevance in a public mmc header. Currently it's used only
> by the sh romImage MMCIF boot, so let's instead define the enum in there
> and rename the types to MMCIF_* to show this.
> 
> Cc: linux-sh@vger.kernel.org
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

I assume there is also a patch to remove the enum from
include/linux/mmc/boot.h

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
  2016-12-30 12:47   ` Ulf Hansson
@ 2017-01-09 15:00     ` Linus Walleij
  -1 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, linux-sh, Simon Horman,
	Yoshinori Sato, Rich Felker

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
> thing and has no relevance in a public mmc header. Currently it's used only
> by the sh romImage MMCIF boot, so let's instead define the enum in there
> and rename the types to MMCIF_* to show this.
>
> Cc: linux-sh@vger.kernel.org
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

As Simon notices: this also needs to delete <linux/mmc/boot.h>.

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
@ 2017-01-09 15:00     ` Linus Walleij
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:00 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, linux-sh, Simon Horman,
	Yoshinori Sato, Rich Felker

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
> thing and has no relevance in a public mmc header. Currently it's used only
> by the sh romImage MMCIF boot, so let's instead define the enum in there
> and rename the types to MMCIF_* to show this.
>
> Cc: linux-sh@vger.kernel.org
> Cc: Simon Horman <horms@verge.net.au>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

As Simon notices: this also needs to delete <linux/mmc/boot.h>.

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 02/21] mmc: Removed the unused public mmc boot.h header
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:01 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Ah there it is. I would squash this into patch 1.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 03/21] mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:03 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Kuninori Morimoto

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/21] mmc: sh_mmcif: Remove unused ->get_cd() platform callback
  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
  0 siblings, 1 reply; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:04 UTC (permalink / raw)
  To: Ulf Hansson, Geert Uytterhoeven
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Kuninori Morimoto

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Removing the callback also enables us to remove the sh_mmcif_get_cd()
> altogether, as we convert to use mmc_gpio_get_cd() to the same kind of
> work.
>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Looks correct, would need a Tested-by ideally?
Geert can you have a quick look at the Renesas patches in this
series?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 05/21] mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:05 UTC (permalink / raw)
  To: Ulf Hansson, Geert Uytterhoeven
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Kuninori Morimoto

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> There are currently no users of the ccs_unsupported member from the
> platform data, so let's remove it.
>
> Note, as some of the sh_mmcif variants may not support ccs, let's keep the
> current code in the driver, which deals with this. For future support, we
> should invent a DT binding instead, but let's leave that until it's needed.
>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 06/21] mmc: sh_mmcif: Remove unused clk_ctrl2_present from the platform data
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:06 UTC (permalink / raw)
  To: Ulf Hansson, Geert Uytterhoeven
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Kuninori Morimoto

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> There are currently no users of the clk_ctrl2_present member from the
> platform data, so let's remove it.
>
> Note, as some of the sh_mmcif variants may support clk_ctrl2, let's keep
> the current code in the driver, which deals with this. For future support,
> we should invent a DT binding instead, but let's leave that until it's
> needed.
>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 07/21] mmc: dw_mmc: Remove the public dw_mmc header file
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:13 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> There are currently no external users of the public dw_mmc header file,
> except the dw_mmc driver itself. Therefore let's move the definitions from
> the public dw_mmc header file into the existing private dw_mmc header file
> and then remove the public one.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 08/21] mmc: sdhci-cadence: Include mmc.h
  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
  1 sibling, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:14 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Masahiro Yamada

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Don't rely on host.h to include the mmc.h header, but instead include it
> explicitly because the driver depends on it.
>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 09/21] mmc: sdhci: Include leds.h
  2016-12-30 12:47 ` [PATCH 09/21] mmc: sdhci: Include leds.h Ulf Hansson
  2016-12-30 13:35   ` Mateusz Nowak
@ 2017-01-09 15:15   ` Linus Walleij
  2017-01-10  8:32   ` Adrian Hunter
  2 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:15 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Don't rely on host.h to include the mmc.h header, but instead include it
> explicitly because the driver depends on it.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

As noted, the commit message is bogus.
Refer to <linux/leds.h>

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 10/21] mmc: host: Include interrupt.h in mmc host drivers that depends on it
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 15:18 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> An mmc host driver shouldn't rely on interrupt.h being included by another
> public mmc header. Instead make that dependency explicit by including
> interrupt.h in those host drivers that depends on it.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 04/21] mmc: sh_mmcif: Remove unused ->get_cd() platform callback
  2017-01-09 15:04   ` Linus Walleij
@ 2017-01-09 15:48     ` Geert Uytterhoeven
  0 siblings, 0 replies; 56+ messages in thread
From: Geert Uytterhoeven @ 2017-01-09 15:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ulf Hansson, Geert Uytterhoeven, linux-mmc, Jaehoon Chung,
	Adrian Hunter, Kuninori Morimoto, Wolfram Sang, Simon Horman

Hi Linus,

On Mon, Jan 9, 2017 at 4:04 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
>> Removing the callback also enables us to remove the sh_mmcif_get_cd()
>> altogether, as we convert to use mmc_gpio_get_cd() to the same kind of
>> work.
>>
>> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Looks correct, would need a Tested-by ideally?
> Geert can you have a quick look at the Renesas patches in this
> series?

I'm not really into MMC. Wolfram? Simon?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 13/21] mmc: core: Move public functions from core.h to private headers
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:19 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> A significant amount of functions are available through the public mmc
> core.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 header files.
>
> This change concentrates on moving the functions into private mmc headers,
> following changes may continue with additional clean-ups, as an example
> some functions can be turned into static.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Nice, encapsulate!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 14/21] mmc: core: Move some host specific public functions to host.h
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:21 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Ideally the public mmc header file, core.h, shouldn't contain interfaces
> particularly intended to be used by host drivers. Instead those should
> remain in the host.h header file. Therefore, let's move a couple functions
> from core.h to host.h.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/21] mmc: core: Move erase/trim/discard defines from public core.h to mmc.h
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:22 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> As the public mmc.h header already contains similar defines for other mmc
> commands and arguments, let's move those for erase/trim/discard into here
> as well.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 16/21] mmc: core: Remove unused struct _mmc_csd from public mmc.h header
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:23 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

No wonder things are confusing with cruft like this littering around.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 17/21] mmc: omap: Don't use mmc_card_present() when validating for inserted card
  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
  1 sibling, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:24 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Linux-OMAP,
	Tony Lindgren, Jarkko Nikula

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> The mmc_card_present() function helps the mmc core to track an internal
> state of the card device. More importantly, it's not intended to be used by
> mmc host drivers to check for an inserted card. Therefore, let's stop using
> it and instead rely on checking for a valid pointer to a struct mmc_card,
> as it should be good enough.
>
> Cc: linux-omap@vger.kernel.org
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 18/21] mmc: vub300: Don't use mmc_card_present() when validating for inserted card
  2016-12-30 12:47 ` [PATCH 18/21] mmc: vub300: " Ulf Hansson
@ 2017-01-09 18:24   ` Linus Walleij
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:24 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> The mmc_card_present() function helps the mmc core to track an internal
> state of the card device. More importantly, it's not intended to be used by
> mmc host drivers to check for an inserted card. Therefore, let's stop using
> it and instead rely on checking for a valid pointer to a struct mmc_card,
> as it should be good enough.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 19/21] mmc: core: Move public functions from card.h to private headers
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:26 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> A significant amount of functions and other definitions are available
> through the public mmc card.h header file. Let's slim down this public mmc
> interface, as to prevent users from abusing it, by moving some of the
> functions/definitions to private mmc header files.
>
> 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>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 20/21] mmc: core: Move public functions from host.h to private headers
  2016-12-30 12:47 ` [PATCH 20/21] mmc: core: Move public functions from host.h " Ulf Hansson
@ 2017-01-09 18:26   ` Linus Walleij
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:26 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> 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>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 21/21] mmc: core: Don't use extern declarations of public mmc functions
  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
  0 siblings, 0 replies; 56+ messages in thread
From: Linus Walleij @ 2017-01-09 18:27 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter

On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Using extern when declaring functions in the public header, core.h, is
> redundant. Let's just remove the use of it.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

I only specify extern explicitly when declaring variables (like globals).
Good riddance.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 09/21] mmc: sdhci: Include leds.h
  2016-12-30 12:47 ` [PATCH 09/21] mmc: sdhci: Include leds.h Ulf Hansson
  2016-12-30 13:35   ` Mateusz Nowak
  2017-01-09 15:15   ` Linus Walleij
@ 2017-01-10  8:32   ` Adrian Hunter
  2 siblings, 0 replies; 56+ messages in thread
From: Adrian Hunter @ 2017-01-10  8:32 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Jaehoon Chung, Linus Walleij

On 30/12/16 14:47, Ulf Hansson wrote:
> Don't rely on host.h to include the mmc.h header, but instead include it
> explicitly because the driver depends on it.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Apart from commit message:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0b66f21..a10a7b6 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -17,6 +17,7 @@
>  #include <linux/compiler.h>
>  #include <linux/types.h>
>  #include <linux/io.h>
> +#include <linux/leds.h>
>  
>  #include <linux/mmc/host.h>
>  
> 


^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 08/21] mmc: sdhci-cadence: Include mmc.h
  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
  1 sibling, 0 replies; 56+ messages in thread
From: Adrian Hunter @ 2017-01-10  8:35 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc; +Cc: Jaehoon Chung, Linus Walleij, Masahiro Yamada

On 30/12/16 14:47, Ulf Hansson wrote:
> Don't rely on host.h to include the mmc.h header, but instead include it
> explicitly because the driver depends on it.
> 
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-cadence.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index 4b0ecb9..31e786d 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -17,6 +17,7 @@
>  #include <linux/iopoll.h>
>  #include <linux/module.h>
>  #include <linux/mmc/host.h>
> +#include <linux/mmc/mmc.h>
>  
>  #include "sdhci-pltfm.h"
>  
> 


^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
  2017-01-09 15:00     ` Linus Walleij
@ 2017-01-10 15:28       ` Ulf Hansson
  -1 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-10 15:28 UTC (permalink / raw)
  To: Linus Walleij, Simon Horman
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, linux-sh,
	Yoshinori Sato, Rich Felker

On 9 January 2017 at 16:00, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
>> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
>> thing and has no relevance in a public mmc header. Currently it's used only
>> by the sh romImage MMCIF boot, so let's instead define the enum in there
>> and rename the types to MMCIF_* to show this.
>>
>> Cc: linux-sh@vger.kernel.org
>> Cc: Simon Horman <horms@verge.net.au>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Rich Felker <dalias@libc.org>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> As Simon notices: this also needs to delete <linux/mmc/boot.h>.

Yes, it's done as change on top of this one.

https://patchwork.kernel.org/patch/9492077/

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/21] sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
@ 2017-01-10 15:28       ` Ulf Hansson
  0 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-10 15:28 UTC (permalink / raw)
  To: Linus Walleij, Simon Horman
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, linux-sh,
	Yoshinori Sato, Rich Felker

On 9 January 2017 at 16:00, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Fri, Dec 30, 2016 at 1:47 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
>> The enum that specifies the MMC_PROGRESS* types, is a sh mmcif specific
>> thing and has no relevance in a public mmc header. Currently it's used only
>> by the sh romImage MMCIF boot, so let's instead define the enum in there
>> and rename the types to MMCIF_* to show this.
>>
>> Cc: linux-sh@vger.kernel.org
>> Cc: Simon Horman <horms@verge.net.au>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Rich Felker <dalias@libc.org>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> As Simon notices: this also needs to delete <linux/mmc/boot.h>.

Yes, it's done as change on top of this one.

https://patchwork.kernel.org/patch/9492077/

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 09/21] mmc: sdhci: Include leds.h
  2016-12-30 13:35   ` Mateusz Nowak
@ 2017-01-10 15:32     ` Ulf Hansson
  0 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-10 15:32 UTC (permalink / raw)
  To: Mateusz Nowak; +Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Linus Walleij

On 30 December 2016 at 14:35, Mateusz Nowak
<mateusz.nowak@linux.intel.com> wrote:
> Hi Ulf,
>
> On 12/30/2016 13:47, Ulf Hansson wrote:
>>
>> Don't rely on host.h to include the mmc.h header, but instead include it
>> explicitly because the driver depends on it.
>
> You refer in description to header file (mmc.h) not related to this patch.

Ahh, copy/paste error. Thanks, for reviewing!

Kind regards
Uffe

>
>>
>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>> ---
>>  drivers/mmc/host/sdhci.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
>> index 0b66f21..a10a7b6 100644
>> --- a/drivers/mmc/host/sdhci.h
>> +++ b/drivers/mmc/host/sdhci.h
>> @@ -17,6 +17,7 @@
>>  #include <linux/compiler.h>
>>  #include <linux/types.h>
>>  #include <linux/io.h>
>> +#include <linux/leds.h>
>>
>>  #include <linux/mmc/host.h>
>>
>>
>
> Regards,
> Mateusz.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 00/21] mmc: core: A start to slim down public mmc headers
  2016-12-30 12:47 [PATCH 00/21] mmc: core: A start to slim down public mmc headers Ulf Hansson
                   ` (20 preceding siblings ...)
  2016-12-30 12:47 ` [PATCH 21/21] mmc: core: Don't use extern declarations of public mmc functions Ulf Hansson
@ 2017-01-10 15:37 ` Ulf Hansson
  21 siblings, 0 replies; 56+ messages in thread
From: Ulf Hansson @ 2017-01-10 15:37 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson; +Cc: Jaehoon Chung, Adrian Hunter, Linus Walleij

On 30 December 2016 at 13:47, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Ideally we should not expose functions nor structures as being public available
> as the interface for mmc - unless they really are intended to be used like that.
>
> Unfortunate this is not the case today and which has lead to the mmc interface
> in some cases being abused. That of course has its own problems, but we can
> still move things in the right direction, which is what this series intend to
> do. More precisely, it moves things that can be easily moved from the public mmc
> headers to the private mmc headers.
>
> This should be considered as a first step of improving the situation, further
> additional changes will have to continue this path.
>
>
> Ulf Hansson (21):
>   sh: sh7724: Don't use a public mmc header for MMC_PROGRESS*
>   mmc: Removed the unused public mmc boot.h header
>   mmc: sh_mmcif: Remove unused use_cd_gpio/cd_gpio from platform data
>   mmc: sh_mmcif: Remove unused ->get_cd() platform callback
>   mmc: sh_mmcif: Remove unused ccs_unsupported from the platform data
>   mmc: sh_mmcif: Remove unused clk_ctrl2_present from the platform data
>   mmc: dw_mmc: Remove the public dw_mmc header file
>   mmc: sdhci-cadence: Include mmc.h
>   mmc: sdhci: Include leds.h
>   mmc: host: Include interrupt.h in mmc host drivers that depends on it
>   mmc: core: First step in cleaning up public mmc header files
>   mmc: core: First step in cleaning up private mmc header files
>   mmc: core: Move public functions from core.h to private headers
>   mmc: core: Move some host specific public functions to host.h
>   mmc: core: Move erase/trim/discard defines from public core.h to mmc.h
>   mmc: core: Remove unused struct _mmc_csd from public mmc.h header
>   mmc: omap: Don't use mmc_card_present() when validating for inserted
>     card
>   mmc: vub300: Don't use mmc_card_present() when validating for inserted
>     card
>   mmc: core: Move public functions from card.h to private headers
>   mmc: core: Move public functions from host.h to private headers
>   mmc: core: Don't use extern declarations of public mmc functions
>
>  MAINTAINERS                          |   1 -
>  arch/sh/boot/romimage/mmcif-sh7724.c |  16 +-
>  drivers/mmc/core/block.c             |   6 +
>  drivers/mmc/core/block.h             |   8 +
>  drivers/mmc/core/bus.c               |   2 +
>  drivers/mmc/core/bus.h               |  16 +-
>  drivers/mmc/core/card.h              | 223 ++++++++++++++++++++++++++++
>  drivers/mmc/core/core.c              |   1 +
>  drivers/mmc/core/core.h              |  41 +++++-
>  drivers/mmc/core/debugfs.c           |   2 +
>  drivers/mmc/core/host.h              |  48 ++++++
>  drivers/mmc/core/mmc.c               |  13 ++
>  drivers/mmc/core/mmc_ops.h           |  14 ++
>  drivers/mmc/core/mmc_test.c          |   5 +
>  drivers/mmc/core/pwrseq.h            |   6 +-
>  drivers/mmc/core/queue.c             |   2 +
>  drivers/mmc/core/queue.h             |   6 +-
>  drivers/mmc/core/quirks.c            |   2 +
>  drivers/mmc/core/sd.c                |   2 +
>  drivers/mmc/core/sd.h                |   5 +-
>  drivers/mmc/core/sd_ops.h            |   9 ++
>  drivers/mmc/core/sdio.c              |   2 +
>  drivers/mmc/core/sdio_bus.c          |   1 +
>  drivers/mmc/core/sdio_bus.h          |   3 +
>  drivers/mmc/core/sdio_cis.h          |   3 +
>  drivers/mmc/core/sdio_io.c           |   2 +
>  drivers/mmc/core/sdio_irq.c          |   2 +
>  drivers/mmc/core/sdio_ops.h          |   5 +
>  drivers/mmc/core/slot-gpio.h         |   2 +
>  drivers/mmc/host/davinci_mmc.c       |   1 +
>  drivers/mmc/host/dw_mmc-exynos.c     |   1 -
>  drivers/mmc/host/dw_mmc-k3.c         |   1 -
>  drivers/mmc/host/dw_mmc-pci.c        |   1 -
>  drivers/mmc/host/dw_mmc-pltfm.c      |   1 -
>  drivers/mmc/host/dw_mmc-rockchip.c   |   1 -
>  drivers/mmc/host/dw_mmc.c            |   1 -
>  drivers/mmc/host/dw_mmc.h            | 258 +++++++++++++++++++++++++++++++++
>  drivers/mmc/host/meson-gx-mmc.c      |   1 +
>  drivers/mmc/host/mtk-sd.c            |   1 +
>  drivers/mmc/host/omap.c              |   2 +-
>  drivers/mmc/host/sdhci-cadence.c     |   1 +
>  drivers/mmc/host/sdhci.h             |   2 +
>  drivers/mmc/host/sh_mmcif.c          |  28 +---
>  drivers/mmc/host/tmio_mmc.h          |   1 +
>  drivers/mmc/host/via-sdmmc.c         |   1 +
>  drivers/mmc/host/vub300.c            |   6 +-
>  drivers/mmc/host/wmt-sdmmc.c         |   1 +
>  include/linux/mmc/boot.h             |   7 -
>  include/linux/mmc/card.h             | 242 -------------------------------
>  include/linux/mmc/core.h             |  86 ++---------
>  include/linux/mmc/dw_mmc.h           | 274 -----------------------------------
>  include/linux/mmc/host.h             |  63 ++------
>  include/linux/mmc/mmc.h              |  59 ++------
>  include/linux/mmc/sh_mmcif.h         |   5 -
>  include/linux/mmc/slot-gpio.h        |   3 +
>  55 files changed, 747 insertions(+), 749 deletions(-)
>  create mode 100644 drivers/mmc/core/card.h
>  delete mode 100644 include/linux/mmc/boot.h
>  delete mode 100644 include/linux/mmc/dw_mmc.h
>
> --
> 1.9.1
>

Patch 1->10 applied for next. Thanks all reviewers!

I will fix the build issues reported for patch 11 and re-spin the series asap.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2017-01-10 15:38 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 20/21] mmc: core: Move public functions from host.h " Ulf Hansson
2017-01-09 18:26   ` 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

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.