From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
Peter Wang <peter.wang@mediatek.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Avri Altman <avri.altman@wdc.com>, Bean Huo <beanhuo@micron.com>,
Andrew Halaney <ahalaney@redhat.com>
Subject: [PATCH 5/9] ufs: core: Move the ufshcd_device_init() call
Date: Mon, 19 Aug 2024 15:50:22 -0700 [thread overview]
Message-ID: <20240819225102.2437307-6-bvanassche@acm.org> (raw)
In-Reply-To: <20240819225102.2437307-1-bvanassche@acm.org>
Move the ufshcd_device_init() call to the ufshcd_probe_hba() callers and
remove the 'init_dev_params' argument of ufshcd_probe_hba().
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufshcd.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 502d0f5a95c0..86deea546b44 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -298,7 +298,8 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba);
static int ufshcd_eh_host_reset_handler(struct scsi_cmnd *cmd);
static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag);
static void ufshcd_hba_exit(struct ufs_hba *hba);
-static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params);
+static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params);
+static int ufshcd_probe_hba(struct ufs_hba *hba);
static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on);
static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba);
static int ufshcd_host_reset_and_restore(struct ufs_hba *hba);
@@ -7717,8 +7718,11 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
err = ufshcd_hba_enable(hba);
/* Establish the link again and restore the device */
- if (!err)
- err = ufshcd_probe_hba(hba, false);
+ if (!err) {
+ err = ufshcd_device_init(hba, /*init_dev_params=*/false);
+ if (!err)
+ err = ufshcd_probe_hba(hba);
+ }
if (err)
dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err);
@@ -8853,22 +8857,17 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
/**
* ufshcd_probe_hba - probe hba to detect device and initialize it
* @hba: per-adapter instance
- * @init_dev_params: whether or not to call ufshcd_device_params_init().
*
* Execute link-startup and verify device initialization
*
* Return: 0 upon success; < 0 upon failure.
*/
-static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
+static int ufshcd_probe_hba(struct ufs_hba *hba)
{
ktime_t start = ktime_get();
unsigned long flags;
int ret;
- ret = ufshcd_device_init(hba, init_dev_params);
- if (ret)
- goto out;
-
if (!hba->pm_op_in_progress &&
(hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) {
/* Reset the device and controller before doing reinit */
@@ -8885,7 +8884,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
}
/* Reinit the device */
- ret = ufshcd_device_init(hba, init_dev_params);
+ ret = ufshcd_device_init(hba, /*init_dev_params=*/false);
if (ret)
goto out;
}
@@ -8933,7 +8932,9 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
down(&hba->host_sem);
/* Initialize hba, detect and initialize UFS device */
- ret = ufshcd_probe_hba(hba, true);
+ ret = ufshcd_device_init(hba, /*init_dev_params=*/true);
+ if (ret == 0)
+ ret = ufshcd_probe_hba(hba);
up(&hba->host_sem);
if (ret)
goto out;
next prev parent reply other threads:[~2024-08-19 22:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 22:50 [PATCH 0/9] Simplify the UFS driver initialization code Bart Van Assche
2024-08-19 22:50 ` [PATCH 1/9] ufs: core: Introduce ufshcd_add_scsi_host() Bart Van Assche
2024-08-19 22:50 ` [PATCH 2/9] ufs: core: Introduce ufshcd_activate_link() Bart Van Assche
2024-08-19 22:50 ` [PATCH 3/9] ufs: core: Introduce ufshcd_post_device_init() Bart Van Assche
2024-08-19 22:50 ` [PATCH 4/9] ufs: core: Call ufshcd_add_scsi_host() later Bart Van Assche
2024-08-19 22:50 ` Bart Van Assche [this message]
2024-08-22 16:07 ` [PATCH 5/9] ufs: core: Move the ufshcd_device_init() call kernel test robot
2024-08-22 17:46 ` Bart Van Assche
2024-08-19 22:50 ` [PATCH 6/9] ufs: core: Move the ufshcd_device_init(hba, true) call Bart Van Assche
2024-08-19 22:50 ` [PATCH 7/9] ufs: core: Expand " Bart Van Assche
2024-08-19 22:50 ` [PATCH 8/9] ufs: core: Move the MCQ scsi_add_host() call Bart Van Assche
2024-08-19 22:50 ` [PATCH 9/9] ufs: core: Remove the second argument of ufshcd_device_init() Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240819225102.2437307-6-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=ahalaney@redhat.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox