linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] rc: Misc fixes for v3.15
@ 2014-03-26 21:08 James Hogan
  2014-03-26 21:08 ` [PATCH 1/3] rc-main: Revert generic scancode filtering support James Hogan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: James Hogan @ 2014-03-26 21:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-media, James Hogan, David Härdeman, Antti Seppälä

A few misc fixes for v3.15, all relating to my previous patches.

James Hogan (3):
  rc-main: Revert generic scancode filtering support
  rc-main: Limit to a single wakeup protocol group
  rc: img-ir: Expand copyright headers with GPL notices

 drivers/media/rc/img-ir/img-ir-core.c  |  5 +++++
 drivers/media/rc/img-ir/img-ir-hw.c    |  5 +++++
 drivers/media/rc/img-ir/img-ir-hw.h    |  5 +++++
 drivers/media/rc/img-ir/img-ir-jvc.c   |  5 +++++
 drivers/media/rc/img-ir/img-ir-nec.c   |  5 +++++
 drivers/media/rc/img-ir/img-ir-raw.c   |  5 +++++
 drivers/media/rc/img-ir/img-ir-raw.h   |  5 +++++
 drivers/media/rc/img-ir/img-ir-sanyo.c |  5 +++++
 drivers/media/rc/img-ir/img-ir-sharp.c |  5 +++++
 drivers/media/rc/img-ir/img-ir-sony.c  |  5 +++++
 drivers/media/rc/img-ir/img-ir.h       |  5 +++++
 drivers/media/rc/rc-main.c             | 39 ++++++++++++++++++----------------
 12 files changed, 76 insertions(+), 18 deletions(-)

Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: David Härdeman <david@hardeman.nu>
Cc: Antti Seppälä <a.seppala@gmail.com>
-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] rc-main: Revert generic scancode filtering support
  2014-03-26 21:08 [PATCH 0/3] rc: Misc fixes for v3.15 James Hogan
@ 2014-03-26 21:08 ` James Hogan
  2014-03-29 16:15   ` David Härdeman
  2014-03-26 21:08 ` [PATCH 2/3] rc-main: Limit to a single wakeup protocol group James Hogan
  2014-03-26 21:08 ` [PATCH 3/3] rc: img-ir: Expand copyright headers with GPL notices James Hogan
  2 siblings, 1 reply; 5+ messages in thread
From: James Hogan @ 2014-03-26 21:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-media, James Hogan, David Härdeman, Antti Seppälä

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(-)

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;
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] rc-main: Limit to a single wakeup protocol group
  2014-03-26 21:08 [PATCH 0/3] rc: Misc fixes for v3.15 James Hogan
  2014-03-26 21:08 ` [PATCH 1/3] rc-main: Revert generic scancode filtering support James Hogan
@ 2014-03-26 21:08 ` James Hogan
  2014-03-26 21:08 ` [PATCH 3/3] rc: img-ir: Expand copyright headers with GPL notices James Hogan
  2 siblings, 0 replies; 5+ messages in thread
From: James Hogan @ 2014-03-26 21:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, James Hogan, Antti Seppälä

Limit the enabled wakeup protocols to be within a protocol group, as
defined by the proto_names array. For example this prevents the
selection of both rc-5 and nec, while allowing rc-5 alone (which
encompasses both normal rc-5 and rc-5x).

It doesn't usually make sense to enable more than one wakeup protocol
since only a single protocol can usually be used for wakeup at a time,
and doing so with encode based wakeup will result in an arbitrary
protocol being used if multiple are possible.

Reported-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Antti Seppälä <a.seppala@gmail.com>
---
Sorry it took a little while to get around to submitting this.
---
 drivers/media/rc/rc-main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index e067fee..79d1060 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -979,6 +979,19 @@ static ssize_t store_protocols(struct device *device,
 		goto out;
 	}
 
+	if (fattr->type == RC_FILTER_WAKEUP) {
+		/* A proto_names entry must cover enabled wakeup protocols */
+		for (i = 0; i < ARRAY_SIZE(proto_names); i++)
+			if (type & proto_names[i].type &&
+			    !(type & ~proto_names[i].type))
+				break;
+		if (i == ARRAY_SIZE(proto_names)) {
+			IR_dprintk(1, "Multiple distinct wakeup protocols\n");
+			ret = -EINVAL;
+			goto out;
+		}
+	}
+
 	change_protocol = (fattr->type == RC_FILTER_NORMAL)
 		? dev->change_protocol : dev->change_wakeup_protocol;
 	if (change_protocol) {
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] rc: img-ir: Expand copyright headers with GPL notices
  2014-03-26 21:08 [PATCH 0/3] rc: Misc fixes for v3.15 James Hogan
  2014-03-26 21:08 ` [PATCH 1/3] rc-main: Revert generic scancode filtering support James Hogan
  2014-03-26 21:08 ` [PATCH 2/3] rc-main: Limit to a single wakeup protocol group James Hogan
@ 2014-03-26 21:08 ` James Hogan
  2 siblings, 0 replies; 5+ messages in thread
From: James Hogan @ 2014-03-26 21:08 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, James Hogan, David Härdeman

Add the basic GPLv2+ license notice to the copyright headers at the top
of all the source files in the img-ir driver.

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>
---
 drivers/media/rc/img-ir/img-ir-core.c  | 5 +++++
 drivers/media/rc/img-ir/img-ir-hw.c    | 5 +++++
 drivers/media/rc/img-ir/img-ir-hw.h    | 5 +++++
 drivers/media/rc/img-ir/img-ir-jvc.c   | 5 +++++
 drivers/media/rc/img-ir/img-ir-nec.c   | 5 +++++
 drivers/media/rc/img-ir/img-ir-raw.c   | 5 +++++
 drivers/media/rc/img-ir/img-ir-raw.h   | 5 +++++
 drivers/media/rc/img-ir/img-ir-sanyo.c | 5 +++++
 drivers/media/rc/img-ir/img-ir-sharp.c | 5 +++++
 drivers/media/rc/img-ir/img-ir-sony.c  | 5 +++++
 drivers/media/rc/img-ir/img-ir.h       | 5 +++++
 11 files changed, 55 insertions(+)

diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
index 6b78348..a0cac2f 100644
--- a/drivers/media/rc/img-ir/img-ir-core.c
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -3,6 +3,11 @@
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
  * This contains core img-ir code for setting up the driver. The two interfaces
  * (raw and hardware decode) are handled separately.
  */
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index 579a52b..23b47c7 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -3,6 +3,11 @@
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
  * This ties into the input subsystem using the RC-core. Protocol support is
  * provided in separate modules which provide the parameters and scancode
  * translation functions to set up the hardware decoder and interpret the
diff --git a/drivers/media/rc/img-ir/img-ir-hw.h b/drivers/media/rc/img-ir/img-ir-hw.h
index 6c9a94a..450f17d 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.h
+++ b/drivers/media/rc/img-ir/img-ir-hw.h
@@ -2,6 +2,11 @@
  * ImgTec IR Hardware Decoder found in PowerDown Controller.
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #ifndef _IMG_IR_HW_H_
diff --git a/drivers/media/rc/img-ir/img-ir-jvc.c b/drivers/media/rc/img-ir/img-ir-jvc.c
index 10209d2..85ee90f 100644
--- a/drivers/media/rc/img-ir/img-ir-jvc.c
+++ b/drivers/media/rc/img-ir/img-ir-jvc.c
@@ -2,6 +2,11 @@
  * ImgTec IR Decoder setup for JVC protocol.
  *
  * Copyright 2012-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #include "img-ir-hw.h"
diff --git a/drivers/media/rc/img-ir/img-ir-nec.c b/drivers/media/rc/img-ir/img-ir-nec.c
index e7a731b..cff3212 100644
--- a/drivers/media/rc/img-ir/img-ir-nec.c
+++ b/drivers/media/rc/img-ir/img-ir-nec.c
@@ -2,6 +2,11 @@
  * ImgTec IR Decoder setup for NEC protocol.
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #include "img-ir-hw.h"
diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c
index cfb01d9..33f37ed 100644
--- a/drivers/media/rc/img-ir/img-ir-raw.c
+++ b/drivers/media/rc/img-ir/img-ir-raw.c
@@ -3,6 +3,11 @@
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
  * This ties into the input subsystem using the RC-core in raw mode. Raw IR
  * signal edges are reported and decoded by generic software decoders.
  */
diff --git a/drivers/media/rc/img-ir/img-ir-raw.h b/drivers/media/rc/img-ir/img-ir-raw.h
index 9802ffd..4c9b767 100644
--- a/drivers/media/rc/img-ir/img-ir-raw.h
+++ b/drivers/media/rc/img-ir/img-ir-raw.h
@@ -2,6 +2,11 @@
  * ImgTec IR Raw Decoder found in PowerDown Controller.
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #ifndef _IMG_IR_RAW_H_
diff --git a/drivers/media/rc/img-ir/img-ir-sanyo.c b/drivers/media/rc/img-ir/img-ir-sanyo.c
index c2c763e..6755c94 100644
--- a/drivers/media/rc/img-ir/img-ir-sanyo.c
+++ b/drivers/media/rc/img-ir/img-ir-sanyo.c
@@ -3,6 +3,11 @@
  *
  * Copyright 2012-2014 Imagination Technologies Ltd.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
  * From ir-sanyo-decoder.c:
  *
  * This protocol uses the NEC protocol timings. However, data is formatted as:
diff --git a/drivers/media/rc/img-ir/img-ir-sharp.c b/drivers/media/rc/img-ir/img-ir-sharp.c
index 3397cc5..5867be0 100644
--- a/drivers/media/rc/img-ir/img-ir-sharp.c
+++ b/drivers/media/rc/img-ir/img-ir-sharp.c
@@ -2,6 +2,11 @@
  * ImgTec IR Decoder setup for Sharp protocol.
  *
  * Copyright 2012-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #include "img-ir-hw.h"
diff --git a/drivers/media/rc/img-ir/img-ir-sony.c b/drivers/media/rc/img-ir/img-ir-sony.c
index 993409a..b9029ae 100644
--- a/drivers/media/rc/img-ir/img-ir-sony.c
+++ b/drivers/media/rc/img-ir/img-ir-sony.c
@@ -2,6 +2,11 @@
  * ImgTec IR Decoder setup for Sony (SIRC) protocol.
  *
  * Copyright 2012-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #include "img-ir-hw.h"
diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
index afb1893..2ddf560 100644
--- a/drivers/media/rc/img-ir/img-ir.h
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -2,6 +2,11 @@
  * ImgTec IR Decoder found in PowerDown Controller.
  *
  * Copyright 2010-2014 Imagination Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
  */
 
 #ifndef _IMG_IR_H_
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] rc-main: Revert generic scancode filtering support
  2014-03-26 21:08 ` [PATCH 1/3] rc-main: Revert generic scancode filtering support James Hogan
@ 2014-03-29 16:15   ` David Härdeman
  0 siblings, 0 replies; 5+ messages in thread
From: David Härdeman @ 2014-03-29 16:15 UTC (permalink / raw)
  To: James Hogan; +Cc: Mauro Carvalho Chehab, linux-media, Antti Seppälä

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-29 16:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 21:08 [PATCH 0/3] rc: Misc fixes for v3.15 James Hogan
2014-03-26 21:08 ` [PATCH 1/3] rc-main: Revert generic scancode filtering support James Hogan
2014-03-29 16:15   ` David Härdeman
2014-03-26 21:08 ` [PATCH 2/3] rc-main: Limit to a single wakeup protocol group James Hogan
2014-03-26 21:08 ` [PATCH 3/3] rc: img-ir: Expand copyright headers with GPL notices James Hogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).