[PATCH v2 3/3] watchdog: npcm: remove whitespaces

Tomer Maimon tmaimon77 at gmail.com
Wed Mar 4 19:18:12 AEDT 2020


Hi Guenter,

I still see the whitespaces warning in v5.6-rc4

https://github.com/torvalds/linux/blob/master/drivers/watchdog/npcm_wdt.c#L106


bash-4.2$ ./scripts/checkpatch.pl --strict --file
drivers/watchdog/npcm_wdt.c
CHECK: Please don't use multiple blank lines
#106: FILE: drivers/watchdog/npcm_wdt.c:106:
+
+

WARNING: suspect code indent for conditional statements (8, 14)
#112: FILE: drivers/watchdog/npcm_wdt.c:112:
+ else if (timeout < 3)
+      wdd->timeout = 2;

WARNING: suspect code indent for conditional statements (8, 14)
#114: FILE: drivers/watchdog/npcm_wdt.c:114:
+ else if (timeout < 6)
+      wdd->timeout = 5;

WARNING: suspect code indent for conditional statements (8, 14)
#116: FILE: drivers/watchdog/npcm_wdt.c:116:
+ else if (timeout < 11)
+      wdd->timeout = 10;

WARNING: suspect code indent for conditional statements (8, 14)
#118: FILE: drivers/watchdog/npcm_wdt.c:118:
+ else if (timeout < 22)
+      wdd->timeout = 21;

WARNING: suspect code indent for conditional statements (8, 14)
#120: FILE: drivers/watchdog/npcm_wdt.c:120:
+ else if (timeout < 44)
+      wdd->timeout = 43;

WARNING: suspect code indent for conditional statements (8, 14)
#122: FILE: drivers/watchdog/npcm_wdt.c:122:
+ else if (timeout < 87)
+      wdd->timeout = 86;

WARNING: suspect code indent for conditional statements (8, 14)
#124: FILE: drivers/watchdog/npcm_wdt.c:124:
+ else if (timeout < 173)
+      wdd->timeout = 172;

WARNING: suspect code indent for conditional statements (8, 14)
#126: FILE: drivers/watchdog/npcm_wdt.c:126:
+ else if (timeout < 688)
+      wdd->timeout = 687;

WARNING: suspect code indent for conditional statements (8, 14)
#128: FILE: drivers/watchdog/npcm_wdt.c:128:
+ else
+      wdd->timeout = 2750;

Thanks,

Tomer

On Tue, 3 Mar 2020 at 23:25, Guenter Roeck <linux at roeck-us.net> wrote:

> On Tue, Mar 03, 2020 at 12:01:14PM +0200, Tomer Maimon wrote:
> > Signed-off-by: Tomer Maimon <tmaimon77 at gmail.com>
>
> Turns out this problem does not actually exist in the upstream driver
> (as of v5.6-rc4). You might want to align your code with the upstream
> kernel.
>
> Guenter
>
> > ---
> >  drivers/watchdog/npcm_wdt.c | 19 +++++++++----------
> >  1 file changed, 9 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> > index 84a728af6664..bd38bf1ee6a1 100644
> > --- a/drivers/watchdog/npcm_wdt.c
> > +++ b/drivers/watchdog/npcm_wdt.c
> > @@ -123,30 +123,29 @@ static int npcm_wdt_stop(struct watchdog_device
> *wdd)
> >       return 0;
> >  }
> >
> > -
> >  static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
> >                               unsigned int timeout)
> >  {
> >       if (timeout < 2)
> >               wdd->timeout = 1;
> >       else if (timeout < 3)
> > -           wdd->timeout = 2;
> > +             wdd->timeout = 2;
> >       else if (timeout < 6)
> > -           wdd->timeout = 5;
> > +             wdd->timeout = 5;
> >       else if (timeout < 11)
> > -           wdd->timeout = 10;
> > +             wdd->timeout = 10;
> >       else if (timeout < 22)
> > -           wdd->timeout = 21;
> > +             wdd->timeout = 21;
> >       else if (timeout < 44)
> > -           wdd->timeout = 43;
> > +             wdd->timeout = 43;
> >       else if (timeout < 87)
> > -           wdd->timeout = 86;
> > +             wdd->timeout = 86;
> >       else if (timeout < 173)
> > -           wdd->timeout = 172;
> > +             wdd->timeout = 172;
> >       else if (timeout < 688)
> > -           wdd->timeout = 687;
> > +             wdd->timeout = 687;
> >       else
> > -           wdd->timeout = 2750;
> > +             wdd->timeout = 2750;
> >
> >       if (watchdog_active(wdd))
> >               npcm_wdt_start(wdd);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20200304/91ce2239/attachment-0001.htm>


More information about the openbmc mailing list