Commit 2dc98346 authored by Federico Vaga's avatar Federico Vaga Committed by Wolfram Sang
Browse files

i2c: ocores: do not handle IRQ if IF is not set

If the Interrupt Flag (IF) is not set, we should not handle the IRQ:
- the line can be shared with other devices
- it can be a spurious interrupt

To avoid reading twice the status register, the ocores_process() function
expects it to be read by the caller.

Signed-off-by: default avatarFederico Vaga <>
Acked-by: default avatarPeter Korsgaard <>
Reviewed-by: default avatarAndrew Lunn <>
Signed-off-by: default avatarWolfram Sang <>
parent e7663ef5
......@@ -143,10 +143,9 @@ static inline u8 oc_getreg(struct ocores_i2c *i2c, int reg)
return i2c->getreg(i2c, reg);
static void ocores_process(struct ocores_i2c *i2c)
static void ocores_process(struct ocores_i2c *i2c, u8 stat)
struct i2c_msg *msg = i2c->msg;
u8 stat = oc_getreg(i2c, OCI2C_STATUS);
unsigned long flags;
......@@ -223,8 +222,12 @@ static void ocores_process(struct ocores_i2c *i2c)
static irqreturn_t ocores_isr(int irq, void *dev_id)
struct ocores_i2c *i2c = dev_id;
u8 stat = oc_getreg(i2c, OCI2C_STATUS);
if (!(stat & OCI2C_STAT_IF))
return IRQ_NONE;
ocores_process(i2c, stat);
Supports Markdown
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