From patchwork Mon Jul 1 15:01:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 168211 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3027891ilk; Mon, 1 Jul 2019 08:01:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW+IY4StUTjyI+PNZCOzqPlGxXG38YbCKv2pTSXLJ+I3uF0NgY1cIT0Z1XOziwRhlxFoHz X-Received: by 2002:a17:90a:b104:: with SMTP id z4mr31598989pjq.102.1561993293058; Mon, 01 Jul 2019 08:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561993293; cv=none; d=google.com; s=arc-20160816; b=zsk7qPkcwSok4ms9cJ3M3tHXXRXD+MnrcT7kwyU9am8jRdB/F6bvtVCkkk/uaByVL1 IkXZ7SP/297ZCnepgwuHM9XXfWGVHQZiCjj+XhPH1zI7+We7pYPlNGkPlTEoanvA1Vo0 Gs1hNx3R2rUVv0UKHb4P5eg0qvfGZs7nOQ7ZRZQaMuj8ZENx3M/jCPw+gT8VIySVqGGS VW3/q2YgE7EEogBiB9HEOBbh0qJ04jI11GRB0e1ErAmBDLkOH2w7HsgsxJhgUak7u/2V KesP5EIIbO15L6xXZpBPbsDMm+KvxUT2b9fH2J9AazzVThwF6VZ5JiUbyYef5E9RPJOE 1bZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IIXpnZYD0H/d3NqVWEXP706dKN7k+XEZCaQ0ZxH8464=; b=xgN8tL0VLd36kUNnGsiklQLp2kfqYaw4YXJ7qA9+nzvzpeYGc4EK3yG8xiv1BpZy7p ROXdwQnTdYsLO/HyEqIApKH9puJ4fZmjuZVDqP5SBEBCLQI8YmcUkFblpkZiNQYUaGoq XNFN02LxhmdegkLFlMZMxOLIGRDTnKJRa09Y5w+VEtXZLEmCwdZfUMMqaQVVA6okMwlZ seLsiFDI5CtCVXIsOOy34wnWIq6qIy7wNfvBvXS0x/7ExwAw28ee4Ege62ux2CCqcmKA wVTYj3Da0KHUs2qkELKeqAE8lDPSgaHVhr3f5CXhe6fG6z6ZK5M1fjFDHXlO0U7YgyYA f8/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ShgvQlkj; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si8142704plo.64.2019.07.01.08.01.32; Mon, 01 Jul 2019 08:01:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ShgvQlkj; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727477AbfGAPBc (ORCPT + 15 others); Mon, 1 Jul 2019 11:01:32 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34816 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727170AbfGAPBc (ORCPT ); Mon, 1 Jul 2019 11:01:32 -0400 Received: by mail-wm1-f66.google.com with SMTP id c6so16336728wml.0 for ; Mon, 01 Jul 2019 08:01:30 -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:mime-version :content-transfer-encoding; bh=IIXpnZYD0H/d3NqVWEXP706dKN7k+XEZCaQ0ZxH8464=; b=ShgvQlkjJOhVGKdERs2kjRZrm8SgyU9V8shTDKruNYEn5BrO6mtB1ONdNYXLWT1wXk q88Lqm4My/pOTwGUx9EO7KHalnVaIRuUsC2dItCptPW7CUZfdZGxh/bybgki+EyygNh7 LHMIGHYXI4/ZSYd/FpnPsHXMuH1Gak5/8h1qLjKXUWD7yAYxOLxU/Z+ly5Y/AEPmHLuY YDFuTKwd3sgviBatQLLlCYdS6JVQJ5D4J6x1l485gzeqhu0k2/0xO0kZfREJtxFEqNpR vTU4wBCXh9jeTTz76Yp2yjskWYKQHOu0a8hywEef5jRtkcGZx/juHQ/77ZbnlWI45p1y Hv9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IIXpnZYD0H/d3NqVWEXP706dKN7k+XEZCaQ0ZxH8464=; b=ijwU4qZG3M/FNSc1UHLB0oA3bb2l0Zo69QHIq0u8KIFqjOk1nnOw66EmHWK5UslmTT 8G6zD1TbCX38JWiGIyYrclqj0FuB0dPIV87mzy2UkNvHP6O+wNdGsND1eEjN3SqR+7JE VKaGjTKA8Xop6L/clcfFDpYh4dDDGl5vwXyYt1AwXsdgzuvbHiO6R7g6byliaMYZ++Rs 6tnC5BvgxstScSbpPQiFXiv5SNjQpi0cjGgtJaO/vZtkJhBzKC1Alc815F9jzDQ+izkf ADGd5qctFsZa6qNhlxlnXFH3mS0ub0ldk9T+S3G/6qJ97694T3I7fTxrmoBB+QunEQvW oXNA== X-Gm-Message-State: APjAAAUoeP+S2dp0T37h5aejcs66B5CRScD6k95bXvo+yoOqXmRlab6p 1hBf6aQ1K3e7EkqfQwKnraavgQ== X-Received: by 2002:a1c:9dc4:: with SMTP id g187mr16003141wme.86.1561993289850; Mon, 01 Jul 2019 08:01:29 -0700 (PDT) Received: from localhost.localdomain (30.red-83-34-200.dynamicip.rima-tde.net. [83.34.200.30]) by smtp.gmail.com with ESMTPSA id r12sm11638593wrt.95.2019.07.01.08.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jul 2019 08:01:29 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, agross@kernel.org, adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, khasim.mohammed@linaro.org, vinod.koul@linaro.org Subject: [PATCH v2] mmc: sdhci-msm: fix mutex while in spinlock Date: Mon, 1 Jul 2019 17:01:25 +0200 Message-Id: <20190701150125.2602-1-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org mutexes can sleep and therefore should not be taken while holding a spinlock. move clk_get_rate (can sleep) outside the spinlock protected region. Fixes: 83736352e0ca ("mmc: sdhci-msm: Update DLL reset sequence") Cc: stable@vger.kernel.org Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/mmc/host/sdhci-msm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.21.0 Reviewed-by: Vinod Koul Acked-by: Adrian Hunter diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 5fc76a1993d0..9cf14b359c14 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); int wait_cnt = 50; - unsigned long flags; + unsigned long flags, xo_clk = 0; u32 config; const struct sdhci_msm_offset *msm_offset = msm_host->offset; + if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk)) + xo_clk = clk_get_rate(msm_host->xo_clk); + spin_lock_irqsave(&host->lock, flags); /* @@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host) config &= CORE_FLL_CYCLE_CNT; if (config) mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8), - clk_get_rate(msm_host->xo_clk)); + xo_clk); else mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4), - clk_get_rate(msm_host->xo_clk)); + xo_clk); config = readl_relaxed(host->ioaddr + msm_offset->core_dll_config_2);