aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/core/core.c1
-rw-r--r--drivers/mmc/core/core.h1
-rw-r--r--drivers/mmc/core/mmc.c2
-rw-r--r--drivers/mmc/core/sd.c2
-rw-r--r--include/linux/mmc/host.h8
5 files changed, 11 insertions, 3 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 09eee6df0653..ab4446c428be 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -58,6 +58,7 @@ int mmc_assume_removable;
58#else 58#else
59int mmc_assume_removable = 1; 59int mmc_assume_removable = 1;
60#endif 60#endif
61EXPORT_SYMBOL(mmc_assume_removable);
61module_param_named(removable, mmc_assume_removable, bool, 0644); 62module_param_named(removable, mmc_assume_removable, bool, 0644);
62MODULE_PARM_DESC( 63MODULE_PARM_DESC(
63 removable, 64 removable,
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 9d9eef50e5d1..a2ca770ca89b 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -58,7 +58,6 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr);
58 58
59/* Module parameters */ 59/* Module parameters */
60extern int use_spi_crc; 60extern int use_spi_crc;
61extern int mmc_assume_removable;
62 61
63/* Debugfs information for hosts and cards */ 62/* Debugfs information for hosts and cards */
64void mmc_add_host_debugfs(struct mmc_host *host); 63void mmc_add_host_debugfs(struct mmc_host *host);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6909a54c39be..6570c03f9c76 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -685,7 +685,7 @@ static void mmc_attach_bus_ops(struct mmc_host *host)
685{ 685{
686 const struct mmc_bus_ops *bus_ops; 686 const struct mmc_bus_ops *bus_ops;
687 687
688 if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable) 688 if (!mmc_card_is_removable(host))
689 bus_ops = &mmc_ops_unsafe; 689 bus_ops = &mmc_ops_unsafe;
690 else 690 else
691 bus_ops = &mmc_ops; 691 bus_ops = &mmc_ops;
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0f5241085557..bc745e1237bf 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -750,7 +750,7 @@ static void mmc_sd_attach_bus_ops(struct mmc_host *host)
750{ 750{
751 const struct mmc_bus_ops *bus_ops; 751 const struct mmc_bus_ops *bus_ops;
752 752
753 if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable) 753 if (!mmc_card_is_removable(host))
754 bus_ops = &mmc_sd_ops_unsafe; 754 bus_ops = &mmc_sd_ops_unsafe;
755 else 755 else
756 bus_ops = &mmc_sd_ops; 756 bus_ops = &mmc_sd_ops;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index ded401703762..2e0fe623df90 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -267,5 +267,13 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
267 host->disable_delay = disable_delay; 267 host->disable_delay = disable_delay;
268} 268}
269 269
270/* Module parameter */
271extern int mmc_assume_removable;
272
273static inline int mmc_card_is_removable(struct mmc_host *host)
274{
275 return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
276}
277
270#endif 278#endif
271 279