Hi Shimoda-san, On Tue, Mar 12, 2019 at 4:17 AM Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote: > From: Phong Hoang <phong.hoang.wz@xxxxxxxxxxx> > > This patch fixes deadlock warning if removing PWM device > when CONFIG_PROVE_LOCKING is enabled. > > This issue can be reproceduced by the following steps on > the R-Car H3 Salvator-X board if the backlight is disabled: > > # cd /sys/class/pwm/pwmchip0 > # echo 0 > export > # ls > device export npwm power pwm0 subsystem uevent unexport > # cd device/driver > # ls > bind e6e31000.pwm uevent unbind > # echo e6e31000.pwm > unbind > > [ 87.659974] ====================================================== > [ 87.666149] WARNING: possible circular locking dependency detected > [ 87.672327] 5.0.0 #7 Not tainted [...] > This warning occurs because pwmchip_remove still keeps pwm_lock > when removing sysfs. That's why it leads to that conflict. > Hence, this patch unlocks pwm_lock before removing sysfs. > Also, pwmchip_sysfs_export() doesn't seem to need the pwm_lock > held so that to achieve consistance between export and > unexport this patch also modifies it. > > Signed-off-by: Phong Hoang <phong.hoang.wz@xxxxxxxxxxx> > [shimoda: revise the commit log and code] > Fixes: 76abbdde2d95 ("pwm: Add sysfs interface") > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> > Tested-by: Hoan Nguyen An <na-hoan@xxxxxxxxxxx> Thanks for your patch! Looks good to me: class_find_device() seems to use its own locking in the class to protect against concurrent modification. Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds