From patchwork Thu Nov 5 15:08:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 56057 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp459121lbr; Thu, 5 Nov 2015 07:08:11 -0800 (PST) X-Received: by 10.25.88.129 with SMTP id m123mr2280249lfb.23.1446736091706; Thu, 05 Nov 2015 07:08:11 -0800 (PST) Return-Path: Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id rc10si4556625lbb.160.2015.11.05.07.08.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2015 07:08:11 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) client-ip=2a00:1450:4010:c07::22f; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by lfgh9 with SMTP id h9so58804323lfg.1 for ; Thu, 05 Nov 2015 07:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=XWIIazHMQ7zaVLX8sHE/lIi52fbV6p/rIlthU1i6KKY=; b=rlAkqKF90KeQpsqpCokDeebl+J8sm8ys0RBaK9CpPBkvx6g7JRXw8S0sasXFYMbntp 15wttTVqbcBRj9zwIQi17G868Bu0g82Z5Us8aBTwqcpRNFPOLemqmg7S8RbeYC9hXw+d qfwHuLQZdYvRuACRwAO6D/RPb5LYVvx1uFhdzVats/n5PraeA10mUevkCVmawJhlfWS+ LgsEYsil5w4s0RS1YSYeCkpXR8EW9VAeN6PMTMo1lTU51INdKugk19lUPWIVGH/9QNuc Q98KhotmzkSOC0QAdSZ6HsqDP/ehGlaIqze71YOS8xvXvg8JrwgUT0jysGAYuMHtq5+K 0a3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=XWIIazHMQ7zaVLX8sHE/lIi52fbV6p/rIlthU1i6KKY=; b=NDgY6jBNF+VQ4V5u0K10CHkH+58W2T2ctB26N1oLprmw58Dag7TNzNahHNE6d/YngY N6VnVr4ZyBFhe1G02hf3zj6/2u9eYMZgN5fEaAXFSbs1ok2R8nMQ2ir220YM1tkp9ft2 /pCxHNd652D1gWynd8+vRLLBUI/A45nAM3h8Vqe0Ikv2BCi6W1kZyLH/Nm1mvPSBZGgU 0O/a0NZw4zlocR7Y0wBVkj4eeWBACWXAQ91VzYmAEuvTEs3q2CowqEy0Ss48UCbt563h uFHzVd8XsIKHUnBf+o0TjNDaSF1AkXW0NOkuBkfFUEpim6ih1B1bfkXV51oxXk+er1R0 4++Q== X-Gm-Message-State: ALoCoQnLNeYNMQQV8kU/kVntzrrhHgxB8PC8i1maDLDcOJJH2Ms8bxMpwCmqYTY7PqBj3gZRSYim X-Received: by 10.25.13.74 with SMTP id 71mr2304508lfn.113.1446736091391; Thu, 05 Nov 2015 07:08:11 -0800 (PST) Return-Path: Received: from uffe-Latitude-E6430s.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f198sm1044405lff.9.2015.11.05.07.08.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 07:08:10 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Subject: [PATCH 1/2] mmc: core: Invoke ->card_event() callback only when needed Date: Thu, 5 Nov 2015 16:08:07 +0100 Message-Id: <1446736088-11715-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 The ->card_event() callback may be called when re-scan is disabled and for non-removable cards, which both cases are unnecessary. Instead let's move the call later in mmc_rescan() where these constraints have been validated. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5ae89e4..c1027a4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2567,11 +2567,6 @@ void mmc_rescan(struct work_struct *work) container_of(work, struct mmc_host, detect.work); int i; - if (host->trigger_card_event && host->ops->card_event) { - host->ops->card_event(host); - host->trigger_card_event = false; - } - if (host->rescan_disable) return; @@ -2580,6 +2575,11 @@ void mmc_rescan(struct work_struct *work) return; host->rescan_entered = 1; + if (host->trigger_card_event && host->ops->card_event) { + host->ops->card_event(host); + host->trigger_card_event = false; + } + mmc_bus_get(host); /*