Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Bart Van Assche and committed by
Martin K. Petersen
72e97922 b6195d02

+19 -22
+19 -22
drivers/ufs/core/ufshcd.c
··· 10344 10344 { 10345 10345 int err; 10346 10346 10347 - if (!hba->scsi_host_added) { 10348 - WARN_ON_ONCE(is_mcq_supported(hba)); 10347 + if (is_mcq_supported(hba)) { 10348 + ufshcd_mcq_enable(hba); 10349 + err = ufshcd_alloc_mcq(hba); 10350 + if (!err) { 10351 + ufshcd_config_mcq(hba); 10352 + } else { 10353 + /* Continue with SDB mode */ 10354 + ufshcd_mcq_disable(hba); 10355 + use_mcq_mode = false; 10356 + dev_err(hba->dev, "MCQ mode is disabled, err=%d\n", 10357 + err); 10358 + } 10359 + err = scsi_add_host(hba->host, hba->dev); 10360 + if (err) { 10361 + dev_err(hba->dev, "scsi_add_host failed\n"); 10362 + return err; 10363 + } 10364 + hba->scsi_host_added = true; 10365 + } else { 10349 10366 if (!hba->lsdb_sup) { 10350 10367 dev_err(hba->dev, 10351 10368 "%s: failed to initialize (legacy doorbell mode not supported)\n", ··· 10622 10605 err = ufshcd_device_params_init(hba); 10623 10606 if (err) 10624 10607 goto out_disable; 10625 - 10626 - if (is_mcq_supported(hba)) { 10627 - ufshcd_mcq_enable(hba); 10628 - err = ufshcd_alloc_mcq(hba); 10629 - if (!err) { 10630 - ufshcd_config_mcq(hba); 10631 - } else { 10632 - /* Continue with SDB mode */ 10633 - ufshcd_mcq_disable(hba); 10634 - use_mcq_mode = false; 10635 - dev_err(hba->dev, "MCQ mode is disabled, err=%d\n", 10636 - err); 10637 - } 10638 - err = scsi_add_host(host, hba->dev); 10639 - if (err) { 10640 - dev_err(hba->dev, "scsi_add_host failed\n"); 10641 - goto out_disable; 10642 - } 10643 - hba->scsi_host_added = true; 10644 - } 10645 10608 10646 10609 err = ufshcd_post_device_init(hba); 10647 10610