Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728129 > unrolled thread

[PATCH] drivers: cpuidle: Fix checkpatch error and warnings

Started bygaurav jindal <gauravjindal1104@gmail.com>
First post2017-09-07 12:30 +0200
Last post2017-09-08 15:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drivers: cpuidle: Fix checkpatch error and warnings gaurav jindal <gauravjindal1104@gmail.com> - 2017-09-07 12:30 +0200
    Re: [PATCH] drivers: cpuidle: Fix checkpatch error and warnings Joe Perches <joe@perches.com> - 2017-09-07 12:40 +0200
      Re: [PATCH] drivers: cpuidle: Fix checkpatch error and warnings gaurav jindal <gauravjindal1104@gmail.com> - 2017-09-07 14:50 +0200
        Re: [PATCH] drivers: cpuidle: Fix checkpatch error and warnings "Rafael J. Wysocki" <rafael@kernel.org> - 2017-09-08 01:20 +0200
          Re: [PATCH] drivers: cpuidle: Fix checkpatch error and warnings gaurav jindal <gauravjindal1104@gmail.com> - 2017-09-08 15:40 +0200

#1728129 — [PATCH] drivers: cpuidle: Fix checkpatch error and warnings

Fromgaurav jindal <gauravjindal1104@gmail.com>
Date2017-09-07 12:30 +0200
Subject[PATCH] drivers: cpuidle: Fix checkpatch error and warnings
Message-ID<un2em-74v-7@gated-at.bofh.it>
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);

Signed-off-by: gaurav jindal<gauravjindal1104@gmail.com>

---

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 60bb64f..a42148e 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -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);
 
 /**

[toc] | [next] | [standalone]


#1728131

FromJoe Perches <joe@perches.com>
Date2017-09-07 12:40 +0200
Message-ID<un2o1-77H-5@gated-at.bofh.it>
In reply to#1728129
On Thu, 2017-09-07 at 15:53 +0530, gaurav jindal wrote:
> 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.

> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
[]
> 
> @@ -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;
> +	}

checkpatch should complain here about unnecessary
blank line after open brace

[toc] | [prev] | [next] | [standalone]


#1728204

Fromgaurav jindal <gauravjindal1104@gmail.com>
Date2017-09-07 14:50 +0200
Message-ID<un4pP-8qv-3@gated-at.bofh.it>
In reply to#1728131
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);

Signed-off-by:gaurav jindal<gauravjindal1104@gmail.com>

---

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 60bb64f..a42148e 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -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);

 /**

[toc] | [prev] | [next] | [standalone]


#1728492

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-09-08 01:20 +0200
Message-ID<unefw-6Pb-11@gated-at.bofh.it>
In reply to#1728204
On Thu, Sep 7, 2017 at 2:40 PM, gaurav jindal
<gauravjindal1104@gmail.com> wrote:
> 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);
>
> Signed-off-by:gaurav jindal<gauravjindal1104@gmail.com>
>
> ---
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 60bb64f..a42148e 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -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;
>         }

Don't do this.

The rest is fine by me.

[toc] | [prev] | [next] | [standalone]


#1728893

Fromgaurav jindal <gauravjindal1104@gmail.com>
Date2017-09-08 15:40 +0200
Message-ID<unrFN-7D6-41@gated-at.bofh.it>
In reply to#1728492
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);

Signed-off-by: gaurav jindal<gauravjindal1104@gmail.com>

---

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 60bb64f..f2be6dd 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -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);

 /**
On Fri, Sep 08, 2017 at 01:18:49AM +0200, Rafael J. Wysocki wrote:
> On Thu, Sep 7, 2017 at 2:40 PM, gaurav jindal
> <gauravjindal1104@gmail.com> wrote:
> > 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);
> >
> > Signed-off-by:gaurav jindal<gauravjindal1104@gmail.com>
> >
> > ---
> >
> > diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> > index 60bb64f..a42148e 100644
> > --- a/drivers/cpuidle/cpuidle.c
> > +++ b/drivers/cpuidle/cpuidle.c
> > @@ -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;
> >         }
> 
> Don't do this.
> 
> The rest is fine by me.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web