MMC core:

- Fix regression for the mmc ioctl
 
 MMC host:
  - sdhci-of-dwcmshc: Fixup PM support in ->remove_new()
  - sdhci-omap: Re-tune when device became runtime suspended
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmYFXgwXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCmLHxAAyrtVrqGuoJYibhGgM3G8GAK9
 8q525iGXq6f3qUpGY4d1Cuxw9HWLstdYGhxVkMt0kl76EzQXNgYmMPpYUuWEFji3
 bwQIBoE/iWvJ44I6sKmmZvXrxzkc/nPdK/y2BJJ05z5zlNO6hht+Lw2ZJmrbdLxe
 ZhexfZHMzR2tLhpn4HfLbt/kArxChN16FzKdoQURMiUsT/yLwrrXpUwqyaRkjcW9
 N4ZwyxlCor0FlJ1IClMhaa7KUptCOL+UQnV1qO1w9vFqojcFO0mC69mSBp5FE2be
 GH6+AWMq7DC8Zma3CVBwXY+bRTkE5ezw2/uUeCrfYijN42v73/tRGUefX9lfpcw5
 r39CaqekZVZXOEKEXngS7wj5wlqUXKQjVmnpDrbOVxtZYBFQJaBghAWOoNdP/80C
 Ab84HrGR8ILjpGT++L06DRxkRxNiifgUu6eKzjkB4TaRZAloSkQSlEAcSxhDdO4r
 Rrl3A8CCnDwPHCLSJItMgd3cL97aA+f/mnJlZKumX4bNEijFsCNm23qDGFQDDboY
 jS2IJTdciE1NJ20owaPBjyak4m4NsvlxiG6+qmeHI6ZSuZkBEKEp25Zx0sJf8+Qz
 s9F3bAqa7laskSzS1Q1S45W1vP0mRRfcwuH4YRoZEqiDukxFgwxb3b4YFX4Vgz4J
 qjYVoeToEOLsVIxC4uo=
 =y4NT
 -----END PGP SIGNATURE-----

Merge tag 'mmc-v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Fix regression for the mmc ioctl

  MMC host:
   - sdhci-of-dwcmshc: Fixup PM support in ->remove_new()
   - sdhci-omap: Re-tune when device became runtime suspended"

* tag 'mmc-v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  sdhci-of-dwcmshc: disable PM runtime in dwcmshc_remove()
  mmc: sdhci-omap: re-tuning is needed after a pm transition to support emmc HS200 mode
  mmc: core: Avoid negative index with array access
  mmc: core: Initialize mmc_blk_ioc_data
This commit is contained in:
Linus Torvalds 2024-03-28 17:15:33 -07:00
commit 317c7bc0ef
3 changed files with 22 additions and 13 deletions

View File

@ -413,7 +413,7 @@ static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user(
struct mmc_blk_ioc_data *idata;
int err;
idata = kmalloc(sizeof(*idata), GFP_KERNEL);
idata = kzalloc(sizeof(*idata), GFP_KERNEL);
if (!idata) {
err = -ENOMEM;
goto out;
@ -488,7 +488,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
if (idata->flags & MMC_BLK_IOC_DROP)
return 0;
if (idata->flags & MMC_BLK_IOC_SBC)
if (idata->flags & MMC_BLK_IOC_SBC && i > 0)
prev_idata = idatas[i - 1];
/*

View File

@ -999,6 +999,17 @@ free_pltfm:
return err;
}
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
{
u16 ctrl;
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
if (ctrl & SDHCI_CLOCK_CARD_EN) {
ctrl &= ~SDHCI_CLOCK_CARD_EN;
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
}
}
static void dwcmshc_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
@ -1006,8 +1017,14 @@ static void dwcmshc_remove(struct platform_device *pdev)
struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
struct rk35xx_priv *rk_priv = priv->priv;
pm_runtime_get_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
sdhci_remove_host(host, 0);
dwcmshc_disable_card_clk(host);
clk_disable_unprepare(pltfm_host->clk);
clk_disable_unprepare(priv->bus_clk);
if (rk_priv)
@ -1099,17 +1116,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host)
}
}
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
{
u16 ctrl;
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
if (ctrl & SDHCI_CLOCK_CARD_EN) {
ctrl &= ~SDHCI_CLOCK_CARD_EN;
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
}
}
static int dwcmshc_runtime_suspend(struct device *dev)
{
struct sdhci_host *host = dev_get_drvdata(dev);

View File

@ -1439,6 +1439,9 @@ static int __maybe_unused sdhci_omap_runtime_suspend(struct device *dev)
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
mmc_retune_needed(host->mmc);
if (omap_host->con != -EINVAL)
sdhci_runtime_suspend_host(host);