Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3190208pxu; Tue, 8 Dec 2020 06:00:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPFio2mxS0YyU7FE1ntxknblafHm5qtNUAh7tX/usudeMVhN9AHUDuNOAdamJrK+WHxOMd X-Received: by 2002:a17:907:435c:: with SMTP id oc20mr23998853ejb.286.1607436035006; Tue, 08 Dec 2020 06:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607436034; cv=none; d=google.com; s=arc-20160816; b=SCgUC8HUzlTzew5ppasVsBn1CBd/d3tSQmRnkzmW+XykTcb3Cdjhmggy4dutKLXDnR +iYopChAM+DP+CLUJFyeWJOutDV1Pt81/cvEjWhWL4cjDghbYRrxt+2jB9IHDkzfq9wA GU/IJQY1ecrMTudnnOvlo8hhiqIulJFwNPxCnp6swWP1msmFBOF1ynQ+gj27gARdVrAX 2y/QBDrrbrZ57/ovObt2o5T+mKo68Zxg0iqnvKJS2SeVZrGN2V5k4dWVoSr45Ygqrncp zmIBTnKzpgZdz0maiMDAwuPObVV4Bj74DNVyW61fUjHM2BM5TOMT6CVKkxcs0O5Gva5h VMBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=/uIDb9cVJLDmOA/LQEUqt6FwQyjYiOAC/kxDeKXWCr4=; b=jLmdzFa9V5wxJ2X9fPQJPVpC/vA/3AXLVTRkrBUIbXqsXSJSI3PHQ+Hhph7njMA4yw lLFtKRGYNl618lSwuKCbrTR3cEPAfdPSD17BQgFP9raEk3aEGPzcHA41FvzD4asLWrnJ bdM24ZLHV/LyJ8OwwB++2xEkCJHzfln/v7ok6iys6GLVPuMZpw3cDkWQMRAnKgvJPwZF IxWb9QoMgAuO2m3MZqyte1WtRiMVdDr9YJjPvMqo/Vs2yN7KYQa4IKW8ka2iLDhxxTqX 5b0XQsvKd78XFU6A1gcTunOW4W1OVxpYnDORc8p8F5SvRQz4drTug2UGEhvRIme6ToZw FA2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq27si7691011ejc.5.2020.12.08.06.00.07; Tue, 08 Dec 2020 06:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbgLHN5Y (ORCPT + 99 others); Tue, 8 Dec 2020 08:57:24 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:37939 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729680AbgLHN5X (ORCPT ); Tue, 8 Dec 2020 08:57:23 -0500 X-UUID: 04896d5bc9764a2e8ec41ba1c2bb8256-20201208 X-UUID: 04896d5bc9764a2e8ec41ba1c2bb8256-20201208 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 510762096; Tue, 08 Dec 2020 21:56:38 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Dec 2020 21:56:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 8 Dec 2020 21:56:34 +0800 From: Stanley Chu To: , , , , CC: , , , , , , , , , , , , , , , , , , Stanley Chu Subject: [PATCH v2 2/2] scsi: ufs: Uninline ufshcd_vops_device_reset function Date: Tue, 8 Dec 2020 21:56:35 +0800 Message-ID: <20201208135635.15326-3-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201208135635.15326-1-stanley.chu@mediatek.com> References: <20201208135635.15326-1-stanley.chu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 101DC9A9E8D7F51DCEBAB7D3E09A549AADA7E869E7FE7D2790AA99B6101A000D2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since more and more statements showing up in ufshcd_vops_device_reset(), uninline it to allow compiler making possibly better optimization. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 27 ++++++++++++++++++++++----- drivers/scsi/ufs/ufshcd.h | 19 +++++-------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c1c401b2b69d..b2ca1a6ad426 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -580,6 +580,23 @@ static void ufshcd_print_pwr_info(struct ufs_hba *hba) hba->pwr_info.hs_rate); } +static void ufshcd_device_reset(struct ufs_hba *hba) +{ + int err; + + err = ufshcd_vops_device_reset(hba); + + if (!err) { + ufshcd_set_ufs_dev_active(hba); + if (ufshcd_is_wb_allowed(hba)) { + hba->wb_enabled = false; + hba->wb_buf_flush_enabled = false; + } + } + if (err != -EOPNOTSUPP) + ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err); +} + void ufshcd_delay_us(unsigned long us, unsigned long tolerance) { if (!us) @@ -3932,7 +3949,7 @@ int ufshcd_link_recovery(struct ufs_hba *hba) spin_unlock_irqrestore(hba->host->host_lock, flags); /* Reset the attached device */ - ufshcd_vops_device_reset(hba); + ufshcd_device_reset(hba); ret = ufshcd_host_reset_and_restore(hba); @@ -6933,7 +6950,7 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) do { /* Reset the attached device */ - ufshcd_vops_device_reset(hba); + ufshcd_device_reset(hba); err = ufshcd_host_reset_and_restore(hba); } while (err && --retries); @@ -8712,7 +8729,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) * further below. */ if (ufshcd_is_ufs_dev_deepsleep(hba)) { - ufshcd_vops_device_reset(hba); + ufshcd_device_reset(hba); WARN_ON(!ufshcd_is_link_off(hba)); } if (ufshcd_is_link_hibern8(hba) && !ufshcd_uic_hibern8_exit(hba)) @@ -8722,7 +8739,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) set_dev_active: /* Can also get here needing to exit DeepSleep */ if (ufshcd_is_ufs_dev_deepsleep(hba)) { - ufshcd_vops_device_reset(hba); + ufshcd_device_reset(hba); ufshcd_host_reset_and_restore(hba); } if (!ufshcd_set_dev_pwr_mode(hba, UFS_ACTIVE_PWR_MODE)) @@ -9321,7 +9338,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) } /* Reset the attached device */ - ufshcd_vops_device_reset(hba); + ufshcd_device_reset(hba); ufshcd_init_crypto(hba); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 36d367eb8139..9bb5f0ed4124 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -1216,21 +1216,12 @@ static inline void ufshcd_vops_dbg_register_dump(struct ufs_hba *hba) hba->vops->dbg_register_dump(hba); } -static inline void ufshcd_vops_device_reset(struct ufs_hba *hba) +static inline int ufshcd_vops_device_reset(struct ufs_hba *hba) { - if (hba->vops && hba->vops->device_reset) { - int err = hba->vops->device_reset(hba); - - if (!err) { - ufshcd_set_ufs_dev_active(hba); - if (ufshcd_is_wb_allowed(hba)) { - hba->wb_enabled = false; - hba->wb_buf_flush_enabled = false; - } - } - if (err != -EOPNOTSUPP) - ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err); - } + if (hba->vops && hba->vops->device_reset) + return hba->vops->device_reset(hba); + + return -EOPNOTSUPP; } static inline void ufshcd_vops_config_scaling_param(struct ufs_hba *hba, -- 2.18.0