From: "Jan Beulich" Subject: Re: [PATCH v2 5/9] x86/intel_pstate: relocate the driver register/unregister function Date: Tue, 26 May 2015 14:05:59 +0100 Message-ID: <55648BD7020000780007DE9B@mail.emea.novell.com> References: <1463125836-13967-1-git-send-email-wei.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1463125836-13967-1-git-send-email-wei.w.wang@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Wang Cc: jinsong.liu@alibaba-inc.com, xen-devel@lists.xen.org, wei.liu2@citrix.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com List-Id: xen-devel@lists.xenproject.org >>> On 13.05.16 at 09:50, wrote: > Register/unregister the CPU hotplug notifier when the driver is > registered, and move the driver register/unregister function to > the cpufreq.c. Without saying why I'm afraid I don't even see much reason to review this in any detail. > --- a/xen/drivers/cpufreq/cpufreq.c > +++ b/xen/drivers/cpufreq/cpufreq.c > @@ -630,12 +630,31 @@ static struct notifier_block cpu_nfb = { > .notifier_call = cpu_callback > }; > > -static int __init cpufreq_presmp_init(void) > +int cpufreq_register_driver(struct cpufreq_driver *driver_data) > { > - void *cpu = (void *)(long)smp_processor_id(); > - cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); Why is this being removed without replacement? > + if (!driver_data || !driver_data->init > + || !driver_data->verify || !driver_data->exit > + || (!driver_data->target == !driver_data->setpolicy)) > + return -EINVAL; > + > + if (cpufreq_driver) > + return -EBUSY; > + > + cpufreq_driver = driver_data; > + > register_cpu_notifier(&cpu_nfb); > + > return 0; > } > -presmp_initcall(cpufreq_presmp_init); > > +int cpufreq_unregister_driver(struct cpufreq_driver *driver) > +{ > + if (!cpufreq_driver || (driver != cpufreq_driver)) > + return -EINVAL; > + > + cpufreq_driver = NULL; > + > + unregister_cpu_notifier(&cpu_nfb); > + > + return 0; > +} This function is dead (and perhaps just like unregister_cpu_notifier() not even needed without loadable modules). Jan