Re: [Xen-devel] [PATCH v5 4/9] x86/intel_pstate: relocate the driver register function

2015-10-07 Thread Jan Beulich
>>> On 14.09.15 at 04:32,  wrote:
> Move the driver register function to
> the cpufreq.c.

... and remove the (unused) de-registration one.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 4/9] x86/intel_pstate: relocate the driver register function

2015-09-21 Thread Jan Beulich
>>> On 17.09.15 at 17:38,  wrote:
> On 14/09/15 03:32, Wei Wang wrote:
>> Move the driver register function to
>> the cpufreq.c.
>>
>> Signed-off-by: Wei Wang 
>> ---
>>  xen/drivers/cpufreq/cpufreq.c  | 15 +++
>>  xen/include/acpi/cpufreq/cpufreq.h | 27 +--
>>  2 files changed, 16 insertions(+), 26 deletions(-)
>>
>>  changes in v5:
>>  1) keep cpufreq_presmp_init() intact.
>>
>> diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
>> index 567e9e9..0c437d4 100644
>> --- a/xen/drivers/cpufreq/cpufreq.c
>> +++ b/xen/drivers/cpufreq/cpufreq.c
>> @@ -638,3 +638,18 @@ static int __init cpufreq_presmp_init(void)
>>  }
>>  presmp_initcall(cpufreq_presmp_init);
>>  
>> +int cpufreq_register_driver(struct cpufreq_driver *driver_data)
>> +{
>> +   if ( !driver_data || !driver_data->init ||
>> +!driver_data->verify || !driver_data->exit ||
>> +(!driver_data->target == !driver_data->setpolicy) )
> 
> This line will incur the wrath of newer GCC's which have warnings
> against such logic.

Hmm, I think we have other instances of such, without gcc
complaining. Iirc there was a bug in an early 5.0-rc which got
fixed in the final 5.1.0.

> Either bracket the (!driver_data->$X) or alter the logic itself.

I'd prefer to avoid either change.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v5 4/9] x86/intel_pstate: relocate the driver register function

2015-09-17 Thread Andrew Cooper
On 14/09/15 03:32, Wei Wang wrote:
> Move the driver register function to
> the cpufreq.c.
>
> Signed-off-by: Wei Wang 
> ---
>  xen/drivers/cpufreq/cpufreq.c  | 15 +++
>  xen/include/acpi/cpufreq/cpufreq.h | 27 +--
>  2 files changed, 16 insertions(+), 26 deletions(-)
>
>  changes in v5:
>  1) keep cpufreq_presmp_init() intact.
>
> diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
> index 567e9e9..0c437d4 100644
> --- a/xen/drivers/cpufreq/cpufreq.c
> +++ b/xen/drivers/cpufreq/cpufreq.c
> @@ -638,3 +638,18 @@ static int __init cpufreq_presmp_init(void)
>  }
>  presmp_initcall(cpufreq_presmp_init);
>  
> +int cpufreq_register_driver(struct cpufreq_driver *driver_data)
> +{
> +   if ( !driver_data || !driver_data->init ||
> +!driver_data->verify || !driver_data->exit ||
> +(!driver_data->target == !driver_data->setpolicy) )

This line will incur the wrath of newer GCC's which have warnings
against such logic.

Either bracket the (!driver_data->$X) or alter the logic itself.

Also, the commit message needs to be corrected to state that you are
also introducing a new check to the registration function.

~Andrew

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v5 4/9] x86/intel_pstate: relocate the driver register function

2015-09-13 Thread Wei Wang
Move the driver register function to
the cpufreq.c.

Signed-off-by: Wei Wang 
---
 xen/drivers/cpufreq/cpufreq.c  | 15 +++
 xen/include/acpi/cpufreq/cpufreq.h | 27 +--
 2 files changed, 16 insertions(+), 26 deletions(-)

 changes in v5:
 1) keep cpufreq_presmp_init() intact.

diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 567e9e9..0c437d4 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -638,3 +638,18 @@ static int __init cpufreq_presmp_init(void)
 }
 presmp_initcall(cpufreq_presmp_init);
 
+int cpufreq_register_driver(struct cpufreq_driver *driver_data)
+{
+   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;
+}
diff --git a/xen/include/acpi/cpufreq/cpufreq.h 
b/xen/include/acpi/cpufreq/cpufreq.h
index 1ec04ca..c6976d0 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -170,32 +170,7 @@ struct cpufreq_driver {
 
 extern struct cpufreq_driver *cpufreq_driver;
 
-static __inline__ 
-int cpufreq_register_driver(struct cpufreq_driver *driver_data)
-{
-if (!driver_data || 
-!driver_data->init   || 
-!driver_data->exit   || 
-!driver_data->verify || 
-!driver_data->target)
-return -EINVAL;
-
-if (cpufreq_driver)
-return -EBUSY;
-
-cpufreq_driver = driver_data;
-return 0;
-}
-
-static __inline__ 
-int cpufreq_unregister_driver(struct cpufreq_driver *driver)
-{
-if (!cpufreq_driver || (driver != cpufreq_driver))
-return -EINVAL;
-
-cpufreq_driver = NULL;
-return 0;
-}
+extern int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 
 static __inline__
 void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
-- 
1.9.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel