Re: [PATCH] umem nvram driver: clean up style

From: Alexey Dobriyan
Date: Sun Dec 16 2007 - 16:55:25 EST


On Sun, Dec 16, 2007 at 01:15:58PM -0800, Randy Dunlap wrote:
> > btw., if anyone feels so inclined, this file has quite a number of
> > coding style issues, as per scripts/checkpatch.pl output:
> >
> > total: 28 errors, 54 warnings, 1221 lines checked

> Cleanup umem driver: fix all checkpatch warnings, conform to kernel
> coding style.

> --- linux-2.6.24-rc5-git3.orig/drivers/block/umem.c
> +++ linux-2.6.24-rc5-git3/drivers/block/umem.c

> static void check_batteries(struct cardinfo *card);
>
> /*
> ------------------------------------------------------------------------------------
> --- get_userbit
> ------------------------------------------------------------------------------------
> -*/
> + * get_userbit
> + */

useless comments, they aren't becoming useful after prettifying, right. ;-)

> static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
> {
> dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
> if (dmastat & DMASCR_ANY_ERR)
> - printk("ANY_ERR ");
> + printk(KERN_CONT "ANY_ERR ");
> if (dmastat & DMASCR_MBE_ERR)
> - printk("MBE_ERR ");
> + printk(KERN_CONT "MBE_ERR ");
> if (dmastat & DMASCR_PARITY_ERR_REP)
> - printk("PARITY_ERR_REP ");
> + printk(KERN_CONT "PARITY_ERR_REP ");
> if (dmastat & DMASCR_PARITY_ERR_DET)
> - printk("PARITY_ERR_DET ");
> + printk(KERN_CONT "PARITY_ERR_DET ");
> if (dmastat & DMASCR_SYSTEM_ERR_SIG)
> - printk("SYSTEM_ERR_SIG ");
> + printk(KERN_CONT "SYSTEM_ERR_SIG ");
> if (dmastat & DMASCR_TARGET_ABT)
> - printk("TARGET_ABT ");
> + printk(KERN_CONT "TARGET_ABT ");
> if (dmastat & DMASCR_MASTER_ABT)
> - printk("MASTER_ABT ");
> + printk(KERN_CONT "MASTER_ABT ");
> if (dmastat & DMASCR_CHAIN_COMPLETE)
> - printk("CHAIN_COMPLETE ");
> + printk(KERN_CONT "CHAIN_COMPLETE ");
> if (dmastat & DMASCR_DMA_COMPLETE)
> - printk("DMA_COMPLETE ");
> + printk(KERN_CONT "DMA_COMPLETE ");

KERN_NOISE, it's pretty hard to not notice transformation of
bitmask to string representation, isn't it?

> @@ -889,7 +866,8 @@ static int __devinit mm_pci_probe(struct
> return -ENODEV;
>
> dev_printk(KERN_INFO, &dev->dev,
> - "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
> + "Micro Memory(tm) controller found "
> + "(PCI Mem Module (Battery Backup))\n");

For the record, string splitting occasionaly makes grepping much more annoying:
grep. nothing? kernel in bugreport definitely spit it! [minute later]
Oh, I need to grep for smaller strings.

> @@ -1030,18 +1011,18 @@ static int __devinit mm_pci_probe(struct
> data = ~data;
> data += 1;
>
> - if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) {
> + if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
> + card)) {

Oh, c'mon!



And my pet peeve with checkpatch.pl crap: why does it force me to _add_
KERN_ markers when my patch changes code leaving printk intact, because
the patch wasn't about printk at all?

Or more philosophically, why a tool which doesn't parse C compiler-style
suddenly starts making suggestions on how C code should look like?
--
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/