[Ubuntu PATCH] Build mmc_block into mmc_core directly

From: Randy Dunlap
Date: Mon Jul 03 2006 - 16:43:23 EST



Build mmc_block into mmc_core directly.

Bug Reference:
https://launchpad.net/distros/ubuntu/+source/linux-source-2.6.15/+bug/30335

Patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=b0bf1e46d11576130fdc68d6ede8a986ce4334a1

---
drivers/mmc/Kconfig | 10 ----------
drivers/mmc/Makefile | 8 +-------
drivers/mmc/mmc_block.c | 10 ++--------
drivers/mmc/mmc_sysfs.c | 26 +++++++++++++++++++++-----
4 files changed, 24 insertions(+), 30 deletions(-)

--- linux-2617-g21.orig/drivers/mmc/Kconfig
+++ linux-2617-g21/drivers/mmc/Kconfig
@@ -19,16 +19,6 @@ config MMC_DEBUG
This is an option for use by developers; most people should
say N here. This enables MMC core and driver debugging.

-config MMC_BLOCK
- tristate "MMC block device driver"
- depends on MMC
- default y
- help
- Say Y here to enable the MMC block device driver support.
- This provides a block device driver, which you can use to
- mount the filesystem. Almost everyone wishing MMC support
- should say Y or M here.
-
config MMC_ARMMMCI
tristate "ARM AMBA Multimedia Card Interface support"
depends on ARM_AMBA && MMC
--- linux-2617-g21.orig/drivers/mmc/Makefile
+++ linux-2617-g21/drivers/mmc/Makefile
@@ -7,12 +7,6 @@
#
obj-$(CONFIG_MMC) += mmc_core.o

-#
-# Media drivers
-#
-obj-$(CONFIG_MMC_BLOCK) += mmc_block.o
-
-#
# Host drivers
#
obj-$(CONFIG_MMC_ARMMMCI) += mmci.o
@@ -24,7 +18,7 @@ obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
obj-$(CONFIG_MMC_OMAP) += omap.o
obj-$(CONFIG_MMC_AT91RM9200) += at91_mci.o

-mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o
+mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o mmc_block.o

ifeq ($(CONFIG_MMC_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG
--- linux-2617-g21.orig/drivers/mmc/mmc_block.c
+++ linux-2617-g21/drivers/mmc/mmc_block.c
@@ -540,7 +540,7 @@ static struct mmc_driver mmc_driver = {
.resume = mmc_blk_resume,
};

-static int __init mmc_blk_init(void)
+int __init mmc_blk_init(void)
{
int res = -ENOMEM;

@@ -559,17 +559,11 @@ static int __init mmc_blk_init(void)
return res;
}

-static void __exit mmc_blk_exit(void)
+void __exit mmc_blk_exit(void)
{
mmc_unregister_driver(&mmc_driver);
unregister_blkdev(major, "mmc");
}

-module_init(mmc_blk_init);
-module_exit(mmc_blk_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
-
module_param(major, int, 0444);
MODULE_PARM_DESC(major, "specify the major device number for MMC block driver");
--- linux-2617-g21.orig/drivers/mmc/mmc_sysfs.c
+++ linux-2617-g21/drivers/mmc/mmc_sysfs.c
@@ -317,20 +317,36 @@ void mmc_free_host_sysfs(struct mmc_host
class_device_put(&host->class_dev);
}

+extern int mmc_blk_init(void);
+extern void mmc_blk_exit(void);

static int __init mmc_init(void)
{
int ret = bus_register(&mmc_bus_type);
- if (ret == 0) {
- ret = class_register(&mmc_host_class);
- if (ret)
- bus_unregister(&mmc_bus_type);
- }
+
+ if (ret != 0)
+ return ret;
+
+ ret = class_register(&mmc_host_class);
+ if (ret)
+ goto class_fail;
+
+ ret = mmc_blk_init();
+ if (ret)
+ goto blk_fail;
+
+ return 0;
+
+blk_fail:
+ class_unregister(&mmc_host_class);
+class_fail:
+ bus_unregister(&mmc_bus_type);
return ret;
}

static void __exit mmc_exit(void)
{
+ mmc_blk_exit();
class_unregister(&mmc_host_class);
bus_unregister(&mmc_bus_type);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/