Loading drivers/mmc/core/core.c +12 −5 Original line number Diff line number Diff line Loading @@ -3411,7 +3411,8 @@ void mmc_rescan(struct work_struct *work) mmc_release_host(host); mmc_rpm_release(host, &host->class_dev); out: if (extend_wakelock) /* only extend the wakelock, if suspend has not started yet */ if (extend_wakelock && !host->rescan_disable) wake_lock_timeout(&host->detect_wake_lock, HZ / 2); if (host->caps & MMC_CAP_NEEDS_POLL) Loading Loading @@ -3812,16 +3813,15 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_unlock_irqrestore(&host->lock, flags); break; } /* since its suspending anyway, disable rescan */ host->rescan_disable = 1; spin_unlock_irqrestore(&host->lock, flags); /* Wait for pending detect work to be completed */ if (!(host->caps & MMC_CAP_NEEDS_POLL)) flush_work(&host->detect.work); spin_lock_irqsave(&host->lock, flags); host->rescan_disable = 1; spin_unlock_irqrestore(&host->lock, flags); /* * In some cases, the detect work might be scheduled * just before rescan_disable is set to true. Loading @@ -3829,6 +3829,13 @@ int mmc_pm_notify(struct notifier_block *notify_block, */ cancel_delayed_work_sync(&host->detect); /* * It is possible that the wake-lock has been acquired, since * its being suspended, release the wakelock */ if (wake_lock_active(&host->detect_wake_lock)) wake_unlock(&host->detect_wake_lock); if (!host->bus_ops || host->bus_ops->suspend) break; Loading drivers/mmc/core/sd.c +11 −4 Original line number Diff line number Diff line Loading @@ -1380,7 +1380,11 @@ int mmc_attach_sd(struct mmc_host *host) */ #ifdef CONFIG_MMC_PARANOID_SD_INIT retries = 5; while (retries) { /* * Some bad cards may take a long time to init, give preference to * suspend in those cases. */ while (retries && !host->rescan_disable) { err = mmc_sd_init_card(host, host->ocr, NULL); if (err) { retries--; Loading @@ -1398,6 +1402,9 @@ int mmc_attach_sd(struct mmc_host *host) mmc_hostname(host), err); goto err; } if (host->rescan_disable) goto err; #else err = mmc_sd_init_card(host, host->ocr, NULL); if (err) Loading @@ -1421,9 +1428,9 @@ remove_card: mmc_claim_host(host); err: mmc_detach_bus(host); pr_err("%s: error %d whilst initialising SD card\n", mmc_hostname(host), err); if (err) pr_err("%s: error %d whilst initialising SD card: rescan: %d\n", mmc_hostname(host), err, host->rescan_disable); return err; } Loading Loading
drivers/mmc/core/core.c +12 −5 Original line number Diff line number Diff line Loading @@ -3411,7 +3411,8 @@ void mmc_rescan(struct work_struct *work) mmc_release_host(host); mmc_rpm_release(host, &host->class_dev); out: if (extend_wakelock) /* only extend the wakelock, if suspend has not started yet */ if (extend_wakelock && !host->rescan_disable) wake_lock_timeout(&host->detect_wake_lock, HZ / 2); if (host->caps & MMC_CAP_NEEDS_POLL) Loading Loading @@ -3812,16 +3813,15 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_unlock_irqrestore(&host->lock, flags); break; } /* since its suspending anyway, disable rescan */ host->rescan_disable = 1; spin_unlock_irqrestore(&host->lock, flags); /* Wait for pending detect work to be completed */ if (!(host->caps & MMC_CAP_NEEDS_POLL)) flush_work(&host->detect.work); spin_lock_irqsave(&host->lock, flags); host->rescan_disable = 1; spin_unlock_irqrestore(&host->lock, flags); /* * In some cases, the detect work might be scheduled * just before rescan_disable is set to true. Loading @@ -3829,6 +3829,13 @@ int mmc_pm_notify(struct notifier_block *notify_block, */ cancel_delayed_work_sync(&host->detect); /* * It is possible that the wake-lock has been acquired, since * its being suspended, release the wakelock */ if (wake_lock_active(&host->detect_wake_lock)) wake_unlock(&host->detect_wake_lock); if (!host->bus_ops || host->bus_ops->suspend) break; Loading
drivers/mmc/core/sd.c +11 −4 Original line number Diff line number Diff line Loading @@ -1380,7 +1380,11 @@ int mmc_attach_sd(struct mmc_host *host) */ #ifdef CONFIG_MMC_PARANOID_SD_INIT retries = 5; while (retries) { /* * Some bad cards may take a long time to init, give preference to * suspend in those cases. */ while (retries && !host->rescan_disable) { err = mmc_sd_init_card(host, host->ocr, NULL); if (err) { retries--; Loading @@ -1398,6 +1402,9 @@ int mmc_attach_sd(struct mmc_host *host) mmc_hostname(host), err); goto err; } if (host->rescan_disable) goto err; #else err = mmc_sd_init_card(host, host->ocr, NULL); if (err) Loading @@ -1421,9 +1428,9 @@ remove_card: mmc_claim_host(host); err: mmc_detach_bus(host); pr_err("%s: error %d whilst initialising SD card\n", mmc_hostname(host), err); if (err) pr_err("%s: error %d whilst initialising SD card: rescan: %d\n", mmc_hostname(host), err, host->rescan_disable); return err; } Loading