Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2772347imj; Mon, 11 Feb 2019 08:14:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ79+D4BhvuPJ+sznSYyDpmI2ny8IGpyJMg8jybtt9WoKZdE43Scd/3z3EBrU07XuYt+7lD X-Received: by 2002:a63:6184:: with SMTP id v126mr6181965pgb.277.1549901653259; Mon, 11 Feb 2019 08:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901653; cv=none; d=google.com; s=arc-20160816; b=OPz59y03/EPMCNMDhRmY57AtHhu+E4Cs6YMLtrIR3NnteH7pLsQz7aF7mo7oEGeybe +/h/89NbUdecmCIrMckM/Xwj9sZDd0BZrSxOlKnvifA4eTHC9GZNzbW+5ZOgrBK9cWKK N9d8wMPJZm4YEmShttVzYfX4FgAcavv/9XhGHLy6IJBcmcyf9EvrHY/lvUgBNnjSo/3i TaddmQn50HynSyRs5oNKCJXC+wdox77eHH9aKt3ygHbsLbvHeVtMMLHH3ikRM0RNAq9O TibEzVluxEWceAB+7Zu8+ZSedyfAH0wuFHjJC/HnayGY/GqvOh8Sk0Bgue87sS8wQJe0 pqgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uBgdJKUbzNtQN11rNsc+jJuGyvzU8VCd8nOidLyVqxs=; b=tF+RQgC1bvNAp7sFtu7WeygTtcg6tCrps9K5HpOln/GGqAyOJxLE+5Uehiy8AMpopH hZY8n7V7j/Bbo/Ii/OD77CWXykdfd8XMbhSN6XnyQIwPt75393vDsV5vDZezvvn5k40S 0R6OE5hLN+fReW71xptMkDIg6Lp6NyMp29HRDYP7ccYIvtuPderY58EJpr6Vgwa6jGZS 5LFHAX+3OdAdEIJHdZSZCSmgHgdlKZ+/9S1Tm++HU4BsP9sWlLU+DKWmNRkoW6Lbpmha GZMiBhlrRs/jlZvDTyq7IACeZt35biyqR3AiJPsi632aVtwCfbXxjx94xR2pDboc5lrh 1FGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PO28vPtq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si10243095pls.367.2019.02.11.08.13.55; Mon, 11 Feb 2019 08:14:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PO28vPtq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729368AbfBKQMU (ORCPT + 99 others); Mon, 11 Feb 2019 11:12:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:56288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727916AbfBKOXQ (ORCPT ); Mon, 11 Feb 2019 09:23:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D1D320844; Mon, 11 Feb 2019 14:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894995; bh=OtqeTX0dvTwVTKlDl4YPvyYx0U5AVhCQ4FTUHB/D1ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PO28vPtqzgdPYYQHcpoZWNQm1l2hHhM16qGDcpYv7TP4szREUxBKE+DPACX7ev8Ye 5Pil8KTnuH/iOxmdyPQqzrfjUqRl/9O4ZoAX21w4GYY42RsfQ8OpCEtRCaXLMFdFse Ar9swWmVZ00mkqnuvLNUZB1Lty8HOIufXNov4jjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.20 057/352] media: rc: ensure close() is called on rc_unregister_device Date: Mon, 11 Feb 2019 15:14:44 +0100 Message-Id: <20190211141849.795974357@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 --- drivers/media/rc/rc-main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 877978dbd409..66a174979b3c 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1952,6 +1952,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); -- 2.19.1