Re: [PATCH 1/1] Drivers: Staging: ft1000: checkpatch warning fixes

From: Joe Perches
Date: Wed Mar 11 2015 - 17:21:49 EST


On Wed, 2015-03-11 at 14:03 -0700, Janakarajan Natarajan wrote:
> Addition of blank line after declaration in ft1000_hw.c
> Minor changes to remove {} from single line if and remove extra parenthesis.
> Fixes checkpatch warning for <asm/bitops.h> and <asm/io.h> usage.

Most prefer separate patches for each type of change,
so this single patch could be 3 patches.

> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c

and for more trivia:

> @@ -1948,11 +1948,11 @@ static irqreturn_t ft1000_interrupt(int irq, void *dev_id)
> ft1000_read_reg(dev,
> FT1000_REG_MAG_DFSR);
> }
> - if (tempword & 0x1f) {
> + if (tempword & 0x1f)
> ft1000_copy_up_pkt(dev);
> - } else {
> + else
> break;
> - }
> +
> cnt++;
> } while (cnt < MAX_RCV_LOOP);

do {
if (foo)
bar;
else
break;
} while (baz);

is generally better written

do {
if (!foo)
break;
bar;
} while (baz);

so

if (!(tempword & 0x1f))
break;

ft100_copy_up_pkt(dev);
cnt++;
} while (cnt < MAX_RCV_LOOP);

or maybe

if (!(tempword & 0x1f))
break;

ft100_copy_up_pkt(dev);
} while (++cnt < MAX_RCV_LOOP);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/