From patchwork Tue Jun 17 16:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Smythies X-Patchwork-Id: 4368931 Return-Path: X-Original-To: patchwork-linux-pm@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 063C9BEEAA for ; Tue, 17 Jun 2014 16:56:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01991202F2 for ; Tue, 17 Jun 2014 16:56:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EE82200CF for ; Tue, 17 Jun 2014 16:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965479AbaFQQ4o (ORCPT ); Tue, 17 Jun 2014 12:56:44 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:62856 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965332AbaFQQ4m (ORCPT ); Tue, 17 Jun 2014 12:56:42 -0400 Received: by mail-pd0-f171.google.com with SMTP id fp1so2499725pdb.30 for ; Tue, 17 Jun 2014 09:56:42 -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; bh=QjAIjBSv2S6qKYYc441ONlIH9x65y34Lzmuk3xV1p1A=; b=F2nGvr7lnceHbyJ16fZLWDfw3CU5teClnjsn93G6z5jmOTB5LUYZY6RykE9I/25HQd ec+KCLdH3mPIPTKpV/UpOEAC73Jj2msiYyd0kkHaaLmw58ZmwtgBUJTSTHczIehhRTpr l8d+sXyAPRYIMIU3Y3iunwWS8kn3ycbJmsmWINEzwypl5BwOhd+ejKJ87D1tBk3hj/XY l35HxTAFXCqlACDFRED9YGvQOgENY3ReJhbmTz9kIIk7nyfx6JITlWF5NIOV6zcjpcK6 aZWjoQzNfCVDzp4eRz8SO4RzKsyj5wTiar6l5iSbt6VhWltWKr0X9RHMknaBHnZK/eXN 97SQ== X-Received: by 10.68.215.40 with SMTP id of8mr33996078pbc.15.1403024202060; Tue, 17 Jun 2014 09:56:42 -0700 (PDT) Received: from s15.smythies.com (s173-180-45-4.bc.hsia.telus.net. [173.180.45.4]) by mx.google.com with ESMTPSA id fl6sm87582889pab.43.2014.06.17.09.56.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jun 2014 09:56:41 -0700 (PDT) From: Doug Smythies X-Google-Original-From: Doug Smythies To: linux-pm@vger.kernel.org Cc: rjw@rjwysocki.net, dsmythies@telus.net, dirk.brandewie@gmail.com Subject: [PATCH] intel_pstate: Correct rounding in busy calculation again Date: Tue, 17 Jun 2014 09:56:19 -0700 Message-Id: <1403024179-26280-1-git-send-email-dsmythies@telus.net> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 There was a mistake in the actual rounding portion of the previous patch, such that the rounding was asymetric and incorrect. (see also: f0fe3cd7e12d8290c82284b5c8aee723cbd0371a intel_pstate: Correct rounding in busy calculation) Signed-off-by: Doug Smythies --- drivers/cpufreq/intel_pstate.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 4e7f492..924bb2d 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -196,10 +196,7 @@ static signed int pid_calc(struct _pid *pid, int32_t busy) pid->last_err = fp_error; result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; - if (result >= 0) - result = result + (1 << (FRAC_BITS-1)); - else - result = result - (1 << (FRAC_BITS-1)); + result = result + (1 << (FRAC_BITS-1)); return (signed int)fp_toint(result); }