From: "Jan Beulich" Subject: Re: [PATCH v2 7/9] x86/intel_pstate: add a booting param to select the driver to load Date: Thu, 04 Jun 2015 20:17:52 +0100 Message-ID: <5570B27002000078000D0EA5@mail.emea.novell.com> References: <1463125872-14337-1-git-send-email-wei.w.wang@intel.com> <556498FC020000780007DF2A@mail.emea.novell.com> <286AC319A985734F985F78AFA26841F797A66A@shsmsx102.ccr.corp.intel.com> <556F06300200007800080DFC@mail.emea.novell.com> <286AC319A985734F985F78AFA26841F797ABEE@shsmsx102.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <286AC319A985734F985F78AFA26841F797ABEE@shsmsx102.ccr.corp.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.w.wang@intel.com 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 >>>> "Wang, Wei W" 06/04/15 3:15 AM >>> >On 03/06/2015 19:51, Jan Beulich wrote >> >>> On 03.06.15 at 10:07, wrote: >>> @@ -650,9 +650,12 @@ static int __init cpufreq_driver_init(void) >>> int ret = 0; >>> >>> if ((cpufreq_controller == FREQCTL_xen) && >> >- (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) >> >- ret = cpufreq_register_driver(&acpi_cpufreq_driver); >>> - else if ((cpufreq_controller == FREQCTL_xen) && >> >+ (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) { >> >+ if (load_intel_pstate) >> >+ ret = intel_pstate_init(); >> >+ if (!load_intel_pstate) >> >+ ret = cpufreq_register_driver(&acpi_cpufreq_driver); > >>I don't see why you need load_intel_pstate here: Simply call the original function whenever >>intel_pstate_init() returns an error. > >I plan to change it to: >if (load_intel_pstate) >ret = intel_pstate_init(); >if (ret) >ret = cpufreq_register_driver(&acpi_cpufreq_driver); > >This allows the case that the machine supports the intel_pstate driver but people > just prefer to use the old driver for their own reasons. But there's no point in using load_intel_pstate here - it should be a variable local to that driver. Simply call the function unconditionally and check the variable first thing inside the function. Jan