From patchwork Thu Apr 22 23:48:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatesh Pallipadi X-Patchwork-Id: 94559 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 o3MNnQpx031637 for ; Thu, 22 Apr 2010 23:49:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754043Ab0DVXt0 (ORCPT ); Thu, 22 Apr 2010 19:49:26 -0400 Received: from smtp-out.google.com ([216.239.44.51]:35324 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753914Ab0DVXtY (ORCPT ); Thu, 22 Apr 2010 19:49:24 -0400 Received: from kpbe14.cbf.corp.google.com (kpbe14.cbf.corp.google.com [172.25.105.78]) by smtp-out.google.com with ESMTP id o3MNnMOH015555 for ; Thu, 22 Apr 2010 16:49:23 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1271980164; bh=miYnWKJf10XXO9yznyYfdithC30=; h=From:To:Cc:Subject:Date:Message-Id; b=Oajt4OBF+s6wLLwEoZB6g4jwQYmz/GzAFJHjNqruHSBBjl4MOBN4HndwiyPCp9cxp YayZmV2kHF0sTjP/ihjZw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer:x-system-of-record; b=SeSfp/ENilPAMX4VdBUG104mcN88IQvgwrL6P8i82Yk/EjBkD0hFO4+wrviGV4XHa j0qhvZ8T7gBqzKhLbWBXw== Received: from gwaa20 (gwaa20.prod.google.com [10.200.27.20]) by kpbe14.cbf.corp.google.com with ESMTP id o3MNnLTQ028857 for ; Thu, 22 Apr 2010 16:49:22 -0700 Received: by gwaa20 with SMTP id a20so3559169gwa.39 for ; Thu, 22 Apr 2010 16:49:21 -0700 (PDT) Received: by 10.101.178.8 with SMTP id f8mr24895316anp.179.1271980161613; Thu, 22 Apr 2010 16:49:21 -0700 (PDT) Received: from localhost.localdomain (tippy.mtv.corp.google.com [172.22.64.214]) by mx.google.com with ESMTPS id 22sm4051310anz.8.2010.04.22.16.49.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Apr 2010 16:49:20 -0700 (PDT) From: Venkatesh Pallipadi To: Len Brown Cc: ACPI list , Venkatesh Pallipadi Subject: [PATCH] acpi: Minor cleanup eliminating redundant PMTIMER_TICKS to NS conversion Date: Thu, 22 Apr 2010 16:48:33 -0700 Message-Id: <1271980113-5624-1-git-send-email-venki@google.com> X-Mailer: git-send-email 1.7.0.1 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]); Thu, 22 Apr 2010 23:49:53 +0000 (UTC) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5939e7f..9e734ce 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -869,6 +869,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, struct acpi_processor *pr; struct acpi_processor_cx *cx = cpuidle_get_statedata(state); ktime_t kt1, kt2; + s64 idle_time_ns; s64 idle_time; s64 sleep_ticks = 0; @@ -910,12 +911,14 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, sched_clock_idle_sleep_event(); acpi_idle_do_entry(cx); kt2 = ktime_get_real(); - idle_time = ktime_to_us(ktime_sub(kt2, kt1)); + idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1)); + 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(sleep_ticks*PM_TIMER_TICK_NS); + sched_clock_idle_wakeup_event(idle_time_ns); local_irq_enable(); current_thread_info()->status |= TS_POLLING; @@ -943,6 +946,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, struct acpi_processor *pr; struct acpi_processor_cx *cx = cpuidle_get_statedata(state); ktime_t kt1, kt2; + s64 idle_time_ns; s64 idle_time; s64 sleep_ticks = 0; @@ -1025,11 +1029,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, spin_unlock(&c3_lock); } kt2 = ktime_get_real(); - idle_time = ktime_to_us(ktime_sub(kt2, kt1)); + idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1)); + 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(sleep_ticks*PM_TIMER_TICK_NS); + sched_clock_idle_wakeup_event(idle_time_ns); local_irq_enable(); current_thread_info()->status |= TS_POLLING;