summaryrefslogtreecommitdiff
path: root/drivers/ufs
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2024-10-16 13:12:06 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2024-10-25 15:30:22 -0400
commit72e979225ed2e9427396e317d33050bcf50ad899 (patch)
tree1c042361d2246c752003beb35e40c385b65e756a /drivers/ufs
parentb6195d02b914ddfddb50e3ceb6b66928ebf0fdb8 (diff)
downloadlwn-72e979225ed2e9427396e317d33050bcf50ad899.tar.gz
lwn-72e979225ed2e9427396e317d33050bcf50ad899.zip
scsi: ufs: core: Move the MCQ scsi_add_host() call
Whether or not MCQ is used, call scsi_add_host() from ufshcd_add_scsi_host(). For MCQ this patch swaps the order of the scsi_add_host() and UFS device initialization. This patch prepares for combining the two scsi_add_host() calls. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20241016201249.2256266-11-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs')
-rw-r--r--drivers/ufs/core/ufshcd.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4103b1c9c388..fd2783623a89 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10344,8 +10344,25 @@ static int ufshcd_add_scsi_host(struct ufs_hba *hba)
{
int err;
- if (!hba->scsi_host_added) {
- WARN_ON_ONCE(is_mcq_supported(hba));
+ if (is_mcq_supported(hba)) {
+ ufshcd_mcq_enable(hba);
+ err = ufshcd_alloc_mcq(hba);
+ if (!err) {
+ ufshcd_config_mcq(hba);
+ } else {
+ /* Continue with SDB mode */
+ ufshcd_mcq_disable(hba);
+ use_mcq_mode = false;
+ dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
+ err);
+ }
+ err = scsi_add_host(hba->host, hba->dev);
+ if (err) {
+ dev_err(hba->dev, "scsi_add_host failed\n");
+ return err;
+ }
+ hba->scsi_host_added = true;
+ } else {
if (!hba->lsdb_sup) {
dev_err(hba->dev,
"%s: failed to initialize (legacy doorbell mode not supported)\n",
@@ -10606,26 +10623,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
if (err)
goto out_disable;
- if (is_mcq_supported(hba)) {
- ufshcd_mcq_enable(hba);
- err = ufshcd_alloc_mcq(hba);
- if (!err) {
- ufshcd_config_mcq(hba);
- } else {
- /* Continue with SDB mode */
- ufshcd_mcq_disable(hba);
- use_mcq_mode = false;
- dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
- err);
- }
- err = scsi_add_host(host, hba->dev);
- if (err) {
- dev_err(hba->dev, "scsi_add_host failed\n");
- goto out_disable;
- }
- hba->scsi_host_added = true;
- }
-
err = ufshcd_post_device_init(hba);
initialized: