diff mbox

[1/3] rc-main: Revert generic scancode filtering support

Message ID 1395868113-17950-2-git-send-email-james.hogan@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Hogan March 26, 2014, 9:08 p.m. UTC
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 <david@hardeman.nu>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: David Härdeman <david@hardeman.nu>
Cc: Antti Seppälä <a.seppala@gmail.com>
---
 drivers/media/rc/rc-main.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

Comments

David Härdeman March 29, 2014, 4:15 p.m. UTC | #1
On Wed, Mar 26, 2014 at 09:08:31PM +0000, James Hogan wrote:
>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.

I think it'd be a more complete fix to make sure the sysfs files aren't
even there if there's no hw support. See the patchset I've just
posted...

Regards,
David

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;