From patchwork Sat Sep 1 01:57:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changbin Du X-Patchwork-Id: 1394751 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 897E6402E1 for ; Sat, 1 Sep 2012 02:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755428Ab2IACAI (ORCPT ); Fri, 31 Aug 2012 22:00:08 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:41948 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755352Ab2IACAG (ORCPT ); Fri, 31 Aug 2012 22:00:06 -0400 Received: by pbbrr13 with SMTP id rr13so5684044pbb.19 for ; Fri, 31 Aug 2012 19:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=eHhruFNfYj3u1CnGNnDWr+5MBEKcfTwTth3KCzWezdo=; b=kNqCBpuBc/XegemC76IYrVYOLHtUUoU6ZO7C/Z9fFU6paYQB6pwk/81tNwkq9aKUY7 Y+L9r+VyRq0qL8Vc8yXqj3SNrvuj808L5viIYpq9dVX+FjIB8kM9mlwczQYUoccCUR/J RkON/he2is8QpDlHiY58nUW1AgHbtZSj94hoILThsN4+aYAwItNY9mkP/HohRkvDJiIq tGJWq42ku18daiEC5W0fIrGAWosl7/yDLgf1H5290bTBadQcbg2yk9SKKc+fXz19pfXW 1BbVNcukH+HCth8/aNCUMzvfqIeqhLA2YTPpGpyL/3wKR4AV1NG+/K0JaU3bqNhx29gf FAFg== Received: by 10.68.135.67 with SMTP id pq3mr21339404pbb.49.1346464806104; Fri, 31 Aug 2012 19:00:06 -0700 (PDT) Received: from localhost.localdomain ([124.200.52.20]) by mx.google.com with ESMTPS id vh7sm4606188pbc.22.2012.08.31.19.00.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 31 Aug 2012 19:00:05 -0700 (PDT) From: "Du, Changbin" 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" Subject: [RFC PATCH] [media] rc: filter out not allowed protocols when decoding Date: Sat, 1 Sep 2012 09:57:09 +0800 Message-Id: <1346464629-22458-1-git-send-email-changbin.du@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: "Du, Changbin" 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 --- 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); }