@@ -2546,7 +2546,6 @@ static struct device_driver mmc_driver = {
.pm = &mmc_blk_pm_ops,
.probe = mmc_blk_probe,
.remove = mmc_blk_remove,
- .shutdown = mmc_blk_shutdown,
};
static int __init mmc_blk_init(void)
@@ -2566,6 +2565,15 @@ static int __init mmc_blk_init(void)
if (res)
goto out2;
+ /*
+ * device_shutdown() calls bus_ops ->shutdown() if it's present
+ * and falls back to device_driver ->shutdown() if it's not. This
+ * motivates existence of a sanity check in driver_register() against
+ * both ops being set at the same time. Work around this check
+ * with deferred setting of device_driver ->shutdown().
+ */
+ mmc_driver.shutdown = mmc_blk_shutdown;
+
return 0;
out2:
unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");