Skip to content

Commit d402b20

Browse files
ahunter6martinkpetersen
authored andcommitted
scsi: ufs: core: Do not write interrupt enable register unnecessarily
Write a new value to the interrupt enable register only if it is different from the old value, thereby saving a register write operation. Signed-off-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent b4c0cab commit d402b20

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,11 @@ EXPORT_SYMBOL_GPL(ufshcd_disable_irq);
371371
*/
372372
static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
373373
{
374-
u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
374+
u32 old_val = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
375+
u32 new_val = old_val | intrs;
375376

376-
set |= intrs;
377-
ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE);
377+
if (new_val != old_val)
378+
ufshcd_writel(hba, new_val, REG_INTERRUPT_ENABLE);
378379
}
379380

380381
/**
@@ -384,10 +385,11 @@ static void ufshcd_enable_intr(struct ufs_hba *hba, u32 intrs)
384385
*/
385386
static void ufshcd_disable_intr(struct ufs_hba *hba, u32 intrs)
386387
{
387-
u32 set = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
388+
u32 old_val = ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
389+
u32 new_val = old_val & ~intrs;
388390

389-
set &= ~intrs;
390-
ufshcd_writel(hba, set, REG_INTERRUPT_ENABLE);
391+
if (new_val != old_val)
392+
ufshcd_writel(hba, new_val, REG_INTERRUPT_ENABLE);
391393
}
392394

393395
static void ufshcd_configure_wb(struct ufs_hba *hba)

0 commit comments

Comments
 (0)