Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528262

Re: [PATCH v3 2/3] cpuidle:powernv: Add helper function to populate powernv idle states.

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH v3 2/3] cpuidle:powernv: Add helper function to populate powernv idle states.
Date 2016-11-23 11:00 +0100
Message-ID <sGCvn-3a3-11@gated-at.bofh.it> (permalink)
References <sBSr7-2As-15@gated-at.bofh.it> <sBSr7-2As-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


"Gautham R. Shenoy" <ego@linux.vnet.ibm.com> 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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v3 2/3] cpuidle:powernv: Add helper function to populate powernv idle states. Michael Ellerman <mpe@ellerman.id.au> - 2016-11-23 11:00 +0100

csiph-web