mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Drokin, Oleg" <oleg.drokin@intel.com>
To: "<gregkh@linuxfoundation.org>" <gregkh@linuxfoundation.org>
Cc: Tal Shorer <tal.shorer@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	"<devel@driverdev.osuosl.org>" <devel@driverdev.osuosl.org>,
	"Dilger, Andreas" <andreas.dilger@intel.com>,
	"<linux-kernel@vger.kernel.org>" <linux-kernel@vger.kernel.org>,
	"<clabbe.montjoie@gmail.com>" <clabbe.montjoie@gmail.com>
Subject: Re: [PATCH v3] staging: lustre: fix coding style errors
Date: Tue, 10 Feb 2015 00:34:07 +0000	[thread overview]
Message-ID: <452EBC1C-3FEF-4D29-8780-606021377B26@intel.com> (raw)
In-Reply-To: <20150209213408.GA11071@kroah.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

  reply	other threads:[~2015-02-10  0:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 17:20 Tal Shorer
2015-02-09 21:34 ` <gregkh@linuxfoundation.org>
2015-02-10  0:34   ` Drokin, Oleg [this message]
2015-02-10  0:52     ` <gregkh@linuxfoundation.org>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=452EBC1C-3FEF-4D29-8780-606021377B26@intel.com \
    --to=oleg.drokin@intel.com \
    --cc=andreas.dilger@intel.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tal.shorer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®