public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Remove unnecessary braces
@ 2014-03-19 21:33 Stratos Karafotis
  2014-03-19 22:45 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Stratos Karafotis @ 2014-03-19 21:33 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar
  Cc: cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, LKML

Remove 3 sets of unnecessary braces

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
---
 drivers/cpufreq/cpufreq.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1eafd8c..ca3c01f 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1325,17 +1325,16 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
 	cpus = cpumask_weight(policy->cpus);
 	up_read(&policy->rwsem);
 
-	if (cpu != policy->cpu) {
+	if (cpu != policy->cpu)
 		sysfs_remove_link(&dev->kobj, "cpufreq");
-	} else if (cpus > 1) {
+	else if (cpus > 1) {
 		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
 		if (new_cpu >= 0) {
 			update_policy_cpu(policy, new_cpu);
 
-			if (!cpufreq_suspended) {
+			if (!cpufreq_suspended)
 				pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
 					 __func__, new_cpu, cpu);
-			}
 		}
 	}
 
@@ -2158,11 +2157,9 @@ int cpufreq_update_policy(unsigned int cpu)
 		if (!policy->cur) {
 			pr_debug("Driver did not initialize current freq\n");
 			policy->cur = new_policy.cur;
-		} else {
-			if (policy->cur != new_policy.cur && has_target())
+		} else if (policy->cur != new_policy.cur && has_target())
 				cpufreq_out_of_sync(cpu, policy->cur,
 								new_policy.cur);
-		}
 	}
 
 	ret = cpufreq_set_policy(policy, &new_policy);
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: Remove unnecessary braces
  2014-03-19 21:33 [PATCH] cpufreq: Remove unnecessary braces Stratos Karafotis
@ 2014-03-19 22:45 ` Rafael J. Wysocki
  2014-03-19 23:25   ` Stratos Karafotis
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-03-19 22:45 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Viresh Kumar, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	LKML

On Wednesday, March 19, 2014 11:33:00 PM Stratos Karafotis wrote:
> Remove 3 sets of unnecessary braces
> 
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
>  drivers/cpufreq/cpufreq.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 1eafd8c..ca3c01f 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1325,17 +1325,16 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>  	cpus = cpumask_weight(policy->cpus);
>  	up_read(&policy->rwsem);
>  
> -	if (cpu != policy->cpu) {
> +	if (cpu != policy->cpu)
>  		sysfs_remove_link(&dev->kobj, "cpufreq");
> -	} else if (cpus > 1) {

These braces aren't in fact unnecessary, they are in accordance with CodingStyle.

> +	else if (cpus > 1) {
>  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
>  		if (new_cpu >= 0) {
>  			update_policy_cpu(policy, new_cpu);
>  
> -			if (!cpufreq_suspended) {
> +			if (!cpufreq_suspended)
>  				pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
>  					 __func__, new_cpu, cpu);
> -			}
>  		}
>  	}
>  
> @@ -2158,11 +2157,9 @@ int cpufreq_update_policy(unsigned int cpu)
>  		if (!policy->cur) {
>  			pr_debug("Driver did not initialize current freq\n");
>  			policy->cur = new_policy.cur;
> -		} else {
> -			if (policy->cur != new_policy.cur && has_target())
> +		} else if (policy->cur != new_policy.cur && has_target())

And here too.

>  				cpufreq_out_of_sync(cpu, policy->cur,
>  								new_policy.cur);
> -		}
>  	}
>  
>  	ret = cpufreq_set_policy(policy, &new_policy);
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: Remove unnecessary braces
  2014-03-19 22:45 ` Rafael J. Wysocki
@ 2014-03-19 23:25   ` Stratos Karafotis
  2014-03-20  0:06     ` Viresh Kumar
  0 siblings, 1 reply; 4+ messages in thread
From: Stratos Karafotis @ 2014-03-19 23:25 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Viresh Kumar, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	LKML

On 20/03/2014 12:45 πμ, Rafael J. Wysocki wrote:
> On Wednesday, March 19, 2014 11:33:00 PM Stratos Karafotis wrote:
>> Remove 3 sets of unnecessary braces
>>
>> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
>> ---
>>  drivers/cpufreq/cpufreq.c | 11 ++++-------
>>  1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 1eafd8c..ca3c01f 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1325,17 +1325,16 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>>  	cpus = cpumask_weight(policy->cpus);
>>  	up_read(&policy->rwsem);
>>  
>> -	if (cpu != policy->cpu) {
>> +	if (cpu != policy->cpu)
>>  		sysfs_remove_link(&dev->kobj, "cpufreq");
>> -	} else if (cpus > 1) {
> 
> These braces aren't in fact unnecessary, they are in accordance with CodingStyle.
> 
>> +	else if (cpus > 1) {
>>  		new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
>>  		if (new_cpu >= 0) {
>>  			update_policy_cpu(policy, new_cpu);
>>  
>> -			if (!cpufreq_suspended) {
>> +			if (!cpufreq_suspended)
>>  				pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
>>  					 __func__, new_cpu, cpu);
>> -			}
>>  		}
>>  	}
>>  
>> @@ -2158,11 +2157,9 @@ int cpufreq_update_policy(unsigned int cpu)
>>  		if (!policy->cur) {
>>  			pr_debug("Driver did not initialize current freq\n");
>>  			policy->cur = new_policy.cur;
>> -		} else {
>> -			if (policy->cur != new_policy.cur && has_target())
>> +		} else if (policy->cur != new_policy.cur && has_target())
> 
> And here too.
> 
>>  				cpufreq_out_of_sync(cpu, policy->cur,
>>  								new_policy.cur);
>> -		}
>>  	}
>>  
>>  	ret = cpufreq_set_policy(policy, &new_policy);
>>
> 

I'm sorry for the inconvenience. I read again the CodingStyle (more carefully :) ).
I'm sending the corrected patch with the single case of unnecessary braces.

Thanks,
Stratos

------------------------8<-----------------------
Remove unnecessary braces from a single statement.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
---
 drivers/cpufreq/cpufreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e3aa9de..220c4a9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1330,10 +1330,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
 		if (new_cpu >= 0) {
 			update_policy_cpu(policy, new_cpu);
 
-			if (!cpufreq_suspended) {
+			if (!cpufreq_suspended)
 				pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
 					 __func__, new_cpu, cpu);
-			}
 		}
 	}
 
-- 
1.8.5.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: Remove unnecessary braces
  2014-03-19 23:25   ` Stratos Karafotis
@ 2014-03-20  0:06     ` Viresh Kumar
  0 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-03-20  0:06 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Rafael J. Wysocki, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org, LKML

On 20 March 2014 04:55, Stratos Karafotis <stratosk@semaphore.gr> wrote:
> I'm sorry for the inconvenience. I read again the CodingStyle (more carefully :) ).
> I'm sending the corrected patch with the single case of unnecessary braces.
>
> Thanks,
> Stratos
>
> ------------------------8<-----------------------
> Remove unnecessary braces from a single statement.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
>  drivers/cpufreq/cpufreq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e3aa9de..220c4a9 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1330,10 +1330,9 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
>                 if (new_cpu >= 0) {
>                         update_policy_cpu(policy, new_cpu);
>
> -                       if (!cpufreq_suspended) {
> +                       if (!cpufreq_suspended)
>                                 pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
>                                          __func__, new_cpu, cpu);
> -                       }
>                 }
>         }

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-20  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 21:33 [PATCH] cpufreq: Remove unnecessary braces Stratos Karafotis
2014-03-19 22:45 ` Rafael J. Wysocki
2014-03-19 23:25   ` Stratos Karafotis
2014-03-20  0:06     ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox