From patchwork Wed Jun 2 17:01:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatesh Pallipadi X-Patchwork-Id: 103842 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o52H1oRl014493 for ; Wed, 2 Jun 2010 17:01:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758224Ab0FBRBt (ORCPT ); Wed, 2 Jun 2010 13:01:49 -0400 Received: from smtp-out.google.com ([216.239.44.51]:7560 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758220Ab0FBRBt (ORCPT ); Wed, 2 Jun 2010 13:01:49 -0400 Received: from kpbe16.cbf.corp.google.com (kpbe16.cbf.corp.google.com [172.25.105.80]) by smtp-out.google.com with ESMTP id o52H1mlK029963 for ; Wed, 2 Jun 2010 10:01:48 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1275498108; bh=DyZW5HIw+nJFrI1/2jzBojVrsLE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MpQdXBKBJof3DAssd4GtpbyzYJgTTckbj8ZNYrq0q4bxRViw1om6VLy8NuMAd+zxu cUnrbZyiaFCzYnAGjUCRQ== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to: references:x-system-of-record; b=u2gjYhEei4HjpCX9WVqz4f8Gq+Wf1q4CvQYn/163cBl2V1uG7tTqkLqHZuIcE0YTQ evweOWG2MEXPfcV6O8/gg== Received: from pxi15 (pxi15.prod.google.com [10.243.27.15]) by kpbe16.cbf.corp.google.com with ESMTP id o52H1b5E012761 for ; Wed, 2 Jun 2010 10:01:46 -0700 Received: by pxi15 with SMTP id 15so1782132pxi.16 for ; Wed, 02 Jun 2010 10:01:46 -0700 (PDT) Received: by 10.142.8.22 with SMTP id 22mr5256315wfh.194.1275498106512; Wed, 02 Jun 2010 10:01:46 -0700 (PDT) Received: from localhost.localdomain (tippy.mtv.corp.google.com [172.22.64.214]) by mx.google.com with ESMTPS id x35sm2248201wfh.18.2010.06.02.10.01.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 02 Jun 2010 10:01:44 -0700 (PDT) From: Venkatesh Pallipadi To: Len Brown Cc: ACPI list , Venkatesh Pallipadi Subject: [PATCH] acpi: Eliminate us to pm ticks conversion in common path Date: Wed, 2 Jun 2010 10:01:09 -0700 Message-Id: <1275498069-30614-1-git-send-email-venki@google.com> X-Mailer: git-send-email 1.7.0.1 In-Reply-To: References: X-System-Of-Record: true Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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, 02 Jun 2010 17:01:51 +0000 (UTC) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 2e8c27d..71c9608 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -80,7 +80,7 @@ module_param(nocst, uint, 0000); static unsigned int latency_factor __read_mostly = 2; module_param(latency_factor, uint, 0644); -static s64 us_to_pm_timer_ticks(s64 t) +static u64 us_to_pm_timer_ticks(s64 t) { return div64_u64(t * PM_TIMER_FREQUENCY, 1000000); } @@ -731,10 +731,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) seq_puts(seq, "demotion[--] "); - seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", + seq_printf(seq, "latency[%03d] usage[%08d] duration[%020Lu]\n", pr->power.states[i].latency, pr->power.states[i].usage, - (unsigned long long)pr->power.states[i].time); + us_to_pm_timer_ticks(pr->power.states[i].time)); } end: @@ -861,7 +861,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, ktime_t kt1, kt2; s64 idle_time_ns; s64 idle_time; - s64 sleep_ticks = 0; pr = __get_cpu_var(processors); @@ -906,8 +905,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, idle_time = idle_time_ns; do_div(idle_time, NSEC_PER_USEC); - sleep_ticks = us_to_pm_timer_ticks(idle_time); - /* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event(idle_time_ns); @@ -918,7 +915,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, cx->usage++; lapic_timer_state_broadcast(pr, cx, 0); - cx->time += sleep_ticks; + cx->time += idle_time; return idle_time; } @@ -940,7 +937,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ktime_t kt1, kt2; s64 idle_time_ns; s64 idle_time; - s64 sleep_ticks = 0; pr = __get_cpu_var(processors); @@ -1026,7 +1022,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, idle_time = idle_time_ns; do_div(idle_time, NSEC_PER_USEC); - sleep_ticks = us_to_pm_timer_ticks(idle_time); /* Tell the scheduler how much we idled: */ sched_clock_idle_wakeup_event(idle_time_ns); @@ -1037,7 +1032,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, cx->usage++; lapic_timer_state_broadcast(pr, cx, 0); - cx->time += sleep_ticks; + cx->time += idle_time; return idle_time; }