From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Tim Schmielau <tim@physik3.uni-rostock.de>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
Zach Brown <zach.brown@oracle.com>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: lots of code could be simplified by using ARRAY_SIZE()
Date: Sun, 17 Dec 2006 13:13:59 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612171301020.24836@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.63.0612152351360.16895@gockel.physik3.uni-rostock.de>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2071 bytes --]
so here's the end result of my experiment to replace unnecessary
code snippets with an invocation of the ARRAY_SIZE() macro from
include/linux/kernel.h. i've attached the script that i ran on the
entire tree, then (after adding al viro's connector patch), did:
$ make allyesconfig # for the stress factor
$ make
to see what would happen.
amazingly, the compile worked all the way down to:
AS arch/i386/boot/bootsect.o
LD arch/i386/boot/bootsect
AS arch/i386/boot/setup.o
LD arch/i386/boot/setup
AS arch/i386/boot/compressed/head.o
CC arch/i386/boot/compressed/misc.o
OBJCOPY arch/i386/boot/compressed/vmlinux.bin
HOSTCC arch/i386/boot/compressed/relocs
arch/i386/boot/compressed/relocs.c: In function 'sym_type':
arch/i386/boot/compressed/relocs.c:72: warning: implicit declaration of function 'ARRAY_SIZE'
/tmp/ccRTpFxM.o: In function `main':
relocs.c:(.text+0xb13): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xddb): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xe10): undefined reference to `ARRAY_SIZE'
relocs.c:(.text+0xe2b): undefined reference to `ARRAY_SIZE'
collect2: ld returned 1 exit status
make[2]: *** [arch/i386/boot/compressed/relocs] Error 1
make[1]: *** [arch/i386/boot/compressed/vmlinux] Error 2
make: *** [bzImage] Error 2
not surprisingly, the diff is fairly sizable (2408 lines), and
that's *way* outside of my comfort zone in terms of what i would
submit as a patch. others higher up the food chain can decide if they
want to do anything with this. (for the information value, i also
attached the "diffstat" output.)
at this point, i think it's someone else's call.
rday
p.s. clearly, this didn't even hit all of the possible
transformations, such as the ones based on typedefs, or even the ones
that are broken over two lines. you can see from the script that i
just went after the low-hanging fruit.
p.p.s. i didn't bother fixing relocs.c yet to see if the build would
actually finish. i thought i'd better stop here and wait to hear what
others think.
[-- Attachment #2: Type: APPLICATION/x-sh, Size: 1472 bytes --]
[-- Attachment #3: Type: TEXT/PLAIN, Size: 7293 bytes --]
Documentation/hpet.txt | 2
arch/arm/kernel/dma-isa.c | 2
arch/arm/kernel/ecard.c | 2
arch/arm26/kernel/ecard.c | 2
arch/avr32/kernel/setup.c | 2
arch/cris/arch-v10/drivers/axisflashmap.c | 2
arch/cris/arch-v10/kernel/setup.c | 4 -
arch/cris/mm/tlb.c | 2
arch/i386/boot/compressed/relocs.c | 8 +--
arch/m68k/amiga/amisound.c | 2
arch/m68k/kernel/ptrace.c | 4 -
arch/m68k/kernel/traps.c | 2
arch/m68knommu/kernel/ptrace.c | 4 -
arch/m68knommu/kernel/traps.c | 2
arch/mips/arc/identify.c | 2
arch/mips/jmr3927/rbhma3100/setup.c | 2
arch/mips/mips-boards/atlas/atlas_int.c | 4 -
arch/mips/pci/fixup-vr4133.c | 2
arch/powerpc/lib/rheap.c | 2
arch/powerpc/xmon/ppc-opc.c | 4 -
arch/powerpc/xmon/spu-opc.c | 2
arch/ppc/lib/rheap.c | 2
arch/ppc/syslib/m8xx_setup.c | 2
arch/ppc/xmon/ppc-opc.c | 4 -
arch/um/kernel/tt/ptproxy/ptrace.c | 12 ++--
arch/v850/kernel/anna.c | 2
arch/v850/kernel/as85ep1.c | 2
arch/v850/kernel/fpga85e2c.c | 2
arch/v850/kernel/gbus_int.c | 4 -
arch/v850/kernel/ma.c | 2
arch/v850/kernel/me2.c | 2
arch/v850/kernel/rte_cb.c | 2
arch/v850/kernel/rte_mb_a_pci.c | 2
arch/v850/kernel/rte_me2_cb.c | 2
arch/v850/kernel/teg.c | 2
arch/x86_64/kernel/smpboot.c | 2
drivers/acorn/block/fd1772.c | 2
drivers/acpi/toshiba_acpi.c | 2
drivers/atm/he.c | 2
drivers/atm/idt77252.c | 8 +--
drivers/block/acsi.c | 4 -
drivers/block/acsi_slm.c | 4 -
drivers/char/drm/drm_proc.c | 2
drivers/char/synclink_gt.c | 2
drivers/connector/connector.c | 3 -
drivers/ide/ide-cd.h | 2
drivers/infiniband/core/device.c | 2
drivers/isdn/capi/capi.c | 4 -
drivers/isdn/capi/capidrv.c | 4 -
drivers/isdn/hardware/eicon/debug.c | 30 ++++++------
drivers/isdn/hardware/eicon/message.c | 22 ++++----
drivers/kvm/kvm_svm.h | 2
drivers/kvm/svm.c | 4 -
drivers/kvm/vmx.c | 4 -
drivers/macintosh/apm_emu.c | 2
drivers/md/md.c | 4 -
drivers/media/dvb/bt8xx/dvb-bt8xx.c | 2
drivers/media/dvb/frontends/cx24110.c | 4 -
drivers/media/dvb/frontends/cx24123.c | 6 +-
drivers/media/video/cpia2/cpia2_v4l.c | 8 +--
drivers/media/video/ov7670.c | 6 +-
drivers/media/video/pvrusb2/pvrusb2-audio.c | 4 -
drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 2
drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c | 4 -
drivers/media/video/pvrusb2/pvrusb2-debugifc.c | 4 -
drivers/media/video/pvrusb2/pvrusb2-eeprom.c | 2
drivers/media/video/pvrusb2/pvrusb2-encoder.c | 16 +++---
drivers/media/video/pvrusb2/pvrusb2-hdw.c | 16 +++---
drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 2
drivers/media/video/pvrusb2/pvrusb2-std.c | 14 ++---
drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 2
drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 4 -
drivers/media/video/pvrusb2/pvrusb2-wm8775.c | 4 -
drivers/media/video/tveeprom.c | 6 +-
drivers/media/video/tvp5150.c | 2
drivers/media/video/usbvideo/quickcam_messenger.c | 2
drivers/message/fusion/mptbase.c | 2
drivers/mmc/au1xmmc.c | 2
drivers/net/apne.c | 2
drivers/net/arm/am79c961a.c | 2
drivers/net/atarilance.c | 2
drivers/net/cs89x0.c | 6 +-
drivers/net/e1000/e1000_ethtool.c | 2
drivers/net/fec_8xx/fec_mii.c | 4 -
drivers/net/ibm_emac/ibm_emac_debug.c | 8 +--
drivers/net/irda/actisys-sir.c | 2
drivers/net/ixgb/ixgb_param.c | 2
drivers/net/ne-h8300.c | 2
drivers/net/ne.c | 2
drivers/net/ne2.c | 2
drivers/net/ne2k-pci.c | 2
drivers/net/netxen/netxen_nic_hw.c | 2
drivers/net/pcmcia/axnet_cs.c | 2
drivers/net/pcmcia/pcnet_cs.c | 2
drivers/net/sk98lin/skgemib.c | 2
drivers/net/sk98lin/skgesirq.c | 2
drivers/net/skfp/smt.c | 2
drivers/net/skfp/srf.c | 4 -
drivers/net/wireless/airo.c | 4 -
drivers/net/wireless/hostap/hostap.h | 2
drivers/net/wireless/ipw2100.c | 12 ++--
drivers/net/wireless/prism54/oid_mgt.c | 2
drivers/net/wireless/wavelan.p.h | 2
drivers/net/zorro8390.c | 2
drivers/s390/cio/device_id.c | 2
drivers/serial/68328serial.c | 6 +-
drivers/serial/mcfserial.c | 2
drivers/w1/slaves/w1_therm.c | 6 +-
fs/reiserfs/do_balan.c | 4 -
include/asm-parisc/mmzone.h | 2
include/linux/netfilter/xt_sctp.h | 2
include/net/ip_vs.h | 2
include/video/sgivw.h | 2
kernel/rcutorture.c | 2
net/atm/proc.c | 2
sound/oss/au1550_ac97.c | 4 -
sound/oss/es1371.c | 2
sound/oss/nec_vrc5477.c | 4 -
sound/oss/swarm_cs4297a.c | 2
119 files changed, 223 insertions(+), 224 deletions(-)
next prev parent reply other threads:[~2006-12-17 18:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-13 19:58 Robert P. J. Day
[not found] ` <2F8F687E-C5E5-4F7D-9585-97DA97AE1376@oracle.com>
2006-12-14 22:27 ` Robert P. J. Day
2006-12-14 23:13 ` Stefan Richter
2006-12-15 10:36 ` Jan Engelhardt
2006-12-15 20:48 ` Robert P. J. Day
2006-12-15 22:54 ` Tim Schmielau
2006-12-16 11:59 ` Robert P. J. Day
2006-12-16 13:30 ` Tim Schmielau
2006-12-16 13:55 ` Robert P. J. Day
2006-12-17 18:13 ` Robert P. J. Day [this message]
2006-12-17 18:27 ` Randy Dunlap
2006-12-17 18:25 ` Robert P. J. Day
2006-12-14 23:16 ` Miguel Ojeda
2006-12-15 0:12 ` Robert P. J. Day
2006-12-16 8:40 ` Pavel Machek
2006-12-16 13:09 ` Robert P. J. Day
2006-12-16 18:14 ` Jan Engelhardt
2006-12-17 11:44 ` Stefan Richter
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=Pine.LNX.4.64.0612171301020.24836@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanr@s5r6.in-berlin.de \
--cc=tim@physik3.uni-rostock.de \
--cc=zach.brown@oracle.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®