Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934898AbcKWJ4Z (ORCPT ); Wed, 23 Nov 2016 04:56:25 -0500 Received: from ozlabs.org ([103.22.144.67]:49891 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934444AbcKWJzj (ORCPT ); Wed, 23 Nov 2016 04:55:39 -0500 From: Michael Ellerman To: "Gautham R. Shenoy" , Benjamin Herrenschmidt , Paul Mackerras , "Rafael J. Wysocki" , Daniel Lezcano , Michael Neuling , Vaidyanathan Srinivasan , "Shreyas B. Prabhu" , Shilpasri G Bhat , Stewart Smith , Balbir Singh , "Oliver O'Halloran" Cc: , , , , "Gautham R. Shenoy" Subject: Re: [PATCH v3 2/3] cpuidle:powernv: Add helper function to populate powernv idle states. In-Reply-To: <9c2b5cae68b54ec5dcb2651f352f740f1d09051c.1478760806.git.ego@linux.vnet.ibm.com> References: <9c2b5cae68b54ec5dcb2651f352f740f1d09051c.1478760806.git.ego@linux.vnet.ibm.com> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Wed, 23 Nov 2016 20:49:08 +1100 Message-ID: <87vavettkb.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 830 Lines: 28 "Gautham R. Shenoy" writes: > diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c > index 7fe442c..9240e08 100644 > --- a/drivers/cpuidle/cpuidle-powernv.c > +++ b/drivers/cpuidle/cpuidle-powernv.c > @@ -243,28 +262,31 @@ static int powernv_add_idle_states(void) > */ > if (latency_ns[i] > POWERNV_THRESHOLD_LATENCY_NS) > continue; > + /* > + * Firmware passes residency and latency values in ns. > + * cpuidle expects it in us. > + */ > + exit_latency = ((unsigned int)latency_ns[i]) / 1000; > + target_residency = (!rc) ? ((unsigned int)residency_ns[i]) : 0; > + target_residency /= 1000; Urk. Can you just do it normally: if (rc == 0) target_residency = (unsigned int)residency_ns[i] / 1000; I also don't see why you need the cast? cheers