Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp996346ybl; Sat, 18 Jan 2020 16:15:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyqRNw6dWUzkm4mahsYjrwrVJGR6PPFUtA2T8BboaDFC1SoFoNopFhuk3KyaYPM4zPgAsmm X-Received: by 2002:aca:4c15:: with SMTP id z21mr8157582oia.8.1579392924932; Sat, 18 Jan 2020 16:15:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579392924; cv=none; d=google.com; s=arc-20160816; b=xFaLCsanqh2KehPGzOQMMyRSAFUuhgj1HQD/TydV20tswHro8nhCkdIho1uVGc45Db 1qB+GyWmU/AN4ZQfX8wJzBBkrV+KjfXUAXmoU1jUqRDV0+YghLoN0bP531WgkhzSLLFo g4xVfz2k7RQsQKpJoyrXOdK7vp1kgKXcUA0QWDtREL5HhB2KN29PUBcxpSH6+6Rkmb00 FbDsQVoZCwLGVV/DD0zwmmZuaIOulrwjTBhw4ki6KIac6K50xxhLds0IhM8mIRl7Z1vo 05x4h+N1YZbuIG6BdwY1rDMNKMRAsLp9pJL9M1D9ZbV29nM7djMtBy01kvT7D2ZBFEyD +xTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=MRb5bXAWMY+l9HME4BWEKQK1eCgQVNeKGRrRGFvy7Iw=; b=hhrr5z12/Wt96Bi2vXoxY3EcYAX+TpXmT2jPdZuYMZUN8fGhkHwEjfW1mS556fQgH5 WCbgqnt3r4/nwJ8p4tNOodO6EMhlNN/2usXsHw1+sgS8sEXu0cwE7f/cP32ynQQTfymf jpHoqa4tmeI0kf5YNUmUnudV/G6WgOeDtn6fTZfpwmth2bMEsfEKE+M4XTct7ul7a4wA IDh66ONz+P2/P+sQ2KWqIr+nDVuY7qXfuMdyA5piYZ1ZEZRoU7Q4arZaWLMKpKHnMFMX MPOMafafCyolkqC3AhSBdlZRZ6aDoDVQsm5KQmOiWfbFNig2cjxiGpX8R+oESc1U3XTA Tn8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="B2/FrWN5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si16726225otd.186.2020.01.18.16.15.12; Sat, 18 Jan 2020 16:15:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@gmail.com header.s=20161025 header.b="B2/FrWN5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728886AbgASAOK (ORCPT + 99 others); Sat, 18 Jan 2020 19:14:10 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38201 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728811AbgASAOJ (ORCPT ); Sat, 18 Jan 2020 19:14:09 -0500 Received: by mail-wr1-f68.google.com with SMTP id y17so26065247wrh.5; Sat, 18 Jan 2020 16:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MRb5bXAWMY+l9HME4BWEKQK1eCgQVNeKGRrRGFvy7Iw=; b=B2/FrWN5PiQe/aTA5s7VuSedpHC2t/ZqQdcAwrd0ExqpHwthaMB9cq+df6CU+2tQXl iSKy9v5cJb/LkghYrXOZfyzrHsFH+VbKpRKnxYPVU2cJmdsnmRVnQHrT2aEgG2lCeMXh GfOGgYVOUrP881eKZcTOzGHFU/cDaNGwF4J/3662OuScc3v3lC8fMJPOO7a1ggydqhg1 SUqR7fT6krqRh0W9sUiNH5H1I0FxMjQkZIgPPSWYLjvtFl9UkfPaYtjoRFvXfzeLqKA8 ZXJm5Jwq/UMFrBUoHEwAywqnZJVZWffyLm2po+OKDne+T50m/BQdlZy/tQmQW1NVJWwY HIcw== 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:in-reply-to :references; bh=MRb5bXAWMY+l9HME4BWEKQK1eCgQVNeKGRrRGFvy7Iw=; b=HX3G2afWsP8TbNB5NMvDj4sf8IpGVmlRI+8C0fw0Ce8muKFkjQtj3GMmjmAiePCJaw kzDgj9uSB6EE8gILKKUs1ysbVTEgut9Z/g85ub37Z6mewnLPDH7r5jDzo9tuCMDSfTd5 rm5OfYdilLajzo7N6MDQfuArCTjRSTiFuqrWCbZRAkz7+y283zNG1dBFarma2NZrF8qV mKOx+5IUNS8CSGPahO0gY4uHPMF2FbXQTjrhjQnK218/ZKkxcAYmgHCrJWmZev0EXTAE BVXFeIP/yqSFNtznD+Kk26jOoCpEY1vAiefY411noxcwSY08dQKGFU+9Iw6H68s+lcTl QEEQ== X-Gm-Message-State: APjAAAXPJt/+Q5gOYb/GuknxydT+kNNoEL7XvbwQPZtLWLTNMGugKN8Z IUZw8NM/KrMQ7OqSBUvv2iE= X-Received: by 2002:a5d:4481:: with SMTP id j1mr10609347wrq.348.1579392847120; Sat, 18 Jan 2020 16:14:07 -0800 (PST) Received: from localhost.localdomain (ip5f5bee3c.dynamic.kabel-deutschland.de. [95.91.238.60]) by smtp.gmail.com with ESMTPSA id i8sm42177432wro.47.2020.01.18.16.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 16:14:06 -0800 (PST) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/8] scsi: ufs: move ufshcd_get_max_pwr_mode() to ufs_init_params() Date: Sun, 19 Jan 2020 01:13:23 +0100 Message-Id: <20200119001327.29155-5-huobean@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200119001327.29155-1-huobean@gmail.com> References: <20200119001327.29155-1-huobean@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bean Huo ufshcd_get_max_pwr_mode() only need to be called once while booting, take it out from ufshcd_probe_hba() and inline into ufshcd_init_params(). Signed-off-by: Bean Huo --- drivers/scsi/ufs/ufshcd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 54c127ef360b..925b31dc3110 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6959,6 +6959,11 @@ static int ufshcd_init_params(struct ufs_hba *hba) QUERY_FLAG_IDN_PWR_ON_WPE, &flag)) hba->dev_info.f_power_on_wp_en = flag; + /* Probe maximum power mode co-supported by both UFS host and device */ + if (ufshcd_get_max_pwr_mode(hba)) + dev_err(hba->dev, + "%s: Failed getting max supported power mode\n", + __func__); out: return ret; } @@ -7057,11 +7062,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async) ufshcd_force_reset_auto_bkops(hba); hba->wlun_dev_clr_ua = true; - if (ufshcd_get_max_pwr_mode(hba)) { - dev_err(hba->dev, - "%s: Failed getting max supported power mode\n", - __func__); - } else { + /* Gear up to HS gear if supported */ + if (hba->max_pwr_info.is_valid) { /* * Set the right value to bRefClkFreq before attempting to * switch to HS gears. -- 2.17.1