From patchwork Wed Jul 13 21:26:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 973442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6DLQPSs009147 for ; Wed, 13 Jul 2011 21:26:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137Ab1GMV0X (ORCPT ); Wed, 13 Jul 2011 17:26:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42955 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120Ab1GMV0V (ORCPT ); Wed, 13 Jul 2011 17:26:21 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6DLQKLF006197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Jul 2011 17:26:20 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6DLQCOP032230; Wed, 13 Jul 2011 17:26:19 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson , Chris Dodge , Andrew Vincer , Stephen Cox Subject: [PATCH 2/3] [media] redrat3: cap duration in the right place Date: Wed, 13 Jul 2011 17:26:06 -0400 Message-Id: <1310592367-11501-3-git-send-email-jarod@redhat.com> In-Reply-To: <1310592367-11501-1-git-send-email-jarod@redhat.com> References: <1310592367-11501-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 13 Jul 2011 21:26:25 +0000 (UTC) Trying to cap duration before multiplying it was obviously wrong. CC: Chris Dodge CC: Andrew Vincer CC: Stephen Cox Signed-off-by: Jarod Wilson --- drivers/media/rc/redrat3.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 9134254..5312e34 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -496,9 +496,6 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) u16 val = len_vals[data_vals[i]]; single_len = redrat3_len_to_us((u32)be16_to_cpu(val)); - /* cap the value to IR_MAX_DURATION */ - single_len &= IR_MAX_DURATION; - /* we should always get pulse/space/pulse/space samples */ if (i % 2) rawir.pulse = false; @@ -506,6 +503,9 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) rawir.pulse = true; rawir.duration = US_TO_NS(single_len); + /* cap the value to IR_MAX_DURATION */ + rawir.duration &= IR_MAX_DURATION; + rr3_dbg(dev, "storing %s with duration %d (i: %d)\n", rawir.pulse ? "pulse" : "space", rawir.duration, i); ir_raw_event_store_with_filter(rr3->rc, &rawir);