Hack: mmc: explicitly invoking mmc_test probe from bus drv
Sachin Nikam [Fri, 2 Mar 2012 13:24:07 +0000 (18:24 +0530)]
Bug 930113

Change-Id: I15fede503217152263905d8f7f56d3392e460e8a
Signed-off-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-on: http://git-master/r/87241
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
Tested-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/mmc/core/bus.c

index e07d6c9..f4bdbe6 100644 (file)
 
 #define to_mmc_driver(d)       container_of(d, struct mmc_driver, drv)
 
+#ifdef CONFIG_MMC_TEST
+static struct mmc_driver *mmc_test_drv;
+#endif
+
 static ssize_t mmc_type_show(struct device *dev,
        struct device_attribute *attr, char *buf)
 {
@@ -107,6 +111,13 @@ static int mmc_bus_probe(struct device *dev)
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = mmc_dev_to_card(dev);
 
+#ifdef CONFIG_MMC_TEST
+       /*
+        * Hack: Explicitly invoking mmc_test probe to co-exist with mmcblk driver.
+        */
+       mmc_test_drv->probe(card);
+#endif
+
        return drv->probe(card);
 }
 
@@ -196,6 +207,10 @@ void mmc_unregister_bus(void)
 int mmc_register_driver(struct mmc_driver *drv)
 {
        drv->drv.bus = &mmc_bus_type;
+#ifdef CONFIG_MMC_TEST
+       if (!strcmp(drv->drv.name, "mmc_test"))
+               mmc_test_drv = drv;
+#endif
        return driver_register(&drv->drv);
 }