linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Du, Changbin" <changbin.du@gmail.com>
To: mchehab@infradead.org
Cc: paul.gortmaker@windriver.com, sfr@canb.auug.org.au,
	srinivas.kandagatla@st.com, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Du,
	Changbin" <changbin.du@gmail.com>
Subject: [RFC PATCH] [media] rc: filter out not allowed protocols when decoding
Date: Sat,  1 Sep 2012 09:57:09 +0800	[thread overview]
Message-ID: <1346464629-22458-1-git-send-email-changbin.du@gmail.com> (raw)

From: "Du, Changbin" <changbin.du@gmail.com>

Each rc-raw device has a property "allowed_protos" stored in structure
ir_raw_event_ctrl. But it didn't work because all decoders would be
called when decoding. This path makes only allowed protocol decoders
been invoked.

Signed-off-by: Du, Changbin <changbin.du@gmail.com>
---
 drivers/media/rc/ir-raw.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index a820251..198b6d8 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -63,8 +63,12 @@ static int ir_raw_event_thread(void *data)
 		spin_unlock_irq(&raw->lock);
 
 		mutex_lock(&ir_raw_handler_lock);
-		list_for_each_entry(handler, &ir_raw_handler_list, list)
-			handler->decode(raw->dev, ev);
+		list_for_each_entry(handler, &ir_raw_handler_list, list) {
+			/* use all protocol by default */
+			if (raw->dev->allowed_protos == RC_TYPE_UNKNOWN ||
+			    raw->dev->allowed_protos & handler->protocols)
+				handler->decode(raw->dev, ev);
+		}
 		raw->prev_ev = ev;
 		mutex_unlock(&ir_raw_handler_lock);
 	}
-- 
1.7.9.5


             reply	other threads:[~2012-09-01  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01  1:57 Du, Changbin [this message]
2012-09-03 13:03 ` [RFC PATCH] [media] rc: filter out not allowed protocols when decoding Sean Young
     [not found]   ` <CABgQ-ThYGdvhmpf+=GcLpE-qFAhrDUc1j07+XqohDNRa9bStiw@mail.gmail.com>
2012-09-04  3:06     ` Changbin Du
2012-09-04 12:21       ` Sean Young
2012-09-06  9:36         ` Changbin Du

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=1346464629-22458-1-git-send-email-changbin.du@gmail.com \
    --to=changbin.du@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=sfr@canb.auug.org.au \
    --cc=srinivas.kandagatla@st.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 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).