From patchwork Wed Aug 4 04:31:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 116952 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o744V5VN017526 for ; Wed, 4 Aug 2010 04:31:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753249Ab0HDEan (ORCPT ); Wed, 4 Aug 2010 00:30:43 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:37785 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596Ab0HDEam (ORCPT ); Wed, 4 Aug 2010 00:30:42 -0400 Received: by pwi5 with SMTP id 5so1865558pwi.19 for ; Tue, 03 Aug 2010 21:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=ZA3Ri2bRbaJwOM+JorOzvVL6nUqZ0ufDlcaGMv1ebfU=; b=vJHh3De+Oknhter6wkhwa1EgW9Xq6Q1pA3aCzsJGxqaQUVyXmmcr6E/RsK+QpM+2in l8SP6T+TkewnHVVNtjPyPYNPl7E2tYZyJ19eMVoYxWQVxJoFX3iOzMW6pxHN9MyIPehe Z89fsDZZOekSD12xUCS+uyFLonilQV5+KSHXs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=PgNxLefDECaP/QmqD1bor1emsfYu/F8Ab7wSpjvEpUMJWp9/wBi7n3Itmy8rOzdiRY JtylJKwQjd0fQhD7OkRhQpESMVpNEvEnQcxCP34G2NzA6+CIc1xoNG5NQEVtQ6jxFb0M Bk65MR9ADAt8Y6TjlJubkxalIyhxVdaZA6bC8= Received: by 10.142.165.7 with SMTP id n7mr5932019wfe.158.1280896241917; Tue, 03 Aug 2010 21:30:41 -0700 (PDT) Received: from [127.0.0.1] (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id q27sm10043850wfc.6.2010.08.03.21.30.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 03 Aug 2010 21:30:40 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: johnstul@us.ibm.com, Magnus Damm , lethal@linux-sh.org Date: Wed, 04 Aug 2010 13:31:38 +0900 Message-Id: <20100804043138.28089.32443.sendpatchset@t400s> Subject: [PATCH] clocksource: sh_cmt: One-off clockevent fix V2 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 04 Aug 2010 04:31:05 +0000 (UTC) --- 0006/drivers/clocksource/sh_cmt.c +++ work/drivers/clocksource/sh_cmt.c 2010-08-04 13:21:21.000000000 +0900 @@ -308,7 +308,7 @@ static irqreturn_t sh_cmt_interrupt(int * isr before we end up here. */ if (p->flags & FLAG_CLOCKSOURCE) - p->total_cycles += p->match_value; + p->total_cycles += p->match_value + 1; if (!(p->flags & FLAG_REPROGRAM)) p->next_match_value = p->max_match_value; @@ -403,7 +403,7 @@ static cycle_t sh_cmt_clocksource_read(s raw = sh_cmt_get_counter(p, &has_wrapped); if (unlikely(has_wrapped)) - raw += p->match_value; + raw += p->match_value + 1; spin_unlock_irqrestore(&p->lock, flags); return value + raw; @@ -478,7 +478,7 @@ static void sh_cmt_clock_event_start(str ced->min_delta_ns = clockevent_delta2ns(0x1f, ced); if (periodic) - sh_cmt_set_next(p, (p->rate + HZ/2) / HZ); + sh_cmt_set_next(p, ((p->rate + HZ/2) / HZ) - 1); else sh_cmt_set_next(p, p->max_match_value); } @@ -523,9 +523,9 @@ static int sh_cmt_clock_event_next(unsig BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT); if (likely(p->flags & FLAG_IRQCONTEXT)) - p->next_match_value = delta; + p->next_match_value = delta - 1; else - sh_cmt_set_next(p, delta); + sh_cmt_set_next(p, delta - 1); return 0; }