Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mmc-v4.5-rc2' of git://git.linaro.org/people/ulf.hansson/mmc

Pull MMC fixes from Ulf Hansson:
"Here are some mmc fixes intended for v4.5 rc4.

MMC core:
- Fix an sysfs ABI regression
- Return an error in a specific error path dealing with mmc ioctls

MMC host:
- sdhci-pci|acpi: Fix card detect race for Intel BXT/APL
- sh_mmcif: Correct TX DMA channel allocation
- mmc_spi: Fix error handling for dma mapping errors
- sdhci-of-at91: Fix an unbalance issue for the runtime PM usage count
- pxamci: Fix the device-tree probe deferral path
- pxamci: Fix read-only GPIO polarity"

* tag 'mmc-v4.5-rc2' of git://git.linaro.org/people/ulf.hansson/mmc:
Revert "mmc: block: don't use parameter prefix if built as module"
mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
mmc: sdhci: Allow override of get_cd() called from sdhci_request()
mmc: sdhci: Allow override of mmc host operations
mmc: sh_mmcif: Correct TX DMA channel allocation
mmc: block: return error on failed mmc_blk_get()
mmc: pxamci: fix the device-tree probe deferral path
mmc: mmc_spi: add checks for dma mapping error
mmc: sdhci-of-at91: fix pm runtime unbalanced issue in error path
mmc: pxamci: fix again read-only gpio detection polarity

