From patchwork Fri May 18 08:24:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 10408677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A64260353 for ; Fri, 18 May 2018 08:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BB9C288A0 for ; Fri, 18 May 2018 08:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10AA7288AD; Fri, 18 May 2018 08:26:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27D01288A0 for ; Fri, 18 May 2018 08:26:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753581AbeERIZA (ORCPT ); Fri, 18 May 2018 04:25:00 -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= 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);