From patchwork Fri Apr 24 17:35:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Haslam X-Patchwork-Id: 6272691 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0A9B3BF4A6 for ; Fri, 24 Apr 2015 17:36:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0250220377 for ; Fri, 24 Apr 2015 17:36:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA04620380 for ; Fri, 24 Apr 2015 17:36:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966750AbbDXRf4 (ORCPT ); Fri, 24 Apr 2015 13:35:56 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:36793 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966672AbbDXRf4 (ORCPT ); Fri, 24 Apr 2015 13:35:56 -0400 Received: by wgen6 with SMTP id n6so57898457wge.3 for ; Fri, 24 Apr 2015 10:35:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N/CilnKYEZCZUMyioTR80ejq3CtqR0vYJ3DdqXmDn2I=; b=FUgK39VzA4EDksaC0/rwV/kg2ncwFuCp7OcuLd/7LSZ9gdwNYzOmkmqnWzae1aH7YP JPEFNqC4RHbH1Kv4rgKPuAJy5AmUu982ETdzftiK+O4QEUE00sXnfFmJc1EL4+8XQkpT cDAmjpJppvtyyOV9qwdX33TuOVdmtUp9+vrJIRuDrojneR3dirujMJ1GDULs6ScQQcmr pduGFRxS1PMT6vo1Ty3kUICRcvdYjrliHSHK1BpOvwchU09GYtKixICu6j7Hm1PnKXPQ rzF141doQwT49dek7zTABm86k8k0rG4asarQOGxZ2+XonAZGvRz0ovmxI3XyL4ku3ZEn 6V2A== X-Gm-Message-State: ALoCoQli7oCrfdVSr2yXWQxsGbc0IQ4syZb16BtsVDQQIePYtcj+hVSWSjLjfLUaVei0bkrood33 X-Received: by 10.180.93.193 with SMTP id cw1mr5961154wib.12.1429896954810; Fri, 24 Apr 2015 10:35:54 -0700 (PDT) Received: from axelh-ThinkPad-T440s.home (LPoitiers-656-1-62-228.w90-63.abo.wanadoo.fr. [90.63.143.228]) by mx.google.com with ESMTPSA id n3sm177488wix.1.2015.04.24.10.35.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Apr 2015 10:35:54 -0700 (PDT) From: ahaslam@baylibre.com To: ulf.hansson@linaro.org, khilman@linaro.org, k.kozlowski.k@gmail.com, geert@linux-m68k.org, rjw@rjwysocki.net Cc: bcousson@baylibre.com, linux-pm@vger.kernel.org, Axel Haslam Subject: [RFC v5 8/8] PM / Domains: remove old power on/off callbacks. Date: Fri, 24 Apr 2015 19:35:24 +0200 Message-Id: <1429896924-21540-9-git-send-email-ahaslam@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429896924-21540-1-git-send-email-ahaslam@baylibre.com> References: <1429896924-21540-1-git-send-email-ahaslam@baylibre.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, TVD_SUBJ_WIPE_DEBT, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Axel Haslam Now that all known users have been converted to use the state version of the callbacks, we can remove the default callbacks without breaking compilation. Signed-off-by: Axel Haslam --- drivers/base/power/domain.c | 55 +++++++++++------------------------- drivers/base/power/domain_governor.c | 35 ++++++----------------- include/linux/pm_domain.h | 2 -- 3 files changed, 26 insertions(+), 66 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index b519926..2927763 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -147,11 +147,7 @@ static void genpd_recalc_cpu_exit_latency(struct generic_pm_domain *genpd) if (!genpd->cpuidle_data) return; - if (genpd->state_count == 0) - usecs64 = genpd->power_on_latency_ns; - else - usecs64 = genpd->states[state_idx].power_on_latency_ns; - + usecs64 = genpd->states[state_idx].power_on_latency_ns; do_div(usecs64, NSEC_PER_USEC); usecs64 += genpd->cpuidle_data->saved_exit_latency; genpd->cpuidle_data->idle_state->exit_latency = usecs64; @@ -173,15 +169,9 @@ static int genpd_power_on(struct generic_pm_domain *genpd) return ret; elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); - if (genpd->state_count == 0) { - if (elapsed_ns <= genpd->power_on_latency_ns) - return ret; - genpd->power_on_latency_ns = elapsed_ns; - } else { - if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns) - return ret; - genpd->states[state_idx].power_on_latency_ns = elapsed_ns; - } + if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns) + return ret; + genpd->states[state_idx].power_on_latency_ns = elapsed_ns; genpd->max_off_time_changed = true; genpd_recalc_cpu_exit_latency(genpd); @@ -207,15 +197,11 @@ static int genpd_power_off(struct generic_pm_domain *genpd) return ret; elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); - if (genpd->state_count == 0) { - if (elapsed_ns <= genpd->power_off_latency_ns) - return ret; - genpd->power_off_latency_ns = elapsed_ns; - } else { - if (elapsed_ns <= genpd->states[state_idx].power_off_latency_ns) - return ret; - genpd->states[state_idx].power_off_latency_ns = elapsed_ns; - } + if (elapsed_ns <= genpd->states[state_idx].power_off_latency_ns) + return ret; + + genpd->states[state_idx].power_off_latency_ns = elapsed_ns; + genpd->max_off_time_changed = true; pr_warn("%s: Power-%s latency exceeded, new value %lld ns\n", genpd->name, "off", elapsed_ns); @@ -1931,12 +1917,10 @@ void pm_genpd_init(struct generic_pm_domain *genpd, if (IS_ERR_OR_NULL(genpd)) return; - if (genpd->state_count > 0) { - /* Copy the state data to allocated memory */ - genpd->states = genpd_alloc_states_data(genpd); - if (!genpd->states) - return; - } + /* Point the state data to allocated memory */ + genpd->states = genpd_alloc_states_data(genpd); + if (!genpd->states) + return; INIT_LIST_HEAD(&genpd->master_links); INIT_LIST_HEAD(&genpd->slave_links); @@ -2338,15 +2322,10 @@ static int pm_genpd_summary_one(struct seq_file *s, if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup))) goto exit; - - if (genpd->state_count == 0) - seq_printf(s, "%-30s %-15s ", - genpd->name, status_lookup[genpd->status]); - else - seq_printf(s, "%-30s %-15s ", genpd->name, - (genpd->status == GPD_STATE_POWER_OFF) ? - genpd->states[state_idx].name : - status_lookup[genpd->status]); + seq_printf(s, "%-30s %-15s ", genpd->name, + (genpd->status == GPD_STATE_POWER_OFF) ? + genpd->states[state_idx].name : + status_lookup[genpd->status]); /* * Modifications on the list require holding locks on both diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 061c711..b77f7c9 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c @@ -104,13 +104,8 @@ static bool power_down_ok_for_state(struct dev_pm_domain *pd, int state) struct pm_domain_data *pdd; s64 min_off_time_ns; s64 off_on_time_ns; - - if (genpd->state_count == 0) - off_on_time_ns = genpd->power_off_latency_ns + - genpd->power_on_latency_ns; - else - off_on_time_ns = genpd->states[state].power_off_latency_ns + - genpd->states[state].power_on_latency_ns; + off_on_time_ns = genpd->states[state].power_off_latency_ns + + genpd->states[state].power_on_latency_ns; /* * It doesn't make sense to remove power from the domain if saving * the state of all devices in it and the power off/power on operations @@ -199,12 +194,8 @@ static bool power_down_ok_for_state(struct dev_pm_domain *pd, int state) * time and the time needed to turn the domain on is the maximum * theoretical time this domain can spend in the "off" state. */ - if (genpd->state_count == 0) - genpd->max_off_time_ns = - min_off_time_ns - genpd->power_on_latency_ns; - else - genpd->max_off_time_ns = min_off_time_ns - - genpd->states[state].power_on_latency_ns; + genpd->max_off_time_ns = min_off_time_ns - + genpd->states[state].power_on_latency_ns; return true; } @@ -236,19 +227,11 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) genpd->max_off_time_changed = false; /* find a state to power down to, starting from the deepest */ - if (genpd->state_count == 0) { - /* - * there are no states. power_down_ok_for_state will use - * the stateless values, and ignore the state argument. - */ - retval = power_down_ok_for_state(pd, 0); - } else { - for (i = 0; i < genpd->state_count; i++) { - if (power_down_ok_for_state(pd, last_state_idx - i)) { - genpd->state_idx = last_state_idx - i; - retval = true; - break; - } + for (i = 0; i < genpd->state_count; i++) { + if (power_down_ok_for_state(pd, last_state_idx - i)) { + genpd->state_idx = last_state_idx - i; + retval = true; + break; } } diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 25082f6..38339f4 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -73,9 +73,7 @@ struct generic_pm_domain { unsigned int prepared_count; /* Suspend counter of prepared devices */ bool suspend_power_off; /* Power status before system suspend */ int (*power_off)(struct generic_pm_domain *domain); - s64 power_off_latency_ns; int (*power_on)(struct generic_pm_domain *domain); - s64 power_on_latency_ns; struct gpd_dev_ops dev_ops; s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ bool max_off_time_changed;