All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Härdeman" <david@hardeman.nu>
To: James Hogan <james.hogan@imgtec.com>
Cc: linux-media@vger.kernel.org, m.chehab@samsung.com
Subject: Re: [PATCH 06/11] rc-core: remove generic scancode filter
Date: Mon, 31 Mar 2014 21:38:13 +0200	[thread overview]
Message-ID: <20140331193813.GC9610@hardeman.nu> (raw)
In-Reply-To: <53393591.7060405@imgtec.com>

On Mon, Mar 31, 2014 at 10:29:53AM +0100, James Hogan wrote:
>On 29/03/14 16:11, David Härdeman wrote:
>> The generic scancode filtering has questionable value and makes it
>> impossible to determine from userspace if there is an actual
>> scancode hw filter present or not.
>> 
>> So revert the generic parts.
>> 
>> Based on a patch from James Hogan <james.hogan@imgtec.com>, but this
>> version also makes sure that only the valid sysfs files are created
>> in the first place.
>> 
>> Signed-off-by: David Härdeman <david@hardeman.nu>
>> ---
>>  drivers/media/rc/rc-main.c |   66 +++++++++++++++++++++++++++++---------------
>>  include/media/rc-core.h    |    2 +
>>  2 files changed, 45 insertions(+), 23 deletions(-)
>> 
>> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
>> index ba955ac..8675e07 100644
>> --- a/drivers/media/rc/rc-main.c
>> +++ b/drivers/media/rc/rc-main.c
>> @@ -634,7 +634,6 @@ EXPORT_SYMBOL_GPL(rc_repeat);
>>  static void ir_do_keydown(struct rc_dev *dev, enum rc_type protocol,
>>  			  u32 scancode, u32 keycode, u8 toggle)
>>  {
>> -	struct rc_scancode_filter *filter;
>>  	bool new_event = (!dev->keypressed		 ||
>>  			  dev->last_protocol != protocol ||
>>  			  dev->last_scancode != scancode ||
>> @@ -643,11 +642,6 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_type protocol,
>>  	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) {
>> @@ -1017,14 +1011,11 @@ static ssize_t store_protocols(struct device *device,
>>  	set_filter = (fattr->type == RC_FILTER_NORMAL)
>>  		? dev->s_filter : dev->s_wakeup_filter;
>>  
>> -	if (old_type != type && filter->mask) {
>> +	if (set_filter && old_type != type && filter->mask) {
>>  		local_filter = *filter;
>>  		if (!type) {
>>  			/* no protocol => clear filter */
>>  			ret = -1;
>> -		} else if (!set_filter) {
>> -			/* generic filtering => accept any filter */
>> -			ret = 0;
>>  		} else {
>>  			/* hardware filtering => try setting, otherwise clear */
>>  			ret = set_filter(dev, &local_filter);
>> @@ -1033,8 +1024,7 @@ static ssize_t store_protocols(struct device *device,
>>  			/* clear the filter */
>>  			local_filter.data = 0;
>>  			local_filter.mask = 0;
>> -			if (set_filter)
>> -				set_filter(dev, &local_filter);
>> +			set_filter(dev, &local_filter);
>>  		}
>>  
>>  		/* commit the new filter */
>> @@ -1078,7 +1068,9 @@ static ssize_t show_filter(struct device *device,
>>  		return -EINVAL;
>>  
>>  	mutex_lock(&dev->lock);
>> -	if (fattr->mask)
>> +	if (!dev->s_filter)
>> +		val = 0;
>
>I suspect this should take s_wakeup_filter into account depending on
>fattr->type. It's probably quite common to have a wakeup filter but no
>normal filter.

Thanks for spotting that.

>The rest looks reasonable, though it could easily have been a separate
>patch (at least as long as the show/store callbacks don't assume the
>presence of the callbacks they use).

Yes, I wanted to avoid there being more intermediary states than
necessary (i.e. first a read/writable sysfs file, then one that can't be
read/written, then the file disappears...).

Can still respin it on top of your patch if you prefer.


-- 
David Härdeman

  reply	other threads:[~2014-03-31 19:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-29 16:10 [PATCH 00/11] rc-core: My current patch queue David Härdeman
2014-03-29 16:10 ` [PATCH 01/11] bt8xx: fixup RC5 decoding David Härdeman
2014-03-29 16:10 ` [PATCH 02/11] rc-core: improve ir-kbd-i2c get_key functions David Härdeman
2014-03-29 16:11 ` [PATCH 03/11] rc-core: document the protocol type David Härdeman
2014-03-31  9:54   ` James Hogan
2014-03-31 19:39     ` David Härdeman
2014-03-29 16:11 ` [PATCH 04/11] rc-core: do not change 32bit NEC scancode format for now David Härdeman
2014-03-31  9:09   ` James Hogan
2014-03-29 16:11 ` [PATCH 05/11] rc-core: split dev->s_filter David Härdeman
2014-04-03 23:27   ` James Hogan
2014-03-29 16:11 ` [PATCH 06/11] rc-core: remove generic scancode filter David Härdeman
2014-03-31  9:29   ` James Hogan
2014-03-31 19:38     ` David Härdeman [this message]
2014-03-31 22:01       ` James Hogan
2014-03-29 16:11 ` [PATCH 07/11] dib0700: NEC scancode cleanup David Härdeman
2014-03-29 16:11 ` [PATCH 08/11] lmedm04: " David Härdeman
2014-03-29 16:11 ` [PATCH 09/11] saa7134: NEC scancode fix David Härdeman
2014-03-29 16:11 ` [PATCH 10/11] [RFC] rc-core: use the full 32 bits for NEC scancodes David Härdeman
2014-03-31  9:44   ` James Hogan
2014-03-31 10:19     ` David Härdeman
2014-03-31 10:56       ` James Hogan
2014-03-31 13:22         ` David Härdeman
2014-03-31 14:06           ` James Hogan
2014-03-31 15:26           ` Mauro Carvalho Chehab
2014-03-31 16:47             ` David Härdeman
2014-03-31 12:14       ` Mauro Carvalho Chehab
2014-03-31 12:58         ` David Härdeman
2014-03-31 13:15           ` Mauro Carvalho Chehab
2014-03-31 13:54             ` David Härdeman
2014-03-29 16:11 ` [PATCH 11/11] [RFC] rc-core: don't throw away protocol information David Härdeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140331193813.GC9610@hardeman.nu \
    --to=david@hardeman.nu \
    --cc=james.hogan@imgtec.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.