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>,
Andrew Halaney <ahalaney@redhat.com>,
Bean Huo <beanhuo@micron.com>
Subject: [PATCH v2 6/9] ufs: core: Move the ufshcd_device_init(hba, true) call
Date: Thu, 22 Aug 2024 14:36:07 -0700 [thread overview]
Message-ID: <20240822213645.1125016-7-bvanassche@acm.org> (raw)
In-Reply-To: <20240822213645.1125016-1-bvanassche@acm.org>
Move the ufshcd_device_init(hba, true) call from ufshcd_async_scan()
into ufshcd_init(). This patch prepares for moving both scsi_add_host()
calls into ufshcd_add_scsi_host(). Calling ufshcd_device_init() from
ufshcd_init() without holding hba->host_sem is safe because
hba->host_sem serializes core code with sysfs callback code and because
the ufshcd_device_init() is moved before the scsi_add_host() call.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ufs/core/ufshcd.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5c8751672bc7..0fdf19889191 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8933,10 +8933,7 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
int ret;
down(&hba->host_sem);
- /* Initialize hba, detect and initialize UFS device */
- ret = ufshcd_device_init(hba, /*init_dev_params=*/true);
- if (ret == 0)
- ret = ufshcd_probe_hba(hba);
+ ret = ufshcd_probe_hba(hba);
up(&hba->host_sem);
if (ret)
goto out;
@@ -10632,6 +10629,11 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
*/
ufshcd_set_ufs_dev_active(hba);
+ /* Initialize hba, detect and initialize UFS device */
+ err = ufshcd_device_init(hba, /*init_dev_params=*/true);
+ if (err)
+ goto out_disable;
+
err = ufshcd_add_scsi_host(hba);
if (err)
goto out_disable;
next prev parent reply other threads:[~2024-08-22 21:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 21:36 [PATCH v2 0/9] Simplify the UFS driver initialization code Bart Van Assche
2024-08-22 21:36 ` [PATCH v2 1/9] ufs: core: Introduce ufshcd_add_scsi_host() Bart Van Assche
2024-08-24 9:59 ` Avri Altman
2024-08-25 5:10 ` Manivannan Sadhasivam
2024-08-27 22:04 ` Bart Van Assche
2024-08-22 21:36 ` [PATCH v2 2/9] ufs: core: Introduce ufshcd_activate_link() Bart Van Assche
2024-08-24 10:06 ` Avri Altman
2024-08-25 5:11 ` Manivannan Sadhasivam
2024-08-22 21:36 ` [PATCH v2 3/9] ufs: core: Introduce ufshcd_post_device_init() Bart Van Assche
2024-08-24 10:12 ` Avri Altman
2024-08-25 5:16 ` Manivannan Sadhasivam
2024-08-28 17:05 ` Bart Van Assche
2024-08-22 21:36 ` [PATCH v2 4/9] ufs: core: Call ufshcd_add_scsi_host() later Bart Van Assche
2024-08-25 5:18 ` Manivannan Sadhasivam
2024-08-22 21:36 ` [PATCH v2 5/9] ufs: core: Move the ufshcd_device_init() call Bart Van Assche
2024-08-25 5:22 ` Manivannan Sadhasivam
2024-08-28 17:14 ` Bart Van Assche
2024-08-22 21:36 ` Bart Van Assche [this message]
2024-08-25 5:33 ` [PATCH v2 6/9] ufs: core: Move the ufshcd_device_init(hba, true) call Manivannan Sadhasivam
2024-08-28 17:19 ` Bart Van Assche
2024-08-22 21:36 ` [PATCH v2 7/9] ufs: core: Expand " Bart Van Assche
2024-08-25 5:36 ` Manivannan Sadhasivam
2024-08-22 21:36 ` [PATCH v2 8/9] ufs: core: Move the MCQ scsi_add_host() call Bart Van Assche
2024-08-25 5:38 ` Manivannan Sadhasivam
2024-08-22 21:36 ` [PATCH v2 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=20240822213645.1125016-7-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