Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3710514imu; Mon, 28 Jan 2019 09:25:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN5XMZRtyLwqOVFE7EXW+1hHiSoLjFDOh/Jk4KZOyGt7T+iSQM4jVqpjzkPp5t/M6DqmLO8x X-Received: by 2002:a65:63d3:: with SMTP id n19mr20835009pgv.179.1548696358458; Mon, 28 Jan 2019 09:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696358; cv=none; d=google.com; s=arc-20160816; b=J32zG9EpPObGGQm7W47b3S1YzJ9mrUVLrY66tn+DY80AiKiXPLi031kwgWhS944okc lrEOVD7jJeiDN2gD5uKEhgDyz0j9cZp1wghQ2+5xjDkvixgqZkkL+vLoQiFTJ7gy1YzM Ylc6pwC5NTqRtTSL5/f2MyY9UghzYOt23Ib2N8cFz8q6P400whs704O+YcvbQ6+sa0LP Zg6my9aeGUEsFhAjcuwwiyKmTL1jfQnzDBKRrr9MmPZELwWRVxTrV+Q68W4uHtsE6Mng gvErAx+JvgXGsqFFJITOItScmkix8+GVoc49VFFePxlZ88ZLqexuXsbTxQo4YDznplUx +igA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XiVTgxt528SS6vRUIgpsNTkMLfV567WrDYQbPeZRAfk=; b=yZJ43ZBPSqlXJKxjXHxX95hNnm361r8xTB6s/Wy4jbacOTW3ZaB78QWCBAJhNnBtUX eSOQ8sbTvw/0ztBkqQb7diTHhTDSbEeNkPiLkMmvjyTyxLhjZGtxIY/kqeI+ho4pas3z sG7lqCJfMbbvMgYSa/2v31eh/Q9JkmuzHsXVkHdSyq60GrOhNwkxJYgehc9GNakV4hga mwEipudnu7pf4UtAswPB1IW47r8n9beqUQSd7iCbKnLLaqAFY8+2JzMaUcDfgY44CrPI DkLLIMHi9mu2i9UqsDsdRdMOiROj/vZQZucNQ3WaHH9cp0jQS6Keltpw7b1jSFaNCGgJ aCbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BxTcDeqM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si34238977pgc.448.2019.01.28.09.25.43; Mon, 28 Jan 2019 09:25:58 -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=BxTcDeqM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731141AbfA1QBz (ORCPT + 99 others); Mon, 28 Jan 2019 11:01:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730467AbfA1QBy (ORCPT ); Mon, 28 Jan 2019 11:01:54 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2133B21852; Mon, 28 Jan 2019 16:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691313; bh=21PtvNerbDQN+aHUgiiVLDyRflbVL/nXsswIpEbRmp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxTcDeqMG1ttM/p7bDlJ3G/pQjzTZuc+QB6UPePwJ06ZiVlVJAnR5Yj7OYF+JkdxL 20Eh6kyOq+CV4+aAc+Tk1tAsOj1/h3Qqwm8o/XDqsFlxYoGSiLinh+I9sKjXs9+ShS 1ou5rvmEZmAjak/jt3iRrzrxY9Giw9k/XhTzrvrs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sean Young , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 055/258] media: rc: ensure close() is called on rc_unregister_device Date: Mon, 28 Jan 2019 10:56:01 -0500 Message-Id: <20190128155924.51521-55-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Young [ 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 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); -- 2.19.1