• Shinya Kuribayashi's avatar
    i2c-designware: i2c_dw_xfer_msg: Fix error handling procedures · 8f588e40
    Shinya Kuribayashi authored
    Current error handling procedures are not good in two respects:
    
    * Forgot to mark dev->cmd_complete as "completed" on errors
    
      Once an I2C transaction is initiated, wait_for_completion_
      interruptible_timeout() waits for dev->cmd_complete to be completed.
      We have to take care of it whenever an error is detected, otherwise
      we will have a needless HZ timeout.
    
    * Forgot to disable interrupts
    
      In the previous patch, interrupt mask operations have been changed.
      We don't disable interrupts at the end of the interrupt handler any
      more, and try to keep RX_FULL (and TX_EMPTY if required) enabled
      during the transaction so that we can send longer data than the size
      of Tx/Rx FIFO.
    
      If an error is detected, we need to disable interrupts before
      quitting current transaction.
    
    We can work around above points using dev->msg_err effectively.
    Signed-off-by: default avatarShinya Kuribayashi <shinya.kuribayashi@necel.com>
    Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
    8f588e40
i2c-designware.c 20.6 KB