Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757503AbcLOQvB (ORCPT ); Thu, 15 Dec 2016 11:51:01 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:47794 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754684AbcLOQu7 (ORCPT ); Thu, 15 Dec 2016 11:50:59 -0500 Date: Thu, 15 Dec 2016 17:47:59 +0100 (CET) From: Thomas Gleixner To: Boris Ostrovsky cc: bigeasy@linutronix.de, rjw@rjwysocki.net, viresh.kumar@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized In-Reply-To: <1481814058-4799-3-git-send-email-boris.ostrovsky@oracle.com> Message-ID: References: <1481814058-4799-1-git-send-email-boris.ostrovsky@oracle.com> <1481814058-4799-3-git-send-email-boris.ostrovsky@oracle.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1177 Lines: 36 On Thu, 15 Dec 2016, Boris Ostrovsky wrote: > Since cpu hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state, > successful callback initialization will result in cpuhp_setup_state() > returning a positive value. Therefore acpi_cpufreq_online being zero > indicates that callbacks have not been installed. > > This means that acpi_cpufreq_boost_exit() should only remove them if > acpi_cpufreq_online is positive. Trying to call > cpuhp_remove_state_nocalls(0) will cause a BUG(). > > Signed-off-by: Boris Ostrovsky Reviewed-by: Thomas Gleixner > --- > drivers/cpufreq/acpi-cpufreq.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c > index 3a98702..3a2ca0f 100644 > --- a/drivers/cpufreq/acpi-cpufreq.c > +++ b/drivers/cpufreq/acpi-cpufreq.c > @@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void) > > static void acpi_cpufreq_boost_exit(void) > { > - if (acpi_cpufreq_online >= 0) > + if (acpi_cpufreq_online > 0) > cpuhp_remove_state_nocalls(acpi_cpufreq_online); > } > > -- > 1.7.1 > >