Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754639AbcCXFLh (ORCPT ); Thu, 24 Mar 2016 01:11:37 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:64977 "EHLO mx0a-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750798AbcCXFLf (ORCPT ); Thu, 24 Mar 2016 01:11:35 -0400 From: Jisheng Zhang To: , CC: , , , Jisheng Zhang Subject: [PATCH] cpuidle: arm: make enter idle operation a bit more efficient Date: Thu, 24 Mar 2016 13:07:18 +0800 Message-ID: <1458796038-6062-1-git-send-email-jszhang@marvell.com> X-Mailer: git-send-email 2.8.0.rc3 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-24_02:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1603240077 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1382 Lines: 51 Currently, entering idle need to check the idx every time to choose the real entering idle routine. But this check could be avoided by pointing the idle enter function pointer of each idle states to the routines suitable for each states directly. Signed-off-by: Jisheng Zhang --- drivers/cpuidle/cpuidle-arm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 545069d..48a620f 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -23,6 +23,13 @@ #include "dt_idle_states.h" +static int arm_enter_wfi_state(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int idx) +{ + cpu_do_idle(); + return 0; +} + /* * arm_enter_idle_state - Programs CPU to enter the specified state * @@ -38,11 +45,6 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, { int ret; - if (!idx) { - cpu_do_idle(); - return idx; - } - ret = cpu_pm_enter(); if (!ret) { /* @@ -69,7 +71,7 @@ static struct cpuidle_driver arm_idle_driver = { * handler for idle state index 0. */ .states[0] = { - .enter = arm_enter_idle_state, + .enter = arm_enter_wfi_state, .exit_latency = 1, .target_residency = 1, .power_usage = UINT_MAX, -- 2.8.0.rc3