Commit 190d20e8 authored by Yicong Yang's avatar Yicong Yang Committed by lujunhua
Browse files

i2c: hisi: Avoid redundant interrupts

mainline inclusion
from mainline-v6.3-rc4
commit cc9812a3
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6P4DV
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc9812a3096d1986caca9a23bee99effc45c08df



----------------------------------------------------------------------

After issuing all the messages we can disable the TX_EMPTY interrupts
to avoid handling redundant interrupts. For doing a sinlge bus
detection (i2cdetect -y -r 0) we can reduce ~97% interrupts (before
~12000 after ~400).

Signed-off-by: default avatarSheng Feng <fengsheng5@huawei.com>
Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
Signed-off-by: default avatarlujunhua <lujunhua7@h-partners.com>
parent ae344b95
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -320,6 +320,13 @@ static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
		    max_write == 0)
			break;
	}

	/*
	 * Disable the TX_EMPTY interrupt after finishing all the messages to
	 * avoid overwhelming the CPU.
	 */
	if (ctlr->msg_tx_idx == ctlr->msg_num)
		hisi_i2c_disable_int(ctlr, HISI_I2C_INT_TX_EMPTY);
}

static irqreturn_t hisi_i2c_irq(int irq, void *context)