diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2017-03-25 16:14:08 +0300 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-03-30 18:31:29 +0300 |
commit | cda816d163e08abb698f10ec32aa2d173ad93e7f (patch) | |
tree | 03b9791ebb63b422b68f419baa8bffe142a2a24a /drivers/i2c | |
parent | 3911764cfbe7f5d229498d818aa2eff6e5611da8 (diff) | |
download | linux-cda816d163e08abb698f10ec32aa2d173ad93e7f.tar.xz |
i2c: meson: improve and simplify interrupt handler
The preceding changes in this patch series now allow to simplify
the interrupt handler significantly.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-meson.c | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c index be9f83bd92fc..88d15b92ec35 100644 --- a/drivers/i2c/busses/i2c-meson.c +++ b/drivers/i2c/busses/i2c-meson.c @@ -242,41 +242,21 @@ static irqreturn_t meson_i2c_irq(int irqno, void *dev_id) goto out; } - switch (i2c->state) { - case STATE_READ: - if (i2c->count > 0) { - meson_i2c_get_data(i2c, i2c->msg->buf + i2c->pos, - i2c->count); - i2c->pos += i2c->count; - } - - if (i2c->pos >= i2c->msg->len) { - i2c->state = STATE_IDLE; - complete(&i2c->done); - break; - } - - meson_i2c_prepare_xfer(i2c); - break; - case STATE_WRITE: - i2c->pos += i2c->count; + if (i2c->state == STATE_READ && i2c->count) + meson_i2c_get_data(i2c, i2c->msg->buf + i2c->pos, i2c->count); - if (i2c->pos >= i2c->msg->len) { - i2c->state = STATE_IDLE; - complete(&i2c->done); - break; - } + i2c->pos += i2c->count; - meson_i2c_prepare_xfer(i2c); - break; + if (i2c->pos >= i2c->msg->len) { + i2c->state = STATE_IDLE; + complete(&i2c->done); + goto out; } + /* Restart the processing */ + meson_i2c_prepare_xfer(i2c); + meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, REG_CTRL_START); out: - if (i2c->state != STATE_IDLE) - /* Restart the processing */ - meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, - REG_CTRL_START); - spin_unlock(&i2c->lock); return IRQ_HANDLED; |