Commit 0ae7a027 authored by Manivannan Sadhasivam's avatar Manivannan Sadhasivam Committed by Martin K. Petersen

scsi: ufs: qcom: Export ufshcd_{enable/disable}_irq helpers and make use of them

Instead of duplicating the enable/disable IRQ part, let's export the
helpers available in ufshcd driver and make use of them. This also fixes
the possible redundant IRQ disable before asserting reset (when IRQ was
already disabled).

Fixes: 4a791574 ("scsi: ufs: ufs-qcom: Disable interrupt in reset path")
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20231208065902.11006-7-manivannan.sadhasivam@linaro.org
Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d42d3686
...@@ -289,21 +289,23 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, ...@@ -289,21 +289,23 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba,
static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba);
static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba);
static inline void ufshcd_enable_irq(struct ufs_hba *hba) void ufshcd_enable_irq(struct ufs_hba *hba)
{ {
if (!hba->is_irq_enabled) { if (!hba->is_irq_enabled) {
enable_irq(hba->irq); enable_irq(hba->irq);
hba->is_irq_enabled = true; hba->is_irq_enabled = true;
} }
} }
EXPORT_SYMBOL_GPL(ufshcd_enable_irq);
static inline void ufshcd_disable_irq(struct ufs_hba *hba) void ufshcd_disable_irq(struct ufs_hba *hba)
{ {
if (hba->is_irq_enabled) { if (hba->is_irq_enabled) {
disable_irq(hba->irq); disable_irq(hba->irq);
hba->is_irq_enabled = false; hba->is_irq_enabled = false;
} }
} }
EXPORT_SYMBOL_GPL(ufshcd_disable_irq);
static void ufshcd_configure_wb(struct ufs_hba *hba) static void ufshcd_configure_wb(struct ufs_hba *hba)
{ {
......
...@@ -300,8 +300,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) ...@@ -300,8 +300,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
return 0; return 0;
reenable_intr = hba->is_irq_enabled; reenable_intr = hba->is_irq_enabled;
disable_irq(hba->irq); ufshcd_disable_irq(hba);
hba->is_irq_enabled = false;
ret = reset_control_assert(host->core_reset); ret = reset_control_assert(host->core_reset);
if (ret) { if (ret) {
...@@ -324,10 +323,8 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) ...@@ -324,10 +323,8 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
usleep_range(1000, 1100); usleep_range(1000, 1100);
if (reenable_intr) { if (reenable_intr)
enable_irq(hba->irq); ufshcd_enable_irq(hba);
hba->is_irq_enabled = true;
}
return 0; return 0;
} }
......
...@@ -1231,6 +1231,8 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) ...@@ -1231,6 +1231,8 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
ufshcd_writel(hba, tmp, reg); ufshcd_writel(hba, tmp, reg);
} }
void ufshcd_enable_irq(struct ufs_hba *hba);
void ufshcd_disable_irq(struct ufs_hba *hba);
int ufshcd_alloc_host(struct device *, struct ufs_hba **); int ufshcd_alloc_host(struct device *, struct ufs_hba **);
void ufshcd_dealloc_host(struct ufs_hba *); void ufshcd_dealloc_host(struct ufs_hba *);
int ufshcd_hba_enable(struct ufs_hba *hba); int ufshcd_hba_enable(struct ufs_hba *hba);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment