Message ID | 20240828174435.2469498-5-bvanassche@acm.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Simplify the UFS driver initialization code | expand |
On Wed, 2024-08-28 at 10:43 -0700, Bart Van Assche wrote: > Call ufshcd_add_scsi_host() after host controller initialization has > completed. This is possible because no code between the old and new > ufshcd_add_scsi_host() call site depends on the scsi_add_host() call. > > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> I don't understand why the first 3 patches can't be combined into this one for easier review. Reviewed-by: Bean Huo <beanhuo@micron.com>
On 9/1/24 6:37 AM, Bean Huo wrote: > I don't understand why the first 3 patches can't be combined into this > one for easier review. Combining patches is easy but I'd like to keep the first four patches separate. I'm following this guidance from Documentation/process/submitting-patches.rst: "Solve only one problem per patch." I don't think that it is possible to follow this rule if I combine any of the first four patches? Thanks, Bart.
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 1b69b370991d..20e00ec5fda8 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10576,10 +10576,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) hba->is_irq_enabled = true; } - err = ufshcd_add_scsi_host(hba); - if (err) - goto out_disable; - /* Reset the attached device */ ufshcd_device_reset(hba); @@ -10591,7 +10587,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) dev_err(hba->dev, "Host controller enable failed\n"); ufshcd_print_evt_hist(hba); ufshcd_print_host_state(hba); - goto free_tmf_queue; + goto out_disable; } /* @@ -10626,6 +10622,10 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) */ ufshcd_set_ufs_dev_active(hba); + err = ufshcd_add_scsi_host(hba); + if (err) + goto out_disable; + async_schedule(ufshcd_async_scan, hba); ufs_sysfs_add_nodes(hba->dev); @@ -10633,12 +10633,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) ufshcd_pm_qos_init(hba); return 0; -free_tmf_queue: - blk_mq_destroy_queue(hba->tmf_queue); - blk_put_queue(hba->tmf_queue); - blk_mq_free_tag_set(&hba->tmf_tag_set); - if (hba->scsi_host_added) - scsi_remove_host(hba->host); out_disable: hba->is_irq_enabled = false; ufshcd_hba_exit(hba);