Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4234734imm; Fri, 18 May 2018 01:27:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZql+XO0vZ+AOtsi/tj2zVZ198AuvVGwuK6fF34RXKDbVrwCXZCF90nmfLJen2WLeJgWeHc1 X-Received: by 2002:a62:6883:: with SMTP id d125-v6mr8520841pfc.26.1526632069210; Fri, 18 May 2018 01:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526632069; cv=none; d=google.com; s=arc-20160816; b=PNvkUQe7M5zNQyL4gD9dWE8vUbTtMyw5qzcn0ZbOHTpyLPrpSuJkt8wX3YfbMD5qAP FcmSnDnxnv4CeNolgIczpi9tOzkrJRp9oZI9uHrIwykPBGwdutspTQS4YXxjuORE/cNZ up/CyZwgdnoHTPzSP+zW1mfqg5Gyt+POtAYYWlYGpEjmnIM4KzPaNnEzOTPAEeBBmhI7 8K9DqBazdPv9BcIoWfmQuiEtNeaDXBZvxE/f/B95NHkMTv2mVgZ8o5o7kvyhEhm9w8ZQ ayDIi7hL9b4EjrboE4JUDVM3+M33d/mtgDCp8Yi2ibJrscwGt8S8pOxULRV/31YuChQL xbyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=e7vI/ix6JMloetZrwZNmq6DbDk2Y47gi6CMg6iEsmPw=; b=jFRKqWaxul/p7IZol6I+ibM7+819XyyajHp65CFnR3QjFV8M1pX4qdCsQzdMLTd0QE Gi2QhY14r8zV7mnSk7RdP4jBsBmye5erGxS+sXOnEt6dxW3pPrWVO3+yY245ObqSQUQg D+W6LZSckvt1tm5QtbUnU52kxB+s4YZW7NiQcOUHJ6fgnW61HomL08jg9a+KQTpl8nCn sx5kUVs2OvOWKTF+7Sh99EXTT0AZ7ehP5OcqaCoTU7gyeId6AyzUc7pDxIYqBFx4OCWV MaPDYNvwaZlMnloavW/OBpQYnGep2zFioMfvsVpoPk8fZMIJWzh6tG4X69XLS+onBevI 3x/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Yg5c0QeG; dkim=pass header.i=@codeaurora.org header.s=default header.b=gsy4MJth; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12-v6si6623454pll.360.2018.05.18.01.27.35; Fri, 18 May 2018 01:27:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Yg5c0QeG; dkim=pass header.i=@codeaurora.org header.s=default header.b=gsy4MJth; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753856AbeERIZB (ORCPT + 99 others); Fri, 18 May 2018 04:25:01 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57170 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbeERIY4 (ORCPT ); Fri, 18 May 2018 04:24:56 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3E159609D1; Fri, 18 May 2018 08:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526631896; bh=95EhfalmqYNikHjJtHPitF2azgXjrNaeJCcqpgeuqE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yg5c0QeGhvCjpE4gtXlNTshximM/raXU4jWqvk1plvCjRyv9N6tNqINDrgueZhh5U CgRpY78lkdyIQh0VJVTFk+kPmyvylK4zYzaP4hlS+DpF4Y7kImY7fUrPitXLQLhbrm olR77A4uYfQhe5Zbd4VNxqTuvCgBTVYEId38Ne3s= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from skannan1-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: skannan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68E8160F74; Fri, 18 May 2018 08:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526631895; bh=95EhfalmqYNikHjJtHPitF2azgXjrNaeJCcqpgeuqE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gsy4MJthq4tzOCB6YaRFbth/efs+IpHKTzjHLRLs12w1AqrTgXzNCPvK3O7ioQJAf mrhxwAXnVZJ/XXMAja0+HVY2wykK0M+MYrojvzJTLEpFeCe0EmPp6V2iDsBxSW6OHx KV2qwGXIdiUF82lZCDQgbx9QzFJ0zwulYzwe+7Bk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 68E8160F74 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=skannan@codeaurora.org From: Saravana Kannan To: "Rafael J. Wysocki" , Viresh Kumar Cc: Saravana Kannan , Rajendra Nayak , Amit Kucheria , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] Revert "cpufreq: Remove policy create/remove notifiers" Date: Fri, 18 May 2018 01:24:47 -0700 Message-Id: <1526631889-5084-2-git-send-email-skannan@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1526631889-5084-1-git-send-email-skannan@codeaurora.org> References: <1526631889-5084-1-git-send-email-skannan@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit f9f41e3ef99ac9d4e91b07634362e393fb929aad. Change-Id: Iddde3ef56c9e5b14dcb14f8737899b85e56f5b43 --- drivers/cpufreq/cpufreq.c | 16 +++++++++++----- include/linux/cpufreq.h | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 075d18f..f790686 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1129,11 +1129,15 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) return NULL; } -static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) +static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy, bool notify) { struct kobject *kobj; struct completion *cmp; + if (notify) + blocking_notifier_call_chain(&cpufreq_policy_notifier_list, + CPUFREQ_REMOVE_POLICY, policy); + down_write(&policy->rwsem); cpufreq_stats_free_table(policy); kobj = &policy->kobj; @@ -1151,7 +1155,7 @@ static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) pr_debug("wait complete\n"); } -static void cpufreq_policy_free(struct cpufreq_policy *policy) +static void cpufreq_policy_free(struct cpufreq_policy *policy, bool notify) { unsigned long flags; int cpu; @@ -1164,7 +1168,7 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) per_cpu(cpufreq_cpu_data, cpu) = NULL; write_unlock_irqrestore(&cpufreq_driver_lock, flags); - cpufreq_policy_put_kobj(policy); + cpufreq_policy_put_kobj(policy, notify); free_cpumask_var(policy->real_cpus); free_cpumask_var(policy->related_cpus); free_cpumask_var(policy->cpus); @@ -1296,6 +1300,8 @@ static int cpufreq_online(unsigned int cpu) goto out_destroy_policy; cpufreq_stats_create_table(policy); + blocking_notifier_call_chain(&cpufreq_policy_notifier_list, + CPUFREQ_CREATE_POLICY, policy); write_lock_irqsave(&cpufreq_driver_lock, flags); list_add(&policy->policy_list, &cpufreq_policy_list); @@ -1334,7 +1340,7 @@ static int cpufreq_online(unsigned int cpu) cpufreq_driver->exit(policy); out_free_policy: - cpufreq_policy_free(policy); + cpufreq_policy_free(policy, !new_policy); return ret; } @@ -1447,7 +1453,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) remove_cpu_dev_symlink(policy, dev); if (cpumask_empty(policy->real_cpus)) - cpufreq_policy_free(policy); + cpufreq_policy_free(policy, true); } /** diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 87f48dd..b6209b3 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -437,6 +437,9 @@ static inline void cpufreq_resume(void) {} /* Policy Notifiers */ #define CPUFREQ_ADJUST (0) #define CPUFREQ_NOTIFY (1) +#define CPUFREQ_START (2) +#define CPUFREQ_CREATE_POLICY (3) +#define CPUFREQ_REMOVE_POLICY (4) #ifdef CONFIG_CPU_FREQ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project