+93 -36
+3 -4
drivers/mmc/card/block.c
··· 47 47 #include "queue.h" 48 48 49 49 MODULE_ALIAS("mmc:block"); 50 - 51 - #ifdef KERNEL 52 50 #ifdef MODULE_PARAM_PREFIX 53 51 #undef MODULE_PARAM_PREFIX 54 52 #endif 55 53 #define MODULE_PARAM_PREFIX "mmcblk." 56 - #endif 57 54 58 55 #define INAND_CMD38_ARG_EXT_CSD 113 59 56 #define INAND_CMD38_ARG_ERASE 0x00 ··· 652 655 } 653 656 654 657 md = mmc_blk_get(bdev->bd_disk); 655 - if (!md) 658 + if (!md) { 659 + err = -EINVAL; 656 660 goto cmd_err; 661 + } 657 662 658 663 card = md->queue.card; 659 664 if (IS_ERR(card)) {
+13 -2
drivers/mmc/host/mmc_spi.c
··· 925 925 926 926 dma_addr = dma_map_page(dma_dev, sg_page(sg), 0, 927 927 PAGE_SIZE, dir); 928 + if (dma_mapping_error(dma_dev, dma_addr)) { 929 + data->error = -EFAULT; 930 + break; 931 + } 928 932 if (direction == DMA_TO_DEVICE) 929 933 t->tx_dma = dma_addr + sg->offset; 930 934 else ··· 1397 1393 host->dma_dev = dev; 1398 1394 host->ones_dma = dma_map_single(dev, ones, 1399 1395 MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); 1396 + if (dma_mapping_error(dev, host->ones_dma)) 1397 + goto fail_ones_dma; 1400 1398 host->data_dma = dma_map_single(dev, host->data, 1401 1399 sizeof(*host->data), DMA_BIDIRECTIONAL); 1402 - 1403 - /* REVISIT in theory those map operations can fail... */ 1400 + if (dma_mapping_error(dev, host->data_dma)) 1401 + goto fail_data_dma; 1404 1402 1405 1403 dma_sync_single_for_cpu(host->dma_dev, 1406 1404 host->data_dma, sizeof(*host->data), ··· 1468 1462 if (host->dma_dev) 1469 1463 dma_unmap_single(host->dma_dev, host->data_dma, 1470 1464 sizeof(*host->data), DMA_BIDIRECTIONAL); 1465 + fail_data_dma: 1466 + if (host->dma_dev) 1467 + dma_unmap_single(host->dma_dev, host->ones_dma, 1468 + MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); 1469 + fail_ones_dma: 1471 1470 kfree(host->data); 1472 1471 1473 1472 fail_nobuf1:
+10 -27
drivers/mmc/host/pxamci.c
··· 86 86 static inline void pxamci_init_ocr(struct pxamci_host *host) 87 87 { 88 88 #ifdef CONFIG_REGULATOR 89 - host->vcc = regulator_get_optional(mmc_dev(host->mmc), "vmmc"); 89 + host->vcc = devm_regulator_get_optional(mmc_dev(host->mmc), "vmmc"); 90 90 91 91 if (IS_ERR(host->vcc)) 92 92 host->vcc = NULL; ··· 654 654 655 655 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 656 656 irq = platform_get_irq(pdev, 0); 657 - if (!r || irq < 0) 658 - return -ENXIO; 659 - 660 - r = request_mem_region(r->start, SZ_4K, DRIVER_NAME); 661 - if (!r) 662 - return -EBUSY; 657 + if (irq < 0) 658 + return irq; 663 659 664 660 mmc = mmc_alloc_host(sizeof(struct pxamci_host), &pdev->dev); 665 661 if (!mmc) { ··· 691 695 host->pdata = pdev->dev.platform_data; 692 696 host->clkrt = CLKRT_OFF; 693 697 694 - host->clk = clk_get(&pdev->dev, NULL); 698 + host->clk = devm_clk_get(&pdev->dev, NULL); 695 699 if (IS_ERR(host->clk)) { 696 700 ret = PTR_ERR(host->clk); 697 701 host->clk = NULL; ··· 723 727 host->irq = irq; 724 728 host->imask = MMC_I_MASK_ALL; 725 729 726 - host->base = ioremap(r->start, SZ_4K); 727 - if (!host->base) { 728 - ret = -ENOMEM; 730 + host->base = devm_ioremap_resource(&pdev->dev, r); 731 + if (IS_ERR(host->base)) { 732 + ret = PTR_ERR(host->base); 729 733 goto out; 730 734 } 731 735 ··· 738 742 writel(64, host->base + MMC_RESTO); 739 743 writel(host->imask, host->base + MMC_I_MASK); 740 744 741 - ret = request_irq(host->irq, pxamci_irq, 0, DRIVER_NAME, host); 745 + ret = devm_request_irq(&pdev->dev, host->irq, pxamci_irq, 0, 746 + DRIVER_NAME, host); 742 747 if (ret) 743 748 goto out; 744 749 ··· 801 804 dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); 802 805 goto out; 803 806 } else { 804 - mmc->caps |= host->pdata->gpio_card_ro_invert ? 807 + mmc->caps2 |= host->pdata->gpio_card_ro_invert ? 805 808 0 : MMC_CAP2_RO_ACTIVE_HIGH; 806 809 } 807 810 ··· 830 833 dma_release_channel(host->dma_chan_rx); 831 834 if (host->dma_chan_tx) 832 835 dma_release_channel(host->dma_chan_tx); 833 - if (host->base) 834 - iounmap(host->base); 835 - if (host->clk) 836 - clk_put(host->clk); 837 836 } 838 837 if (mmc) 839 838 mmc_free_host(mmc); 840 - release_resource(r); 841 839 return ret; 842 840 } 843 841 ··· 851 859 gpio_ro = host->pdata->gpio_card_ro; 852 860 gpio_power = host->pdata->gpio_power; 853 861 } 854 - if (host->vcc) 855 - regulator_put(host->vcc); 856 - 857 862 if (host->pdata && host->pdata->exit) 858 863 host->pdata->exit(&pdev->dev, mmc); 859 864 ··· 859 870 END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, 860 871 host->base + MMC_I_MASK); 861 872 862 - free_irq(host->irq, host); 863 873 dmaengine_terminate_all(host->dma_chan_rx); 864 874 dmaengine_terminate_all(host->dma_chan_tx); 865 875 dma_release_channel(host->dma_chan_rx); 866 876 dma_release_channel(host->dma_chan_tx); 867 - iounmap(host->base); 868 - 869 - clk_put(host->clk); 870 - 871 - release_resource(host->res); 872 877 873 878 mmc_free_host(mmc); 874 879 }
+30
drivers/mmc/host/sdhci-acpi.c
··· 146 146 .ops = &sdhci_acpi_ops_int, 147 147 }; 148 148 149 + static int bxt_get_cd(struct mmc_host *mmc) 150 + { 151 + int gpio_cd = mmc_gpio_get_cd(mmc); 152 + struct sdhci_host *host = mmc_priv(mmc); 153 + unsigned long flags; 154 + int ret = 0; 155 + 156 + if (!gpio_cd) 157 + return 0; 158 + 159 + pm_runtime_get_sync(mmc->parent); 160 + 161 + spin_lock_irqsave(&host->lock, flags); 162 + 163 + if (host->flags & SDHCI_DEVICE_DEAD) 164 + goto out; 165 + 166 + ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); 167 + out: 168 + spin_unlock_irqrestore(&host->lock, flags); 169 + 170 + pm_runtime_mark_last_busy(mmc->parent); 171 + pm_runtime_put_autosuspend(mmc->parent); 172 + 173 + return ret; 174 + } 175 + 149 176 static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev, 150 177 const char *hid, const char *uid) 151 178 { ··· 222 195 host = c->host; 223 196 224 197 /* Platform specific code during sd probe slot goes here */ 198 + 199 + if (hid && !strcmp(hid, "80865ACA")) 200 + host->mmc_host_ops.get_cd = bxt_get_cd; 225 201 226 202 return 0; 227 203 }
+1
drivers/mmc/host/sdhci-of-at91.c
··· 217 217 pm_runtime_disable: 218 218 pm_runtime_disable(&pdev->dev); 219 219 pm_runtime_set_suspended(&pdev->dev); 220 + pm_runtime_put_noidle(&pdev->dev); 220 221 clocks_disable_unprepare: 221 222 clk_disable_unprepare(priv->gck); 222 223 clk_disable_unprepare(priv->mainck);
+31
drivers/mmc/host/sdhci-pci-core.c
··· 330 330 sdhci_pci_spt_drive_strength = 0x10 | ((val >> 12) & 0xf); 331 331 } 332 332 333 + static int bxt_get_cd(struct mmc_host *mmc) 334 + { 335 + int gpio_cd = mmc_gpio_get_cd(mmc); 336 + struct sdhci_host *host = mmc_priv(mmc); 337 + unsigned long flags; 338 + int ret = 0; 339 + 340 + if (!gpio_cd) 341 + return 0; 342 + 343 + pm_runtime_get_sync(mmc->parent); 344 + 345 + spin_lock_irqsave(&host->lock, flags); 346 + 347 + if (host->flags & SDHCI_DEVICE_DEAD) 348 + goto out; 349 + 350 + ret = !!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); 351 + out: 352 + spin_unlock_irqrestore(&host->lock, flags); 353 + 354 + pm_runtime_mark_last_busy(mmc->parent); 355 + pm_runtime_put_autosuspend(mmc->parent); 356 + 357 + return ret; 358 + } 359 + 333 360 static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) 334 361 { 335 362 slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | ··· 389 362 slot->cd_con_id = NULL; 390 363 slot->cd_idx = 0; 391 364 slot->cd_override_level = true; 365 + if (slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_BXT_SD || 366 + slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_APL_SD) 367 + slot->host->mmc_host_ops.get_cd = bxt_get_cd; 368 + 392 369 return 0; 393 370 } 394 371
+3 -2
drivers/mmc/host/sdhci.c
··· 1360 1360 sdhci_runtime_pm_get(host); 1361 1361 1362 1362 /* Firstly check card presence */ 1363 - present = sdhci_do_get_cd(host); 1363 + present = mmc->ops->get_cd(mmc); 1364 1364 1365 1365 spin_lock_irqsave(&host->lock, flags); 1366 1366 ··· 2849 2849 2850 2850 host = mmc_priv(mmc); 2851 2851 host->mmc = mmc; 2852 + host->mmc_host_ops = sdhci_ops; 2853 + mmc->ops = &host->mmc_host_ops; 2852 2854 2853 2855 return host; 2854 2856 } ··· 3039 3037 /* 3040 3038 * Set host parameters. 3041 3039 */ 3042 - mmc->ops = &sdhci_ops; 3043 3040 max_clk = host->max_clk; 3044 3041 3045 3042 if (host->ops->get_min_clock)
+1
drivers/mmc/host/sdhci.h
··· 430 430 431 431 /* Internal data */ 432 432 struct mmc_host *mmc; /* MMC structure */ 433 + struct mmc_host_ops mmc_host_ops; /* MMC host ops */ 433 434 u64 dma_mask; /* custom DMA mask */ 434 435 435 436 #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+1 -1
drivers/mmc/host/sh_mmcif.c
··· 445 445 pdata->slave_id_rx); 446 446 } else { 447 447 host->chan_tx = dma_request_slave_channel(dev, "tx"); 448 - host->chan_tx = dma_request_slave_channel(dev, "rx"); 448 + host->chan_rx = dma_request_slave_channel(dev, "rx"); 449 449 } 450 450 dev_dbg(dev, "%s: got channel TX %p RX %p\n", __func__, host->chan_tx, 451 451 host->chan_rx);