From patchwork Mon Nov 16 19:51:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7630441 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 284F49F2EC for ; Mon, 16 Nov 2015 19:54:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53FFD2058A for ; Mon, 16 Nov 2015 19:54:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20078205B6 for ; Mon, 16 Nov 2015 19:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809AbbKPTyG (ORCPT ); Mon, 16 Nov 2015 14:54:06 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36936 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbbKPTyC (ORCPT ); Mon, 16 Nov 2015 14:54:02 -0500 Received: by wmww144 with SMTP id w144so135105307wmw.0 for ; Mon, 16 Nov 2015 11:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=VwUNc57HYX5IwRwgjNonii2H0UkunUNrsI699krvi0I=; b=mgF08a8jXwvtskqbEjgaopkCvbqJr3XQ87KvwrM/+aea2xExSUkyono/tfTFfdXNcE o7kG+q3usnz5Mz51ozG3goVKG4i9AfnCZKEHezSgBP2COmtoUtM12WFiDVwLjqAkWWVN B1v2YnN1dS0dyJ6ALH649XzRzKtWY4rDZAVO9UYBq0iBA4JEXEmmYLwD1DzYbXShDIfo C70IGuaq7kd8MZxLLw1K0i69UvGS22kRPotT8+DHXtsxSsAVWPQgl+q5YNQipFDhdMD7 +xbkfELuPTIfZYlR4OuKHumnfIJrk232RV88C5rXxZ5KntERNH7v9BFVjyOrmvuxsPBg +C+A== X-Received: by 10.28.13.78 with SMTP id 75mr21990166wmn.24.1447703641295; Mon, 16 Nov 2015 11:54:01 -0800 (PST) Received: from ?IPv6:2003:62:5f55:ba00:2914:ea82:f3d7:fe39? (p200300625F55BA002914EA82F3D7FE39.dip0.t-ipconnect.de. [2003:62:5f55:ba00:2914:ea82:f3d7:fe39]) by smtp.googlemail.com with ESMTPSA id 5sm6399400wmx.23.2015.11.16.11.54.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2015 11:54:00 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 1/8] media: rc: fix decoder module unloading To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, =?UTF-8?Q?David_H=c3=a4rdeman?= Message-ID: <564A33DC.90809@gmail.com> Date: Mon, 16 Nov 2015 20:51:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, if a decoder module is unloadad, the respective protocol is still shown as enabled (if it was enabled before). Fix this by resetting the respective protocol bits if a decoder module is unloaded. Signed-off-by: Heiner Kallweit --- drivers/media/rc/rc-ir-raw.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index ad26052..5cfb61f 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c @@ -246,6 +246,14 @@ static int change_protocol(struct rc_dev *dev, u64 *rc_type) return 0; } +static void ir_raw_disable_protocols(struct rc_dev *dev, u64 protocols) +{ + mutex_lock(&dev->lock); + dev->enabled_protocols &= ~protocols; + dev->enabled_wakeup_protocols &= ~protocols; + mutex_unlock(&dev->lock); +} + /* * Used to (un)register raw event clients */ @@ -337,13 +345,16 @@ EXPORT_SYMBOL(ir_raw_handler_register); void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) { struct ir_raw_event_ctrl *raw; + u64 protocols = ir_raw_handler->protocols; mutex_lock(&ir_raw_handler_lock); list_del(&ir_raw_handler->list); - if (ir_raw_handler->raw_unregister) - list_for_each_entry(raw, &ir_raw_client_list, list) + list_for_each_entry(raw, &ir_raw_client_list, list) { + ir_raw_disable_protocols(raw->dev, protocols); + if (ir_raw_handler->raw_unregister) ir_raw_handler->raw_unregister(raw->dev); - available_protocols &= ~ir_raw_handler->protocols; + } + available_protocols &= ~protocols; mutex_unlock(&ir_raw_handler_lock); } EXPORT_SYMBOL(ir_raw_handler_unregister);