All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3] staging: lustre: fix coding style errors
@ 2015-02-09 17:20 Tal Shorer
  2015-02-09 21:34 ` <gregkh@linuxfoundation.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Tal Shorer @ 2015-02-09 17:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Drokin, Oleg, <devel@driverdev.osuosl.org>,
	Dilger, Andreas, <gregkh@linuxfoundation.org>,
	<linux-kernel@vger.kernel.org>,
	<clabbe.montjoie@gmail.com>

Fix the following coding style errors in
drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c:
1. initializing lnet_table_header (static pointer) to NULL
2. missing spaces around '='

There's a third coding style error in this file which I've chosen to
not fix for clarity's sake. It is: initializing min_watchdog_ratelimit
(static int) to 0

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---

drivers/staging/lustre/lustre/
libcfs/linux/linux-proc.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
index c539e37..acc2e10 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
@@ -65,7 +65,7 @@
#include <asm/div64.h>
#include "../tracefile.h"

-static struct ctl_table_header *lnet_table_header = NULL;
+static struct ctl_table_header *lnet_table_header;
extern char lnet_upcall[1024];
/**
  * The path of debug log dump upcall script.
@@ -308,7 +308,7 @@ static int proc_console_backoff(struct ctl_table
*table, int write,
        dummy.proc_handler = &proc_dointvec;

        if (!write) { /* read */
-               backoff= libcfs_console_backoff;
+               backoff = libcfs_console_backoff;
                rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
                return rc;
        }
--
2.2.2

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

* Re: [PATCH v3] staging: lustre: fix coding style errors
  2015-02-09 17:20 [PATCH v3] staging: lustre: fix coding style errors Tal Shorer
@ 2015-02-09 21:34 ` <gregkh@linuxfoundation.org>
  2015-02-10  0:34   ` Drokin, Oleg
  0 siblings, 1 reply; 4+ messages in thread
From: <gregkh@linuxfoundation.org> @ 2015-02-09 21:34 UTC (permalink / raw)
  To: Tal Shorer
  Cc: Dan Carpenter, <devel@driverdev.osuosl.org>,
	Dilger, Andreas, <linux-kernel@vger.kernel.org>,
	Drokin, Oleg, <clabbe.montjoie@gmail.com>

On Mon, Feb 09, 2015 at 07:20:30PM +0200, Tal Shorer wrote:
> Fix the following coding style errors in
> drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c:
> 1. initializing lnet_table_header (static pointer) to NULL
> 2. missing spaces around '='

Those are two different things, and should be 2 different patches.
Please split up and resend that way.

> There's a third coding style error in this file which I've chosen to
> not fix for clarity's sake. It is: initializing min_watchdog_ratelimit
> (static int) to 0

Please fix that too, it's not correct.  Drop the comment there if you
think that's confusing.

thanks,

greg k-h

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

* Re: [PATCH v3] staging: lustre: fix coding style errors
  2015-02-09 21:34 ` <gregkh@linuxfoundation.org>
@ 2015-02-10  0:34   ` Drokin, Oleg
  2015-02-10  0:52     ` <gregkh@linuxfoundation.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Drokin, Oleg @ 2015-02-10  0:34 UTC (permalink / raw)
  To: <gregkh@linuxfoundation.org>
  Cc: Tal Shorer, Dan Carpenter, <devel@driverdev.osuosl.org>,
	Dilger, Andreas, <linux-kernel@vger.kernel.org>,
	<clabbe.montjoie@gmail.com>


On Feb 9, 2015, at 4:34 PM, <gregkh@linuxfoundation.org> wrote:
>> There's a third coding style error in this file which I've chosen to
>> not fix for clarity's sake. It is: initializing min_watchdog_ratelimit
>> (static int) to 0
> 
> Please fix that too, it's not correct.  Drop the comment there if you
> think that's confusing.

What's not correct there, I wonder? Just assignment of 0 to a static variable
to get some extra clarity?
The code in the question is:

static int min_watchdog_ratelimit = 0;    /* disable ratelimiting */
static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */

So if you drop both = 0 and the comment, I think it would become even more cryptic?

How about something like this then (not a proper patch, but just to demonstrate
the idea):

--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
@@ -165,7 +165,7 @@ static int proc_dobitmasks(struct ctl_table *table, int write,
                                 __proc_dobitmasks);
 }
 
-static int min_watchdog_ratelimit = 0;   /* disable ratelimiting */
+static int zero;
 static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
 
 static int __proc_dump_kernel(void *data, int write,
@@ -521,7 +521,7 @@ static struct ctl_table lnet_table[] = {
                .maxlen   = sizeof(int),
                .mode     = 0644,
                .proc_handler = &proc_dointvec_minmax,
-               .extra1   = &min_watchdog_ratelimit,
+               .extra1   = &zero, /* Disable ratelimiting */
                .extra2   = &max_watchdog_ratelimit,
        },
        {

Bye,
    Oleg

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

* Re: [PATCH v3] staging: lustre: fix coding style errors
  2015-02-10  0:34   ` Drokin, Oleg
@ 2015-02-10  0:52     ` <gregkh@linuxfoundation.org>
  0 siblings, 0 replies; 4+ messages in thread
From: <gregkh@linuxfoundation.org> @ 2015-02-10  0:52 UTC (permalink / raw)
  To: Drokin, Oleg
  Cc: Tal Shorer, Dan Carpenter, <devel@driverdev.osuosl.org>,
	Dilger, Andreas, <linux-kernel@vger.kernel.org>,
	<clabbe.montjoie@gmail.com>

On Tue, Feb 10, 2015 at 12:34:07AM +0000, Drokin, Oleg wrote:
> 
> On Feb 9, 2015, at 4:34 PM, <gregkh@linuxfoundation.org> wrote:
> >> There's a third coding style error in this file which I've chosen to
> >> not fix for clarity's sake. It is: initializing min_watchdog_ratelimit
> >> (static int) to 0
> > 
> > Please fix that too, it's not correct.  Drop the comment there if you
> > think that's confusing.
> 
> What's not correct there, I wonder? Just assignment of 0 to a static variable
> to get some extra clarity?
> The code in the question is:
> 
> static int min_watchdog_ratelimit = 0;    /* disable ratelimiting */
> static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
> 
> So if you drop both = 0 and the comment, I think it would become even more cryptic?
> 
> How about something like this then (not a proper patch, but just to demonstrate
> the idea):
> 
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c
> @@ -165,7 +165,7 @@ static int proc_dobitmasks(struct ctl_table *table, int write,
>                                  __proc_dobitmasks);
>  }
>  
> -static int min_watchdog_ratelimit = 0;   /* disable ratelimiting */
> +static int zero;
>  static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */

Ick, no, just do like other places have done:
  static int min_watchdog_ratelimit;	/* = 0 disable ratelimiting */


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

end of thread, other threads:[~2015-02-10  0:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 17:20 [PATCH v3] staging: lustre: fix coding style errors Tal Shorer
2015-02-09 21:34 ` <gregkh@linuxfoundation.org>
2015-02-10  0:34   ` Drokin, Oleg
2015-02-10  0:52     ` <gregkh@linuxfoundation.org>

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.