From patchwork Wed Mar 26 21:08:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 3895321 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 B3D639F2B6 for ; Wed, 26 Mar 2014 21:11:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B918D2021C for ; Wed, 26 Mar 2014 21:11:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AF2D3201FD for ; Wed, 26 Mar 2014 21:11:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755732AbaCZVK6 (ORCPT ); Wed, 26 Mar 2014 17:10:58 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:53300 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753816AbaCZVK5 (ORCPT ); Wed, 26 Mar 2014 17:10:57 -0400 Received: by mail-wi0-f177.google.com with SMTP id cc10so2345377wib.10 for ; Wed, 26 Mar 2014 14:10:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; bh=0jrtDXOKN9cLuUdk9vHYwHlzeWXen/q8lxp0w8OeG3o=; b=fypEmOV9hCwNC0H9BSABcRakNs5wLbKUlGPfBnoJtwOegoy1cMshNtcVRa5VM6LW5P yJ0w+utgIIq40Cjox3910jfhclTAykp15w4vpSvP0k+4mRfuyC77fh7NIFYW+DoAJnPF I1lT7e0zSH8uQoMr0ijDPdi13Vp2xrElTHSlQH/EmHVQT27pWhjOE20K+oAqlH4caMaI Hh9bQVrBaWt8OFtmCnLFcnCUfyabi2R7Z8A7X65rTauyyWPfWivNS0xOm8l5j7oK4uC9 7+azZqVcda7N66pdfjTqq6e0AgAw9oXJMIbn5/NJUx20Ekn6/eohQgYkDdJh1xzJcqTm CYZQ== X-Gm-Message-State: ALoCoQnBvGuYvqz/XhnNvSXtnhyVqo+Pj1oRYfzE8ir28Mk1XE7XmQMbBM9/PA/acBPZt2uwZV6m X-Received: by 10.180.10.66 with SMTP id g2mr8276961wib.5.1395868256297; Wed, 26 Mar 2014 14:10:56 -0700 (PDT) Received: from localhost.localdomain (jahogan.plus.com. [212.159.75.221]) by mx.google.com with ESMTPSA id h5sm5699905wiy.18.2014.03.26.14.10.54 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Wed, 26 Mar 2014 14:10:55 -0700 (PDT) From: James Hogan To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, James Hogan , =?UTF-8?q?David=20H=C3=A4rdeman?= , =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Subject: [PATCH 1/3] rc-main: Revert generic scancode filtering support Date: Wed, 26 Mar 2014 21:08:31 +0000 Message-Id: <1395868113-17950-2-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395868113-17950-1-git-send-email-james.hogan@imgtec.com> References: <1395868113-17950-1-git-send-email-james.hogan@imgtec.com> 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This reverts commit b8c7d915087c ([media] rc-main: add generic scancode filtering), and removes certain parts of commit 6bea25af147f ([media] rc-main: automatically refresh filter on protocol change) where generic filtering is taken into account when refreshing filters on a protocol change, but that code cannot be reached any longer since the filter mask will always be zero if the s_filter callback is NULL. Generic scancode filtering had questionable value and as David said: > given how difficult it is to remove functionality that is in a > released kernel...I think that particular part (i.e. the software > filtering) should be removed until it has had further discussion. Reported-by: David Härdeman Signed-off-by: James Hogan Cc: Mauro Carvalho Chehab Cc: David Härdeman Cc: Antti Seppälä --- drivers/media/rc/rc-main.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 99697aa..e067fee 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -633,7 +633,6 @@ EXPORT_SYMBOL_GPL(rc_repeat); static void ir_do_keydown(struct rc_dev *dev, int scancode, u32 keycode, u8 toggle) { - struct rc_scancode_filter *filter; bool new_event = !dev->keypressed || dev->last_scancode != scancode || dev->last_toggle != toggle; @@ -641,11 +640,6 @@ static void ir_do_keydown(struct rc_dev *dev, int scancode, if (new_event && dev->keypressed) ir_do_keyup(dev, false); - /* Generic scancode filtering */ - filter = &dev->scancode_filters[RC_FILTER_NORMAL]; - if (filter->mask && ((scancode ^ filter->data) & filter->mask)) - return; - input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); if (new_event && keycode != KEY_RESERVED) { @@ -1012,9 +1006,6 @@ static ssize_t store_protocols(struct device *device, if (!type) { /* no protocol => clear filter */ ret = -1; - } else if (!dev->s_filter) { - /* generic filtering => accept any filter */ - ret = 0; } else { /* hardware filtering => try setting, otherwise clear */ ret = dev->s_filter(dev, fattr->type, &local_filter); @@ -1023,8 +1014,7 @@ static ssize_t store_protocols(struct device *device, /* clear the filter */ local_filter.data = 0; local_filter.mask = 0; - if (dev->s_filter) - dev->s_filter(dev, fattr->type, &local_filter); + dev->s_filter(dev, fattr->type, &local_filter); } /* commit the new filter */ @@ -1068,7 +1058,9 @@ static ssize_t show_filter(struct device *device, return -EINVAL; mutex_lock(&dev->lock); - if (fattr->mask) + if (!dev->s_filter) + val = 0; + else if (fattr->mask) val = dev->scancode_filters[fattr->type].mask; else val = dev->scancode_filters[fattr->type].data; @@ -1116,7 +1108,7 @@ static ssize_t store_filter(struct device *device, return ret; /* Scancode filter not supported (but still accept 0) */ - if (!dev->s_filter && fattr->type != RC_FILTER_NORMAL) + if (!dev->s_filter) return val ? -EINVAL : count; mutex_lock(&dev->lock); @@ -1133,11 +1125,9 @@ static ssize_t store_filter(struct device *device, ret = -EINVAL; goto unlock; } - if (dev->s_filter) { - ret = dev->s_filter(dev, fattr->type, &local_filter); - if (ret < 0) - goto unlock; - } + ret = dev->s_filter(dev, fattr->type, &local_filter); + if (ret < 0) + goto unlock; /* Success, commit the new filter */ *filter = local_filter;