msm_serial_hs: Call clk_set_rate() from non-atomic context
By default, HSUART Core CLK frequency is set to 7.37MHz. With this
CLK Frequency, it is not possible to get higher baud rate of 3.2 or
4 Mbps. Hence to set higher baud rate, driver calls clk_set_rate()
to set HSUART Core CLK frequency as ( required baud_rate * 16 ).
clk_set_rate() shouldn't be call from atomic context otherwise below
BUG is seen.
BUG: sleeping function called from invalid context at
mutex.c:85 in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: init
[<c00151c4>] (unwind_backtrace+0x0/0x12c) from
[<c07aebbc>] (mutex_lock+0x18/0x3c)
[<c07aebbc>] (mutex_lock+0x18/0x3c) from
[<c0021258>] (clk_set_rate+0x2c/0x178)
[<c0021258>] (clk_set_rate+0x2c/0x178) from
[<c0364a34>] (msm_hs_set_termios+0x820/0xb9c)
[<c0364a34>] (msm_hs_set_termios+0x820/0xb9c)
from [<c0362170>] (uart_change_speed+0x90/0x94)
[<c0362170>] (uart_change_speed+0x90/0x94)
from [<c03626c0>] (uart_startup+0xc8/0x1a0)
[<c03626c0>] (uart_startup+0xc8/0x1a0)
from [<c0363534>] (uart_open+0xe4/0x13c)
[<c0363534>] (uart_open+0xe4/0x13c)
from [<c0343d64>] (tty_open+0x360/0x4ec)
[<c0343d64>] (tty_open+0x360/0x4ec)
from [<c013787c>] (chrdev_open+0x114/0x134)
[<c013787c>] (chrdev_open+0x114/0x134)
from [<c0132844>] (__dentry_open+0x190/0x29c)
[<c0132844>] (__dentry_open+0x190/0x29c)
from [<c0132a00>] (nameidata_to_filp+0x50/0x5c)
[<c0132a00>] (nameidata_to_filp+0x50/0x5c)
from [<c0141b08>] (do_last+0x7ec/0x928)
[<c0141b08>] (do_last+0x7ec/0x928)
from [<c0141d08>] (path_openat+0xc4/0x390)
[<c0141d08>] (path_openat+0xc4/0x390)
from [<c01420b4>] (do_filp_open+0x30/0x7c)
[<c01420b4>] (do_filp_open+0x30/0x7c)
from [<c0132518>] (do_sys_open+0xd8/0x174)
[<c0132518>] (do_sys_open+0xd8/0x174)
from [<c000e380>] (ret_fast_syscall+0x0/0x30)
Hence use mutex to protect msm_set_termios() allowing clk_set_rate()
to be called from non-atomic context.
Change-Id: I92073aaf0c80a9a432c47d42286d9a130cf5172c
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
1 file changed