Hello Linus Walleij-san
We have tested Linux upstream v4.6-rc2 on Renesas's Lager board.
When we tried to unbind the e6051000.gpio, the following warning
messages occurs:
"root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar# echo
e6051000.gpio > unbind
[ 241.511034] ------------[ cut here ]------------
[ 241.525054] WARNING: CPU: 0 PID: 2104 at fs/proc/generic.c:575
remove_proc_entry+0x13c/0x160
[ 241.550456] remove_proc_entry: removing non-empty directory
'irq/169', leaking at least '6-0039'
[ 241.576900] CPU: 0 PID: 2104 Comm: bash Not tainted 4.6.0-rc2-dirty #69
[ 241.596734] Hardware name: Generic R8A7790 (Flattened Device Tree)
[ 241.615261] Backtrace:
[ 241.622646] [<c010aa08>] (dump_backtrace) from [<c010abb0>]
(show_stack+0x18/0x1c)
[ 241.645342] r7:c022321c r6:00000009 r5:60050013 r4:00000000
...."
And we found a patch between v4.5 and v4.6-rc2 that causing of this issue.
The patch is "ff2b1359 gpio: make the gpiochip a real device"
Tested by: LE MINH DUC <lm-duc@xxxxxxxxxxx>.
In case of "git revert" this patch, this issue will disappear.
Please have a look at this patch and fixing this issue.
Best regards,
Jinso/Cao Minh Hiep.
root@linaro-nano:~# cd /sys/bus/platform/drivers/gpio-keys; ls -d keyboard
keyboard
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys# echo keyboard > unbind
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys# cd /sys/bus/platform/drivers/gpio_rcar; ls -d e6051000.gpio
e6051000.gpio
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar# echo e6051000.gpio > unbind
[ 241.511034] ------------[ cut here ]------------
[ 241.525054] WARNING: CPU: 0 PID: 2104 at fs/proc/generic.c:575 remove_proc_entry+0x13c/0x160
[ 241.550456] remove_proc_entry: removing non-empty directory 'irq/169', leaking at least '6-0039'
[ 241.576900] CPU: 0 PID: 2104 Comm: bash Not tainted 4.6.0-rc2-dirty #69
[ 241.596734] Hardware name: Generic R8A7790 (Flattened Device Tree)
[ 241.615261] Backtrace:
[ 241.622646] [<c010aa08>] (dump_backtrace) from [<c010abb0>] (show_stack+0x18/0x1c)
[ 241.645342] r7:c022321c r6:00000009 r5:60050013 r4:00000000
[ 241.662432] [<c010ab98>] (show_stack) from [<c0310cb4>] (dump_stack+0x84/0xa4)
[ 241.684100] [<c0310c30>] (dump_stack) from [<c011d32c>] (__warn+0xd4/0x104)
[ 241.704970] r5:00000000 r4:ef38fd08
[ 241.715747] [<c011d258>] (__warn) from [<c011d39c>] (warn_slowpath_fmt+0x40/0x48)
[ 241.738180] r9:000be408 r8:ef38ff80 r7:c0a62254 r6:ef0f6680 r5:ef0f66d9 r4:ee4a3780
[ 241.761539] [<c011d360>] (warn_slowpath_fmt) from [<c022321c>] (remove_proc_entry+0x13c/0x160)
[ 241.787351] r3:c070ecc0 r2:c0835169
[ 241.798089] [<c02230e0>] (remove_proc_entry) from [<c0162654>] (unregister_irq_proc+0x94/0xb8)
[ 241.823891] r7:000000a9 r6:000000a9 r5:c0a57df4 r4:eeb1d180
[ 241.840913] [<c01625c0>] (unregister_irq_proc) from [<c015af8c>] (free_desc+0x2c/0x60)
[ 241.864631] r6:c0a0a7c0 r5:c0a0a7cc r4:eeb1d180
[ 241.878509] [<c015af60>] (free_desc) from [<c015b128>] (irq_free_descs+0x48/0x7c)
[ 241.900926] r7:000000aa r6:00000001 r5:000000aa r4:000000a9
[ 241.917948] [<c015b0e0>] (irq_free_descs) from [<c016131c>] (irq_dispose_mapping+0x50/0x58)
[ 241.942969] r7:c0a1c9e8 r6:0000000f r5:ee487400 r4:000000a9
[ 241.959990] [<c01612cc>] (irq_dispose_mapping) from [<c033c3ac>] (gpiochip_remove+0x78/0x134)
[ 241.985532] r5:ee487400 r4:ee48761c
[ 241.996269] [<c033c334>] (gpiochip_remove) from [<c033f9a8>] (gpio_rcar_remove+0x1c/0x30)
[ 242.020768] r7:c0a1c9e8 r6:c0a12cc8 r5:ef1cf210 r4:ef1cf200
[ 242.037785] [<c033f98c>] (gpio_rcar_remove) from [<c03e1bd4>] (platform_drv_remove+0x2c/0x44)
[ 242.063327] r5:ef1cf210 r4:ef1cf210
[ 242.074061] [<c03e1ba8>] (platform_drv_remove) from [<c03e09c4>] (__device_release_driver+0x9c/0x110)
[ 242.101686] r5:c0a12cc8 r4:ef1cf210
[ 242.112417] [<c03e0928>] (__device_release_driver) from [<c03e0ab4>] (device_release_driver+0x24/0x30)
[ 242.140301] r5:ef1cf210 r4:ef1cf244
[ 242.151036] [<c03e0a90>] (device_release_driver) from [<c03def0c>] (unbind_store+0x60/0x94)
[ 242.176055] r5:ef1cf210 r4:0000000e
[ 242.186788] [<c03deeac>] (unbind_store) from [<c03de88c>] (drv_attr_store+0x2c/0x38)
[ 242.209984] r7:ee82204c r6:ee822040 r5:ee822940 r4:0000000e
[ 242.227002] [<c03de860>] (drv_attr_store) from [<c022d680>] (sysfs_kf_write+0x40/0x4c)
[ 242.250723] [<c022d640>] (sysfs_kf_write) from [<c022cd14>] (kernfs_fop_write+0x13c/0x1a0)
[ 242.275488] [<c022cbd8>] (kernfs_fop_write) from [<c01d2150>] (__vfs_write+0x34/0xdc)
[ 242.298945] r10:00000000 r9:ef38e000 r8:c0107064 r7:0000000e r6:ef38ff80 r5:c022cbd8
[ 242.322485] r4:edeb6840
[ 242.330074] [<c01d211c>] (__vfs_write) from [<c01d2374>] (vfs_write+0xb4/0x13c)
[ 242.351967] r7:ef38ff80 r6:000be408 r5:edeb6840 r4:0000000e
[ 242.368980] [<c01d22c0>] (vfs_write) from [<c01d24dc>] (SyS_write+0x50/0x90)
[ 242.390094] r9:ef38e000 r8:c0107064 r7:0000000e r6:000be408 r5:edeb6840 r4:edeb6840
[ 242.413375] [<c01d248c>] (SyS_write) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)
[ 242.436051] r7:00000004 r6:b6ef6b58 r5:000be408 r4:0000000e
[ 242.453202] ---[ end trace 34483a4a0b11769a ]---
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar#
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar#
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar# ls -d e6051000.gpio
ls: cannot access e6051000.gpio: No such file or directory
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar# echo e6051000.gpio > bind
[ 262.882338] gpio_rcar e6051000.gpio: driving 30 GPIOs
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar#
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar# cd /sys/bus/platform/drivers/gpio-keys; ls -d keyboard
ls: cannot access keyboard: No such file or directory
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys# echo keyboard > bind
[ 283.972000] input: keyboard as /devices/platform/keyboard/input/input1
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys# ls -d keyboard
keyboard
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys#
root@linaro-nano:/sys/bus/platform/drivers/gpio-keys# cd /sys/bus/platform/drivers/gpio_rcar; ls -d e6051000.gpio
e6051000.gpio
root@linaro-nano:/sys/bus/platform/drivers/gpio_rcar#