Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e51eb82 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: core: abort rescan if suspend is triggered"

parents 6cf73961 c865639f
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -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)
@@ -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.
@@ -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;

+11 −4
Original line number Diff line number Diff line
@@ -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--;
@@ -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)
@@ -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;
}