From patchwork Mon Oct 20 16:25:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 39056 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 00D1320C2D for ; Mon, 20 Oct 2014 16:26:26 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id b13sf2729804wgh.0 for ; Mon, 20 Oct 2014 09:26:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=4+Ap1A3RIcor8SK7/jvlbpvct4l04Bqb14NLcxM1R3c=; b=Rt/YV9hVfbHOWOf55y4q9NyOUfpcn+tvy3gHqjDNLey5JBOMtiqIvWKmIZY1RPKuvW SmdKxpSV+c+OMJ8ZpcPPEmsGx9QyxD9dlDCfk/kaqKIYac47HEGLO84NweF8I25KEsgl QMXq+y27JVGIJ/DFp6GKPIWHWnIOo3EFcK1y8x4FR9maDG1SaQ13wqYiBrJtF7+MHjQc jlnTb4QbtWdxZ8L2xT3Cte8knKkmXI5DXs54xiLf9lpj6T9zPM/L94Px2qyCQazApmCf iMzDB1B+UT1lr5qL+Pj9SJkgOLAOR2pUs47BXGEqy+GNo1ZJU6dtuev7fCT029PEAheU wosg== X-Gm-Message-State: ALoCoQnlarrgrY8CjcnhX8BBHo3mp1zWxQ7g/T8QJ7gD87MEutYxyiY0f22vb+1vVfthKanmx9tO X-Received: by 10.112.154.194 with SMTP id vq2mr684416lbb.10.1413822384460; Mon, 20 Oct 2014 09:26:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.107 with SMTP id lv11ls402796lac.27.gmail; Mon, 20 Oct 2014 09:26:24 -0700 (PDT) X-Received: by 10.152.87.171 with SMTP id az11mr4101436lab.97.1413822384321; Mon, 20 Oct 2014 09:26:24 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id m4si15031696lbd.106.2014.10.20.09.26.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 09:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gq15so4192433lab.40 for ; Mon, 20 Oct 2014 09:26:22 -0700 (PDT) X-Received: by 10.152.87.98 with SMTP id w2mr28211835laz.27.1413822382490; Mon, 20 Oct 2014 09:26:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp339330lbz; Mon, 20 Oct 2014 09:26:21 -0700 (PDT) X-Received: by 10.69.19.225 with SMTP id gx1mr25446830pbd.64.1413822380444; Mon, 20 Oct 2014 09:26:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rp1si8256659pbc.214.2014.10.20.09.26.19 for ; Mon, 20 Oct 2014 09:26:20 -0700 (PDT) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbaJTQ0B (ORCPT + 15 others); Mon, 20 Oct 2014 12:26:01 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:52871 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbaJTQZ6 (ORCPT ); Mon, 20 Oct 2014 12:25:58 -0400 Received: by mail-wg0-f42.google.com with SMTP id z12so5773999wgg.13 for ; Mon, 20 Oct 2014 09:25:51 -0700 (PDT) X-Received: by 10.194.60.198 with SMTP id j6mr34857753wjr.30.1413822351240; Mon, 20 Oct 2014 09:25:51 -0700 (PDT) Received: from localhost.localdomain (AToulouse-656-1-960-30.w90-50.abo.wanadoo.fr. [90.50.217.30]) by mx.google.com with ESMTPSA id cs2sm10155776wib.2.2014.10.20.09.25.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Oct 2014 09:25:50 -0700 (PDT) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: peterz@infradead.org, nicolas.pitre@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org Subject: [PATCH 3/5] cpuidle: idle: menu: Don't reflect when a state selection failed Date: Mon, 20 Oct 2014 18:25:41 +0200 Message-Id: <1413822343-1972-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413822343-1972-1-git-send-email-daniel.lezcano@linaro.org> References: <1413822343-1972-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In the current code, the check to reflect or not the outcoming state is done against the idle state which has been choose and its value. Instead of doing a check in each of the reflect functions, just don't call reflect if something went wrong in the idle path. Signed-off-by: Daniel Lezcano Acked-by: Nicolas Pitre --- drivers/cpuidle/governors/ladder.c | 3 +-- drivers/cpuidle/governors/menu.c | 4 +--- kernel/sched/idle.c | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index fb396d6..c0b36a8 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -165,8 +165,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv, static void ladder_reflect(struct cpuidle_device *dev, int index) { struct ladder_device *ldev = &__get_cpu_var(ladder_devices); - if (index > 0) - ldev->last_state_idx = index; + ldev->last_state_idx = index; } static struct cpuidle_governor ladder_governor = { diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index a17515f..3907301 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -365,9 +365,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, static void menu_reflect(struct cpuidle_device *dev, int index) { struct menu_device *data = &__get_cpu_var(menu_devices); - data->last_state_idx = index; - if (index >= 0) - data->needs_update = 1; + data->needs_update = 1; } /** diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index f439161..9ac7322 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -162,7 +162,8 @@ use_default: /* * Give the governor an opportunity to reflect on the outcome */ - cpuidle_reflect(dev, entered_state); + if (entered_state >= 0) + cpuidle_reflect(dev, entered_state); exit_idle: __current_set_polling();