i2c: davinci: Refactor i2c_davinci_wait_bus_not_busy()
authorAlexander Sverdlin <alexander.sverdlin@nokia.com>
Tue, 9 Jun 2015 10:58:29 +0000 (12:58 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 10 Jun 2015 13:08:36 +0000 (22:08 +0900)
commit72a956c556b68aa2a9c2c64f5a7b9e50f7bf67e1
tree260c4e159fc217c8c853b7e7c944dd598ec85d06
parentdd1aa2524bc55345ede0b13853c54e1b0be22b9f
i2c: davinci: Refactor i2c_davinci_wait_bus_not_busy()

There are several problems in the function:
- "to_cnt" variable does nothing
- schedule_timeout() call without setting current state does nothing
- "allow_sleep" parameter is not really used

Refactor the function so that it really tries to wait. In case of timeout try
to recover the bus.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-davinci.c