[PATCH 1/3] i2c: designware: avoid race with interrupt handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The interrupt handler dw_i2c_isr may be racing with i2c_dw_xfer_init.
Use disable_irq/enable_irq when setting up the adapter.

Cc: Ben Gardner <gardner.ben@xxxxxxxxx>
Cc: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
Signed-off-by: Alexander Monakov <amonakov@xxxxxxxxx>
---
 drivers/i2c/busses/i2c-designware-master.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index fd36c39ddf4e..e7fd0e57ab1f 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -181,6 +181,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 
 	/* Disable the adapter */
 	__i2c_dw_enable_and_wait(dev, false);
+	disable_irq(dev->irq);
 
 	/* If the slave address is ten bit address, enable 10BITADDR */
 	ic_con = dw_readl(dev, DW_IC_CON);
@@ -214,6 +215,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
 	/* Clear and enable interrupts */
 	dw_readl(dev, DW_IC_CLR_INTR);
 	dw_writel(dev, DW_IC_INTR_MASTER_MASK, DW_IC_INTR_MASK);
+	enable_irq(dev->irq);
 }
 
 /*
-- 
2.11.0




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux