From patchwork Wed Jul 16 08:30:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 33709 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A2879201F1 for ; Wed, 16 Jul 2014 08:30:10 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf4111742pdb.1 for ; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=St6iX/TG7ZEHvoXZbe7fQhMUTfj/dfXUq0LAyR5sCZo=; b=QTtIVvJrOnEtZ4xzoYDcZkG+UtO/FJpcSwMWaYxWqIpDSP8fvqhUtkmqDT8w63cWZ7 A7JHHcZHVimZgzlmBi13X18MRSvIqItb6WlBAWtaoNt7vQRMo5mrCb0+me/wZMPbcn9E fnmWwBzBhjCmwDePV3cTabXA/wwf6ECtrDlFzvnBexK0WxkG7J+TAHGy3RHDAt21ENqu FiGHFpx9l4ZpHG3drHnzmWuZ9aXzYScbQwWelhQ1z2wl7nStSAI3EbbIBx2mASjJ9tyG 0Ow0nWU93tsgvW3Tzz7LTSj1Z5ECJjZrvDP0Cotp8Oy7y1c6a9hi1XwQoDUo0IFtL2XL hjfw== X-Gm-Message-State: ALoCoQktjHBJIwJ/bEZvGRkrVr9l238vovcVm9RrWRZXoLhkdHdVx8qFhOOR5nkdm7Or+H1zXgpj X-Received: by 10.68.242.74 with SMTP id wo10mr13894292pbc.0.1405499409937; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.194 with SMTP id 60ls341930qgf.7.gmail; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr317144vcf.71.1405499409837; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id lg9si7974695vdb.3.2014.07.16.01.30.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jul 2014 01:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so1016763vcb.9 for ; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) X-Received: by 10.52.239.6 with SMTP id vo6mr4756021vdc.59.1405499409760; Wed, 16 Jul 2014 01:30:09 -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.221.37.5 with SMTP id tc5csp278177vcb; Wed, 16 Jul 2014 01:30:09 -0700 (PDT) X-Received: by 10.68.57.140 with SMTP id i12mr13387935pbq.44.1405499408780; Wed, 16 Jul 2014 01:30:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si6958260pdi.165.2014.07.16.01.30.08; Wed, 16 Jul 2014 01:30:08 -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 S1760392AbaGPIaG (ORCPT + 15 others); Wed, 16 Jul 2014 04:30:06 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:54820 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760377AbaGPIaB (ORCPT ); Wed, 16 Jul 2014 04:30:01 -0400 Received: by mail-oa0-f46.google.com with SMTP id m1so603921oag.33 for ; Wed, 16 Jul 2014 01:30:01 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.57.3 with SMTP id e3mr32706404oeq.33.1405499401077; Wed, 16 Jul 2014 01:30:01 -0700 (PDT) Received: by 10.182.233.166 with HTTP; Wed, 16 Jul 2014 01:30:00 -0700 (PDT) In-Reply-To: <53C5C738.5040705@codeaurora.org> References: <1405464473-3916-1-git-send-email-skannan@codeaurora.org> <1405464473-3916-2-git-send-email-skannan@codeaurora.org> <53C5C738.5040705@codeaurora.org> Date: Wed, 16 Jul 2014 14:00:00 +0530 Message-ID: Subject: Re: [PATCH v3 1/2] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend From: Viresh Kumar To: Saravana Kannan Cc: "Rafael J . Wysocki" , Todd Poynor , "Srivatsa S . Bhat" , "linux-pm@vger.kernel.org" , Linux Kernel Mailing List , "linux-arm-msm@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Stephen Boyd 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: viresh.kumar@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.220.178 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: , On 16 July 2014 05:58, Saravana Kannan wrote: >> + if (!cpus && cpufreq_driver->stop_cpu && >> cpufreq_driver->setpolicy) { >> + cpufreq_driver->stop_cpu(policy); >> + } >> > > Viresh, I tried your suggestion (and my initial thought too) to combine this > as an if/else with the previous if. But the indentation got nasty and made > it hard to read. I'm sure the compiler will optimize it. So, I would prefer > to leave it this way. Okay, I gave that comment again :) Try this: ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS); @@ -1001,9 +1003,7 @@ static int cpufreq_change_policy_cpus(struct cpufreq_policy *policy, pr_err("%s: Failed to start governor\n", __func__); goto unlock; } - } - - if (!cpus && cpufreq_driver->stop_cpu && cpufreq_driver->setpolicy) { + } else if (cpufreq_driver->stop_cpu && cpufreq_driver->setpolicy) { cpufreq_driver->stop_cpu(policy); } --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index f72b2b7..092a0ba 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -991,8 +991,10 @@ static int cpufreq_change_policy_cpus(struct cpufreq_policy *policy, CPUFREQ_UPDATE_POLICY_CPU, policy); } - cpus = !cpumask_empty(policy->cpus); - if (has_target() && cpus) { + if (!cpumask_empty(policy->cpus)) { + if (!has_target()) + goto unlock; + ret = __cpufreq_governor(policy, CPUFREQ_GOV_START); if (!ret)