From patchwork Wed May 14 22:30:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 4178541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 678D0BFF02 for ; Wed, 14 May 2014 22:35:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8FA86202EB for ; Wed, 14 May 2014 22:35:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C133520265 for ; Wed, 14 May 2014 22:35:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wkhk1-0003kZ-4Z; Wed, 14 May 2014 22:33:37 +0000 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wkhjs-0003gy-IV for linux-arm-kernel@lists.infradead.org; Wed, 14 May 2014 22:33:29 +0000 Received: by mail-qg0-f45.google.com with SMTP id z60so399882qgd.18 for ; Wed, 14 May 2014 15:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=kvKIocxKt0oC5Ih1hsJoje3JTMrM2IJBIZ5YmaL3Iq8=; b=s0ABvjeCtf9dbR/p4saliMtm+6fw6phdDEfRoi0CNapeqL7ZYykyjE+sVJilkosQPF rHcc7n0otwG4S244BnpCoseEvaEjIU4+Ke9MrzN4aNSG4464eULZElEUEz3K3XKX0Lj6 0YoYxtedwzcidcbwn0Vv6s6+PpGC2K0KPPhCktuqFB2HJLJlEIeGmh4uQdcGcoXiQUMX ANpGN0ZOLPYujYBV/q4m812mzER3KV3fJWV87FbzYxl8WqU7ZFVavDWKqaSemhWT9bII EZIafaSg1gtEVTjLzVs+9OLut8/Qb8PJl2FyVvII9KjD7iOzxoBJM4kNJBk1hOdssNb4 Ya7w== X-Received: by 10.140.86.178 with SMTP id p47mr9889412qgd.66.1400106786941; Wed, 14 May 2014 15:33:06 -0700 (PDT) Received: from localhost ([149.199.62.254]) by mx.google.com with ESMTPSA id f3sm4921428qag.7.2014.05.14.15.33.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 14 May 2014 15:33:06 -0700 (PDT) From: Soren Brinkmann To: Mike Turquette , "Rafael J. Wysocki" , Viresh Kumar , Russell King Subject: [RFC PATCH 1/5] cpufreq: stats: Allow small rounding errors Date: Wed, 14 May 2014 15:30:51 -0700 Message-Id: <1400106655-22465-2-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 1.9.3.1.ga73a6ad In-Reply-To: <1400106655-22465-1-git-send-email-soren.brinkmann@xilinx.com> References: <1400106655-22465-1-git-send-email-soren.brinkmann@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140514_153328_713529_E06D1413 X-CRM114-Status: GOOD ( 11.65 ) X-Spam-Score: 0.0 (/) Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, Michal Simek , Soren Brinkmann , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When matching a frequency against the freq_table, allow small deviances to allow rounding errors. Rounding errors are likely to occur due to the differenct frequency resolutions used in the common clock vs cpufreq frameworks. Signed-off-by: Soren Brinkmann --- drivers/cpufreq/cpufreq_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index ecaaebf969fc..37a34178ab3a 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -146,7 +146,7 @@ static int freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq) { int index; for (index = 0; index < stat->max_state; index++) - if (stat->freq_table[index] == freq) + if (abs(stat->freq_table[index] - freq) < 2) return index; return -1; }