greybus: Fix unbalanced irq_enable() backtrace
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Mon, 23 May 2016 14:01:08 +0000 (15:01 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 23 May 2016 21:49:58 +0000 (14:49 -0700)
commitd7be800f7ae9398055509b3a83d0ea3118e9277f
tree1517143eb0f4e76c054efdc49130dac02c3eec06
parent37f07c0c974d78bfcdc9f3267438c91163fc3ae5
greybus: Fix unbalanced irq_enable() backtrace

Tip-of-tree is exhibiting a backtrace when loading-up the set of greybus
kernel modules due to calling arche_platform_wd_irq_en() directly after a
call to devm_request_threaded_irq().

At the point we call arch_platform_wd_irq_en() the relevant IRQ will
already be enabled. What we want to do in this situation is configure the
GPIO line as an input. This patch fixes the backtrace by supplanting
arche_platform_wd_irq_en() with
gpio_direction_input(arche_pdata->wake_detect_gpio) in
arche_platform_probe().

WARNING: at msm-ara-3.10/kernel/irq/manage.c:457 __enable_irq+0x74/0xc0()
Unbalanced enable for IRQ 687
Modules linked in: gb_arche(O+) gb_camera(O) gb_es2(O) gb_vibrator(O)
gb_raw(O) gb_power_supply(O) gb_loopback(O) gb_light(O) gb_hid(O)
greybus(O)
CPU: 0 PID: 415 Comm: insmod Tainted: G        W  O 3.10.78-g2a4dec8 #65
Call trace:
[<ffffffc000206adc>] dump_backtrace+0x0/0x248
[<ffffffc000206d34>] show_stack+0x10/0x1c
[<ffffffc000c6c698>] dump_stack+0x1c/0x28
[<ffffffc00021c95c>] warn_slowpath_common+0x74/0x9c
[<ffffffc00021c9d0>] warn_slowpath_fmt+0x4c/0x58
[<ffffffc000269d7c>] __enable_irq+0x70/0xc0
[<ffffffc000269e34>] enable_irq+0x68/0x7c
[<ffffffbffc0609b4>] arche_platform_probe+0x3b4/0x4f4 [gb_arche]
[<ffffffc0005ace30>] platform_drv_probe+0x14/0x20
[<ffffffc0005ab980>] driver_probe_device+0x160/0x374
[<ffffffc0005abc40>] __driver_attach+0x60/0x90
[<ffffffc0005aa768>] bus_for_each_dev+0x74/0x94
[<ffffffc0005ab2c4>] driver_attach+0x1c/0x28
[<ffffffc0005aae74>] bus_add_driver+0x124/0x248
[<ffffffc0005ac270>] driver_register+0x94/0x110
[<ffffffc0005ad3c4>] platform_driver_register+0x58/0x64
[<ffffffbffc065020>] $x+0x20/0x58 [gb_arche]
[<ffffffc0002007dc>] do_one_initcall+0xb0/0x14c
[<ffffffc00028252c>] load_module+0x19d0/0x1b18
[<ffffffc00028278c>] SyS_init_module+0x118/0x130

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiermath@linaro.org>
Tested-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/arche-platform.c