i2c: davinci: fix the cpufreq transition
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 22 Jan 2018 14:42:58 +0000 (15:42 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Wed, 24 Jan 2018 06:14:59 +0000 (07:14 +0100)
commit19cfcafd7f0fa7a672f0ac5146e2ff38594497b0
treeb052f7a036c236bdf70674bef6a60671752df124
parent5bacb56b2b56283ab26fea9e15f06ebe27afbe3d
i2c: davinci: fix the cpufreq transition

i2c_davinci_cpufreq_transition() is implemented in a way that will
block if it ever gets called while no transfer is in progress.

Not only that, but reinit_completion() is never called for xfr_complete.

Use the fact that cpufreq uses an srcu_notifier (running in process
context) for transitions and that the bus_lock is taken during the call
to master_xfer() and simplify the code by removing the transfer
completion entirely and protecting i2c_davinci_cpufreq_transition()
with i2c_lock/unlock_adapter().

Reported-by: David Lechner <david@lechnology.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-davinci.c