diff options
Diffstat (limited to 'hw/i2c/omap_i2c.c')
-rw-r--r-- | hw/i2c/omap_i2c.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c index d63278dbde..b6f544a221 100644 --- a/hw/i2c/omap_i2c.c +++ b/hw/i2c/omap_i2c.c @@ -171,9 +171,13 @@ static uint32_t omap_i2c_read(void *opaque, hwaddr addr) case 0x0c: /* I2C_IV */ if (s->revision >= OMAP2_INTR_REV) break; - ret = ffs(s->stat & s->mask); - if (ret) - s->stat ^= 1 << (ret - 1); + ret = ctz32(s->stat & s->mask); + if (ret != 32) { + s->stat ^= 1 << ret; + ret++; + } else { + ret = 0; + } omap_i2c_interrupts_update(s); return ret; |