Skip to contentSkip to conversation

drivers: cpuidle: Fix checkpatch error and warnings

PATCH In review gaurav jindal 3 participants 5 messages Sep 7, 2017 – Sep 8, 2017 CPU idle time management framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: cpuidle: Fix checkpatch error and warnings

This patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

WARNING: line over 80 characters
#311: FILE: drivers/cpuidle/cpuidle.c:311:
+ /* Make sure all changes finished before we switch to new idle */

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #343: FILE: drivers/cpuidle/cpuidle.c:343:
+EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #354: FILE: drivers/cpuidle/cpuidle.c:354:
+EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

ERROR: do not use assignment in if condition
#402: FILE: drivers/cpuidle/cpuidle.c:402:
+ if (cpuidle_curr_governor->enable &&

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/cpuidle/cpuidle.c:419:
+EXPORT_SYMBOL_GPL(cpuidle_enable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #447: FILE: drivers/cpuidle/cpuidle.c:447:
+EXPORT_SYMBOL_GPL(cpuidle_disable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #537: FILE: drivers/cpuidle/cpuidle.c:537:
+EXPORT_SYMBOL_GPL(cpuidle_register_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #561: FILE: drivers/cpuidle/cpuidle.c:561:
+EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

---

drivers/cpuidle/cpuidle.c +10 -10
index 60bb64f..a42148e 100644
@@ -308,7 +308,10 @@ void cpuidle_reflect(struct cpuidle_device *dev, int index)
 void cpuidle_install_idle_handler(void)
 {
 	if (enabled_devices) {
-		/* Make sure all changes finished before we switch to new idle */
+		/*
+		 * Make sure all changes finished before we switch to
+		 * new idle
+		 */
 		smp_wmb();
 		initialized = 1;
 	}
@@ -339,7 +342,6 @@ void cpuidle_pause_and_lock(void)
 	mutex_lock(&cpuidle_lock);
 	cpuidle_uninstall_idle_handler();
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);
 
 /**
@@ -350,7 +352,6 @@ void cpuidle_resume_and_unlock(void)
 	cpuidle_install_idle_handler();
 	mutex_unlock(&cpuidle_lock);
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);
 
 /* Currently used in suspend/resume path to suspend cpuidle */
@@ -399,9 +400,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (ret)
 		return ret;
 
-	if (cpuidle_curr_governor->enable &&
-	    (ret = cpuidle_curr_governor->enable(drv, dev)))
-		goto fail_sysfs;
+	if (cpuidle_curr_governor->enable) {
+
+		ret = cpuidle_curr_governor->enable(drv, dev);
+		if (ret)
+			goto fail_sysfs;
+	}
 
 	smp_wmb();
 
@@ -415,7 +419,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_enable_device);
 
 /**
@@ -443,7 +446,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
 	cpuidle_remove_device_sysfs(dev);
 	enabled_devices--;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_disable_device);
 
 static void __cpuidle_unregister_device(struct cpuidle_device *dev)
@@ -533,7 +535,6 @@ int cpuidle_register_device(struct cpuidle_device *dev)
 	__cpuidle_unregister_device(dev);
 	goto out_unlock;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_register_device);
 
 /**
@@ -557,7 +558,6 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
 
 	cpuidle_resume_and_unlock();
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_unregister_device);
 
 /**
#1 lore raw
Quoted 2 lines · gaurav jindal

This patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

If you are going to propose a checkpatch only patch, please run your proposed patch through checkpatch.

drivers/cpuidle/cpuidle.c

Quoted 1 line
drivers/cpuidle/cpuidle.c +0 -0

[]

Quoted 4 lines
drivers/cpuidle/cpuidle.c +0 -0
@@ -399,9 +400,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (ret)
 		return ret;

drivers/cpuidle/cpuidle.c int cpuidle_enable_device(struct cpuidle_device *dev) · line 408

Quoted 10 lines
drivers/cpuidle/cpuidle.c +6 -3
 
-	if (cpuidle_curr_governor->enable &&
-	    (ret = cpuidle_curr_governor->enable(drv, dev)))
-		goto fail_sysfs;
+	if (cpuidle_curr_governor->enable) {
+
+		ret = cpuidle_curr_governor->enable(drv, dev);
+		if (ret)
+			goto fail_sysfs;
+	}

checkpatch should complain here about unnecessary
blank line after open brace

#2 lore raw

this patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

WARNING: line over 80 characters
#311: FILE: drivers/cpuidle/cpuidle.c:311:
+ /* Make sure all changes finished before we switch to new idle */

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #343: FILE: drivers/cpuidle/cpuidle.c:343:
+EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #354: FILE: drivers/cpuidle/cpuidle.c:354:
+EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

ERROR: do not use assignment in if condition
#402: FILE: drivers/cpuidle/cpuidle.c:402:
+ if (cpuidle_curr_governor->enable &&

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/cpuidle/cpuidle.c:419:
+EXPORT_SYMBOL_GPL(cpuidle_enable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #447: FILE: drivers/cpuidle/cpuidle.c:447:
+EXPORT_SYMBOL_GPL(cpuidle_disable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #537: FILE: drivers/cpuidle/cpuidle.c:537:
+EXPORT_SYMBOL_GPL(cpuidle_register_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #561: FILE: drivers/cpuidle/cpuidle.c:561:
+EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

---

drivers/cpuidle/cpuidle.c +9 -10
index 60bb64f..a42148e 100644
@@ -308,7 +308,10 @@ void cpuidle_reflect(struct cpuidle_device *dev, int index)
 void cpuidle_install_idle_handler(void)
 {
 	if (enabled_devices) {
-		/* Make sure all changes finished before we switch to new idle */
+		/*
+		 * Make sure all changes finished before we switch to
+		 * new idle
+		 */
 		smp_wmb();
 		initialized = 1;
 	}
@@ -339,7 +342,6 @@ void cpuidle_pause_and_lock(void)
 	mutex_lock(&cpuidle_lock);
 	cpuidle_uninstall_idle_handler();
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);
 
 /**
@@ -350,7 +352,6 @@ void cpuidle_resume_and_unlock(void)
 	cpuidle_install_idle_handler();
 	mutex_unlock(&cpuidle_lock);
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);
 
 /* Currently used in suspend/resume path to suspend cpuidle */
@@ -399,9 +400,12 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (ret)
 		return ret;
 
-	if (cpuidle_curr_governor->enable &&
-	    (ret = cpuidle_curr_governor->enable(drv, dev)))
-		goto fail_sysfs;
+	if (cpuidle_curr_governor->enable) {
+		ret = cpuidle_curr_governor->enable(drv, dev);
+		if (ret)
+			goto fail_sysfs;
+	}
 
 	smp_wmb();
 
@@ -415,7 +419,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_enable_device);
 
 /**
@@ -443,7 +446,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
 	cpuidle_remove_device_sysfs(dev);
 	enabled_devices--;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_disable_device);
 
 static void __cpuidle_unregister_device(struct cpuidle_device *dev)
@@ -533,7 +535,6 @@ int cpuidle_register_device(struct cpuidle_device *dev)
 	__cpuidle_unregister_device(dev);
 	goto out_unlock;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_register_device);
 
 /**
@@ -557,7 +558,6 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
 
 	cpuidle_resume_and_unlock();
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_unregister_device);
 
 /**
#3 lore raw
Quoted 45 lines · gaurav jindal

this patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

WARNING: line over 80 characters
#311: FILE: drivers/cpuidle/cpuidle.c:311:
+ /* Make sure all changes finished before we switch to new idle */

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #343: FILE: drivers/cpuidle/cpuidle.c:343:
+EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #354: FILE: drivers/cpuidle/cpuidle.c:354:
+EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

ERROR: do not use assignment in if condition
#402: FILE: drivers/cpuidle/cpuidle.c:402:
+ if (cpuidle_curr_governor->enable &&

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/cpuidle/cpuidle.c:419:
+EXPORT_SYMBOL_GPL(cpuidle_enable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #447: FILE: drivers/cpuidle/cpuidle.c:447:
+EXPORT_SYMBOL_GPL(cpuidle_disable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #537: FILE: drivers/cpuidle/cpuidle.c:537:
+EXPORT_SYMBOL_GPL(cpuidle_register_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #561: FILE: drivers/cpuidle/cpuidle.c:561:
+EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

---

drivers/cpuidle/cpuidle.c +0 -0
index 60bb64f..a42148e 100644
@@ -308,7 +308,10 @@ void cpuidle_reflect(struct cpuidle_device *dev, int index)
 void cpuidle_install_idle_handler(void)

drivers/cpuidle/cpuidle.c void cpuidle_reflect(struct cpuidle_device *dev, int index) · line 317

Quoted 10 lines
drivers/cpuidle/cpuidle.c +4 -1
 {
        if (enabled_devices) {
-               /* Make sure all changes finished before we switch to new idle */
+               /*
+                * Make sure all changes finished before we switch to
+                * new idle
+                */
                smp_wmb();
                initialized = 1;
        }

Don't do this.

The rest is fine by me.

#4 lore raw

This patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #343: FILE: drivers/cpuidle/cpuidle.c:343:
+EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #354: FILE: drivers/cpuidle/cpuidle.c:354:
+EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

ERROR: do not use assignment in if condition
#402: FILE: drivers/cpuidle/cpuidle.c:402:
+ if (cpuidle_curr_governor->enable &&

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/cpuidle/cpuidle.c:419:
+EXPORT_SYMBOL_GPL(cpuidle_enable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #447: FILE: drivers/cpuidle/cpuidle.c:447:
+EXPORT_SYMBOL_GPL(cpuidle_disable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #537: FILE: drivers/cpuidle/cpuidle.c:537:
+EXPORT_SYMBOL_GPL(cpuidle_register_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #561: FILE: drivers/cpuidle/cpuidle.c:561:
+EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

---

drivers/cpuidle/cpuidle.c +5 -7
index 60bb64f..f2be6dd 100644
@@ -339,7 +339,6 @@ void cpuidle_pause_and_lock(void)
 	mutex_lock(&cpuidle_lock);
 	cpuidle_uninstall_idle_handler();
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);
 
 /**
@@ -350,7 +349,6 @@ void cpuidle_resume_and_unlock(void)
 	cpuidle_install_idle_handler();
 	mutex_unlock(&cpuidle_lock);
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);
 
 /* Currently used in suspend/resume path to suspend cpuidle */
@@ -399,9 +397,11 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 	if (ret)
 		return ret;
 
-	if (cpuidle_curr_governor->enable &&
-	    (ret = cpuidle_curr_governor->enable(drv, dev)))
-		goto fail_sysfs;
+	if (cpuidle_curr_governor->enable) {
+		ret = cpuidle_curr_governor->enable(drv, dev);
+		if (ret)
+			goto fail_sysfs;
+	}
 
 	smp_wmb();
 
@@ -415,7 +415,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
 
 	return ret;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_enable_device);
 
@@ -443,7 +442,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev)
 	cpuidle_remove_device_sysfs(dev);
 	enabled_devices--;
 }
-
 EXPORT_SYMBOL_GPL(cpuidle_disable_device);
 

static void __cpuidle_unregister_device(struct cpuidle_device *dev) @@ -533,7 +531,6 @@ int cpuidle_register_device(struct cpuidle_device *dev)
__cpuidle_unregister_device(dev);
goto out_unlock;
}
-
EXPORT_SYMBOL_GPL(cpuidle_register_device);

/**
@@ -557,7 +554,6 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)

cpuidle_resume_and_unlock();
}
-
EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

/**

Quoted 61 lines · Rafael J. Wysocki
Quoted 45 lines · gaurav jindal

this patch fixes the below checkpatch errors and warnings in drivers/cpuidle/cpuidle.c

WARNING: line over 80 characters
#311: FILE: drivers/cpuidle/cpuidle.c:311:
+ /* Make sure all changes finished before we switch to new idle */

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #343: FILE: drivers/cpuidle/cpuidle.c:343:
+EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #354: FILE: drivers/cpuidle/cpuidle.c:354:
+EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

ERROR: do not use assignment in if condition
#402: FILE: drivers/cpuidle/cpuidle.c:402:
+ if (cpuidle_curr_governor->enable &&

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/cpuidle/cpuidle.c:419:
+EXPORT_SYMBOL_GPL(cpuidle_enable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #447: FILE: drivers/cpuidle/cpuidle.c:447:
+EXPORT_SYMBOL_GPL(cpuidle_disable_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #537: FILE: drivers/cpuidle/cpuidle.c:537:
+EXPORT_SYMBOL_GPL(cpuidle_register_device);

WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable #561: FILE: drivers/cpuidle/cpuidle.c:561:
+EXPORT_SYMBOL_GPL(cpuidle_unregister_device);

---

drivers/cpuidle/cpuidle.c +0 -0
index 60bb64f..a42148e 100644
@@ -308,7 +308,10 @@ void cpuidle_reflect(struct cpuidle_device *dev, int index)
 void cpuidle_install_idle_handler(void)

drivers/cpuidle/cpuidle.c void cpuidle_reflect(struct cpuidle_device *dev, int index) · line 317

Quoted 10 lines
drivers/cpuidle/cpuidle.c +4 -1
 {
        if (enabled_devices) {
-               /* Make sure all changes finished before we switch to new idle */
+               /*
+                * Make sure all changes finished before we switch to
+                * new idle
+                */
                smp_wmb();
                initialized = 1;
        }

Don't do this.

The rest is fine by me.