From 661829dd7c336b119e6c05a2e2803635f9e9563d Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 25 Sep 2009 09:39:26 +0200 Subject: [PATCH] --- yaml --- r: 177712 b: refs/heads/master c: 27f37e4bfed803be338dcc78845d4a67eefb40a0 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/.gitignore | 7 +- trunk/Documentation/dontdiff | 1 - trunk/Documentation/kbuild/kbuild.txt | 14 - trunk/Documentation/kbuild/kconfig.txt | 8 +- trunk/Kbuild | 4 +- trunk/MAINTAINERS | 6 - trunk/Makefile | 96 +++- trunk/arch/alpha/boot/bootp.c | 2 +- trunk/arch/alpha/boot/bootpz.c | 2 +- trunk/arch/alpha/boot/main.c | 2 +- trunk/arch/alpha/include/asm/asm-offsets.h | 1 - trunk/arch/arm/Makefile | 14 +- trunk/arch/arm/include/asm/asm-offsets.h | 1 - trunk/arch/arm/include/asm/mach-types.h | 1 - trunk/arch/arm/tools/Makefile | 2 +- trunk/arch/arm/tools/gen-mach-types | 2 +- trunk/arch/avr32/include/asm/asm-offsets.h | 1 - trunk/arch/blackfin/include/asm/asm-offsets.h | 1 - trunk/arch/cris/arch-v32/kernel/head.S | 1 + trunk/arch/cris/include/asm/asm-offsets.h | 1 - trunk/arch/cris/kernel/asm-offsets.c | 1 + trunk/arch/cris/kernel/vmlinux.lds.S | 1 + trunk/arch/frv/include/asm/asm-offsets.h | 1 - trunk/arch/frv/kernel/setup.c | 2 +- trunk/arch/h8300/include/asm/asm-offsets.h | 1 - trunk/arch/ia64/Makefile | 2 +- trunk/arch/ia64/include/asm/asm-offsets.h | 1 - trunk/arch/ia64/include/asm/irq.h | 2 +- trunk/arch/ia64/kernel/Makefile | 7 +- trunk/arch/ia64/kvm/asm-offsets.c | 1 + trunk/arch/m68k/include/asm/asm-offsets.h | 1 - trunk/arch/m68k/kernel/head.S | 2 +- .../arch/microblaze/include/asm/asm-offsets.h | 1 - trunk/arch/mips/include/asm/asm-offsets.h | 1 - trunk/arch/mn10300/include/asm/asm-offsets.h | 1 - trunk/arch/parisc/include/asm/asm-offsets.h | 1 - trunk/arch/powerpc/include/asm/asm-offsets.h | 1 - trunk/arch/powerpc/platforms/52xx/efika.c | 2 +- trunk/arch/powerpc/platforms/amigaone/setup.c | 2 +- .../powerpc/platforms/cell/spufs/Makefile | 6 +- trunk/arch/powerpc/platforms/chrp/setup.c | 2 +- .../powerpc/platforms/powermac/bootx_init.c | 2 +- trunk/arch/s390/include/asm/asm-offsets.h | 1 - trunk/arch/score/include/asm/asm-offsets.h | 1 - trunk/arch/sh/Makefile | 10 +- trunk/arch/sh/drivers/pci/fixups-rts7751r2d.c | 2 +- trunk/arch/sh/include/asm/.gitignore | 1 + trunk/arch/sh/include/asm/asm-offsets.h | 1 - trunk/arch/sh/include/asm/machvec.h | 2 +- trunk/arch/sh/tools/Makefile | 4 +- trunk/arch/sh/tools/gen-mach-types | 2 +- trunk/arch/sparc/include/asm/asm-offsets.h | 1 - trunk/arch/um/Makefile | 2 +- trunk/arch/um/include/asm/asm-offsets.h | 1 - trunk/arch/x86/boot/header.S | 2 +- trunk/arch/x86/boot/version.c | 4 +- trunk/arch/x86/include/asm/asm-offsets.h | 1 - trunk/arch/x86/kernel/ptrace.c | 16 +- trunk/arch/xtensa/include/asm/asm-offsets.h | 1 - .../accessibility/braille/braille_console.c | 1 + trunk/drivers/hid/hid-lg.h | 2 + trunk/drivers/net/wireless/iwlwifi/iwl-core.h | 2 +- trunk/drivers/platform/x86/compal-laptop.c | 1 + trunk/drivers/regulator/Kconfig | 7 + trunk/drivers/regulator/Makefile | 1 + trunk/drivers/regulator/max8660.c | 510 ++++++++++++++++++ trunk/drivers/staging/iio/ring_sw.h | 1 + trunk/drivers/staging/panel/panel.c | 2 +- trunk/drivers/video/atafb.c | 3 + trunk/include/linux/Kbuild | 1 - trunk/include/linux/mmdebug.h | 2 + trunk/include/linux/mmzone.h | 2 +- trunk/include/linux/page-flags.h | 2 +- trunk/include/linux/regulator/max8660.h | 57 ++ trunk/include/linux/vermagic.h | 2 +- trunk/init/Makefile | 8 +- trunk/init/version.c | 4 +- trunk/kernel/bounds.c | 2 +- trunk/kernel/kexec.c | 2 +- trunk/kernel/trace/trace.c | 2 +- trunk/scripts/Kbuild.include | 6 - trunk/scripts/Makefile.lib | 2 +- trunk/scripts/Makefile.modbuiltin | 55 -- trunk/scripts/basic/fixdep.c | 10 +- trunk/scripts/genksyms/keywords.c_shipped | 191 ++++--- trunk/scripts/genksyms/keywords.gperf | 2 - trunk/scripts/headers.sh | 2 + trunk/scripts/kconfig/Makefile | 1 - trunk/scripts/kconfig/confdata.c | 24 +- trunk/scripts/mkcompile_h | 2 +- trunk/scripts/mod/modpost.c | 2 +- trunk/scripts/package/Makefile | 20 +- trunk/scripts/package/buildtar | 6 +- trunk/scripts/tags.sh | 8 +- trunk/scripts/unifdef.c | 341 +++++------- trunk/usr/gen_init_cpio.c | 5 +- 97 files changed, 988 insertions(+), 565 deletions(-) delete mode 100644 trunk/arch/alpha/include/asm/asm-offsets.h delete mode 100644 trunk/arch/arm/include/asm/asm-offsets.h delete mode 100644 trunk/arch/arm/include/asm/mach-types.h delete mode 100644 trunk/arch/avr32/include/asm/asm-offsets.h delete mode 100644 trunk/arch/blackfin/include/asm/asm-offsets.h delete mode 100644 trunk/arch/cris/include/asm/asm-offsets.h delete mode 100644 trunk/arch/frv/include/asm/asm-offsets.h delete mode 100644 trunk/arch/h8300/include/asm/asm-offsets.h delete mode 100644 trunk/arch/ia64/include/asm/asm-offsets.h delete mode 100644 trunk/arch/m68k/include/asm/asm-offsets.h delete mode 100644 trunk/arch/microblaze/include/asm/asm-offsets.h delete mode 100644 trunk/arch/mips/include/asm/asm-offsets.h delete mode 100644 trunk/arch/mn10300/include/asm/asm-offsets.h delete mode 100644 trunk/arch/parisc/include/asm/asm-offsets.h delete mode 100644 trunk/arch/powerpc/include/asm/asm-offsets.h delete mode 100644 trunk/arch/s390/include/asm/asm-offsets.h delete mode 100644 trunk/arch/score/include/asm/asm-offsets.h create mode 100644 trunk/arch/sh/include/asm/.gitignore delete mode 100644 trunk/arch/sh/include/asm/asm-offsets.h delete mode 100644 trunk/arch/sparc/include/asm/asm-offsets.h delete mode 100644 trunk/arch/um/include/asm/asm-offsets.h delete mode 100644 trunk/arch/x86/include/asm/asm-offsets.h delete mode 100644 trunk/arch/xtensa/include/asm/asm-offsets.h create mode 100644 trunk/drivers/regulator/max8660.c create mode 100644 trunk/include/linux/regulator/max8660.h delete mode 100644 trunk/scripts/Makefile.modbuiltin diff --git a/[refs] b/[refs] index 2771298e3d35..4eb4ee63eb7d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a865c0606eb44d5d12cabb429751c83712183de +refs/heads/master: 27f37e4bfed803be338dcc78845d4a67eefb40a0 diff --git a/trunk/.gitignore b/trunk/.gitignore index fb2190c61af0..946c7ec5c922 100644 --- a/trunk/.gitignore +++ b/trunk/.gitignore @@ -22,7 +22,6 @@ *.lst *.symtypes *.order -modules.builtin *.elf *.bin *.gz @@ -46,8 +45,14 @@ Module.symvers # # Generated include files # +include/asm +include/asm-*/asm-offsets.h include/config +include/linux/autoconf.h +include/linux/compile.h include/linux/version.h +include/linux/utsrelease.h +include/linux/bounds.h include/generated # stgit generated dirs diff --git a/trunk/Documentation/dontdiff b/trunk/Documentation/dontdiff index 3ad6acead949..e151b2a36267 100644 --- a/trunk/Documentation/dontdiff +++ b/trunk/Documentation/dontdiff @@ -103,7 +103,6 @@ gconf gen-devlist gen_crc32table gen_init_cpio -generated genheaders genksyms *_gray256.c diff --git a/trunk/Documentation/kbuild/kbuild.txt b/trunk/Documentation/kbuild/kbuild.txt index 6f8c1cabbc5d..bb3bf38f03da 100644 --- a/trunk/Documentation/kbuild/kbuild.txt +++ b/trunk/Documentation/kbuild/kbuild.txt @@ -1,17 +1,3 @@ -Output files - -modules.order --------------------------------------------------- -This file records the order in which modules appear in Makefiles. This -is used by modprobe to deterministically resolve aliases that match -multiple modules. - -modules.builtin --------------------------------------------------- -This file lists all modules that are built into the kernel. This is used -by modprobe to not fail when trying to load something builtin. - - Environment variables KCPPFLAGS diff --git a/trunk/Documentation/kbuild/kconfig.txt b/trunk/Documentation/kbuild/kconfig.txt index 49efae703979..849b5e56d06f 100644 --- a/trunk/Documentation/kbuild/kconfig.txt +++ b/trunk/Documentation/kbuild/kconfig.txt @@ -103,16 +103,10 @@ KCONFIG_AUTOCONFIG This environment variable can be set to specify the path & name of the "auto.conf" file. Its default value is "include/config/auto.conf". -KCONFIG_TRISTATE --------------------------------------------------- -This environment variable can be set to specify the path & name of the -"tristate.conf" file. Its default value is "include/config/tristate.conf". - KCONFIG_AUTOHEADER -------------------------------------------------- This environment variable can be set to specify the path & name of the -"autoconf.h" (header) file. -Its default value is "include/generated/autoconf.h". +"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h". ====================================================================== diff --git a/trunk/Kbuild b/trunk/Kbuild index e3737ad72b5a..f056b4feee51 100644 --- a/trunk/Kbuild +++ b/trunk/Kbuild @@ -8,7 +8,7 @@ ##### # 1) Generate bounds.h -bounds-file := include/generated/bounds.h +bounds-file := include/linux/bounds.h always := $(bounds-file) targets := $(bounds-file) kernel/bounds.s @@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild # 2) Generate asm-offsets.h # -offsets-file := include/generated/asm-offsets.h +offsets-file := include/asm/asm-offsets.h always += $(offsets-file) targets += $(offsets-file) diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index efd2ef2c2660..0699782f8c5b 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -5434,12 +5434,6 @@ F: drivers/uwb/* F: include/linux/uwb.h F: include/linux/uwb/ -UNIFDEF -M: Tony Finch -W: http://dotat.at/prog/unifdef -S: Maintained -F: scripts/unifdef.c - UNIFORM CDROM DRIVER M: Jens Axboe W: http://www.kernel.dk diff --git a/trunk/Makefile b/trunk/Makefile index 8491b21b5537..33d4732a6c4a 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -334,9 +334,10 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage # Use LINUXINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option -LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ - -include include/generated/autoconf.h +LINUXINCLUDE := -Iinclude \ + $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) \ + -I$(srctree)/arch/$(hdr-arch)/include \ + -include include/linux/autoconf.h KBUILD_CPPFLAGS := -D__KERNEL__ @@ -464,7 +465,7 @@ ifeq ($(KBUILD_EXTMOD),) # Carefully list dependencies so we do not try to build scripts twice # in parallel PHONY += scripts -scripts: scripts_basic include/config/auto.conf include/config/tristate.conf +scripts: scripts_basic include/config/auto.conf $(Q)$(MAKE) $(build)=$(@) # Objects we will link into vmlinux / subdirs we need to visit @@ -491,18 +492,18 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # with it and forgot to run make oldconfig. # if auto.conf.cmd is missing then we are probably in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files -include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd +include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig else -# external modules needs include/generated/autoconf.h and include/config/auto.conf +# external modules needs include/linux/autoconf.h and include/config/auto.conf # but do not care if they are up-to-date. Use auto.conf to trigger the test PHONY += include/config/auto.conf include/config/auto.conf: - $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ + $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \ echo; \ echo " ERROR: Kernel configuration is invalid."; \ - echo " include/generated/autoconf.h or $@ are missing.";\ + echo " include/linux/autoconf.h or $@ are missing."; \ echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo; \ /bin/false) @@ -876,9 +877,6 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare scripts $(Q)$(MAKE) $(build)=$@ -ifdef CONFIG_MODULES - $(Q)$(MAKE) $(modbuiltin)=$@ -endif # Build the kernel release string # @@ -957,6 +955,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 # prepare3 is used to check if we are building in a separate output directory, # and if so do: # 1) Check that make has not been executed in the kernel src $(srctree) +# 2) Create the include2 directory, used for the second asm symlink prepare3: include/config/kernel.release ifneq ($(KBUILD_SRC),) @$(kecho) ' Using $(srctree) as source for kernel' @@ -965,13 +964,17 @@ ifneq ($(KBUILD_SRC),) echo " in the '$(srctree)' directory.";\ /bin/false; \ fi; + $(Q)if [ ! -d include2 ]; then \ + mkdir -p include2; \ + ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ + fi endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile -prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ - include/config/auto.conf +prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ + include/asm include/config/auto.conf $(cmd_crmodverdir) archprepare: prepare1 scripts_basic @@ -983,6 +986,42 @@ prepare0: archprepare FORCE # All the preparing.. prepare: prepare0 +# The asm symlink changes when $(ARCH) changes. +# Detect this and ask user to run make mrproper +# If asm is a stale symlink (point to dir that does not exist) remove it +define check-symlink + set -e; \ + if [ -L include/asm ]; then \ + asmlink=`readlink include/asm | cut -d '-' -f 2`; \ + if [ "$$asmlink" != "$(SRCARCH)" ]; then \ + echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \ + echo " set ARCH or save .config and run 'make mrproper' to fix it"; \ + exit 1; \ + fi; \ + test -e $$asmlink || rm include/asm; \ + elif [ -d include/asm ]; then \ + echo "ERROR: $@ is a directory but a symlink was expected";\ + exit 1; \ + fi +endef + +# We create the target directory of the symlink if it does +# not exist so the test in check-symlink works and we have a +# directory for generated filesas used by some architectures. +define create-symlink + if [ ! -L include/asm ]; then \ + $(kecho) ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \ + if [ ! -d include/asm-$(SRCARCH) ]; then \ + mkdir -p include/asm-$(SRCARCH); \ + fi; \ + ln -fsn asm-$(SRCARCH) $@; \ + fi +endef + +include/asm: FORCE + $(Q)$(check-symlink) + $(Q)$(create-symlink) + # Generate some files # --------------------------------------------------------------------------- @@ -1007,7 +1046,7 @@ endef include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) -include/generated/utsrelease.h: include/config/kernel.release FORCE +include/linux/utsrelease.h: include/config/kernel.release FORCE $(call filechk,utsrelease.h) PHONY += headerdep @@ -1037,6 +1076,11 @@ firmware_install: FORCE export INSTALL_HDR_PATH = $(objtree)/usr hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj +# Find out where the Kbuild file is located to support +# arch/$(ARCH)/include/asm +hdr-dir = $(strip \ + $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild), \ + arch/$(hdr-arch)/include/asm, include/asm-$(hdr-arch))) # If we do an all arch process set dst to asm-$(hdr-arch) hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) @@ -1051,10 +1095,10 @@ headers_install_all: PHONY += headers_install headers_install: __headers - $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ + $(if $(wildcard $(srctree)/$(hdr-dir)/Kbuild),, \ $(error Headers not exportable for the $(SRCARCH) architecture)) $(Q)$(MAKE) $(hdr-inst)=include - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) + $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) PHONY += headers_check_all headers_check_all: headers_install_all @@ -1063,7 +1107,7 @@ headers_check_all: headers_install_all PHONY += headers_check headers_check: headers_install $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 - $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 + $(Q)$(MAKE) $(hdr-inst)=$(hdr-dir) $(hdr-dst) HDRCHECK=1 # --------------------------------------------------------------------------- # Modules @@ -1083,7 +1127,6 @@ all: modules PHONY += modules modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order - $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.builtin) > $(objtree)/modules.builtin @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild @@ -1113,7 +1156,6 @@ _modinst_: ln -s $(objtree) $(MODLIB)/build ; \ fi @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst # This depmod is only for convenience to give the initial @@ -1152,10 +1194,12 @@ CLEAN_FILES += vmlinux System.map \ .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map # Directories & files removed with 'make mrproper' -MRPROPER_DIRS += include/config usr/include include/generated -MRPROPER_FILES += .config .config.old .version .old_version \ - include/linux/version.h \ - Module.symvers tags TAGS cscope* +MRPROPER_DIRS += include/config include2 usr/include include/generated +MRPROPER_FILES += .config .config.old include/asm .version .old_version \ + include/linux/autoconf.h include/linux/version.h \ + include/linux/utsrelease.h \ + include/linux/bounds.h include/asm*/asm-offsets.h \ + Module.symvers Module.markers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules # @@ -1174,7 +1218,7 @@ clean: archclean $(clean-dirs) \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' -o -name 'modules.order' \ - -o -name modules.builtin -o -name '.tmp_*.o.*' \ + -o -name 'Module.markers' -o -name '.tmp_*.o.*' \ -o -name '*.gcno' \) -type f -print | xargs rm -f # mrproper - Delete all generated files, including .config @@ -1372,8 +1416,8 @@ $(clean-dirs): clean: rm-dirs := $(MODVERDIR) clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ - $(KBUILD_EXTMOD)/modules.order \ - $(KBUILD_EXTMOD)/modules.builtin + $(KBUILD_EXTMOD)/Module.markers \ + $(KBUILD_EXTMOD)/modules.order clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) diff --git a/trunk/arch/alpha/boot/bootp.c b/trunk/arch/alpha/boot/bootp.c index 3c8d1b25c661..3af21c789339 100644 --- a/trunk/arch/alpha/boot/bootp.c +++ b/trunk/arch/alpha/boot/bootp.c @@ -9,7 +9,7 @@ */ #include #include -#include +#include #include #include diff --git a/trunk/arch/alpha/boot/bootpz.c b/trunk/arch/alpha/boot/bootpz.c index ade3f129dc27..1036b515e20c 100644 --- a/trunk/arch/alpha/boot/bootpz.c +++ b/trunk/arch/alpha/boot/bootpz.c @@ -11,7 +11,7 @@ */ #include #include -#include +#include #include #include diff --git a/trunk/arch/alpha/boot/main.c b/trunk/arch/alpha/boot/main.c index 644b7db55438..89f3be071ae5 100644 --- a/trunk/arch/alpha/boot/main.c +++ b/trunk/arch/alpha/boot/main.c @@ -7,7 +7,7 @@ */ #include #include -#include +#include #include #include diff --git a/trunk/arch/alpha/include/asm/asm-offsets.h b/trunk/arch/alpha/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/alpha/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/arm/Makefile b/trunk/arch/arm/Makefile index e9da08483b3c..fa0cdab2e1d3 100644 --- a/trunk/arch/arm/Makefile +++ b/trunk/arch/arm/Makefile @@ -242,8 +242,15 @@ all: $(KBUILD_IMAGE) boot := arch/arm/boot -archprepare: - $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h +# Update machine arch and proc symlinks if something which affects +# them changed. We use .arch to indicate when they were updated +# last, otherwise make uses the target directory mtime. + +archprepare: maketools + +PHONY += maketools FORCE +maketools: include/linux/version.h FORCE + $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h # Convert bzImage to zImage bzImage: zImage @@ -254,6 +261,9 @@ zImage Image xipImage bootpImage uImage: vmlinux zinstall install: vmlinux $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ +CLEAN_FILES += include/asm-arm/mach-types.h \ + include/asm-arm/arch include/asm-arm/.arch + # We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot) diff --git a/trunk/arch/arm/include/asm/asm-offsets.h b/trunk/arch/arm/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/arm/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/arm/include/asm/mach-types.h b/trunk/arch/arm/include/asm/mach-types.h deleted file mode 100644 index 948178cc6ba8..000000000000 --- a/trunk/arch/arm/include/asm/mach-types.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/arm/tools/Makefile b/trunk/arch/arm/tools/Makefile index 635cb1865e4d..1dbaa29ac4d7 100644 --- a/trunk/arch/arm/tools/Makefile +++ b/trunk/arch/arm/tools/Makefile @@ -4,7 +4,7 @@ # Copyright (C) 2001 Russell King # -include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types +include/asm-arm/mach-types.h: $(src)/gen-mach-types $(src)/mach-types @echo ' Generating $@' @mkdir -p $(dir $@) $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } diff --git a/trunk/arch/arm/tools/gen-mach-types b/trunk/arch/arm/tools/gen-mach-types index 04fef71d7be9..ce319ef64bc1 100644 --- a/trunk/arch/arm/tools/gen-mach-types +++ b/trunk/arch/arm/tools/gen-mach-types @@ -1,6 +1,6 @@ #!/bin/awk # -# Awk script to generate include/generated/mach-types.h +# Awk script to generate include/asm-arm/mach-types.h # BEGIN { nr = 0 } /^#/ { next } diff --git a/trunk/arch/avr32/include/asm/asm-offsets.h b/trunk/arch/avr32/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/avr32/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/blackfin/include/asm/asm-offsets.h b/trunk/arch/blackfin/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/blackfin/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/cris/arch-v32/kernel/head.S b/trunk/arch/cris/arch-v32/kernel/head.S index 76266f80a5f1..3db478eb5155 100644 --- a/trunk/arch/cris/arch-v32/kernel/head.S +++ b/trunk/arch/cris/arch-v32/kernel/head.S @@ -10,6 +10,7 @@ * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so * -traditional must not be used when assembling this file. */ +#include #include #include #include diff --git a/trunk/arch/cris/include/asm/asm-offsets.h b/trunk/arch/cris/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/cris/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/cris/kernel/asm-offsets.c b/trunk/arch/cris/kernel/asm-offsets.c index dd7b8e983221..ddd6fbbe75de 100644 --- a/trunk/arch/cris/kernel/asm-offsets.c +++ b/trunk/arch/cris/kernel/asm-offsets.c @@ -1,5 +1,6 @@ #include #include +#include /* * Generate definitions needed by assembly language modules. diff --git a/trunk/arch/cris/kernel/vmlinux.lds.S b/trunk/arch/cris/kernel/vmlinux.lds.S index d49d17d2a14f..bbfda67d2907 100644 --- a/trunk/arch/cris/kernel/vmlinux.lds.S +++ b/trunk/arch/cris/kernel/vmlinux.lds.S @@ -8,6 +8,7 @@ * the kernel has booted. */ +#include #include #include diff --git a/trunk/arch/frv/include/asm/asm-offsets.h b/trunk/arch/frv/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/frv/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/frv/kernel/setup.c b/trunk/arch/frv/kernel/setup.c index 75cf7f4b2fa8..55e4fab7c0bc 100644 --- a/trunk/arch/frv/kernel/setup.c +++ b/trunk/arch/frv/kernel/setup.c @@ -10,7 +10,7 @@ * 2 of the License, or (at your option) any later version. */ -#include +#include #include #include #include diff --git a/trunk/arch/h8300/include/asm/asm-offsets.h b/trunk/arch/h8300/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/h8300/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/ia64/Makefile b/trunk/arch/ia64/Makefile index 475e2725fbde..e7cbaa02cd0b 100644 --- a/trunk/arch/ia64/Makefile +++ b/trunk/arch/ia64/Makefile @@ -103,4 +103,4 @@ archprepare: make_nr_irqs_h FORCE PHONY += make_nr_irqs_h FORCE make_nr_irqs_h: FORCE - $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.h + $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h diff --git a/trunk/arch/ia64/include/asm/asm-offsets.h b/trunk/arch/ia64/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/ia64/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/ia64/include/asm/irq.h b/trunk/arch/ia64/include/asm/irq.h index 91b920fd7d53..5282546cdf82 100644 --- a/trunk/arch/ia64/include/asm/irq.h +++ b/trunk/arch/ia64/include/asm/irq.h @@ -13,7 +13,7 @@ #include #include -#include +#include static __inline__ int irq_canonicalize (int irq) diff --git a/trunk/arch/ia64/kernel/Makefile b/trunk/arch/ia64/kernel/Makefile index 2a75e937ae8d..6b7edcab0cb5 100644 --- a/trunk/arch/ia64/kernel/Makefile +++ b/trunk/arch/ia64/kernel/Makefile @@ -81,14 +81,17 @@ define cmd_nr_irqs endef # We use internal kbuild rules to avoid the "is up to date" message from make -arch/$(SRCARCH)/kernel/nr-irqs.s: arch/$(SRCARCH)/kernel/nr-irqs.c +arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \ + $(wildcard $(srctree)/include/asm-ia64/*/irq.h) $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c) -include/generated/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s +include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s $(Q)mkdir -p $(dir $@) $(call cmd,nr_irqs) +clean-files += $(objtree)/include/asm-ia64/nr-irqs.h + # # native ivt.S, entry.S and fsys.S # diff --git a/trunk/arch/ia64/kvm/asm-offsets.c b/trunk/arch/ia64/kvm/asm-offsets.c index 9324c875caf5..0c3564a7a033 100644 --- a/trunk/arch/ia64/kvm/asm-offsets.c +++ b/trunk/arch/ia64/kvm/asm-offsets.c @@ -22,6 +22,7 @@ * */ +#include #include #include diff --git a/trunk/arch/m68k/include/asm/asm-offsets.h b/trunk/arch/m68k/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/m68k/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/m68k/kernel/head.S b/trunk/arch/m68k/kernel/head.S index ef54128baa0b..86edb5fbcfc3 100644 --- a/trunk/arch/m68k/kernel/head.S +++ b/trunk/arch/m68k/kernel/head.S @@ -196,7 +196,7 @@ * for them and trying to understand what they mean. * * CONFIG_xxx: These are the obvious machine configuration defines created - * during configuration. These are defined in autoconf.h. + * during configuration. These are defined in include/linux/autoconf.h. * * CONSOLE: There is support for head.S console in this file. This * console can talk to a Mac frame buffer, but could easily be extrapolated diff --git a/trunk/arch/microblaze/include/asm/asm-offsets.h b/trunk/arch/microblaze/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/microblaze/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/mips/include/asm/asm-offsets.h b/trunk/arch/mips/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/mips/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/mn10300/include/asm/asm-offsets.h b/trunk/arch/mn10300/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/mn10300/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/parisc/include/asm/asm-offsets.h b/trunk/arch/parisc/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/parisc/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/powerpc/include/asm/asm-offsets.h b/trunk/arch/powerpc/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/powerpc/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/powerpc/platforms/52xx/efika.c b/trunk/arch/powerpc/platforms/52xx/efika.c index 45c0cb9b67e6..bcc69e1f77c1 100644 --- a/trunk/arch/powerpc/platforms/52xx/efika.c +++ b/trunk/arch/powerpc/platforms/52xx/efika.c @@ -10,7 +10,7 @@ */ #include -#include +#include #include #include #include diff --git a/trunk/arch/powerpc/platforms/amigaone/setup.c b/trunk/arch/powerpc/platforms/amigaone/setup.c index fb4eb0df054c..9290a7a442d0 100644 --- a/trunk/arch/powerpc/platforms/amigaone/setup.c +++ b/trunk/arch/powerpc/platforms/amigaone/setup.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include diff --git a/trunk/arch/powerpc/platforms/cell/spufs/Makefile b/trunk/arch/powerpc/platforms/cell/spufs/Makefile index b9d5d678aa44..b93f877ba504 100644 --- a/trunk/arch/powerpc/platforms/cell/spufs/Makefile +++ b/trunk/arch/powerpc/platforms/cell/spufs/Makefile @@ -13,8 +13,10 @@ SPU_CC := $(SPU_CROSS)gcc SPU_AS := $(SPU_CROSS)gcc SPU_LD := $(SPU_CROSS)ld SPU_OBJCOPY := $(SPU_CROSS)objcopy -SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -D__KERNEL__ -SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -D__KERNEL__ +SPU_CFLAGS := -O2 -Wall -I$(srctree)/include \ + -I$(objtree)/include2 -D__KERNEL__ +SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include \ + -I$(objtree)/include2 -D__KERNEL__ SPU_LDFLAGS := -N -Ttext=0x0 $(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h diff --git a/trunk/arch/powerpc/platforms/chrp/setup.c b/trunk/arch/powerpc/platforms/chrp/setup.c index 8f41685d8f42..52f3df3b4ca0 100644 --- a/trunk/arch/powerpc/platforms/chrp/setup.c +++ b/trunk/arch/powerpc/platforms/chrp/setup.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/trunk/arch/powerpc/platforms/powermac/bootx_init.c b/trunk/arch/powerpc/platforms/powermac/bootx_init.c index 9dd789a7370d..cf660916ae0b 100644 --- a/trunk/arch/powerpc/platforms/powermac/bootx_init.c +++ b/trunk/arch/powerpc/platforms/powermac/bootx_init.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/trunk/arch/s390/include/asm/asm-offsets.h b/trunk/arch/s390/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/s390/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/score/include/asm/asm-offsets.h b/trunk/arch/score/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/score/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/sh/Makefile b/trunk/arch/sh/Makefile index db91925c79d1..ac17c5ac550e 100644 --- a/trunk/arch/sh/Makefile +++ b/trunk/arch/sh/Makefile @@ -205,7 +205,10 @@ libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \ zImage vmlinux.srec romImage -PHONY += $(BOOT_TARGETS) +PHONY += maketools $(BOOT_TARGETS) FORCE + +maketools: include/linux/version.h FORCE + $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h all: $(KBUILD_IMAGE) @@ -214,8 +217,7 @@ $(BOOT_TARGETS): vmlinux compressed: zImage -archprepare: - $(Q)$(MAKE) $(build)=arch/sh/tools include/generated/machtypes.h +archprepare: maketools archclean: $(Q)$(MAKE) $(clean)=$(boot) @@ -232,3 +234,5 @@ define archhelp @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' endef + +CLEAN_FILES += include/asm-sh/machtypes.h diff --git a/trunk/arch/sh/drivers/pci/fixups-rts7751r2d.c b/trunk/arch/sh/drivers/pci/fixups-rts7751r2d.c index 7898f14d6641..052b354236dc 100644 --- a/trunk/arch/sh/drivers/pci/fixups-rts7751r2d.c +++ b/trunk/arch/sh/drivers/pci/fixups-rts7751r2d.c @@ -15,7 +15,7 @@ #include #include #include "pci-sh4.h" -#include +#include #define PCIMCR_MRSET_OFF 0xBFFFFFFF #define PCIMCR_RFSH_OFF 0xFFFFFFFB diff --git a/trunk/arch/sh/include/asm/.gitignore b/trunk/arch/sh/include/asm/.gitignore new file mode 100644 index 000000000000..378db779fb6c --- /dev/null +++ b/trunk/arch/sh/include/asm/.gitignore @@ -0,0 +1 @@ +machtypes.h diff --git a/trunk/arch/sh/include/asm/asm-offsets.h b/trunk/arch/sh/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/sh/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/sh/include/asm/machvec.h b/trunk/arch/sh/include/asm/machvec.h index 9c30955630ff..84dd37761f56 100644 --- a/trunk/arch/sh/include/asm/machvec.h +++ b/trunk/arch/sh/include/asm/machvec.h @@ -12,7 +12,7 @@ #include #include -#include +#include struct sh_machine_vector { void (*mv_setup)(char **cmdline_p); diff --git a/trunk/arch/sh/tools/Makefile b/trunk/arch/sh/tools/Makefile index 558a56bcc7cf..567516b58acc 100644 --- a/trunk/arch/sh/tools/Makefile +++ b/trunk/arch/sh/tools/Makefile @@ -10,7 +10,7 @@ # Shamelessly cloned from ARM. # -include/generated/machtypes.h: $(src)/gen-mach-types $(src)/mach-types +include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types @echo ' Generating $@' - $(Q)mkdir -p $(dir $@) + $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } diff --git a/trunk/arch/sh/tools/gen-mach-types b/trunk/arch/sh/tools/gen-mach-types index f5ff7c5d8913..65161e368353 100644 --- a/trunk/arch/sh/tools/gen-mach-types +++ b/trunk/arch/sh/tools/gen-mach-types @@ -1,6 +1,6 @@ #!/bin/awk # -# Awk script to generate include/generated/machtypes.h +# Awk script to generate include/asm-sh/machtypes.h # Heavily based on arch/arm/tools/gen-mach-types # BEGIN { nr = 0 } diff --git a/trunk/arch/sparc/include/asm/asm-offsets.h b/trunk/arch/sparc/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/sparc/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/um/Makefile b/trunk/arch/um/Makefile index fab8121d2b32..fc633dbacf84 100644 --- a/trunk/arch/um/Makefile +++ b/trunk/arch/um/Makefile @@ -149,6 +149,6 @@ $(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s $(SHARED_HEADERS)/kern_constants.h: $(Q)mkdir -p $(dir $@) - $(Q)echo '#include "../../../../include/generated/asm-offsets.h"' >$@ + $(Q)echo '#include "../../../../include/asm/asm-offsets.h"' >$@ export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH diff --git a/trunk/arch/um/include/asm/asm-offsets.h b/trunk/arch/um/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/um/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/x86/boot/header.S b/trunk/arch/x86/boot/header.S index 93e689f4bd86..b31cc54b4641 100644 --- a/trunk/arch/x86/boot/header.S +++ b/trunk/arch/x86/boot/header.S @@ -16,7 +16,7 @@ */ #include -#include +#include #include #include #include diff --git a/trunk/arch/x86/boot/version.c b/trunk/arch/x86/boot/version.c index 2b15aa488ffb..2723d9b5ce43 100644 --- a/trunk/arch/x86/boot/version.c +++ b/trunk/arch/x86/boot/version.c @@ -13,8 +13,8 @@ */ #include "boot.h" -#include -#include +#include +#include const char kernel_version[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " diff --git a/trunk/arch/x86/include/asm/asm-offsets.h b/trunk/arch/x86/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/x86/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/arch/x86/kernel/ptrace.c b/trunk/arch/x86/kernel/ptrace.c index 017d937639fe..2779321046bd 100644 --- a/trunk/arch/x86/kernel/ptrace.c +++ b/trunk/arch/x86/kernel/ptrace.c @@ -509,14 +509,14 @@ static int genregs_get(struct task_struct *target, { if (kbuf) { unsigned long *k = kbuf; - while (count >= sizeof(*k)) { + while (count > 0) { *k++ = getreg(target, pos); count -= sizeof(*k); pos += sizeof(*k); } } else { unsigned long __user *u = ubuf; - while (count >= sizeof(*u)) { + while (count > 0) { if (__put_user(getreg(target, pos), u++)) return -EFAULT; count -= sizeof(*u); @@ -535,14 +535,14 @@ static int genregs_set(struct task_struct *target, int ret = 0; if (kbuf) { const unsigned long *k = kbuf; - while (count >= sizeof(*k) && !ret) { + while (count > 0 && !ret) { ret = putreg(target, pos, *k++); count -= sizeof(*k); pos += sizeof(*k); } } else { const unsigned long __user *u = ubuf; - while (count >= sizeof(*u) && !ret) { + while (count > 0 && !ret) { unsigned long word; ret = __get_user(word, u++); if (ret) @@ -1458,14 +1458,14 @@ static int genregs32_get(struct task_struct *target, { if (kbuf) { compat_ulong_t *k = kbuf; - while (count >= sizeof(*k)) { + while (count > 0) { getreg32(target, pos, k++); count -= sizeof(*k); pos += sizeof(*k); } } else { compat_ulong_t __user *u = ubuf; - while (count >= sizeof(*u)) { + while (count > 0) { compat_ulong_t word; getreg32(target, pos, &word); if (__put_user(word, u++)) @@ -1486,14 +1486,14 @@ static int genregs32_set(struct task_struct *target, int ret = 0; if (kbuf) { const compat_ulong_t *k = kbuf; - while (count >= sizeof(*k) && !ret) { + while (count > 0 && !ret) { ret = putreg32(target, pos, *k++); count -= sizeof(*k); pos += sizeof(*k); } } else { const compat_ulong_t __user *u = ubuf; - while (count >= sizeof(*u) && !ret) { + while (count > 0 && !ret) { compat_ulong_t word; ret = __get_user(word, u++); if (ret) diff --git a/trunk/arch/xtensa/include/asm/asm-offsets.h b/trunk/arch/xtensa/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182..000000000000 --- a/trunk/arch/xtensa/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/trunk/drivers/accessibility/braille/braille_console.c b/trunk/drivers/accessibility/braille/braille_console.c index cb423f5aef24..d672cfe7ca59 100644 --- a/trunk/drivers/accessibility/braille/braille_console.c +++ b/trunk/drivers/accessibility/braille/braille_console.c @@ -21,6 +21,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include #include diff --git a/trunk/drivers/hid/hid-lg.h b/trunk/drivers/hid/hid-lg.h index bf31592eaf79..27ae750ca878 100644 --- a/trunk/drivers/hid/hid-lg.h +++ b/trunk/drivers/hid/hid-lg.h @@ -1,6 +1,8 @@ #ifndef __HID_LG_H #define __HID_LG_H +#include + #ifdef CONFIG_LOGITECH_FF int lgff_init(struct hid_device *hdev); #else diff --git a/trunk/drivers/net/wireless/iwlwifi/iwl-core.h b/trunk/drivers/net/wireless/iwlwifi/iwl-core.h index 27ca859e7453..675b7df632fc 100644 --- a/trunk/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/trunk/drivers/net/wireless/iwlwifi/iwl-core.h @@ -63,7 +63,7 @@ #ifndef __iwl_core_h__ #define __iwl_core_h__ -#include +#include /************************ * forward declarations * diff --git a/trunk/drivers/platform/x86/compal-laptop.c b/trunk/drivers/platform/x86/compal-laptop.c index 1a387e79f719..11003bba10d3 100644 --- a/trunk/drivers/platform/x86/compal-laptop.c +++ b/trunk/drivers/platform/x86/compal-laptop.c @@ -51,6 +51,7 @@ #include #include #include +#include #define COMPAL_DRIVER_VERSION "0.2.6" diff --git a/trunk/drivers/regulator/Kconfig b/trunk/drivers/regulator/Kconfig index 7cfdd65bebb4..9e0aa14dc6af 100644 --- a/trunk/drivers/regulator/Kconfig +++ b/trunk/drivers/regulator/Kconfig @@ -69,6 +69,13 @@ config REGULATOR_MAX1586 regulator via I2C bus. The provided regulator is suitable for PXA27x chips to control VCC_CORE and VCC_USIM voltages. +config REGULATOR_MAX8660 + tristate "Maxim 8660/8661 voltage regulator" + depends on I2C + help + This driver controls a Maxim 8660/8661 voltage output + regulator via I2C bus. + config REGULATOR_TWL4030 bool "TI TWL4030/TWL5030/TWL6030/TPS695x0 PMIC" depends on TWL4030_CORE diff --git a/trunk/drivers/regulator/Makefile b/trunk/drivers/regulator/Makefile index 9ae3cc44e668..12285e41beec 100644 --- a/trunk/drivers/regulator/Makefile +++ b/trunk/drivers/regulator/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o +obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o diff --git a/trunk/drivers/regulator/max8660.c b/trunk/drivers/regulator/max8660.c new file mode 100644 index 000000000000..acc2fb7b6087 --- /dev/null +++ b/trunk/drivers/regulator/max8660.c @@ -0,0 +1,510 @@ +/* + * max8660.c -- Voltage regulation for the Maxim 8660/8661 + * + * based on max1586.c and wm8400-regulator.c + * + * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + * + * Some info: + * + * Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8660-MAX8661.pdf + * + * This chip is a bit nasty because it is a write-only device. Thus, the driver + * uses shadow registers to keep track of its values. The main problem appears + * to be the initialization: When Linux boots up, we cannot know if the chip is + * in the default state or not, so we would have to pass such information in + * platform_data. As this adds a bit of complexity to the driver, this is left + * out for now until it is really needed. + * + * [A|S|M]DTV1 registers are currently not used, but [A|S|M]DTV2. + * + * If the driver is feature complete, it might be worth to check if one set of + * functions for V3-V7 is sufficient. For maximum flexibility during + * development, they are separated for now. + * + */ + +#include +#include +#include +#include +#include +#include + +#define MAX8660_DCDC_MIN_UV 725000 +#define MAX8660_DCDC_MAX_UV 1800000 +#define MAX8660_DCDC_STEP 25000 +#define MAX8660_DCDC_MAX_SEL 0x2b + +#define MAX8660_LDO5_MIN_UV 1700000 +#define MAX8660_LDO5_MAX_UV 2000000 +#define MAX8660_LDO5_STEP 25000 +#define MAX8660_LDO5_MAX_SEL 0x0c + +#define MAX8660_LDO67_MIN_UV 1800000 +#define MAX8660_LDO67_MAX_UV 3300000 +#define MAX8660_LDO67_STEP 100000 +#define MAX8660_LDO67_MAX_SEL 0x0f + +enum { + MAX8660_OVER1, + MAX8660_OVER2, + MAX8660_VCC1, + MAX8660_ADTV1, + MAX8660_ADTV2, + MAX8660_SDTV1, + MAX8660_SDTV2, + MAX8660_MDTV1, + MAX8660_MDTV2, + MAX8660_L12VCR, + MAX8660_FPWM, + MAX8660_N_REGS, /* not a real register */ +}; + +struct max8660 { + struct i2c_client *client; + u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */ + struct regulator_dev *rdev[]; +}; + +static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val) +{ + static const u8 max8660_addresses[MAX8660_N_REGS] = + { 0x10, 0x12, 0x20, 0x23, 0x24, 0x29, 0x2a, 0x32, 0x33, 0x39, 0x80 }; + + int ret; + u8 reg_val = (max8660->shadow_regs[reg] & mask) | val; + dev_vdbg(&max8660->client->dev, "Writing reg %02x with %02x\n", + max8660_addresses[reg], reg_val); + + ret = i2c_smbus_write_byte_data(max8660->client, + max8660_addresses[reg], reg_val); + if (ret == 0) + max8660->shadow_regs[reg] = reg_val; + + return ret; +} + + +/* + * DCDC functions + */ + +static int max8660_dcdc_is_enabled(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 val = max8660->shadow_regs[MAX8660_OVER1]; + u8 mask = (rdev_get_id(rdev) == MAX8660_V3) ? 1 : 4; + return !!(val & mask); +} + +static int max8660_dcdc_enable(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 bit = (rdev_get_id(rdev) == MAX8660_V3) ? 1 : 4; + return max8660_write(max8660, MAX8660_OVER1, 0xff, bit); +} + +static int max8660_dcdc_disable(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 mask = (rdev_get_id(rdev) == MAX8660_V3) ? ~1 : ~4; + return max8660_write(max8660, MAX8660_OVER1, mask, 0); +} + +static int max8660_dcdc_list(struct regulator_dev *rdev, unsigned selector) +{ + if (selector > MAX8660_DCDC_MAX_SEL) + return -EINVAL; + return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP; +} + +static int max8660_dcdc_get(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 reg = (rdev_get_id(rdev) == MAX8660_V3) ? MAX8660_ADTV2 : MAX8660_SDTV2; + u8 selector = max8660->shadow_regs[reg]; + return MAX8660_DCDC_MIN_UV + selector * MAX8660_DCDC_STEP; +} + +static int max8660_dcdc_set(struct regulator_dev *rdev, int min_uV, int max_uV) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 reg, selector, bits; + int ret; + + if (min_uV < MAX8660_DCDC_MIN_UV || min_uV > MAX8660_DCDC_MAX_UV) + return -EINVAL; + if (max_uV < MAX8660_DCDC_MIN_UV || max_uV > MAX8660_DCDC_MAX_UV) + return -EINVAL; + + selector = (min_uV - (MAX8660_DCDC_MIN_UV - MAX8660_DCDC_STEP + 1)) + / MAX8660_DCDC_STEP; + + ret = max8660_dcdc_list(rdev, selector); + if (ret < 0 || ret > max_uV) + return -EINVAL; + + reg = (rdev_get_id(rdev) == MAX8660_V3) ? MAX8660_ADTV2 : MAX8660_SDTV2; + ret = max8660_write(max8660, reg, 0, selector); + if (ret) + return ret; + + /* Select target voltage register and activate regulation */ + bits = (rdev_get_id(rdev) == MAX8660_V3) ? 0x03 : 0x30; + return max8660_write(max8660, MAX8660_VCC1, 0xff, bits); +} + +static struct regulator_ops max8660_dcdc_ops = { + .is_enabled = max8660_dcdc_is_enabled, + .list_voltage = max8660_dcdc_list, + .set_voltage = max8660_dcdc_set, + .get_voltage = max8660_dcdc_get, +}; + + +/* + * LDO5 functions + */ + +static int max8660_ldo5_list(struct regulator_dev *rdev, unsigned selector) +{ + if (selector > MAX8660_LDO5_MAX_SEL) + return -EINVAL; + return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP; +} + +static int max8660_ldo5_get(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 selector = max8660->shadow_regs[MAX8660_MDTV2]; + + return MAX8660_LDO5_MIN_UV + selector * MAX8660_LDO5_STEP; +} + +static int max8660_ldo5_set(struct regulator_dev *rdev, int min_uV, int max_uV) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 selector; + int ret; + + if (min_uV < MAX8660_LDO5_MIN_UV || min_uV > MAX8660_LDO5_MAX_UV) + return -EINVAL; + if (max_uV < MAX8660_LDO5_MIN_UV || max_uV > MAX8660_LDO5_MAX_UV) + return -EINVAL; + + selector = (min_uV - (MAX8660_LDO5_MIN_UV - MAX8660_LDO5_STEP + 1)) + / MAX8660_LDO5_STEP; + ret = max8660_ldo5_list(rdev, selector); + if (ret < 0 || ret > max_uV) + return -EINVAL; + + ret = max8660_write(max8660, MAX8660_MDTV2, 0, selector); + if (ret) + return ret; + + /* Select target voltage register and activate regulation */ + return max8660_write(max8660, MAX8660_VCC1, 0xff, 0xc0); +} + +static struct regulator_ops max8660_ldo5_ops = { + .list_voltage = max8660_ldo5_list, + .set_voltage = max8660_ldo5_set, + .get_voltage = max8660_ldo5_get, +}; + + +/* + * LDO67 functions + */ + +static int max8660_ldo67_is_enabled(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 val = max8660->shadow_regs[MAX8660_OVER2]; + u8 mask = (rdev_get_id(rdev) == MAX8660_V6) ? 2 : 4; + return !!(val & mask); +} + +static int max8660_ldo67_enable(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 bit = (rdev_get_id(rdev) == MAX8660_V6) ? 2 : 4; + return max8660_write(max8660, MAX8660_OVER2, 0xff, bit); +} + +static int max8660_ldo67_disable(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 mask = (rdev_get_id(rdev) == MAX8660_V6) ? ~2 : ~4; + return max8660_write(max8660, MAX8660_OVER2, mask, 0); +} + +static int max8660_ldo67_list(struct regulator_dev *rdev, unsigned selector) +{ + if (selector > MAX8660_LDO67_MAX_SEL) + return -EINVAL; + return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP; +} + +static int max8660_ldo67_get(struct regulator_dev *rdev) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 shift = (rdev_get_id(rdev) == MAX8660_V6) ? 0 : 4; + u8 selector = (max8660->shadow_regs[MAX8660_L12VCR] >> shift) & 0xf; + + return MAX8660_LDO67_MIN_UV + selector * MAX8660_LDO67_STEP; +} + +static int max8660_ldo67_set(struct regulator_dev *rdev, int min_uV, int max_uV) +{ + struct max8660 *max8660 = rdev_get_drvdata(rdev); + u8 selector; + int ret; + + if (min_uV < MAX8660_LDO67_MIN_UV || min_uV > MAX8660_LDO67_MAX_UV) + return -EINVAL; + if (max_uV < MAX8660_LDO67_MIN_UV || max_uV > MAX8660_LDO67_MAX_UV) + return -EINVAL; + + selector = (min_uV - (MAX8660_LDO67_MIN_UV - MAX8660_LDO67_STEP + 1)) + / MAX8660_LDO67_STEP; + + ret = max8660_ldo67_list(rdev, selector); + if (ret < 0 || ret > max_uV) + return -EINVAL; + + if (rdev_get_id(rdev) == MAX8660_V6) + return max8660_write(max8660, MAX8660_L12VCR, 0xf0, selector); + else + return max8660_write(max8660, MAX8660_L12VCR, 0x0f, selector << 4); +} + +static struct regulator_ops max8660_ldo67_ops = { + .is_enabled = max8660_ldo67_is_enabled, + .enable = max8660_ldo67_enable, + .disable = max8660_ldo67_disable, + .list_voltage = max8660_ldo67_list, + .get_voltage = max8660_ldo67_get, + .set_voltage = max8660_ldo67_set, +}; + +static struct regulator_desc max8660_reg[] = { + { + .name = "V3(DCDC)", + .id = MAX8660_V3, + .ops = &max8660_dcdc_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = MAX8660_DCDC_MAX_SEL + 1, + .owner = THIS_MODULE, + }, + { + .name = "V4(DCDC)", + .id = MAX8660_V4, + .ops = &max8660_dcdc_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = MAX8660_DCDC_MAX_SEL + 1, + .owner = THIS_MODULE, + }, + { + .name = "V5(LDO)", + .id = MAX8660_V5, + .ops = &max8660_ldo5_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = MAX8660_LDO5_MAX_SEL + 1, + .owner = THIS_MODULE, + }, + { + .name = "V6(LDO)", + .id = MAX8660_V6, + .ops = &max8660_ldo67_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = MAX8660_LDO67_MAX_SEL + 1, + .owner = THIS_MODULE, + }, + { + .name = "V7(LDO)", + .id = MAX8660_V7, + .ops = &max8660_ldo67_ops, + .type = REGULATOR_VOLTAGE, + .n_voltages = MAX8660_LDO67_MAX_SEL + 1, + .owner = THIS_MODULE, + }, +}; + +static int max8660_probe(struct i2c_client *client, + const struct i2c_device_id *i2c_id) +{ + struct regulator_dev **rdev; + struct max8660_platform_data *pdata = client->dev.platform_data; + struct max8660 *max8660; + int boot_on, i, id, ret = -EINVAL; + + if (pdata->num_subdevs > MAX8660_V_END) { + dev_err(&client->dev, "Too much regulators found!\n"); + goto out; + } + + max8660 = kzalloc(sizeof(struct max8660) + + sizeof(struct regulator_dev *) * MAX8660_V_END, + GFP_KERNEL); + if (!max8660) { + ret = -ENOMEM; + goto out; + } + + max8660->client = client; + rdev = max8660->rdev; + + if (pdata->en34_is_high) { + /* Simulate always on */ + max8660->shadow_regs[MAX8660_OVER1] = 5; + } else { + /* Otherwise devices can be toggled via software */ + max8660_dcdc_ops.enable = max8660_dcdc_enable; + max8660_dcdc_ops.disable = max8660_dcdc_disable; + } + + /* + * First, set up shadow registers to prevent glitches. As some + * registers are shared between regulators, everything must be properly + * set up for all regulators in advance. + */ + max8660->shadow_regs[MAX8660_ADTV1] = + max8660->shadow_regs[MAX8660_ADTV2] = + max8660->shadow_regs[MAX8660_SDTV1] = + max8660->shadow_regs[MAX8660_SDTV2] = 0x1b; + max8660->shadow_regs[MAX8660_MDTV1] = + max8660->shadow_regs[MAX8660_MDTV2] = 0x04; + + for (i = 0; i < pdata->num_subdevs; i++) { + + if (!pdata->subdevs[i].platform_data) + goto err_free; + + boot_on = pdata->subdevs[i].platform_data->constraints.boot_on; + + switch (pdata->subdevs[i].id) { + case MAX8660_V3: + if (boot_on) + max8660->shadow_regs[MAX8660_OVER1] |= 1; + break; + + case MAX8660_V4: + if (boot_on) + max8660->shadow_regs[MAX8660_OVER1] |= 4; + break; + + case MAX8660_V5: + break; + + case MAX8660_V6: + if (boot_on) + max8660->shadow_regs[MAX8660_OVER2] |= 2; + break; + + case MAX8660_V7: + if (!strcmp(i2c_id->name, "max8661")) { + dev_err(&client->dev, "Regulator not on this chip!\n"); + goto err_free; + } + + if (boot_on) + max8660->shadow_regs[MAX8660_OVER2] |= 4; + break; + + default: + dev_err(&client->dev, "invalid regulator %s\n", + pdata->subdevs[i].name); + goto err_free; + } + } + + /* Finally register devices */ + for (i = 0; i < pdata->num_subdevs; i++) { + + id = pdata->subdevs[i].id; + + rdev[i] = regulator_register(&max8660_reg[id], &client->dev, + pdata->subdevs[i].platform_data, + max8660); + if (IS_ERR(rdev[i])) { + ret = PTR_ERR(rdev[i]); + dev_err(&client->dev, "failed to register %s\n", + max8660_reg[id].name); + goto err_unregister; + } + } + + i2c_set_clientdata(client, rdev); + dev_info(&client->dev, "Maxim 8660/8661 regulator driver loaded\n"); + return 0; + +err_unregister: + while (--i >= 0) + regulator_unregister(rdev[i]); +err_free: + kfree(max8660); +out: + return ret; +} + +static int max8660_remove(struct i2c_client *client) +{ + struct regulator_dev **rdev = i2c_get_clientdata(client); + int i; + + for (i = 0; i < MAX8660_V_END; i++) + if (rdev[i]) + regulator_unregister(rdev[i]); + kfree(rdev); + i2c_set_clientdata(client, NULL); + + return 0; +} + +static const struct i2c_device_id max8660_id[] = { + { "max8660", 0 }, + { "max8661", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max8660_id); + +static struct i2c_driver max8660_driver = { + .probe = max8660_probe, + .remove = max8660_remove, + .driver = { + .name = "max8660", + }, + .id_table = max8660_id, +}; + +static int __init max8660_init(void) +{ + return i2c_add_driver(&max8660_driver); +} +subsys_initcall(max8660_init); + +static void __exit max8660_exit(void) +{ + i2c_del_driver(&max8660_driver); +} +module_exit(max8660_exit); + +/* Module information */ +MODULE_DESCRIPTION("MAXIM 8660/8661 voltage regulator driver"); +MODULE_AUTHOR("Wolfram Sang"); +MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/staging/iio/ring_sw.h b/trunk/drivers/staging/iio/ring_sw.h index fd677f008365..f0b86f02cd80 100644 --- a/trunk/drivers/staging/iio/ring_sw.h +++ b/trunk/drivers/staging/iio/ring_sw.h @@ -29,6 +29,7 @@ * driver requests - some may support multiple options */ +#include #include "iio.h" #include "ring_generic.h" diff --git a/trunk/drivers/staging/panel/panel.c b/trunk/drivers/staging/panel/panel.c index f98a52448eae..4ce399b6d237 100644 --- a/trunk/drivers/staging/panel/panel.c +++ b/trunk/drivers/staging/panel/panel.c @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include diff --git a/trunk/drivers/video/atafb.c b/trunk/drivers/video/atafb.c index b7687c55fe16..2051c9dc813b 100644 --- a/trunk/drivers/video/atafb.c +++ b/trunk/drivers/video/atafb.c @@ -2245,6 +2245,9 @@ static int ext_setcolreg(unsigned int regno, unsigned int red, if (regno > 255) return 1; + if (regno > 255) + return 1; + switch (external_card_type) { case IS_VGA: OUTB(0x3c8, regno); diff --git a/trunk/include/linux/Kbuild b/trunk/include/linux/Kbuild index 756f831cbdd5..f72914db2a11 100644 --- a/trunk/include/linux/Kbuild +++ b/trunk/include/linux/Kbuild @@ -118,7 +118,6 @@ header-y += mtio.h header-y += ncp_no.h header-y += neighbour.h header-y += net_dropmon.h -header-y += net_tstamp.h header-y += netfilter_arp.h header-y += netrom.h header-y += nfs2.h diff --git a/trunk/include/linux/mmdebug.h b/trunk/include/linux/mmdebug.h index ee24ef8ab616..8a5509877192 100644 --- a/trunk/include/linux/mmdebug.h +++ b/trunk/include/linux/mmdebug.h @@ -1,6 +1,8 @@ #ifndef LINUX_MM_DEBUG_H #define LINUX_MM_DEBUG_H 1 +#include + #ifdef CONFIG_DEBUG_VM #define VM_BUG_ON(cond) BUG_ON(cond) #else diff --git a/trunk/include/linux/mmzone.h b/trunk/include/linux/mmzone.h index 30fe668c2542..6f7561730d88 100644 --- a/trunk/include/linux/mmzone.h +++ b/trunk/include/linux/mmzone.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/trunk/include/linux/page-flags.h b/trunk/include/linux/page-flags.h index 5b59f35dcb8f..feee2ba8d06a 100644 --- a/trunk/include/linux/page-flags.h +++ b/trunk/include/linux/page-flags.h @@ -8,7 +8,7 @@ #include #ifndef __GENERATING_BOUNDS_H #include -#include +#include #endif /* !__GENERATING_BOUNDS_H */ /* diff --git a/trunk/include/linux/regulator/max8660.h b/trunk/include/linux/regulator/max8660.h new file mode 100644 index 000000000000..9936763621c7 --- /dev/null +++ b/trunk/include/linux/regulator/max8660.h @@ -0,0 +1,57 @@ +/* + * max8660.h -- Voltage regulation for the Maxim 8660/8661 + * + * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __LINUX_REGULATOR_MAX8660_H +#define __LINUX_REGULATOR_MAX8660_H + +#include + +enum { + MAX8660_V3, + MAX8660_V4, + MAX8660_V5, + MAX8660_V6, + MAX8660_V7, + MAX8660_V_END, +}; + +/** + * max8660_subdev_data - regulator subdev data + * @id: regulator id + * @name: regulator name + * @platform_data: regulator init data + */ +struct max8660_subdev_data { + int id; + char *name; + struct regulator_init_data *platform_data; +}; + +/** + * max8660_platform_data - platform data for max8660 + * @num_subdevs: number of regulators used + * @subdevs: pointer to regulators used + * @en34_is_high: if EN34 is driven high, regulators cannot be en-/disabled. + */ +struct max8660_platform_data { + int num_subdevs; + struct max8660_subdev_data *subdevs; + unsigned en34_is_high:1; +}; +#endif diff --git a/trunk/include/linux/vermagic.h b/trunk/include/linux/vermagic.h index cf97b5b9d1fe..79b9837d9ca0 100644 --- a/trunk/include/linux/vermagic.h +++ b/trunk/include/linux/vermagic.h @@ -1,4 +1,4 @@ -#include +#include #include /* Simply sanity version stamp for modules. */ diff --git a/trunk/init/Makefile b/trunk/init/Makefile index 0bf677aa0872..4a243df426f7 100644 --- a/trunk/init/Makefile +++ b/trunk/init/Makefile @@ -15,8 +15,12 @@ mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o +# files to be removed upon make clean +clean-files := ../include/linux/compile.h + # dependencies on generated files need to be listed explicitly -$(obj)/version.o: include/generated/compile.h + +$(obj)/version.o: include/linux/compile.h # compile.h changes depending on hostname, generation number, etc, # so we regenerate it always. @@ -26,7 +30,7 @@ $(obj)/version.o: include/generated/compile.h chk_compile.h = : quiet_chk_compile.h = echo ' CHK $@' silent_chk_compile.h = : -include/generated/compile.h: FORCE +include/linux/compile.h: FORCE @$($(quiet)chk_compile.h) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)" diff --git a/trunk/init/version.c b/trunk/init/version.c index adff586401a5..52a8b98642b8 100644 --- a/trunk/init/version.c +++ b/trunk/init/version.c @@ -6,11 +6,11 @@ * May be freely distributed as part of Linux. */ -#include +#include #include #include #include -#include +#include #include #ifndef CONFIG_KALLSYMS diff --git a/trunk/kernel/bounds.c b/trunk/kernel/bounds.c index 98a51f26c136..3c5301381837 100644 --- a/trunk/kernel/bounds.c +++ b/trunk/kernel/bounds.c @@ -12,7 +12,7 @@ void foo(void) { - /* The enum constants to put into include/generated/bounds.h */ + /* The enum constants to put into include/linux/bounds.h */ DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS); DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES); /* End of constants */ diff --git a/trunk/kernel/kexec.c b/trunk/kernel/kexec.c index a9a93d9ee7a7..433e9fcc1fc5 100644 --- a/trunk/kernel/kexec.c +++ b/trunk/kernel/kexec.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/trunk/kernel/trace/trace.c b/trunk/kernel/trace/trace.c index 8b9f20ab8eed..06ba26747d7e 100644 --- a/trunk/kernel/trace/trace.c +++ b/trunk/kernel/trace/trace.c @@ -12,7 +12,7 @@ * Copyright (C) 2004 William Lee Irwin III */ #include -#include +#include #include #include #include diff --git a/trunk/scripts/Kbuild.include b/trunk/scripts/Kbuild.include index ed2773edfe71..c67e73ecd5be 100644 --- a/trunk/scripts/Kbuild.include +++ b/trunk/scripts/Kbuild.include @@ -149,12 +149,6 @@ ld-option = $(call try-run,\ # $(Q)$(MAKE) $(build)=dir build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj -### -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.modbuiltin obj= -# Usage: -# $(Q)$(MAKE) $(modbuiltin)=dir -modbuiltin := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.modbuiltin obj - # Prefix -I with $(srctree) if it is not an absolute path. # skip if -I has no parameter addtree = $(if $(patsubst -I%,%,$(1)), \ diff --git a/trunk/scripts/Makefile.lib b/trunk/scripts/Makefile.lib index cd815ac2a50b..224d85e72ef1 100644 --- a/trunk/scripts/Makefile.lib +++ b/trunk/scripts/Makefile.lib @@ -213,7 +213,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \ # Bzip2 and LZMA do not include size in file... so we have to fake that; # append the size as a 32-bit littleendian number as gzip does. -size_append = printf $(shell \ +size_append = /bin/echo -ne $(shell \ dec_size=0; \ for F in $1; do \ fsize=$$(stat -c "%s" $$F); \ diff --git a/trunk/scripts/Makefile.modbuiltin b/trunk/scripts/Makefile.modbuiltin deleted file mode 100644 index 102a276f6eea..000000000000 --- a/trunk/scripts/Makefile.modbuiltin +++ /dev/null @@ -1,55 +0,0 @@ -# ========================================================================== -# Generating modules.builtin -# ========================================================================== - -src := $(obj) - -PHONY := __modbuiltin -__modbuiltin: - --include include/config/auto.conf -# tristate.conf sets tristate variables to uppercase 'Y' or 'M' -# That way, we get the list of built-in modules in obj-Y --include include/config/tristate.conf - -include scripts/Kbuild.include - -# The filename Kbuild has precedence over Makefile -kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) -kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) -include $(kbuild-file) - -include scripts/Makefile.lib -__subdir-Y := $(patsubst %/,%,$(filter %/, $(obj-Y))) -subdir-Y += $(__subdir-Y) -subdir-ym := $(sort $(subdir-y) $(subdir-Y) $(subdir-m)) -subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) -obj-Y := $(addprefix $(obj)/,$(obj-Y)) - -modbuiltin-subdirs := $(patsubst %,%/modules.builtin, $(subdir-ym)) -modbuiltin-mods := $(filter %.ko, $(obj-Y:.o=.ko)) -modbuiltin-target := $(obj)/modules.builtin - -__modbuiltin: $(modbuiltin-target) $(subdir-ym) - @: - -$(modbuiltin-target): $(subdir-ym) FORCE - $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \ - cat /dev/null $(modbuiltin-subdirs)) > $@ - -PHONY += FORCE - -FORCE: - -# Descending -# --------------------------------------------------------------------------- - -PHONY += $(subdir-ym) -$(subdir-ym): - $(Q)$(MAKE) $(modbuiltin)=$@ - - -# Declare the contents of the .PHONY variable as phony. We keep that -# information in a variable se we can use it in if_changed and friends. - -.PHONY: $(PHONY) diff --git a/trunk/scripts/basic/fixdep.c b/trunk/scripts/basic/fixdep.c index ea26b23de082..6bf21f83837d 100644 --- a/trunk/scripts/basic/fixdep.c +++ b/trunk/scripts/basic/fixdep.c @@ -16,15 +16,15 @@ * tells make when to remake a file. * * To use this list as-is however has the drawback that virtually - * every file in the kernel includes autoconf.h. + * every file in the kernel includes . * - * If the user re-runs make *config, autoconf.h will be + * If the user re-runs make *config, linux/autoconf.h will be * regenerated. make notices that and will rebuild every file which * includes autoconf.h, i.e. basically all files. This is extremely * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. * * So we play the same trick that "mkdep" played before. We replace - * the dependency on autoconf.h by a dependency on every config + * the dependency on linux/autoconf.h by a dependency on every config * option which is mentioned in any of the listed prequisites. * * kconfig populates a tree in include/config/ with an empty file @@ -73,7 +73,7 @@ * cmd_ = * * and then basically copies the ..d file to stdout, in the - * process filtering out the dependency on autoconf.h and adding + * process filtering out the dependency on linux/autoconf.h and adding * dependencies on include/config/my/option.h for every * CONFIG_MY_OPTION encountered in any of the prequisites. * @@ -324,7 +324,7 @@ static void parse_dep_file(void *map, size_t len) p++; } memcpy(s, m, p-m); s[p-m] = 0; - if (strrcmp(s, "include/generated/autoconf.h") && + if (strrcmp(s, "include/linux/autoconf.h") && strrcmp(s, "arch/um/include/uml-config.h") && strrcmp(s, ".ver")) { printf(" %s \\\n", s); diff --git a/trunk/scripts/genksyms/keywords.c_shipped b/trunk/scripts/genksyms/keywords.c_shipped index 8060e06798b3..287467a2e8c7 100644 --- a/trunk/scripts/genksyms/keywords.c_shipped +++ b/trunk/scripts/genksyms/keywords.c_shipped @@ -1,4 +1,4 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ +/* ANSI-C code produced by gperf version 3.0.3 */ /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ @@ -34,7 +34,7 @@ struct resword; static const struct resword *is_reserved_word(register const char *str, register unsigned int len); #line 5 "scripts/genksyms/keywords.gperf" struct resword { const char *name; int token; }; -/* maximum key range = 64, duplicates = 0 */ +/* maximum key range = 62, duplicates = 0 */ #ifdef __GNUC__ __inline @@ -48,39 +48,39 @@ is_reserved_hash (register const char *str, register unsigned int len) { static const unsigned char asso_values[] = { - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 0, - 67, 67, 67, 67, 67, 67, 15, 67, 67, 67, - 0, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 0, 67, 0, 67, 5, - 25, 20, 15, 30, 67, 15, 67, 67, 10, 0, - 10, 40, 20, 67, 10, 5, 0, 10, 15, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67 + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 5, + 65, 65, 65, 65, 65, 65, 35, 65, 65, 65, + 0, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 0, 65, 0, 65, 5, + 20, 15, 10, 30, 65, 15, 65, 65, 20, 0, + 10, 35, 20, 65, 10, 5, 0, 10, 5, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, + 65, 65, 65, 65, 65, 65 }; return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; } #ifdef __GNUC__ __inline -#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ +#ifdef __GNUC_STDC_INLINE__ __attribute__ ((__gnu_inline__)) #endif #endif @@ -89,119 +89,116 @@ is_reserved_word (register const char *str, register unsigned int len) { enum { - TOTAL_KEYWORDS = 45, + TOTAL_KEYWORDS = 43, MIN_WORD_LENGTH = 3, MAX_WORD_LENGTH = 24, MIN_HASH_VALUE = 3, - MAX_HASH_VALUE = 66 + MAX_HASH_VALUE = 64 }; static const struct resword wordlist[] = { {""}, {""}, {""}, -#line 30 "scripts/genksyms/keywords.gperf" +#line 28 "scripts/genksyms/keywords.gperf" {"asm", ASM_KEYW}, {""}, -#line 12 "scripts/genksyms/keywords.gperf" +#line 10 "scripts/genksyms/keywords.gperf" {"__asm", ASM_KEYW}, {""}, -#line 13 "scripts/genksyms/keywords.gperf" +#line 11 "scripts/genksyms/keywords.gperf" {"__asm__", ASM_KEYW}, {""}, {""}, -#line 56 "scripts/genksyms/keywords.gperf" +#line 54 "scripts/genksyms/keywords.gperf" {"__typeof__", TYPEOF_KEYW}, {""}, -#line 16 "scripts/genksyms/keywords.gperf" +#line 14 "scripts/genksyms/keywords.gperf" {"__const", CONST_KEYW}, -#line 15 "scripts/genksyms/keywords.gperf" +#line 13 "scripts/genksyms/keywords.gperf" {"__attribute__", ATTRIBUTE_KEYW}, -#line 17 "scripts/genksyms/keywords.gperf" +#line 15 "scripts/genksyms/keywords.gperf" {"__const__", CONST_KEYW}, -#line 22 "scripts/genksyms/keywords.gperf" +#line 20 "scripts/genksyms/keywords.gperf" {"__signed__", SIGNED_KEYW}, -#line 48 "scripts/genksyms/keywords.gperf" +#line 46 "scripts/genksyms/keywords.gperf" {"static", STATIC_KEYW}, - {""}, -#line 43 "scripts/genksyms/keywords.gperf" +#line 22 "scripts/genksyms/keywords.gperf" + {"__volatile__", VOLATILE_KEYW}, +#line 41 "scripts/genksyms/keywords.gperf" {"int", INT_KEYW}, -#line 36 "scripts/genksyms/keywords.gperf" +#line 34 "scripts/genksyms/keywords.gperf" {"char", CHAR_KEYW}, -#line 37 "scripts/genksyms/keywords.gperf" +#line 35 "scripts/genksyms/keywords.gperf" {"const", CONST_KEYW}, -#line 49 "scripts/genksyms/keywords.gperf" +#line 47 "scripts/genksyms/keywords.gperf" {"struct", STRUCT_KEYW}, -#line 28 "scripts/genksyms/keywords.gperf" +#line 26 "scripts/genksyms/keywords.gperf" {"__restrict__", RESTRICT_KEYW}, -#line 29 "scripts/genksyms/keywords.gperf" - {"restrict", RESTRICT_KEYW}, -#line 9 "scripts/genksyms/keywords.gperf" - {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, -#line 20 "scripts/genksyms/keywords.gperf" - {"__inline__", INLINE_KEYW}, - {""}, -#line 24 "scripts/genksyms/keywords.gperf" - {"__volatile__", VOLATILE_KEYW}, -#line 7 "scripts/genksyms/keywords.gperf" - {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, #line 27 "scripts/genksyms/keywords.gperf" + {"restrict", RESTRICT_KEYW}, +#line 25 "scripts/genksyms/keywords.gperf" {"_restrict", RESTRICT_KEYW}, - {""}, -#line 14 "scripts/genksyms/keywords.gperf" - {"__attribute", ATTRIBUTE_KEYW}, -#line 8 "scripts/genksyms/keywords.gperf" - {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, #line 18 "scripts/genksyms/keywords.gperf" + {"__inline__", INLINE_KEYW}, +#line 12 "scripts/genksyms/keywords.gperf" + {"__attribute", ATTRIBUTE_KEYW}, + {""}, +#line 16 "scripts/genksyms/keywords.gperf" {"__extension__", EXTENSION_KEYW}, -#line 39 "scripts/genksyms/keywords.gperf" +#line 37 "scripts/genksyms/keywords.gperf" {"enum", ENUM_KEYW}, -#line 10 "scripts/genksyms/keywords.gperf" - {"EXPORT_UNUSED_SYMBOL", EXPORT_SYMBOL_KEYW}, -#line 40 "scripts/genksyms/keywords.gperf" +#line 21 "scripts/genksyms/keywords.gperf" + {"__volatile", VOLATILE_KEYW}, +#line 38 "scripts/genksyms/keywords.gperf" {"extern", EXTERN_KEYW}, {""}, -#line 21 "scripts/genksyms/keywords.gperf" +#line 19 "scripts/genksyms/keywords.gperf" {"__signed", SIGNED_KEYW}, -#line 11 "scripts/genksyms/keywords.gperf" - {"EXPORT_UNUSED_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, -#line 51 "scripts/genksyms/keywords.gperf" - {"union", UNION_KEYW}, -#line 55 "scripts/genksyms/keywords.gperf" +#line 9 "scripts/genksyms/keywords.gperf" + {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, + {""}, +#line 53 "scripts/genksyms/keywords.gperf" {"typeof", TYPEOF_KEYW}, -#line 50 "scripts/genksyms/keywords.gperf" +#line 48 "scripts/genksyms/keywords.gperf" {"typedef", TYPEDEF_KEYW}, -#line 19 "scripts/genksyms/keywords.gperf" +#line 17 "scripts/genksyms/keywords.gperf" {"__inline", INLINE_KEYW}, -#line 35 "scripts/genksyms/keywords.gperf" +#line 33 "scripts/genksyms/keywords.gperf" {"auto", AUTO_KEYW}, -#line 23 "scripts/genksyms/keywords.gperf" - {"__volatile", VOLATILE_KEYW}, +#line 49 "scripts/genksyms/keywords.gperf" + {"union", UNION_KEYW}, {""}, {""}, -#line 52 "scripts/genksyms/keywords.gperf" +#line 50 "scripts/genksyms/keywords.gperf" {"unsigned", UNSIGNED_KEYW}, - {""}, -#line 46 "scripts/genksyms/keywords.gperf" +#line 51 "scripts/genksyms/keywords.gperf" + {"void", VOID_KEYW}, +#line 44 "scripts/genksyms/keywords.gperf" {"short", SHORT_KEYW}, -#line 42 "scripts/genksyms/keywords.gperf" + {""}, {""}, +#line 52 "scripts/genksyms/keywords.gperf" + {"volatile", VOLATILE_KEYW}, + {""}, +#line 39 "scripts/genksyms/keywords.gperf" + {"float", FLOAT_KEYW}, +#line 36 "scripts/genksyms/keywords.gperf" + {"double", DOUBLE_KEYW}, + {""}, +#line 7 "scripts/genksyms/keywords.gperf" + {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, + {""}, {""}, +#line 40 "scripts/genksyms/keywords.gperf" {"inline", INLINE_KEYW}, +#line 8 "scripts/genksyms/keywords.gperf" + {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, +#line 43 "scripts/genksyms/keywords.gperf" + {"register", REGISTER_KEYW}, {""}, -#line 54 "scripts/genksyms/keywords.gperf" - {"volatile", VOLATILE_KEYW}, -#line 44 "scripts/genksyms/keywords.gperf" - {"long", LONG_KEYW}, -#line 26 "scripts/genksyms/keywords.gperf" +#line 24 "scripts/genksyms/keywords.gperf" {"_Bool", BOOL_KEYW}, - {""}, {""}, #line 45 "scripts/genksyms/keywords.gperf" - {"register", REGISTER_KEYW}, -#line 53 "scripts/genksyms/keywords.gperf" - {"void", VOID_KEYW}, -#line 41 "scripts/genksyms/keywords.gperf" - {"float", FLOAT_KEYW}, -#line 38 "scripts/genksyms/keywords.gperf" - {"double", DOUBLE_KEYW}, - {""}, {""}, {""}, {""}, -#line 47 "scripts/genksyms/keywords.gperf" - {"signed", SIGNED_KEYW} + {"signed", SIGNED_KEYW}, + {""}, {""}, +#line 42 "scripts/genksyms/keywords.gperf" + {"long", LONG_KEYW} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/trunk/scripts/genksyms/keywords.gperf b/trunk/scripts/genksyms/keywords.gperf index e6349acb6f2f..8fe977a4d57b 100644 --- a/trunk/scripts/genksyms/keywords.gperf +++ b/trunk/scripts/genksyms/keywords.gperf @@ -7,8 +7,6 @@ struct resword { const char *name; int token; } EXPORT_SYMBOL, EXPORT_SYMBOL_KEYW EXPORT_SYMBOL_GPL, EXPORT_SYMBOL_KEYW EXPORT_SYMBOL_GPL_FUTURE, EXPORT_SYMBOL_KEYW -EXPORT_UNUSED_SYMBOL, EXPORT_SYMBOL_KEYW -EXPORT_UNUSED_SYMBOL_GPL, EXPORT_SYMBOL_KEYW __asm, ASM_KEYW __asm__, ASM_KEYW __attribute, ATTRIBUTE_KEYW diff --git a/trunk/scripts/headers.sh b/trunk/scripts/headers.sh index 1ddcdd38d97f..0308ecc10d5b 100755 --- a/trunk/scripts/headers.sh +++ b/trunk/scripts/headers.sh @@ -8,6 +8,8 @@ do_command() { if [ -f ${srctree}/arch/$2/include/asm/Kbuild ]; then make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 + elif [ -f ${srctree}/include/asm-$2/Kbuild ]; then + make ARCH=$2 KBUILD_HEADERS=$1 headers_$1 else printf "Ignoring arch: %s\n" ${arch} fi diff --git a/trunk/scripts/kconfig/Makefile b/trunk/scripts/kconfig/Makefile index 999e8a7d5bf7..80599e3a7994 100644 --- a/trunk/scripts/kconfig/Makefile +++ b/trunk/scripts/kconfig/Makefile @@ -27,7 +27,6 @@ oldconfig: $(obj)/conf $< -o $(Kconfig) silentoldconfig: $(obj)/conf - $(Q)mkdir -p include/generated $< -s $(Kconfig) localmodconfig: $(obj)/streamline_config.pl $(obj)/conf diff --git a/trunk/scripts/kconfig/confdata.c b/trunk/scripts/kconfig/confdata.c index c4dec80cfd8e..b55e72ff2fc6 100644 --- a/trunk/scripts/kconfig/confdata.c +++ b/trunk/scripts/kconfig/confdata.c @@ -677,7 +677,7 @@ int conf_write_autoconf(void) struct symbol *sym; const char *str; const char *name; - FILE *out, *tristate, *out_h; + FILE *out, *out_h; time_t now; int i, l; @@ -692,16 +692,9 @@ int conf_write_autoconf(void) if (!out) return 1; - tristate = fopen(".tmpconfig_tristate", "w"); - if (!tristate) { - fclose(out); - return 1; - } - out_h = fopen(".tmpconfig.h", "w"); if (!out_h) { fclose(out); - fclose(tristate); return 1; } @@ -714,9 +707,6 @@ int conf_write_autoconf(void) "# %s" "#\n", sym_get_string_value(sym), ctime(&now)); - fprintf(tristate, "#\n" - "# Automatically generated - do not edit\n" - "\n"); fprintf(out_h, "/*\n" " * Automatically generated C config: don't edit\n" " * Linux kernel version: %s\n" @@ -737,14 +727,10 @@ int conf_write_autoconf(void) break; case mod: fprintf(out, "CONFIG_%s=m\n", sym->name); - fprintf(tristate, "CONFIG_%s=M\n", sym->name); fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); break; case yes: fprintf(out, "CONFIG_%s=y\n", sym->name); - if (sym->type == S_TRISTATE) - fprintf(tristate, "CONFIG_%s=Y\n", - sym->name); fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); break; } @@ -786,19 +772,13 @@ int conf_write_autoconf(void) } } fclose(out); - fclose(tristate); fclose(out_h); name = getenv("KCONFIG_AUTOHEADER"); if (!name) - name = "include/generated/autoconf.h"; + name = "include/linux/autoconf.h"; if (rename(".tmpconfig.h", name)) return 1; - name = getenv("KCONFIG_TRISTATE"); - if (!name) - name = "include/config/tristate.conf"; - if (rename(".tmpconfig_tristate", name)) - return 1; name = conf_get_autoconfig_name(); /* * This must be the last step, kbuild has a dependency on auto.conf diff --git a/trunk/scripts/mkcompile_h b/trunk/scripts/mkcompile_h index 23dbad80cce9..bce3d0fe6fbd 100755 --- a/trunk/scripts/mkcompile_h +++ b/trunk/scripts/mkcompile_h @@ -14,7 +14,7 @@ vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } # So "sudo make install" won't change the "compiled by " # do "compiled by root" -if [ -r $TARGET -a ! -O include/generated/autoconf.h ]; then +if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then vecho " SKIPPED $TARGET" exit 0 fi diff --git a/trunk/scripts/mod/modpost.c b/trunk/scripts/mod/modpost.c index 20923613467c..6c4ffc767b91 100644 --- a/trunk/scripts/mod/modpost.c +++ b/trunk/scripts/mod/modpost.c @@ -15,7 +15,7 @@ #include #include #include "modpost.h" -#include "../../include/generated/autoconf.h" +#include "../../include/linux/autoconf.h" #include "../../include/linux/license.h" /* Some toolchains use a `_' prefix for all user symbols. */ diff --git a/trunk/scripts/package/Makefile b/trunk/scripts/package/Makefile index 62fcc3a7f4d3..f67cc885c807 100644 --- a/trunk/scripts/package/Makefile +++ b/trunk/scripts/package/Makefile @@ -77,27 +77,9 @@ clean-files += $(objtree)/binkernel.spec # Deb target # --------------------------------------------------------------------------- -quiet_cmd_builddeb = BUILDDEB - cmd_builddeb = set -e; \ - test `id -u` = 0 || \ - test -n "$(KBUILD_PKG_ROOTCMD)" || { \ - which fakeroot >/dev/null 2>&1 && \ - KBUILD_PKG_ROOTCMD="fakeroot -u"; \ - } || { \ - echo; \ - echo "builddeb must be run as root (or using fakeroot)."; \ - echo "KBUILD_PKG_ROOTCMD is unset and fakeroot not found."; \ - echo "Try setting KBUILD_PKG_ROOTCMD to a command to acquire"; \ - echo "root privileges (e.g., 'fakeroot -u' or 'sudo')."; \ - false; \ - } && \ - \ - $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ - $(srctree)/scripts/package/builddeb - deb-pkg: FORCE $(MAKE) KBUILD_SRC= - $(call cmd,builddeb) + $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb clean-dirs += $(objtree)/debian/ diff --git a/trunk/scripts/package/buildtar b/trunk/scripts/package/buildtar index 51b2aa0acb82..b1fd48db1640 100644 --- a/trunk/scripts/package/buildtar +++ b/trunk/scripts/package/buildtar @@ -101,11 +101,7 @@ esac # ( cd "${tmpdir}" - opts= - if tar --owner=root --group=root --help >/dev/null 2>&1; then - opts="--owner=root --group=root" - fi - tar cf - . $opts | ${compress} > "${tarball}${file_ext}" + tar cf - . | ${compress} > "${tarball}${file_ext}" ) echo "Tarball successfully created in ${tarball}${file_ext}" diff --git a/trunk/scripts/tags.sh b/trunk/scripts/tags.sh index 1a0c44d7c4a7..d52f7a01557c 100755 --- a/trunk/scripts/tags.sh +++ b/trunk/scripts/tags.sh @@ -89,13 +89,7 @@ all_defconfigs() docscope() { - # always use absolute paths for cscope, as recommended by cscope - # upstream - case "$tree" in - /*) ;; - *) tree=$PWD/$tree ;; - esac - (cd /; echo \-k; echo \-q; all_sources) > cscope.files + (echo \-k; echo \-q; all_sources) > cscope.files cscope -b -f cscope.out } diff --git a/trunk/scripts/unifdef.c b/trunk/scripts/unifdef.c index 44d39785e50d..30d459fb0709 100644 --- a/trunk/scripts/unifdef.c +++ b/trunk/scripts/unifdef.c @@ -1,5 +1,13 @@ /* - * Copyright (c) 2002 - 2009 Tony Finch + * Copyright (c) 2002 - 2005 Tony Finch . All rights reserved. + * + * This code is derived from software contributed to Berkeley by Dave Yost. + * It was rewritten to support ANSI C by Tony Finch. The original version of + * unifdef carried the following copyright notice. None of its code remains + * in this version (though some of the names remain). + * + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,20 +31,23 @@ * SUCH DAMAGE. */ -/* - * This code was derived from software contributed to Berkeley by Dave Yost. - * It was rewritten to support ANSI C by Tony Finch. The original version - * of unifdef carried the 4-clause BSD copyright licence. None of its code - * remains in this version (though some of the names remain) so it now - * carries a more liberal licence. - * - * The latest version is available from http://dotat.at/prog/unifdef - */ +#include -static const char * const copyright[] = { - "@(#) Copyright (c) 2002 - 2009 Tony Finch \n", - "$dotat: unifdef/unifdef.c,v 1.190 2009/11/27 17:21:26 fanf2 Exp $", -}; +#ifndef lint +#if 0 +static const char copyright[] = +"@(#) Copyright (c) 1985, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif +#ifdef __IDSTRING +__IDSTRING(Berkeley, "@(#)unifdef.c 8.1 (Berkeley) 6/6/93"); +__IDSTRING(NetBSD, "$NetBSD: unifdef.c,v 1.8 2000/07/03 02:51:36 matt Exp $"); +__IDSTRING(dotat, "$dotat: things/unifdef.c,v 1.171 2005/03/08 12:38:48 fanf2 Exp $"); +#endif +#endif /* not lint */ +#ifdef __FBSDID +__FBSDID("$FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v 1.20 2005/05/21 09:55:09 ru Exp $"); +#endif /* * unifdef - remove ifdef'ed lines @@ -61,6 +72,8 @@ static const char * const copyright[] = { #include #include +size_t strlcpy(char *dst, const char *src, size_t siz); + /* types of input lines: */ typedef enum { LT_TRUEI, /* a true #if with ignore flag */ @@ -77,7 +90,6 @@ typedef enum { LT_DODGY_LAST = LT_DODGY + LT_ENDIF, LT_PLAIN, /* ordinary line */ LT_EOF, /* end of file */ - LT_ERROR, /* unevaluable #if */ LT_COUNT } Linetype; @@ -88,7 +100,7 @@ static char const * const linetype_name[] = { "DODGY IF", "DODGY TRUE", "DODGY FALSE", "DODGY ELIF", "DODGY ELTRUE", "DODGY ELFALSE", "DODGY ELSE", "DODGY ENDIF", - "PLAIN", "EOF", "ERROR" + "PLAIN", "EOF" }; /* state of #if processing */ @@ -156,13 +168,11 @@ static char const * const linestate_name[] = { * Globals. */ -static bool compblank; /* -B: compress blank lines */ -static bool lnblank; /* -b: blank deleted lines */ static bool complement; /* -c: do the complement */ static bool debugging; /* -d: debugging reports */ static bool iocccok; /* -e: fewer IOCCC errors */ -static bool strictlogic; /* -K: keep ambiguous #ifs */ static bool killconsts; /* -k: eval constant #ifs */ +static bool lnblank; /* -l: blank deleted lines */ static bool lnnum; /* -n: add #line directives */ static bool symlist; /* -s: output symbol list */ static bool text; /* -t: this is a text file */ @@ -186,9 +196,7 @@ static bool ignoring[MAXDEPTH]; /* ignore comments state */ static int stifline[MAXDEPTH]; /* start of current #if */ static int depth; /* current #if nesting */ static int delcount; /* count of deleted lines */ -static unsigned blankcount; /* count of blank lines */ -static unsigned blankmax; /* maximum recent blankcount */ -static bool constexpr; /* constant #if expression */ +static bool keepthis; /* don't delete constant #if */ static int exitstat; /* program exit status */ @@ -198,14 +206,13 @@ static void done(void); static void error(const char *); static int findsym(const char *); static void flushline(bool); -static Linetype parseline(void); +static Linetype get_line(void); static Linetype ifeval(const char **); static void ignoreoff(void); static void ignoreon(void); static void keywordedit(const char *); static void nest(void); static void process(void); -static const char *skipargs(const char *); static const char *skipcomment(const char *); static const char *skipsym(const char *); static void state(Ifstate); @@ -213,7 +220,7 @@ static int strlcmp(const char *, const char *, size_t); static void unnest(void); static void usage(void); -#define endsym(c) (!isalnum((unsigned char)c) && c != '_') +#define endsym(c) (!isalpha((unsigned char)c) && !isdigit((unsigned char)c) && c != '_') /* * The main program. @@ -223,7 +230,7 @@ main(int argc, char *argv[]) { int opt; - while ((opt = getopt(argc, argv, "i:D:U:I:BbcdeKklnst")) != -1) + while ((opt = getopt(argc, argv, "i:D:U:I:cdeklnst")) != -1) switch (opt) { case 'i': /* treat stuff controlled by these symbols as text */ /* @@ -248,13 +255,6 @@ main(int argc, char *argv[]) case 'I': /* no-op for compatibility with cpp */ break; - case 'B': /* compress blank lines around removed section */ - compblank = true; - break; - case 'b': /* blank deleted lines instead of omitting them */ - case 'l': /* backwards compatibility */ - lnblank = true; - break; case 'c': /* treat -D as -U and vice versa */ complement = true; break; @@ -264,12 +264,12 @@ main(int argc, char *argv[]) case 'e': /* fewer errors from dodgy lines */ iocccok = true; break; - case 'K': /* keep ambiguous #ifs */ - strictlogic = true; - break; case 'k': /* process constant #ifs */ killconsts = true; break; + case 'l': /* blank deleted lines instead of omitting them */ + lnblank = true; + break; case 'n': /* add #line directive after deleted lines */ lnnum = true; break; @@ -284,8 +284,6 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; - if (compblank && lnblank) - errx(2, "-B and -b are mutually exclusive"); if (argc > 1) { errx(2, "can only do one file"); } else if (argc == 1 && strcmp(*argv, "-") != 0) { @@ -304,7 +302,7 @@ main(int argc, char *argv[]) static void usage(void) { - fprintf(stderr, "usage: unifdef [-BbcdeKknst] [-Ipath]" + fprintf(stderr, "usage: unifdef [-cdeklnst] [-Ipath]" " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n"); exit(2); } @@ -385,46 +383,46 @@ static state_fn * const trans_table[IS_COUNT][LT_COUNT] = { /* IS_OUTSIDE */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Eendif, Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eendif, - print, done, abort }, + print, done }, /* IS_FALSE_PREFIX */ { Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Strue, Sfalse,Selse, Dendif, Idrop, Idrop, Fdrop, Fdrop, Fdrop, Mpass, Eioccc,Eioccc,Eioccc,Eioccc, - drop, Eeof, abort }, + drop, Eeof }, /* IS_TRUE_PREFIX */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Dfalse,Dfalse,Dfalse,Delse, Dendif, Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc, - print, Eeof, abort }, + print, Eeof }, /* IS_PASS_MIDDLE */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Pelif, Mtrue, Delif, Pelse, Pendif, Oiffy, Oiffy, Fpass, Oif, Oif, Pelif, Oelif, Oelif, Pelse, Pendif, - print, Eeof, abort }, + print, Eeof }, /* IS_FALSE_MIDDLE */ { Idrop, Idrop, Fdrop, Fdrop, Fdrop, Pelif, Mtrue, Delif, Pelse, Pendif, Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eioccc,Eioccc,Eioccc,Eioccc,Eioccc, - drop, Eeof, abort }, + drop, Eeof }, /* IS_TRUE_MIDDLE */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Melif, Melif, Melif, Melse, Pendif, Oiffy, Oiffy, Fpass, Oif, Oif, Eioccc,Eioccc,Eioccc,Eioccc,Pendif, - print, Eeof, abort }, + print, Eeof }, /* IS_PASS_ELSE */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Pendif, Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Pendif, - print, Eeof, abort }, + print, Eeof }, /* IS_FALSE_ELSE */ { Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Dendif, Idrop, Idrop, Fdrop, Fdrop, Fdrop, Eelif, Eelif, Eelif, Eelse, Eioccc, - drop, Eeof, abort }, + drop, Eeof }, /* IS_TRUE_ELSE */ { Itrue, Ifalse,Fpass, Ftrue, Ffalse,Eelif, Eelif, Eelif, Eelse, Dendif, Oiffy, Oiffy, Fpass, Oif, Oif, Eelif, Eelif, Eelif, Eelse, Eioccc, - print, Eeof, abort }, + print, Eeof }, /* IS_FALSE_TRAILER */ { Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Dendif, Idrop, Idrop, Fdrop, Fdrop, Fdrop, Dfalse,Dfalse,Dfalse,Delse, Eioccc, - drop, Eeof, abort } + drop, Eeof } /*TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF TRUEI FALSEI IF TRUE FALSE ELIF ELTRUE ELFALSE ELSE ENDIF (DODGY) - PLAIN EOF ERROR */ + PLAIN EOF */ }; /* @@ -465,11 +463,9 @@ keywordedit(const char *replacement) static void nest(void) { - if (depth > MAXDEPTH-1) - abort(); /* bug */ - if (depth == MAXDEPTH-1) - error("Too many levels of nesting"); depth += 1; + if (depth >= MAXDEPTH) + error("Too many levels of nesting"); stifline[depth] = linenum; } static void @@ -494,23 +490,15 @@ flushline(bool keep) if (symlist) return; if (keep ^ complement) { - bool blankline = tline[strspn(tline, " \t\n")] == '\0'; - if (blankline && compblank && blankcount != blankmax) { - delcount += 1; - blankcount += 1; - } else { - if (lnnum && delcount > 0) - printf("#line %d\n", linenum); - fputs(tline, stdout); - delcount = 0; - blankmax = blankcount = blankline ? blankcount + 1 : 0; - } + if (lnnum && delcount > 0) + printf("#line %d\n", linenum); + fputs(tline, stdout); + delcount = 0; } else { if (lnblank) putc('\n', stdout); exitstat = 1; delcount += 1; - blankcount = 0; } } @@ -522,12 +510,9 @@ process(void) { Linetype lineval; - /* When compressing blank lines, act as if the file - is preceded by a large number of blank lines. */ - blankmax = blankcount = 1000; for (;;) { linenum++; - lineval = parseline(); + lineval = get_line(); trans_table[ifstate[depth]][lineval](); debug("process %s -> %s depth %d", linetype_name[lineval], @@ -541,7 +526,7 @@ process(void) * help from skipcomment(). */ static Linetype -parseline(void) +get_line(void) { const char *cp; int cursym; @@ -610,21 +595,9 @@ parseline(void) if (incomment) linestate = LS_DIRTY; } - /* skipcomment normally changes the state, except - if the last line of the file lacks a newline, or - if there is too much whitespace in a directive */ - if (linestate == LS_HASH) { - size_t len = cp - tline; - if (fgets(tline + len, MAXLINE - len, input) == NULL) { - /* append the missing newline */ - tline[len+0] = '\n'; - tline[len+1] = '\0'; - cp++; - linestate = LS_START; - } else { - linestate = LS_DIRTY; - } - } + /* skipcomment should have changed the state */ + if (linestate == LS_HASH) + abort(); /* bug */ } if (linestate == LS_DIRTY) { while (*cp != '\0') @@ -637,40 +610,17 @@ parseline(void) /* * These are the binary operators that are supported by the expression - * evaluator. + * evaluator. Note that if support for division is added then we also + * need short-circuiting booleans because of divide-by-zero. */ -static Linetype op_strict(int *p, int v, Linetype at, Linetype bt) { - if(at == LT_IF || bt == LT_IF) return (LT_IF); - return (*p = v, v ? LT_TRUE : LT_FALSE); -} -static Linetype op_lt(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a < b, at, bt); -} -static Linetype op_gt(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a > b, at, bt); -} -static Linetype op_le(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a <= b, at, bt); -} -static Linetype op_ge(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a >= b, at, bt); -} -static Linetype op_eq(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a == b, at, bt); -} -static Linetype op_ne(int *p, Linetype at, int a, Linetype bt, int b) { - return op_strict(p, a != b, at, bt); -} -static Linetype op_or(int *p, Linetype at, int a, Linetype bt, int b) { - if (!strictlogic && (at == LT_TRUE || bt == LT_TRUE)) - return (*p = 1, LT_TRUE); - return op_strict(p, a || b, at, bt); -} -static Linetype op_and(int *p, Linetype at, int a, Linetype bt, int b) { - if (!strictlogic && (at == LT_FALSE || bt == LT_FALSE)) - return (*p = 0, LT_FALSE); - return op_strict(p, a && b, at, bt); -} +static int op_lt(int a, int b) { return (a < b); } +static int op_gt(int a, int b) { return (a > b); } +static int op_le(int a, int b) { return (a <= b); } +static int op_ge(int a, int b) { return (a >= b); } +static int op_eq(int a, int b) { return (a == b); } +static int op_ne(int a, int b) { return (a != b); } +static int op_or(int a, int b) { return (a || b); } +static int op_and(int a, int b) { return (a && b); } /* * An evaluation function takes three arguments, as follows: (1) a pointer to @@ -679,8 +629,8 @@ static Linetype op_and(int *p, Linetype at, int a, Linetype bt, int b) { * value of the expression; and (3) a pointer to a char* that points to the * expression to be evaluated and that is updated to the end of the expression * when evaluation is complete. The function returns LT_FALSE if the value of - * the expression is zero, LT_TRUE if it is non-zero, LT_IF if the expression - * depends on an unknown symbol, or LT_ERROR if there is a parse failure. + * the expression is zero, LT_TRUE if it is non-zero, or LT_IF if the + * expression could not be evaluated. */ struct ops; @@ -699,7 +649,7 @@ static const struct ops { eval_fn *inner; struct op { const char *str; - Linetype (*fn)(int *, Linetype, int, Linetype, int); + int (*fn)(int, int); } op[5]; } eval_ops[] = { { eval_table, { { "||", op_or } } }, @@ -714,8 +664,8 @@ static const struct ops { /* * Function for evaluating the innermost parts of expressions, - * viz. !expr (expr) number defined(symbol) symbol - * We reset the constexpr flag in the last two cases. + * viz. !expr (expr) defined(symbol) symbol number + * We reset the keepthis flag when we find a non-constant subexpression. */ static Linetype eval_unary(const struct ops *ops, int *valp, const char **cpp) @@ -723,83 +673,68 @@ eval_unary(const struct ops *ops, int *valp, const char **cpp) const char *cp; char *ep; int sym; - bool defparen; - Linetype lt; cp = skipcomment(*cpp); if (*cp == '!') { debug("eval%d !", ops - eval_ops); cp++; - lt = eval_unary(ops, valp, &cp); - if (lt == LT_ERROR) - return (LT_ERROR); - if (lt != LT_IF) { - *valp = !*valp; - lt = *valp ? LT_TRUE : LT_FALSE; + if (eval_unary(ops, valp, &cp) == LT_IF) { + *cpp = cp; + return (LT_IF); } + *valp = !*valp; } else if (*cp == '(') { cp++; debug("eval%d (", ops - eval_ops); - lt = eval_table(eval_ops, valp, &cp); - if (lt == LT_ERROR) - return (LT_ERROR); + if (eval_table(eval_ops, valp, &cp) == LT_IF) + return (LT_IF); cp = skipcomment(cp); if (*cp++ != ')') - return (LT_ERROR); + return (LT_IF); } else if (isdigit((unsigned char)*cp)) { debug("eval%d number", ops - eval_ops); *valp = strtol(cp, &ep, 0); - if (ep == cp) - return (LT_ERROR); - lt = *valp ? LT_TRUE : LT_FALSE; cp = skipsym(cp); } else if (strncmp(cp, "defined", 7) == 0 && endsym(cp[7])) { cp = skipcomment(cp+7); debug("eval%d defined", ops - eval_ops); - if (*cp == '(') { - cp = skipcomment(cp+1); - defparen = true; - } else { - defparen = false; - } + if (*cp++ != '(') + return (LT_IF); + cp = skipcomment(cp); sym = findsym(cp); - if (sym < 0) { - lt = LT_IF; - } else { - *valp = (value[sym] != NULL); - lt = *valp ? LT_TRUE : LT_FALSE; - } cp = skipsym(cp); cp = skipcomment(cp); - if (defparen && *cp++ != ')') - return (LT_ERROR); - constexpr = false; + if (*cp++ != ')') + return (LT_IF); + if (sym >= 0) + *valp = (value[sym] != NULL); + else { + *cpp = cp; + return (LT_IF); + } + keepthis = false; } else if (!endsym(*cp)) { debug("eval%d symbol", ops - eval_ops); sym = findsym(cp); - cp = skipsym(cp); - if (sym < 0) { - lt = LT_IF; - cp = skipargs(cp); - } else if (value[sym] == NULL) { + if (sym < 0) + return (LT_IF); + if (value[sym] == NULL) *valp = 0; - lt = LT_FALSE; - } else { + else { *valp = strtol(value[sym], &ep, 0); if (*ep != '\0' || ep == value[sym]) - return (LT_ERROR); - lt = *valp ? LT_TRUE : LT_FALSE; - cp = skipargs(cp); + return (LT_IF); } - constexpr = false; + cp = skipsym(cp); + keepthis = false; } else { debug("eval%d bad expr", ops - eval_ops); - return (LT_ERROR); + return (LT_IF); } *cpp = cp; debug("eval%d = %d", ops - eval_ops, *valp); - return (lt); + return (*valp ? LT_TRUE : LT_FALSE); } /* @@ -811,13 +746,11 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) const struct op *op; const char *cp; int val; - Linetype lt, rt; + Linetype lhs, rhs; debug("eval%d", ops - eval_ops); cp = *cpp; - lt = ops->inner(ops+1, valp, &cp); - if (lt == LT_ERROR) - return (LT_ERROR); + lhs = ops->inner(ops+1, valp, &cp); for (;;) { cp = skipcomment(cp); for (op = ops->op; op->str != NULL; op++) @@ -827,16 +760,32 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) break; cp += strlen(op->str); debug("eval%d %s", ops - eval_ops, op->str); - rt = ops->inner(ops+1, &val, &cp); - if (rt == LT_ERROR) - return (LT_ERROR); - lt = op->fn(valp, lt, *valp, rt, val); + rhs = ops->inner(ops+1, &val, &cp); + if (op->fn == op_and && (lhs == LT_FALSE || rhs == LT_FALSE)) { + debug("eval%d: and always false", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_FALSE; + continue; + } + if (op->fn == op_or && (lhs == LT_TRUE || rhs == LT_TRUE)) { + debug("eval%d: or always true", ops - eval_ops); + if (lhs == LT_IF) + *valp = val; + lhs = LT_TRUE; + continue; + } + if (rhs == LT_IF) + lhs = LT_IF; + if (lhs != LT_IF) + *valp = op->fn(*valp, val); } *cpp = cp; debug("eval%d = %d", ops - eval_ops, *valp); - debug("eval%d lt = %s", ops - eval_ops, linetype_name[lt]); - return (lt); + if (lhs != LT_IF) + lhs = (*valp ? LT_TRUE : LT_FALSE); + return lhs; } /* @@ -847,14 +796,17 @@ eval_table(const struct ops *ops, int *valp, const char **cpp) static Linetype ifeval(const char **cpp) { + const char *cp = *cpp; int ret; - int val = 0; + int val; debug("eval %s", *cpp); - constexpr = killconsts ? false : true; - ret = eval_table(eval_ops, &val, cpp); + keepthis = killconsts ? false : true; + ret = eval_table(eval_ops, &val, &cp); + if (ret != LT_IF) + *cpp = cp; debug("eval = %d", val); - return (constexpr ? LT_IF : ret == LT_ERROR ? LT_IF : ret); + return (keepthis ? LT_IF : ret); } /* @@ -965,31 +917,6 @@ skipcomment(const char *cp) return (cp); } -/* - * Skip macro arguments. - */ -static const char * -skipargs(const char *cp) -{ - const char *ocp = cp; - int level = 0; - cp = skipcomment(cp); - if (*cp != '(') - return (cp); - do { - if (*cp == '(') - level++; - if (*cp == ')') - level--; - cp = skipcomment(cp+1); - } while (level != 0 && *cp != '\0'); - if (level == 0) - return (cp); - else - /* Rewind and re-detect the syntax error later. */ - return (ocp); -} - /* * Skip over an identifier. */ @@ -1002,7 +929,7 @@ skipsym(const char *cp) } /* - * Look for the symbol in the symbol table. If it is found, we return + * Look for the symbol in the symbol table. If is is found, we return * the symbol table index, else we return -1. */ static int diff --git a/trunk/usr/gen_init_cpio.c b/trunk/usr/gen_init_cpio.c index b2b3c2d1cf8b..83b3dde1a83b 100644 --- a/trunk/usr/gen_init_cpio.c +++ b/trunk/usr/gen_init_cpio.c @@ -354,10 +354,7 @@ static int cpio_mkfile(const char *name, const char *location, push_pad(); if (size) { - if (fwrite(filebuf, size, 1, stdout) != 1) { - fprintf(stderr, "writing filebuf failed\n"); - goto error; - } + fwrite(filebuf, size, 1, stdout); offset += size; push_pad(); }