can: c_can: don't call pm_runtime_get_sync() from interrupt context
authorMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 24 Nov 2013 22:31:24 +0000 (23:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Dec 2013 06:36:26 +0000 (22:36 -0800)
commit4563588ce57080fc18ead503e5012a11d1e6eea8
tree74b5cdbcdf572bab49709c3dfa722e89569ddada
parentbd56b24db9050289af0b4b6e5bfecc3a9e2fb400
can: c_can: don't call pm_runtime_get_sync() from interrupt context

commit e35d46adc49b469fd92bdb64fea8af93640e6651 upstream.

The c_can driver contians a callpath (c_can_poll -> c_can_state_change ->
c_can_get_berr_counter) which may call pm_runtime_get_sync() from the IRQ
handler, which is not allowed and results in "BUG: scheduling while atomic".

This problem is fixed by introducing __c_can_get_berr_counter, which will not
call pm_runtime_get_sync().

Reported-by: Andrew Glen <AGlen@bepmarine.com>
Tested-by: Andrew Glen <AGlen@bepmarine.com>
Signed-off-by: Andrew Glen <AGlen@bepmarine.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/c_can/c_can.c