gpio: s32: don't run callbacks in some callbacks
The functions "siul2_gpio_dir_in" and "siul2_gpio_free" have been registered to be callbacks as "gc->direction_input" and "gc->free". When the callbacks "irq_chip->irq_set_type/irq_unmask/irq_mask" are called, the caller should guarantee that it will call gc->direction_input and gc->free explicitly instead of counting on irq_set_type/irq_unmask/irq_mask to do this. So let's remove calling of the callbacks from callbacks to avoid calling them multiple times. This patch fixes the calltrace as below: [ 904.363150] BUG: sleeping function called from invalid context at kernel/locking/rtmutex_api.c:510 [ 904.363174] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1246, name: gpiomon [ 904.363181] preempt_count: 1, expected: 0 [ 904.363186] RCU nest depth: 0, expected: 0 [ 904.363190] 2 locks held by gpiomon/1246: [ 904.363195] #0: ffffff8812162ac8 (request_class){..}-{3:3}, at: __setup_irq+0xbc/0x754 [ 904.363232] #1: ffffff8812162900 (lock_class){....}-{2:2}, at: _raw_spin_lock_irqsave+0x1c/0x30 [ 904.363256] irq event stamp: 23554 [ 904.363259] hardirqs last enabled at (23553): [<ffffffc008ff4ae8>] _raw_spin_unlock_irqrestore+0xb8/0xe0 [ 904.363270] hardirqs last disabled at (23554): [<ffffffc0080cf878>] __raw_spin_lock_irqsave+0x114/0x15c [ 904.363283] softirqs last enabled at (15992): [<ffffffc008051a04>] __local_bh_enable_ip+0xa4/0x2a0 [ 904.363297] softirqs last disabled at (15980): [<ffffffc008d1e93c>] release_sock+0xc/0x100 [ 904.363311] Preemption disabled at: [ 904.363314] [<ffffffc0080cf7a0>] __raw_spin_lock_irqsave+0x3c/0x15c [ 904.363329] CPU: 2 PID: 1246 Comm: gpiomon Not tainted 5.15.58-rt48-yocto-preempt-rt #1 [ 904.363339] Hardware name: Aptiv S32G274 CVC (DT) [ 904.363343] Call trace: [ 904.363346] dump_backtrace+0x0/0x1b4 [ 904.363354] show_stack+0x24/0x30 [ 904.363361] dump_stack_lvl+0xb0/0xf4 [ 904.363371] dump_stack+0x18/0x34 [ 904.363378] __might_resched+0x18c/0x22c [ 904.363389] __might_sleep+0x54/0x90 [ 904.363396] mutex_lock_nested+0x5c/0xd0 [ 904.363406] pinctrl_get_device_gpio_range+0x48/0x120 [ 904.363418] pinctrl_gpio_direction+0x40/0xd0 [ 904.363426] pinctrl_gpio_direction_input+0x20/0x30 [ 904.363434] siul2_gpio_dir_in+0x34/0x90 [ 904.363443] siul2_gpio_irq_set_type+0x40/0x1a4 [ 904.363450] __irq_set_trigger+0x6c/0x190 [ 904.363456] __setup_irq+0x2b8/0x754 [ 904.363462] request_threaded_irq+0xf8/0x1bc [ 904.363469] lineevent_create+0x294/0x3e0 [ 904.363480] gpio_ioctl+0x31c/0x3a0 [ 904.363489] __arm64_sys_ioctl+0xb4/0xfc [ 904.363500] invoke_syscall+0x5c/0x130 [ 904.363511] el0_svc_common.constprop.0+0x68/0x124 [ 904.363520] do_el0_svc+0x50/0xbc [ 904.363529] el0_svc+0x54/0x130 [ 904.363536] el0t_64_sync_handler+0xa4/0x130 [ 904.363544] el0t_64_sync+0x1a0/0x1a4 Signed-off-by:Quanyang Wang <quanyang.wang@windriver.com> Signed-off-by:
Zhantao Tang <zhantao.tang@windriver.com> Signed-off-by:
Bruce Ashfield <bruce.ashfield@gmail.com>
Loading
Please register or sign in to comment