From patchwork Mon Dec 1 12:55:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 5412211 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5A85A9F319 for ; Mon, 1 Dec 2014 12:55:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A679920120 for ; Mon, 1 Dec 2014 12:55:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4DA8C20263 for ; Mon, 1 Dec 2014 12:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbaLAMzX (ORCPT ); Mon, 1 Dec 2014 07:55:23 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:38625 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbaLAMzW (ORCPT ); Mon, 1 Dec 2014 07:55:22 -0500 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 7032C4585728E; Mon, 1 Dec 2014 12:55:18 +0000 (GMT) Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 1 Dec 2014 12:55:20 +0000 Received: from jhogan-linux.le.imgtec.org (192.168.154.101) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.210.2; Mon, 1 Dec 2014 12:55:19 +0000 From: James Hogan To: Mauro Carvalho Chehab CC: Sifan Naeem , James Hogan , , Subject: [REVIEW PATCH 1/2] img-ir/hw: Avoid clearing filter for no-op protocol change Date: Mon, 1 Dec 2014 12:55:09 +0000 Message-ID: <1417438510-18977-2-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1417438510-18977-1-git-send-email-james.hogan@imgtec.com> References: <1417438510-18977-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.101] Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 When the img-ir driver is asked to change protocol, if the chosen decoder is already loaded then don't call img_ir_set_decoder(), so as not to clear the current filter. This is important because store_protocol() does not refresh the scancode filter with the new protocol if the set of enabled protocols hasn't actually changed, but it will still call the change_protocol() callback, resulting in the filter being disabled in the hardware. The problem can be reproduced by setting a filter, and then setting the protocol to the same protocol that is already set: $ echo nec > protocols $ echo 0xffff > filter_mask $ echo nec > protocols After this, messages which don't match the filter still get received. Reported-by: Sifan Naeem Signed-off-by: James Hogan Cc: Mauro Carvalho Chehab Cc: # v3.15+ Cc: linux-media@vger.kernel.org --- drivers/media/rc/img-ir/img-ir-hw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c index 9db065344b41..1566337c1059 100644 --- a/drivers/media/rc/img-ir/img-ir-hw.c +++ b/drivers/media/rc/img-ir/img-ir-hw.c @@ -643,6 +643,12 @@ static int img_ir_change_protocol(struct rc_dev *dev, u64 *ir_type) continue; if (*ir_type & dec->type) { *ir_type &= dec->type; + /* + * We don't want to clear the filter if nothing is + * changing as it won't get set again. + */ + if (dec == hw->decoder) + return 0; img_ir_set_decoder(priv, dec, *ir_type); goto success; }