boundarydevices / linux

Kernel tree for Ezurio (ex-Boundary Devices) platforms
https://www.ezurio.com/
194 stars 290 forks source link

Set MMC device index via devicetree alias #44

Open tbetker-rs opened 6 years ago

tbetker-rs commented 6 years ago

About commit 6e9e049fac59, "mmc: Allow setting slot index via devicetree alias" (branch boundary-imx_4.9.x_1.0.0_ga):

I have set up aliases mmc0 = &usdhc3 (eMMC) and mmc1 = &usdhc1 (microSD) in my device tree, but mmc_blk_alloc_req() assigns devidx=1 to mmcblk0boot0 instead of reserving it for mmcblk1 ... The following fix works for me:

diff -Naur linux-4.9.74-orig/drivers/mmc/card/block.c linux-4.9.74/drivers/mmc/card/block.c
--- linux-4.9.74-orig/drivers/mmc/card/block.c  2018-03-21 19:05:25.412964135 +0000
+++ linux-4.9.74/drivers/mmc/card/block.c       2018-03-26 09:55:50.644060529 +0000
@@ -2246,7 +2246,7 @@
                return ERR_PTR(-ENOMEM);

        spin_lock(&mmc_blk_lock);
-       devidx = mmc_get_reserved_index(card->host);
+       devidx = (subname)? -ENODEV: mmc_get_reserved_index(card->host);
        if (devidx >= 0)
                devidx = ida_simple_get(&mmc_blk_ida, devidx, devidx,
                                        GFP_NOWAIT);

Best regards, Thomas Betker