Re: [PATCH] drivers: Conversions from kmalloc+memset to k(z|c)alloc.

Tomasz Kłoczko
2006-07-23T17:55:25Z

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4151 bytes --]

On Sun, 23 Jul 2006, Alexey Dobriyan wrote:
[..]
>> Again: using indent mainly will mean only one time massive changes.
>
> True, 180M(!) of them.

~160M.
And this is so huge now because seems there is no obligation use common
format .. all is formated using hands/mind/difftent editors autoformaters.

>> After
>> this ident can be runed for example by Linus just before make release
>> and/or partial release.
>
> ~4M per run.

If patch submmitter will use formating tool and it will add it will statr
work on formated source tree it will be 0M per run.

>>> scripts/Lindent exists and gets used, but it is not perfect.
>
> Correction: GNU indent exists and gets used, but it is not perfect.

Yes .. and produce by Lindent ~160MB patch it excelent proof how offent is
is used now :>
(please stop this crap "argumentation" :>)

> Last time I checked BSD indent don't have some option Lindent use.
> forgot which.

Any problems with use BDS indent instead GNU ?

>> Again: anywhere are listed/was posted list of "not perfect" examples ?
>
> OOhhhh, please do
>
> find . -type f -name '*.[ch]' | xargs ./scripts/Lindent
>
> on any large C codebase.

Runing above on linux-2.6.17.6 tree produces 248 errors mainly because was
used *bad coding style*. I.e. by keep in distribution tree some strange
pieces of code like:

#if 0
if () {
#endif
if () {

}

>> And/or: what does it mean in this case "not perfect" ?
>
>> Show this for
>> allow start work on fix indent by other people (if all cases will be resul
>> of some bugs in this tool).
>
> Start fixing indent(1) if you're serious about all this. There are
> _plenty_ of C code flying around.

IMO .. first will be good xcleanup some Linux code by remove some to many
multiple using C preprocessor stantments which seems is now main cause
why indent can be used.
Current linux-2.6.17.6 tree have 16028 *.[ch] files.
Gnu indet produces errors on:

[linux-2.6.17.6]$ find -name \*.c -o -name \*.h | xargs indent -npro -kr \
-i8 -ts8 -sob -l80 -ss -ncs 2>&1 | awk '{print $2}' | awk -F: \
'{print $1}' | sort | uniq | wc -l
76

*76 files*

Again: using indent requires keep code in some order. General "Coding
Style" is list of rules. It will be now add one new simple rule "keep code
in form which allow use indent without producing errors".

Below list of files on which now indent produces orrors (from 2.6.17.6
tree):

./arch/xtensa/mm/tlb.c
./drivers/atm/iphase.c
./drivers/cdrom/cm206.c
./drivers/cdrom/mcdx.c
./drivers/char/ftape/lowlevel/ftape-bsm.c
./drivers/char/ip2/ip2main.c
./drivers/char/serial167.c
./drivers/i2c/algos/i2c-algo-bit.c
./drivers/ide/legacy/hd.c
./drivers/ide/pci/alim15x3.c
./drivers/isdn/hardware/eicon/capifunc.c
./drivers/isdn/hisax/l3dss1.c
./drivers/md/linear.c
./drivers/media/video/w9968cf.c
./drivers/net/cris/eth_v10.c
./drivers/net/eepro100.c
./drivers/net/sk98lin/skdim.c
./drivers/net/sk98lin/skge.c
./drivers/net/sk98lin/skgesirq.c
./drivers/net/wireless/i82586.h
./drivers/net/yellowfin.c
./drivers/parport/parport_arc.c
./drivers/s390/cio/qdio.c
./drivers/s390/s390mach.c
./drivers/sbus/char/aurora.c
./drivers/scsi/3w-9xxx.c
./drivers/scsi/53c7xx.c
./drivers/scsi/lpfc/lpfc_init.c
./drivers/scsi/seagate.c
./drivers/scsi/st.c
./drivers/serial/68328serial.c
./drivers/serial/crisv10.c
./drivers/usb/host/hc_crisv10.c
./drivers/usb/input/hid-core.c
./drivers/video/intelfb/intelfbhw.c
./drivers/video/neofb.c
./drivers/video/sis/init301.c
./fs/jffs2/wbuf.c
./fs/jffs/intrep.c
./fs/jfs/jfs_txnmgr.c
./fs/ntfs/super.c
./include/asm-frv/math-emu.h
./include/asm-m68k/atariints.h
./include/asm-m68k/math-emu.h
./include/asm-m68k/raw_io.h
./include/asm-m68k/tlbflush.h
./include/asm-mips/delay.h
./include/asm-s390/page.h
./include/asm-x86_64/calling.h
./include/asm-xtensa/xtensa/coreasm.h
./sound/isa/es18xx.c
./sound/oss/ad1889.c
./sound/oss/cs4232.c
./sound/oss/sb_ess.c

kloczek
--
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: kloczek@rudy.mif.pg.gda.pl*