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: 4565301 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDDF1C0514 for ; Wed, 16 Jul 2014 08:30:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09517201BB for ; Wed, 16 Jul 2014 08:30:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28F622017E for ; Wed, 16 Jul 2014 08:30:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760393AbaGPIaH (ORCPT ); Wed, 16 Jul 2014 04:30:07 -0400 Received: from mail-oa0-f48.google.com ([209.85.219.48]:34797 "EHLO mail-oa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760376AbaGPIaB (ORCPT ); Wed, 16 Jul 2014 04:30:01 -0400 Received: by mail-oa0-f48.google.com with SMTP id m1so596446oag.21 for ; Wed, 16 Jul 2014 01:30:01 -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:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+W6H7di9S77sxWRw66fxcSJIwsvs2ninsJGAdYlxVeo=; b=cxxOa8HLeeaAcv7Wwf2Rf5TWysP9xWDiwxTrZaru9KLn5z38pPpoaKRDGP/8slYwUA wY0P9U1MRQm1R5F6ePoMfWzCRd8O5ytZXt9oobDm647J7TEyV+5vmyya26NNL2jFgh+A SCyKpzupCIfAbXGka2V4HI8i5dJb6KJ8ZhVm7WQA0bIpBiAc/V7HJZG9PgzKsiCnnOQ0 R1xj33eL/GTey1t8N2gV/KVwnZgRHfQGHpT3b7+DL/MGrQeWKbkGSbW045EPs+p5PfQc OLxcE1ZjHN0UomZd0rafGsG7Lt3MQ8XUS3fihlhhGe7xkwMWQ6ZPdNHX0CpyuZs/K5vz I7gw== X-Gm-Message-State: ALoCoQljj7u4VSXPVUxN9aXWiXYHXXB+rbbHUVYepekJq6DElDAKMe3ZwNLUX6MHLgcfAvt4V+vY 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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-arm-msm" 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)