From: Sean Young Date: Sun, 4 Nov 2018 10:12:09 +0000 (-0500) Subject: media: rc: ensure close() is called on rc_unregister_device X-Git-Tag: rel_imx_4.19.35_1.1.0~6823 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=da77b546055c07793c6ae9f6d781d6cb598b7b69;p=linux.git media: rc: ensure close() is called on rc_unregister_device [ Upstream commit 8e782fcf78275f505194e767c515202d4fd274bc ] If userspace has an open file descriptor on the rc input device or lirc device when rc_unregister_device() is called, then the rc close() is never called. This ensures that the receiver is turned off on the nuvoton-cir driver during shutdown. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 8b2c16dd58bd..0f218afdadaa 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1956,6 +1956,8 @@ void rc_unregister_device(struct rc_dev *dev) rc_free_rx_device(dev); mutex_lock(&dev->lock); + if (dev->users && dev->close) + dev->close(dev); dev->registered = false; mutex_unlock(&dev->lock);