From patchwork Thu Apr 28 10:55:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 66889 Delivered-To: patches@linaro.org Received: by 10.140.93.198 with SMTP id d64csp139402qge; Thu, 28 Apr 2016 03:55:56 -0700 (PDT) X-Received: by 10.25.29.141 with SMTP id d135mr5888159lfd.42.1461840956304; Thu, 28 Apr 2016 03:55:56 -0700 (PDT) Return-Path: Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com. [2a00:1450:4010:c07::22d]) by mx.google.com with ESMTPS id v4si4596520lbb.42.2016.04.28.03.55.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2016 03:55:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) client-ip=2a00:1450:4010:c07::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22d as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x22d.google.com with SMTP id u64so79690788lff.3 for ; Thu, 28 Apr 2016 03:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ymTBdw6wmoDzbZm1G0vWVGUhsoT8F50j1PgV4C7/BWo=; b=fQZJMuntc5KeFwEC60ZoaB604TqsGAoiSu2pV+a/HkF+cXxMqf1l/V2wmzZM096Vsy 3hXORmzC/pB+TBQaGM4Or3zIG/DJq2/5LFOZ7s/zNE8/2QG0GU5D4A7WdzWajjDLA+BB OnE8Lb0lzb2GJ/Y8yiuD3cnfnFoHcb2DM9u1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ymTBdw6wmoDzbZm1G0vWVGUhsoT8F50j1PgV4C7/BWo=; b=k8wKEJ04KpWVWTLGU6bOz29qiM+/me6+9Y3JLjfQC4u9012cjBDgzgEpRrm0qI6fdk 9Tn2QEd+DFZVbLRdkUeS1HyO0NASvV4UvSnHDphCA+CPmHUZNKgDls68gHDTPTbFNDOH /IpFZK6GJrnmwkC77TvTfJTPBTMjq/rn/o+7LKPlJ9viOPVyyJzlt9UokVffeXXTMtT6 Wa1U1dyQhUsaYid2Et6W6bTG7jiaCoD7cXMzEK9c5SaY5cE7jWp7bH5wpSmmxLevQ5Ct u3GdoBqw/KDP2bfhuRD01oHiESMau46uew3Ba/js4xBBPap+HwsNF5FyhiaCWF38lZ/2 1NHw== X-Gm-Message-State: AOPr4FUDls0zXb5Dq5XDiymPfDNqa5ZsjpsUnyWXL8hh7vTC4Za2nMMlX2Xg8yX3u3ICX95B+pA= X-Received: by 10.112.202.105 with SMTP id kh9mr5707783lbc.57.1461840955322; Thu, 28 Apr 2016 03:55:55 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-128-67.na.cust.bahnhof.se. [155.4.128.67]) by smtp.gmail.com with ESMTPSA id r9sm1603069lfr.33.2016.04.28.03.55.53 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Apr 2016 03:55:53 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter Subject: [PATCH] mmc: core: Remove redundant rescan_disable flag Date: Thu, 28 Apr 2016 12:55:51 +0200 Message-Id: <1461840951-4401-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 As cancel_delayed_work_sync() prevents an executing work for re-scheduling itself, the rescan_disable flag is redundant. Morover, during host registration phase, it's anyway not safe to schedule a detect work until mmc_start_host() has been invoked. Therfore, there's no need to use the rescan_disable flag to protect a rescan work from being executed in-between mmc_alloc_host() and mmc_start_host(). For these reasons, let's remove the rescan_disable flag. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 12 ------------ drivers/mmc/core/host.c | 3 --- include/linux/mmc/host.h | 1 - 3 files changed, 16 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 99275e4..b8c6a11 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2580,9 +2580,6 @@ void mmc_rescan(struct work_struct *work) container_of(work, struct mmc_host, detect.work); int i; - if (host->rescan_disable) - return; - /* If there is a non-removable card registered, only scan once */ if (!mmc_card_is_removable(host) && host->rescan_entered) return; @@ -2649,7 +2646,6 @@ void mmc_rescan(struct work_struct *work) void mmc_start_host(struct mmc_host *host) { host->f_init = max(freqs[0], host->f_min); - host->rescan_disable = 0; host->ios.power_mode = MMC_POWER_UNDEFINED; mmc_claim_host(host); @@ -2674,7 +2670,6 @@ void mmc_stop_host(struct mmc_host *host) if (host->slot.cd_irq >= 0) disable_irq(host->slot.cd_irq); - host->rescan_disable = 1; cancel_delayed_work_sync(&host->detect); /* clear pm flags now and let card drivers set them as needed */ @@ -2788,9 +2783,6 @@ static int mmc_pm_notify(struct notifier_block *notify_block, case PM_HIBERNATION_PREPARE: case PM_SUSPEND_PREPARE: case PM_RESTORE_PREPARE: - spin_lock_irqsave(&host->lock, flags); - host->rescan_disable = 1; - spin_unlock_irqrestore(&host->lock, flags); cancel_delayed_work_sync(&host->detect); if (!host->bus_ops) @@ -2814,10 +2806,6 @@ static int mmc_pm_notify(struct notifier_block *notify_block, case PM_POST_SUSPEND: case PM_POST_HIBERNATION: case PM_POST_RESTORE: - - spin_lock_irqsave(&host->lock, flags); - host->rescan_disable = 0; - spin_unlock_irqrestore(&host->lock, flags); _mmc_detect_change(host, 0, false); } diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index e0a3ee1..e972489 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -319,9 +319,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) if (!host) return NULL; - /* scanning will be enabled when we're ready */ - host->rescan_disable = 1; - again: if (!ida_pre_get(&mmc_host_ida, GFP_KERNEL)) { kfree(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 85800b4..7fbe5c0 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -330,7 +330,6 @@ struct mmc_host { unsigned int doing_retune:1; /* re-tuning in progress */ unsigned int retune_now:1; /* do re-tuning at next req */ - int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */ int need_retune; /* re-tuning is needed */