linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/35] UAPI header file split
@ 2011-07-02 11:07 David Howells
  2011-07-02 11:07 ` [PATCH 01/35] UAPI: Convert #include "..." to #include <path/...> in kernel system headers David Howells
                   ` (35 more replies)
  0 siblings, 36 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:07 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells


Here's my first installment of patches to clean up the kernel header files and
sort out the recursion problems.  The planned steps are:

 (1) Split the Userspace API (UAPI) out of the kernel headers into its own
     header directories.

 (2) Move stuff out of the Kernel API (KAPI) headers that can be contained in
     individual directories as it is referenced by a single file or directory
     of files.

 (3) Make coherent what can be found in commmon arch headers and disintegrate
     asm/system.h.

 (4) Split some headers into definitions containers and inline function
     containers to clean up recursion problems.  The main culprit is very
     likely to be linux/sched.h, I think.

 (5) I'd like to split some headers (e.g. linux/security.h) to reduce the
     conditional recompilation burden.  linux/security.h could have, for
     instance, struct security_operations split out into a header file private
     to the stuff in the security/ directory as the wrappers of its function
     pointers are now out of lined in security/security.c.

 (6) Replace the traditional anti-reinclusion guards on header files with
     three-state anti-recursion guards that abort compilation if recursive
     inclusion is encountered.

 (7) Provide a script to go through and rejig the #includes of each source file
     to have just the ones that are actually required.

 (8) Provide a make target that tests all the KAPI and UAPI headers by simply
     passing them one at a time to the compiler and attempting to compile them.

==

The patches actually posted here are the manual preparation for the UAPI split
in step (1) above.  I haven't posted the patches that do the actual splitting
by email as the largest of them is in excess of 120,000 lines.  However, the
patches are available through GIT:

	http://git.infradead.org/users/dhowells/linux-headers.git

All the development is on the uapi-split branch.  The patches posted here are
from the base of that branch up to the uapi-prep tag; the automated split
follows thereafter to the uapi-post-split tag.

The main aims of the split are:

 (1) To simplify the kernel headers by separating the UAPI from the KAPI.

 (2) You should be able to simply copy the UAPI directories to userspace with
     no processing, and they should just work.  Unfortunately, it's not quite
     that simple as some of the UAPI headers behave differently depending on
     whether __KERNEL__ is defined or not.

 (3) To eliminate the need for __KERNEL__.  After the split, __KERNEL__ can
     certainly by unifdef'd from the residual kernel headers - but this isn't
     quite true of the UAPI headers.

The main restrictions on how I've done the split are:

 (1) The GIT history must be maintained in both sides of a split header file.

 (2) I don't want to have to alter every #include directive in the kernel
     sources.

 (3) "make allyesconfig" should work after.  This is tricky to test as it
     doesn't necessarily work before.

With this in mind, the way things work is that #include_next is used for the
KAPI header to refer to the UAPI header.  This means that the two headers
effectively have the same name, and if the KAPI header reduces to just a
#include_next, then it can be eliminated entirely and the UAPI header used
directly.

I've created one patch for each include directory that gets exported.  I'd
prefer to use a single patch per file to make GIT's life easier and more sure,
but that would mean a stack of >1100 patches.  I think the most important thing
is to keep the arch header splits separated by arch.

The UAPI headers are mapped from KAPI headers like so:

	include/x/y/z.h -> uapi/x/y/z.h
	arch/foo/include/x/y/z.h -> arch/foo/uapi/x/y/z.h


I've tested it for x86_64 and MIPS and attempted it for MN10300 (but that runs
into other problems).  Other arches will need fixing up as necessary.

There are some issues:

 (*) There is a minor problem with using #include_next - the preceding #include
     must be done with <path> not "path" or else #include_next will find the
     KAPI header again rather than the UAPI header.  A couple of my patches
     address places where someone has added an extra -I flag rather than using
     <...>.

 (*) I'm not sure I have all the kernel scripts and Makefiles altered correctly
     - someone who knows the Kbuild magic should check things over.  However,
     headers do install correctly, so I think I've got things mostly right.

 (*) Documentation/vm/page-types.c directly refers to the magic.h file it wants
     to include using a path with '..' in it.  This is broken from the patch
     that alters the path until the header is split.

 (*) Is uapi/ the right name for the UAPI directories?  If not, it shouldn't be
     too hard to change as most of it is scripted.  It can't be put in usr/
     until the UAPI headers don't need any processing, and besides, the arch
     UAPI headers can't be put under there anyway without collision.

David
---
David Howells (35):
      UAPI: Fix the page-types query program in the docs
      UAPI: Make UAPI headers install to usr/include/
      UAPI: Move linux/version.h
      UAPI: Set up uapi/asm/Kbuild.asm
      UAPI: Plumb the UAPI Kbuilds into the user header handling system
      UAPI: Set up UAPI Kbuild files
      UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines
      UAPI: Fix x86_64 system call count and generation
      UAPI: Fix linux/ncp.h
      UAPI: Guard linux/sound.h
      UAPI: Guard linux/isdn_divertif.h
      UAPI: Fix linux/coda.h
      UAPI: Fix u_quad_t ordering problem in linux/coda.h
      UAPI: Fix SNDRV_*_ENDIAN ordering problem
      UAPI: sound/sound_core.c should include linux/fs.h
      UAPI: Fix drmP.h to use #include <...> when referring to system header files
      UAPI: Fix linux/auto_fs.h inclusion order
      UAPI: Fix up linux/netfilter/xt_policy.h
      UAPI: Fix linux/input.h inclusion order
      UAPI: Fix linux/netfilter.h inclusion order
      UAPI: Fix E820_X_MAX ordering problem
      UAPI: Fix sigset_t ordering problem
      UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace
      UAPI: Fix definition of HZ in asm-generic/param.h
      UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h
      UAPI: Split trivial #if defined(__KERNEL__) && X conditionals
      UAPI: Fix nested __KERNEL__ guards in video/edid.h
      UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h
      UAPI: Make linux/patchkey.h easier to parse
      UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards
      UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed
      UAPI: Differentiate userspace build and kernelspace build include path sets
      UAPI: Add uapi/ include directory to build
      UAPI: Audit drivers/gpu/ for #include "..." referring to system headers
      UAPI: Convert #include "..." to #include <path/...> in kernel system headers


 Documentation/vm/page-types.c                    |    2 
 Makefile                                         |   33 
 arch/alpha/uapi/asm/Kbuild                       |    2 
 arch/arm/include/asm/hwcap.h                     |    4 
 arch/arm/include/asm/localtimer.h                |    2 
 arch/arm/include/asm/page.h                      |    2 
 arch/arm/include/asm/pgtable.h                   |    2 
 arch/arm/include/asm/swab.h                      |    7 
 arch/arm/include/asm/unistd.h                    |    4 
 arch/arm/include/asm/vfpmacros.h                 |    2 
 arch/arm/uapi/asm/Kbuild                         |    2 
 arch/avr32/uapi/asm/Kbuild                       |    2 
 arch/blackfin/uapi/asm/Kbuild                    |    2 
 arch/cris/include/arch-v10/arch/sv_addr_ag.h     |    2 
 arch/cris/include/arch-v10/arch/svinto.h         |    2 
 arch/cris/include/arch-v32/arch/dma.h            |    2 
 arch/cris/include/arch-v32/arch/hwregs/dma.h     |    2 
 arch/cris/uapi/arch-v10/arch/Kbuild              |    0 
 arch/cris/uapi/arch-v10/arch/sv_addr.agh         | 7306 ++++++++++++++++++++++
 arch/cris/uapi/arch-v32/arch/Kbuild              |    0 
 arch/cris/uapi/asm/Kbuild                        |    4 
 arch/frv/uapi/asm/Kbuild                         |    2 
 arch/h8300/uapi/asm/Kbuild                       |    2 
 arch/ia64/include/asm/intrinsics.h               |   21 
 arch/ia64/uapi/asm/Kbuild                        |    2 
 arch/m32r/uapi/asm/Kbuild                        |    2 
 arch/m68k/include/asm/bitops.h                   |    4 
 arch/m68k/include/asm/cacheflush.h               |    4 
 arch/m68k/include/asm/delay.h                    |    4 
 arch/m68k/include/asm/entry.h                    |    4 
 arch/m68k/include/asm/hardirq.h                  |    4 
 arch/m68k/include/asm/io.h                       |    4 
 arch/m68k/include/asm/m68360.h                   |    8 
 arch/m68k/include/asm/m68360_enet.h              |    2 
 arch/m68k/include/asm/page.h                     |    4 
 arch/m68k/include/asm/pgtable.h                  |    4 
 arch/m68k/include/asm/q40_master.h               |    2 
 arch/m68k/include/asm/system.h                   |    4 
 arch/m68k/include/asm/uaccess.h                  |    4 
 arch/m68k/uapi/asm/Kbuild                        |    2 
 arch/microblaze/include/asm/mmu_context.h        |    2 
 arch/microblaze/uapi/asm/Kbuild                  |    2 
 arch/mips/include/asm/Kbuild                     |    4 
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h  |    2 
 arch/mips/include/asm/mach-pnx833x/gpio.h        |    2 
 arch/mips/include/asm/octeon/cvmx-asm.h          |    2 
 arch/mips/include/asm/octeon/cvmx-spinlock.h     |    2 
 arch/mips/include/asm/octeon/cvmx.h              |   36 
 arch/mips/include/asm/octeon/octeon-model.h      |    2 
 arch/mips/include/asm/octeon/octeon.h            |    2 
 arch/mips/include/asm/sibyte/bcm1480_int.h       |    2 
 arch/mips/include/asm/sibyte/bcm1480_l2c.h       |    2 
 arch/mips/include/asm/sibyte/bcm1480_mc.h        |    2 
 arch/mips/include/asm/sibyte/bcm1480_regs.h      |    4 
 arch/mips/include/asm/sibyte/bcm1480_scd.h       |    4 
 arch/mips/include/asm/sibyte/sb1250_dma.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_genbus.h     |    2 
 arch/mips/include/asm/sibyte/sb1250_int.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_l2c.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_ldt.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_mac.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_mc.h         |    2 
 arch/mips/include/asm/sibyte/sb1250_regs.h       |    2 
 arch/mips/include/asm/sibyte/sb1250_scd.h        |    2 
 arch/mips/include/asm/sibyte/sb1250_smbus.h      |    2 
 arch/mips/include/asm/sibyte/sb1250_syncser.h    |    2 
 arch/mips/include/asm/sibyte/sb1250_uart.h       |    2 
 arch/mips/include/asm/types.h                    |   10 
 arch/mips/uapi/asm/Kbuild                        |    2 
 arch/mn10300/uapi/asm/Kbuild                     |    2 
 arch/parisc/uapi/asm/Kbuild                      |    2 
 arch/powerpc/include/asm/ps3.h                   |    2 
 arch/powerpc/include/asm/ucc_fast.h              |    2 
 arch/powerpc/include/asm/ucc_slow.h              |    2 
 arch/powerpc/uapi/asm/Kbuild                     |    2 
 arch/s390/include/asm/mman.h                     |    4 
 arch/s390/uapi/asm/Kbuild                        |    2 
 arch/score/uapi/asm/Kbuild                       |    2 
 arch/sh/include/asm/checksum.h                   |    2 
 arch/sh/include/asm/mmu_context.h                |    4 
 arch/sh/include/asm/posix_types.h                |    8 
 arch/sh/include/asm/processor.h                  |    4 
 arch/sh/include/asm/ptrace.h                     |    4 
 arch/sh/include/asm/string.h                     |    4 
 arch/sh/include/asm/syscall.h                    |    4 
 arch/sh/include/asm/syscalls.h                   |    4 
 arch/sh/include/asm/system.h                     |    4 
 arch/sh/include/asm/tlb.h                        |    2 
 arch/sh/include/asm/uaccess.h                    |    4 
 arch/sh/include/asm/unistd.h                     |    8 
 arch/sh/include/mach-ecovec24/mach/romimage.h    |    2 
 arch/sh/include/mach-kfr2r09/mach/romimage.h     |    2 
 arch/sh/uapi/asm/Kbuild                          |    2 
 arch/sparc/uapi/asm/Kbuild                       |    4 
 arch/tile/include/asm/signal.h                   |    4 
 arch/tile/uapi/asm/Kbuild                        |    2 
 arch/unicore32/include/mach/PKUnity.h            |   36 
 arch/unicore32/include/mach/hardware.h           |    2 
 arch/unicore32/include/mach/uncompress.h         |    4 
 arch/unicore32/uapi/asm/Kbuild                   |    2 
 arch/x86/boot/Makefile                           |    4 
 arch/x86/boot/mkcpustr.c                         |    2 
 arch/x86/include/asm/atomic.h                    |    4 
 arch/x86/include/asm/checksum.h                  |    4 
 arch/x86/include/asm/cmpxchg.h                   |    4 
 arch/x86/include/asm/cpufeature.h                |    2 
 arch/x86/include/asm/e820.h                      |    2 
 arch/x86/include/asm/mmzone.h                    |    4 
 arch/x86/include/asm/mutex.h                     |    4 
 arch/x86/include/asm/numa.h                      |    4 
 arch/x86/include/asm/page.h                      |    2 
 arch/x86/include/asm/page_types.h                |    3 
 arch/x86/include/asm/pci.h                       |    2 
 arch/x86/include/asm/pgtable.h                   |    4 
 arch/x86/include/asm/pgtable_types.h             |    4 
 arch/x86/include/asm/posix_types.h               |    8 
 arch/x86/include/asm/seccomp.h                   |    4 
 arch/x86/include/asm/signal.h                    |    2 
 arch/x86/include/asm/string.h                    |    4 
 arch/x86/include/asm/suspend.h                   |    4 
 arch/x86/include/asm/uaccess.h                   |    4 
 arch/x86/include/asm/unistd.h                    |    8 
 arch/x86/include/asm/user.h                      |    4 
 arch/x86/include/asm/xen/interface.h             |    4 
 arch/x86/include/asm/xor.h                       |    4 
 arch/x86/kernel/asm-offsets_64.c                 |    1 
 arch/x86/kernel/cpu/mkcapflags.pl                |    5 
 arch/x86/kernel/syscall_64.c                     |    2 
 arch/x86/uapi/asm/Kbuild                         |    2 
 arch/xtensa/uapi/asm/Kbuild                      |    2 
 drivers/gpu/drm/ati_pcigart.c                    |    2 
 drivers/gpu/drm/drm_agpsupport.c                 |    2 
 drivers/gpu/drm/drm_auth.c                       |    2 
 drivers/gpu/drm/drm_buffer.c                     |    2 
 drivers/gpu/drm/drm_bufs.c                       |    2 
 drivers/gpu/drm/drm_cache.c                      |    2 
 drivers/gpu/drm/drm_context.c                    |    2 
 drivers/gpu/drm/drm_crtc.c                       |    8 
 drivers/gpu/drm/drm_crtc_helper.c                |    8 
 drivers/gpu/drm/drm_debugfs.c                    |    2 
 drivers/gpu/drm/drm_dma.c                        |    2 
 drivers/gpu/drm/drm_dp_i2c_helper.c              |    4 
 drivers/gpu/drm/drm_drv.c                        |    4 
 drivers/gpu/drm/drm_edid.c                       |    4 
 drivers/gpu/drm/drm_edid_modes.h                 |    4 
 drivers/gpu/drm/drm_encoder_slave.c              |    2 
 drivers/gpu/drm/drm_fb_helper.c                  |    8 
 drivers/gpu/drm/drm_fops.c                       |    2 
 drivers/gpu/drm/drm_gem.c                        |    2 
 drivers/gpu/drm/drm_global.c                     |    2 
 drivers/gpu/drm/drm_hashtab.c                    |    4 
 drivers/gpu/drm/drm_info.c                       |    2 
 drivers/gpu/drm/drm_ioc32.c                      |    4 
 drivers/gpu/drm/drm_ioctl.c                      |    6 
 drivers/gpu/drm/drm_irq.c                        |    2 
 drivers/gpu/drm/drm_lock.c                       |    2 
 drivers/gpu/drm/drm_memory.c                     |    2 
 drivers/gpu/drm/drm_mm.c                         |    4 
 drivers/gpu/drm/drm_modes.c                      |    6 
 drivers/gpu/drm/drm_pci.c                        |    2 
 drivers/gpu/drm/drm_platform.c                   |    2 
 drivers/gpu/drm/drm_proc.c                       |    2 
 drivers/gpu/drm/drm_scatter.c                    |    2 
 drivers/gpu/drm/drm_sman.c                       |    2 
 drivers/gpu/drm/drm_stub.c                       |    4 
 drivers/gpu/drm/drm_sysfs.c                      |    6 
 drivers/gpu/drm/drm_trace_points.c               |    2 
 drivers/gpu/drm/drm_usb.c                        |    2 
 drivers/gpu/drm/drm_vm.c                         |    2 
 drivers/gpu/drm/i2c/ch7006_priv.h                |    8 
 drivers/gpu/drm/i2c/sil164_drv.c                 |    8 
 drivers/gpu/drm/i810/i810_dma.c                  |    6 
 drivers/gpu/drm/i810/i810_drv.c                  |    8 
 drivers/gpu/drm/i915/dvo.h                       |    6 
 drivers/gpu/drm/i915/i915_debugfs.c              |    6 
 drivers/gpu/drm/i915/i915_dma.c                  |   10 
 drivers/gpu/drm/i915/i915_drv.c                  |    8 
 drivers/gpu/drm/i915/i915_gem.c                  |    6 
 drivers/gpu/drm/i915/i915_gem_debug.c            |    6 
 drivers/gpu/drm/i915/i915_gem_evict.c            |    6 
 drivers/gpu/drm/i915/i915_gem_execbuffer.c       |    6 
 drivers/gpu/drm/i915/i915_gem_gtt.c              |    6 
 drivers/gpu/drm/i915/i915_gem_tiling.c           |   10 
 drivers/gpu/drm/i915/i915_ioc32.c                |    6 
 drivers/gpu/drm/i915/i915_irq.c                  |    6 
 drivers/gpu/drm/i915/i915_mem.c                  |    6 
 drivers/gpu/drm/i915/i915_suspend.c              |    6 
 drivers/gpu/drm/i915/intel_acpi.c                |    2 
 drivers/gpu/drm/i915/intel_bios.c                |    6 
 drivers/gpu/drm/i915/intel_bios.h                |    2 
 drivers/gpu/drm/i915/intel_crt.c                 |   12 
 drivers/gpu/drm/i915/intel_display.c             |    8 
 drivers/gpu/drm/i915/intel_dp.c                  |   12 
 drivers/gpu/drm/i915/intel_drv.h                 |    6 
 drivers/gpu/drm/i915/intel_dvo.c                 |    8 
 drivers/gpu/drm/i915/intel_fb.c                  |   10 
 drivers/gpu/drm/i915/intel_hdmi.c                |   10 
 drivers/gpu/drm/i915/intel_i2c.c                 |    6 
 drivers/gpu/drm/i915/intel_lvds.c                |   10 
 drivers/gpu/drm/i915/intel_modes.c               |    2 
 drivers/gpu/drm/i915/intel_opregion.c            |    4 
 drivers/gpu/drm/i915/intel_overlay.c             |    6 
 drivers/gpu/drm/i915/intel_ringbuffer.c          |    6 
 drivers/gpu/drm/i915/intel_sdvo.c                |   10 
 drivers/gpu/drm/i915/intel_tv.c                  |   10 
 drivers/gpu/drm/mga/mga_dma.c                    |    8 
 drivers/gpu/drm/mga/mga_drv.c                    |    8 
 drivers/gpu/drm/mga/mga_ioc32.c                  |    6 
 drivers/gpu/drm/mga/mga_irq.c                    |    6 
 drivers/gpu/drm/mga/mga_state.c                  |    6 
 drivers/gpu/drm/mga/mga_warp.c                   |    6 
 drivers/gpu/drm/nouveau/nouveau_acpi.c           |   10 
 drivers/gpu/drm/nouveau/nouveau_backlight.c      |    4 
 drivers/gpu/drm/nouveau/nouveau_bios.c           |    2 
 drivers/gpu/drm/nouveau/nouveau_bo.c             |    4 
 drivers/gpu/drm/nouveau/nouveau_calc.c           |    2 
 drivers/gpu/drm/nouveau/nouveau_channel.c        |    6 
 drivers/gpu/drm/nouveau/nouveau_connector.c      |    6 
 drivers/gpu/drm/nouveau/nouveau_connector.h      |    2 
 drivers/gpu/drm/nouveau/nouveau_debugfs.c        |    2 
 drivers/gpu/drm/nouveau/nouveau_display.c        |    4 
 drivers/gpu/drm/nouveau/nouveau_dma.c            |    4 
 drivers/gpu/drm/nouveau/nouveau_dp.c             |    2 
 drivers/gpu/drm/nouveau/nouveau_drv.c            |    8 
 drivers/gpu/drm/nouveau/nouveau_drv.h            |   12 
 drivers/gpu/drm/nouveau/nouveau_encoder.h        |    2 
 drivers/gpu/drm/nouveau/nouveau_fbcon.c          |   12 
 drivers/gpu/drm/nouveau/nouveau_fbcon.h          |    2 
 drivers/gpu/drm/nouveau/nouveau_fence.c          |    4 
 drivers/gpu/drm/nouveau/nouveau_gem.c            |    6 
 drivers/gpu/drm/nouveau/nouveau_hw.c             |    2 
 drivers/gpu/drm/nouveau/nouveau_hw.h             |    2 
 drivers/gpu/drm/nouveau/nouveau_i2c.c            |    2 
 drivers/gpu/drm/nouveau/nouveau_i2c.h            |    2 
 drivers/gpu/drm/nouveau/nouveau_ioc32.c          |    4 
 drivers/gpu/drm/nouveau/nouveau_irq.c            |    6 
 drivers/gpu/drm/nouveau/nouveau_mem.c            |    6 
 drivers/gpu/drm/nouveau/nouveau_mm.c             |    2 
 drivers/gpu/drm/nouveau/nouveau_notifier.c       |    4 
 drivers/gpu/drm/nouveau/nouveau_object.c         |    6 
 drivers/gpu/drm/nouveau/nouveau_perf.c           |    2 
 drivers/gpu/drm/nouveau/nouveau_pm.c             |    2 
 drivers/gpu/drm/nouveau/nouveau_ramht.c          |    2 
 drivers/gpu/drm/nouveau/nouveau_sgdma.c          |    2 
 drivers/gpu/drm/nouveau/nouveau_state.c          |   10 
 drivers/gpu/drm/nouveau/nouveau_temp.c           |    2 
 drivers/gpu/drm/nouveau/nouveau_ttm.c            |    2 
 drivers/gpu/drm/nouveau/nouveau_vm.c             |    2 
 drivers/gpu/drm/nouveau/nouveau_vm.h             |    2 
 drivers/gpu/drm/nouveau/nouveau_volt.c           |    2 
 drivers/gpu/drm/nouveau/nv04_crtc.c              |    4 
 drivers/gpu/drm/nouveau/nv04_cursor.c            |    4 
 drivers/gpu/drm/nouveau/nv04_dac.c               |    4 
 drivers/gpu/drm/nouveau/nv04_dfp.c               |    6 
 drivers/gpu/drm/nouveau/nv04_display.c           |    6 
 drivers/gpu/drm/nouveau/nv04_fb.c                |    6 
 drivers/gpu/drm/nouveau/nv04_fbcon.c             |    2 
 drivers/gpu/drm/nouveau/nv04_fifo.c              |    4 
 drivers/gpu/drm/nouveau/nv04_graph.c             |    6 
 drivers/gpu/drm/nouveau/nv04_instmem.c           |    4 
 drivers/gpu/drm/nouveau/nv04_mc.c                |    6 
 drivers/gpu/drm/nouveau/nv04_pm.c                |    2 
 drivers/gpu/drm/nouveau/nv04_timer.c             |    6 
 drivers/gpu/drm/nouveau/nv04_tv.c                |    6 
 drivers/gpu/drm/nouveau/nv10_fb.c                |    6 
 drivers/gpu/drm/nouveau/nv10_fifo.c              |    4 
 drivers/gpu/drm/nouveau/nv10_gpio.c              |    2 
 drivers/gpu/drm/nouveau/nv10_graph.c             |    6 
 drivers/gpu/drm/nouveau/nv17_tv.c                |    4 
 drivers/gpu/drm/nouveau/nv17_tv_modes.c          |    4 
 drivers/gpu/drm/nouveau/nv20_graph.c             |    6 
 drivers/gpu/drm/nouveau/nv30_fb.c                |    6 
 drivers/gpu/drm/nouveau/nv40_fb.c                |    6 
 drivers/gpu/drm/nouveau/nv40_fifo.c              |    4 
 drivers/gpu/drm/nouveau/nv40_graph.c             |    4 
 drivers/gpu/drm/nouveau/nv40_grctx.c             |    2 
 drivers/gpu/drm/nouveau/nv40_mc.c                |    6 
 drivers/gpu/drm/nouveau/nv40_mpeg.c              |    2 
 drivers/gpu/drm/nouveau/nv50_calc.c              |    2 
 drivers/gpu/drm/nouveau/nv50_crtc.c              |    6 
 drivers/gpu/drm/nouveau/nv50_cursor.c            |    4 
 drivers/gpu/drm/nouveau/nv50_dac.c               |    4 
 drivers/gpu/drm/nouveau/nv50_display.c           |    2 
 drivers/gpu/drm/nouveau/nv50_display.h           |    4 
 drivers/gpu/drm/nouveau/nv50_evo.c               |    2 
 drivers/gpu/drm/nouveau/nv50_fb.c                |    6 
 drivers/gpu/drm/nouveau/nv50_fbcon.c             |    2 
 drivers/gpu/drm/nouveau/nv50_fifo.c              |    4 
 drivers/gpu/drm/nouveau/nv50_gpio.c              |    2 
 drivers/gpu/drm/nouveau/nv50_graph.c             |    4 
 drivers/gpu/drm/nouveau/nv50_grctx.c             |    2 
 drivers/gpu/drm/nouveau/nv50_instmem.c           |    4 
 drivers/gpu/drm/nouveau/nv50_mc.c                |    4 
 drivers/gpu/drm/nouveau/nv50_mpeg.c              |    2 
 drivers/gpu/drm/nouveau/nv50_pm.c                |    2 
 drivers/gpu/drm/nouveau/nv50_sor.c               |    4 
 drivers/gpu/drm/nouveau/nv50_vm.c                |    2 
 drivers/gpu/drm/nouveau/nv50_vram.c              |    2 
 drivers/gpu/drm/nouveau/nv84_crypt.c             |    2 
 drivers/gpu/drm/nouveau/nva3_copy.c              |    2 
 drivers/gpu/drm/nouveau/nva3_pm.c                |    2 
 drivers/gpu/drm/nouveau/nvc0_copy.c              |    2 
 drivers/gpu/drm/nouveau/nvc0_fb.c                |    2 
 drivers/gpu/drm/nouveau/nvc0_fbcon.c             |    2 
 drivers/gpu/drm/nouveau/nvc0_fifo.c              |    2 
 drivers/gpu/drm/nouveau/nvc0_graph.c             |    2 
 drivers/gpu/drm/nouveau/nvc0_grctx.c             |    2 
 drivers/gpu/drm/nouveau/nvc0_instmem.c           |    2 
 drivers/gpu/drm/nouveau/nvc0_vm.c                |    2 
 drivers/gpu/drm/nouveau/nvc0_vram.c              |    2 
 drivers/gpu/drm/r128/r128_cce.c                  |    6 
 drivers/gpu/drm/r128/r128_drv.c                  |    8 
 drivers/gpu/drm/r128/r128_ioc32.c                |    6 
 drivers/gpu/drm/r128/r128_irq.c                  |    6 
 drivers/gpu/drm/r128/r128_state.c                |    6 
 drivers/gpu/drm/radeon/atom.h                    |    2 
 drivers/gpu/drm/radeon/atombios_dp.c             |    6 
 drivers/gpu/drm/radeon/evergreen.c               |    4 
 drivers/gpu/drm/radeon/evergreen_blit_kms.c      |    6 
 drivers/gpu/drm/radeon/evergreen_cs.c            |    2 
 drivers/gpu/drm/radeon/ni.c                      |    4 
 drivers/gpu/drm/radeon/r100.c                    |    6 
 drivers/gpu/drm/radeon/r200.c                    |    6 
 drivers/gpu/drm/radeon/r300.c                    |    2 
 drivers/gpu/drm/radeon/r300_cmdbuf.c             |    8 
 drivers/gpu/drm/radeon/r420.c                    |    2 
 drivers/gpu/drm/radeon/r520.c                    |    2 
 drivers/gpu/drm/radeon/r600.c                    |    4 
 drivers/gpu/drm/radeon/r600_audio.c              |    2 
 drivers/gpu/drm/radeon/r600_blit.c               |    6 
 drivers/gpu/drm/radeon/r600_blit_kms.c           |    6 
 drivers/gpu/drm/radeon/r600_cp.c                 |    6 
 drivers/gpu/drm/radeon/r600_cs.c                 |    2 
 drivers/gpu/drm/radeon/r600_hdmi.c               |    4 
 drivers/gpu/drm/radeon/radeon_acpi.c             |    8 
 drivers/gpu/drm/radeon/radeon_agp.c              |    6 
 drivers/gpu/drm/radeon/radeon_atombios.c         |    4 
 drivers/gpu/drm/radeon/radeon_bios.c             |    2 
 drivers/gpu/drm/radeon/radeon_clocks.c           |    4 
 drivers/gpu/drm/radeon/radeon_combios.c          |    4 
 drivers/gpu/drm/radeon/radeon_connectors.c       |   10 
 drivers/gpu/drm/radeon/radeon_cp.c               |    8 
 drivers/gpu/drm/radeon/radeon_cs.c               |    4 
 drivers/gpu/drm/radeon/radeon_cursor.c           |    4 
 drivers/gpu/drm/radeon/radeon_display.c          |    8 
 drivers/gpu/drm/radeon/radeon_drv.c              |    8 
 drivers/gpu/drm/radeon/radeon_encoders.c         |    6 
 drivers/gpu/drm/radeon/radeon_fb.c               |   12 
 drivers/gpu/drm/radeon/radeon_fence.c            |    4 
 drivers/gpu/drm/radeon/radeon_gart.c             |    4 
 drivers/gpu/drm/radeon/radeon_gem.c              |    6 
 drivers/gpu/drm/radeon/radeon_i2c.c              |    4 
 drivers/gpu/drm/radeon/radeon_ioc32.c            |    6 
 drivers/gpu/drm/radeon/radeon_irq.c              |    6 
 drivers/gpu/drm/radeon/radeon_irq_kms.c          |    6 
 drivers/gpu/drm/radeon/radeon_kms.c              |    6 
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c  |    6 
 drivers/gpu/drm/radeon/radeon_legacy_tv.c        |    4 
 drivers/gpu/drm/radeon/radeon_mem.c              |    6 
 drivers/gpu/drm/radeon/radeon_object.c           |    2 
 drivers/gpu/drm/radeon/radeon_pm.c               |    2 
 drivers/gpu/drm/radeon/radeon_ring.c             |    4 
 drivers/gpu/drm/radeon/radeon_state.c            |   10 
 drivers/gpu/drm/radeon/radeon_trace_points.c     |    2 
 drivers/gpu/drm/radeon/rs600.c                   |    2 
 drivers/gpu/drm/radeon/rs690.c                   |    2 
 drivers/gpu/drm/radeon/rv515.c                   |    2 
 drivers/gpu/drm/radeon/rv770.c                   |    4 
 drivers/gpu/drm/savage/savage_bci.c              |    4 
 drivers/gpu/drm/savage/savage_drv.c              |    6 
 drivers/gpu/drm/savage/savage_state.c            |    4 
 drivers/gpu/drm/sis/sis_drv.c                    |    6 
 drivers/gpu/drm/sis/sis_drv.h                    |    2 
 drivers/gpu/drm/sis/sis_mm.c                     |    4 
 drivers/gpu/drm/tdfx/tdfx_drv.c                  |    4 
 drivers/gpu/drm/ttm/ttm_agp_backend.c            |    6 
 drivers/gpu/drm/ttm/ttm_bo.c                     |    6 
 drivers/gpu/drm/ttm/ttm_bo_manager.c             |    8 
 drivers/gpu/drm/ttm/ttm_bo_util.c                |    4 
 drivers/gpu/drm/ttm/ttm_execbuf_util.c           |    6 
 drivers/gpu/drm/ttm/ttm_lock.c                   |    4 
 drivers/gpu/drm/ttm/ttm_memory.c                 |    6 
 drivers/gpu/drm/ttm/ttm_module.c                 |    4 
 drivers/gpu/drm/ttm/ttm_object.c                 |    4 
 drivers/gpu/drm/ttm/ttm_page_alloc.c             |    4 
 drivers/gpu/drm/ttm/ttm_tt.c                     |   12 
 drivers/gpu/drm/via/via_dma.c                    |    6 
 drivers/gpu/drm/via/via_dmablit.c                |    4 
 drivers/gpu/drm/via/via_drv.c                    |    6 
 drivers/gpu/drm/via/via_drv.h                    |    2 
 drivers/gpu/drm/via/via_irq.c                    |    6 
 drivers/gpu/drm/via/via_map.c                    |    4 
 drivers/gpu/drm/via/via_mm.c                     |    6 
 drivers/gpu/drm/via/via_verifier.c               |    6 
 drivers/gpu/drm/via/via_video.c                  |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c           |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              |   10 
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h              |   18 
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c          |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c               |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c             |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c              |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c    |    6 
 drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c            |    2 
 drivers/gpu/drm/vmwgfx/vmwgfx_irq.c              |    2 
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.h              |    2 
 drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c          |    4 
 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c         |    8 
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c         |    2 
 include/acpi/acpi.h                              |   18 
 include/acpi/acpiosxf.h                          |    4 
 include/acpi/acpixf.h                            |    4 
 include/acpi/platform/acenv.h                    |    2 
 include/acpi/platform/aclinux.h                  |    2 
 include/asm-generic/Kbuild.asm                   |   85 
 include/asm-generic/param.h                      |   13 
 include/drm/drm.h                                |    2 
 include/drm/drmP.h                               |   18 
 include/drm/drm_buffer.h                         |    2 
 include/drm/drm_encoder_slave.h                  |    4 
 include/drm/drm_memory.h                         |    2 
 include/drm/drm_sarea.h                          |    2 
 include/drm/drm_sman.h                           |    4 
 include/drm/i915_drm.h                           |    2 
 include/drm/mga_drm.h                            |    2 
 include/drm/radeon_drm.h                         |    2 
 include/drm/ttm/ttm_bo_api.h                     |    2 
 include/drm/ttm/ttm_bo_driver.h                  |   16 
 include/drm/ttm/ttm_execbuf_util.h               |    2 
 include/drm/ttm/ttm_lock.h                       |    2 
 include/drm/ttm/ttm_object.h                     |    2 
 include/drm/ttm/ttm_page_alloc.h                 |    4 
 include/drm/via_drm.h                            |    2 
 include/linux/Kbuild                             |    1 
 include/linux/acct.h                             |    5 
 include/linux/auto_fs.h                          |    2 
 include/linux/ceph/ceph_fs.h                     |    4 
 include/linux/ceph/debugfs.h                     |    4 
 include/linux/ceph/decode.h                      |    2 
 include/linux/ceph/libceph.h                     |   14 
 include/linux/ceph/mdsmap.h                      |    2 
 include/linux/ceph/messenger.h                   |    4 
 include/linux/ceph/mon_client.h                  |    2 
 include/linux/ceph/msgpool.h                     |    2 
 include/linux/ceph/osd_client.h                  |    6 
 include/linux/ceph/osdmap.h                      |    4 
 include/linux/ceph/rados.h                       |    2 
 include/linux/ceph/types.h                       |    6 
 include/linux/coda.h                             |    3 
 include/linux/crush/mapper.h                     |    2 
 include/linux/drbd_tag_magic.h                   |   10 
 include/linux/elf.h                              |   18 
 include/linux/input.h                            |    2 
 include/linux/isdn_divertif.h                    |    4 
 include/linux/mroute6.h                          |    4 
 include/linux/ncp.h                              |    2 
 include/linux/netfilter.h                        |    2 
 include/linux/netfilter/nf_conntrack_h323_asn1.h |    2 
 include/linux/netfilter/xt_policy.h              |    2 
 include/linux/patchkey.h                         |    4 
 include/linux/sound.h                            |    4 
 include/linux/soundcard.h                        |    4 
 include/scsi/osd_attributes.h                    |    2 
 include/scsi/osd_initiator.h                     |    4 
 include/scsi/osd_sec.h                           |    4 
 include/sound/ac97_codec.h                       |    6 
 include/sound/ad1816a.h                          |    6 
 include/sound/ak4531_codec.h                     |    4 
 include/sound/asound.h                           |    1 
 include/sound/cs46xx.h                           |   10 
 include/sound/cs46xx_dsp_spos.h                  |    4 
 include/sound/cs46xx_dsp_task_types.h            |    2 
 include/sound/emu10k1_synth.h                    |    4 
 include/sound/emu8000.h                          |    4 
 include/sound/emux_legacy.h                      |    2 
 include/sound/emux_synth.h                       |   14 
 include/sound/es1688.h                           |    4 
 include/sound/gus.h                              |   10 
 include/sound/mpu401.h                           |    2 
 include/sound/pcm.h                              |    2 
 include/sound/rawmidi.h                          |    2 
 include/sound/sb.h                               |    4 
 include/sound/sb16_csp.h                         |    4 
 include/sound/seq_kernel.h                       |    2 
 include/sound/seq_midi_emul.h                    |    2 
 include/sound/seq_midi_event.h                   |    2 
 include/sound/seq_oss.h                          |    4 
 include/sound/seq_virmidi.h                      |    4 
 include/sound/snd_wavefront.h                    |    8 
 include/sound/soundfont.h                        |    4 
 include/sound/tea6330t.h                         |    2 
 include/sound/trident.h                          |    8 
 include/sound/wss.h                              |    8 
 include/sound/ymfpci.h                           |    8 
 include/trace/events/compaction.h                |    2 
 include/trace/events/kmem.h                      |    2 
 include/trace/events/vmscan.h                    |    2 
 include/video/edid.h                             |    6 
 include/xen/interface/callback.h                 |    2 
 include/xen/interface/hvm/params.h               |    2 
 include/xen/interface/io/blkif.h                 |    4 
 include/xen/interface/io/netif.h                 |    4 
 include/xen/interface/sched.h                    |    2 
 include/xen/interface/version.h                  |    2 
 sound/sound_core.c                               |    1 
 uapi/Kbuild                                      |   13 
 uapi/asm-generic/Kbuild                          |    0 
 uapi/asm-generic/Kbuild.asm                      |   44 
 uapi/drm/Kbuild                                  |    0 
 uapi/linux/Kbuild                                |   17 
 uapi/linux/byteorder/Kbuild                      |    0 
 uapi/linux/caif/Kbuild                           |    0 
 uapi/linux/can/Kbuild                            |    0 
 uapi/linux/dvb/Kbuild                            |    0 
 uapi/linux/hdlc/Kbuild                           |    0 
 uapi/linux/isdn/Kbuild                           |    0 
 uapi/linux/mmc/Kbuild                            |    0 
 uapi/linux/netfilter/Kbuild                      |    1 
 uapi/linux/netfilter/ipset/Kbuild                |    0 
 uapi/linux/netfilter_arp/Kbuild                  |    0 
 uapi/linux/netfilter_bridge/Kbuild               |    0 
 uapi/linux/netfilter_ipv4/Kbuild                 |    0 
 uapi/linux/netfilter_ipv6/Kbuild                 |    0 
 uapi/linux/nfsd/Kbuild                           |    0 
 uapi/linux/raid/Kbuild                           |    0 
 uapi/linux/spi/Kbuild                            |    0 
 uapi/linux/sunrpc/Kbuild                         |    0 
 uapi/linux/tc_act/Kbuild                         |    0 
 uapi/linux/tc_ematch/Kbuild                      |    0 
 uapi/linux/usb/Kbuild                            |    0 
 uapi/linux/version.h                             |    2 
 uapi/linux/wimax/Kbuild                          |    0 
 uapi/mtd/Kbuild                                  |    0 
 uapi/rdma/Kbuild                                 |    0 
 uapi/scsi/Kbuild                                 |    1 
 uapi/scsi/fc/Kbuild                              |    0 
 uapi/sound/Kbuild                                |    0 
 uapi/video/Kbuild                                |    0 
 uapi/xen/Kbuild                                  |    0 
 539 files changed, 8599 insertions(+), 1080 deletions(-)
 create mode 100644 arch/alpha/uapi/asm/Kbuild
 create mode 100644 arch/arm/uapi/asm/Kbuild
 create mode 100644 arch/avr32/uapi/asm/Kbuild
 create mode 100644 arch/blackfin/uapi/asm/Kbuild
 create mode 100644 arch/cris/uapi/arch-v10/arch/Kbuild
 create mode 100644 arch/cris/uapi/arch-v10/arch/sv_addr.agh
 create mode 100644 arch/cris/uapi/arch-v32/arch/Kbuild
 create mode 100644 arch/cris/uapi/asm/Kbuild
 create mode 100644 arch/frv/uapi/asm/Kbuild
 create mode 100644 arch/h8300/uapi/asm/Kbuild
 create mode 100644 arch/ia64/uapi/asm/Kbuild
 create mode 100644 arch/m32r/uapi/asm/Kbuild
 create mode 100644 arch/m68k/uapi/asm/Kbuild
 create mode 100644 arch/microblaze/uapi/asm/Kbuild
 create mode 100644 arch/mips/uapi/asm/Kbuild
 create mode 100644 arch/mn10300/uapi/asm/Kbuild
 create mode 100644 arch/parisc/uapi/asm/Kbuild
 create mode 100644 arch/powerpc/uapi/asm/Kbuild
 create mode 100644 arch/s390/uapi/asm/Kbuild
 create mode 100644 arch/score/uapi/asm/Kbuild
 create mode 100644 arch/sh/uapi/asm/Kbuild
 create mode 100644 arch/sparc/uapi/asm/Kbuild
 create mode 100644 arch/tile/uapi/asm/Kbuild
 create mode 100644 arch/unicore32/uapi/asm/Kbuild
 create mode 100644 arch/x86/uapi/asm/Kbuild
 create mode 100644 arch/xtensa/uapi/asm/Kbuild
 create mode 100644 uapi/Kbuild
 create mode 100644 uapi/asm-generic/Kbuild
 create mode 100644 uapi/asm-generic/Kbuild.asm
 create mode 100644 uapi/drm/Kbuild
 create mode 100644 uapi/linux/Kbuild
 create mode 100644 uapi/linux/byteorder/Kbuild
 create mode 100644 uapi/linux/caif/Kbuild
 create mode 100644 uapi/linux/can/Kbuild
 create mode 100644 uapi/linux/dvb/Kbuild
 create mode 100644 uapi/linux/hdlc/Kbuild
 create mode 100644 uapi/linux/isdn/Kbuild
 create mode 100644 uapi/linux/mmc/Kbuild
 create mode 100644 uapi/linux/netfilter/Kbuild
 create mode 100644 uapi/linux/netfilter/ipset/Kbuild
 create mode 100644 uapi/linux/netfilter_arp/Kbuild
 create mode 100644 uapi/linux/netfilter_bridge/Kbuild
 create mode 100644 uapi/linux/netfilter_ipv4/Kbuild
 create mode 100644 uapi/linux/netfilter_ipv6/Kbuild
 create mode 100644 uapi/linux/nfsd/Kbuild
 create mode 100644 uapi/linux/raid/Kbuild
 create mode 100644 uapi/linux/spi/Kbuild
 create mode 100644 uapi/linux/sunrpc/Kbuild
 create mode 100644 uapi/linux/tc_act/Kbuild
 create mode 100644 uapi/linux/tc_ematch/Kbuild
 create mode 100644 uapi/linux/usb/Kbuild
 create mode 100644 uapi/linux/version.h
 create mode 100644 uapi/linux/wimax/Kbuild
 create mode 100644 uapi/mtd/Kbuild
 create mode 100644 uapi/rdma/Kbuild
 create mode 100644 uapi/scsi/Kbuild
 create mode 100644 uapi/scsi/fc/Kbuild
 create mode 100644 uapi/sound/Kbuild
 create mode 100644 uapi/video/Kbuild
 create mode 100644 uapi/xen/Kbuild

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 01/35] UAPI: Convert #include "..." to #include <path/...> in kernel system headers
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
@ 2011-07-02 11:07 ` David Howells
  2011-07-02 11:08 ` [PATCH 03/35] UAPI: Add uapi/ include directory to build David Howells
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:07 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Convert #include "..." to #include <path/...> in kernel system headers as the
"..."  causes problems for #include_next.

Observations:

 (1) There are quite a lot of #includes of things like "linux/fs.h" which
     should really use <...>.  These are changed within include/ dirs.

 (2) Some referenced header files are missing for no obvious reason - pm2fb.h
     and via_drmclient.h for example.

 (3) The DRM video driving code uses -Iinclude/drm when it should probably
     just preface its header file names with drm/ in #include.  These are
     changed within include/drm/.

 (4) Under arch/cris/include/ there are some directories (arch-v10 and
     arch-v32) that should perhaps be renamed to arch/cris/arch-vXX/include.

     Similarly, under arch/sh/, arch/sh/include/mach-X/ should perhaps be
     arch/sh/boards/mach-X/include/.

     However, I've left these alone as they aren't really a problem.

The following script was used:

#!/usr/bin/perl -w

use File::Find;

my @sys_header_dirs = (
    "include"
    );

#
# Find all the system header directories under arch
#
opendir DIR, "arch" or die;
push @sys_header_dirs,
    map { "arch/$_/include"; }
sort grep { -d "arch/$_/include"; }
grep { $_ !~ /^[.]/ }
readdir DIR;
closedir DIR;

#
# Find all the header files
#
%headers = ();
sub find_header()
{
    $headers{$File::Find::name} = 1 if ($_ =~ /[.]h$/);
}

find(\&find_header, @sys_header_dirs);

#print join("\n", sort keys %headers), "\n";

foreach my $hdr (sort grep { $_ !~ m@arch/um/@} keys %headers) {
    my $dir = $hdr;
    $dir =~ m@(^.*/)@, $dir = $1;

    open FD, '<', $hdr or die "open $hdr: $!\n";
    my @lines = <FD>;
    close FD or die;

    my $printed_name = 0;
    my $alter_header = 0;

    for (my $l = 0; $l <= $#lines; $l++) {
	my $line = $lines[$l];

	if ($line =~ /^(#\s*include\s+)["]([^"]+)["](.*[\n])/) {
	    #print $1, '@', $2, '@', $3;

	    if (!$printed_name) {
		#print "[[[ $hdr [\e[36m$dir\e[m] ]]]\n";
		$printed_name = 1;
	    }

	    my $pre = $1;
	    my $name = $2;
	    my $post = $3;

	    my $inc = undef;
	    my $base = "??";
	    my $path = "??";
	    my $realpath = "??";
	    my $do_existence_check = 1;

	    if ($name eq "platform/acenv.h") {
		# ACPI includes this relative to the current dir
		$inc = $dir . $name;
	    } elsif ($name =~ m@^[a-z].*/@) {
		# We found something like "linux/foo.h" so just accept as is
		$base = "";
		$realpath = $path = $name;
		$do_existence_check = 0;
		goto no_disassemble;
	    } elsif ($name =~ m@^../@) {
		# We found something like "../foo.h" so we jam the dir on the
		# front and then remove "dir/.." pairs
		$inc = $dir . $name;
		while ($inc =~ m@[^/]*/[.][.]/@) {
		    $inc =~ s@[^/]*/[.][.]/@@;
		}
	    } elsif ($name !~ m@/@) {
		# We found something like "foo.h" so we again stick the dir on
		# the front and then cut off the "include/" prefix.
		if ($name =~ m@^drm_@) {
		    # Unless it's a DRM header - the drm stuff adds
		    # -Iinclude/drm to the build flags rather than use
		    # <drm/foo.h> for some reason
		    $inc = "include/drm/$name";
		} else {
		    $inc = $dir . $name;
		}
	    } else {
		die "Don't handle \"$name\"\n";
	    }

	    $inc =~ m@(.*include/)(.*/[^/]*)@, $base = $1, $path = $2;

	    $realpath = $path;
	    if ($dir =~ m@^arch/cris/@ && $path =~ m@^arch-v[0-9]+/(arch/.*)@) {
		$realpath = $1;
	    } elsif ($dir =~ m@^arch/sh/@ && $path =~ m@^mach-[^/]+/(mach/.*)@) {
		$realpath = $1;
	    }

	  no_disassemble:
	    print $hdr, ": ", $name, " -> \e[36m", $base, "\e[m", $path;

	    if ($do_existence_check && ! -f $inc) {
		if (($hdr eq "arch/powerpc/include/asm/bootx.h" && $name eq "linux_type_defs.h") ||
		    ($hdr eq "include/acpi/platform/acenv.h" && $name =~ /ac[a-z]*[0-9]*[.]h/) ||
		    ($hdr eq "include/linux/jbd.h" && $name eq "jfs_compat.h") ||
		    ($hdr eq "include/linux/jbd2.h" && $name eq "jfs_compat.h") ||
		    ($hdr eq "include/video/cvisionppc.h" && $name eq "pm2fb.h") ||
		    ($hdr eq "include/drm/via_drm.h" && $name eq "via_drmclient.h")
		    ) {
		    print " \e[33mnot present\e[m\n";
		} else {
		    print " \e[31mnot found\e[m\n";
		    die;
		}
	    } else {
		$lines[$l] = $pre . "<" . $realpath . ">" . $post;
		$alter_header = 1;
		print "\n";
	    }
	}
    }

    if ($alter_header) {
	my $temp = $hdr . ".syshdr";
	open FD, '>', $temp or die "create $temp: $!\n";
	print FD @lines or die "write $temp: $!\n";
	close FD or die "close $temp: $!\n";
	rename $temp, $hdr or die "move $temp -> $hdr: $!\n";
    }
}

exit 0;


Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/arm/include/asm/localtimer.h                |    2 +
 arch/arm/include/asm/page.h                      |    2 +
 arch/arm/include/asm/pgtable.h                   |    2 +
 arch/arm/include/asm/vfpmacros.h                 |    2 +
 arch/cris/include/arch-v10/arch/sv_addr_ag.h     |    2 +
 arch/cris/include/arch-v10/arch/svinto.h         |    2 +
 arch/cris/include/arch-v32/arch/dma.h            |    2 +
 arch/cris/include/arch-v32/arch/hwregs/dma.h     |    2 +
 arch/m68k/include/asm/bitops.h                   |    4 +-
 arch/m68k/include/asm/cacheflush.h               |    4 +-
 arch/m68k/include/asm/delay.h                    |    4 +-
 arch/m68k/include/asm/entry.h                    |    4 +-
 arch/m68k/include/asm/hardirq.h                  |    4 +-
 arch/m68k/include/asm/io.h                       |    4 +-
 arch/m68k/include/asm/m68360.h                   |    8 ++---
 arch/m68k/include/asm/m68360_enet.h              |    2 +
 arch/m68k/include/asm/page.h                     |    4 +-
 arch/m68k/include/asm/pgtable.h                  |    4 +-
 arch/m68k/include/asm/q40_master.h               |    2 +
 arch/m68k/include/asm/system.h                   |    4 +-
 arch/m68k/include/asm/uaccess.h                  |    4 +-
 arch/microblaze/include/asm/mmu_context.h        |    2 +
 arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h  |    2 +
 arch/mips/include/asm/mach-pnx833x/gpio.h        |    2 +
 arch/mips/include/asm/octeon/cvmx-asm.h          |    2 +
 arch/mips/include/asm/octeon/cvmx-spinlock.h     |    2 +
 arch/mips/include/asm/octeon/cvmx.h              |   36 +++++++++++-----------
 arch/mips/include/asm/octeon/octeon-model.h      |    2 +
 arch/mips/include/asm/octeon/octeon.h            |    2 +
 arch/mips/include/asm/sibyte/bcm1480_int.h       |    2 +
 arch/mips/include/asm/sibyte/bcm1480_l2c.h       |    2 +
 arch/mips/include/asm/sibyte/bcm1480_mc.h        |    2 +
 arch/mips/include/asm/sibyte/bcm1480_regs.h      |    4 +-
 arch/mips/include/asm/sibyte/bcm1480_scd.h       |    4 +-
 arch/mips/include/asm/sibyte/sb1250_dma.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_genbus.h     |    2 +
 arch/mips/include/asm/sibyte/sb1250_int.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_l2c.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_ldt.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_mac.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_mc.h         |    2 +
 arch/mips/include/asm/sibyte/sb1250_regs.h       |    2 +
 arch/mips/include/asm/sibyte/sb1250_scd.h        |    2 +
 arch/mips/include/asm/sibyte/sb1250_smbus.h      |    2 +
 arch/mips/include/asm/sibyte/sb1250_syncser.h    |    2 +
 arch/mips/include/asm/sibyte/sb1250_uart.h       |    2 +
 arch/powerpc/include/asm/ps3.h                   |    2 +
 arch/powerpc/include/asm/ucc_fast.h              |    2 +
 arch/powerpc/include/asm/ucc_slow.h              |    2 +
 arch/sh/include/asm/checksum.h                   |    2 +
 arch/sh/include/asm/mmu_context.h                |    4 +-
 arch/sh/include/asm/posix_types.h                |    8 ++---
 arch/sh/include/asm/processor.h                  |    4 +-
 arch/sh/include/asm/ptrace.h                     |    4 +-
 arch/sh/include/asm/string.h                     |    4 +-
 arch/sh/include/asm/syscall.h                    |    4 +-
 arch/sh/include/asm/syscalls.h                   |    4 +-
 arch/sh/include/asm/system.h                     |    4 +-
 arch/sh/include/asm/tlb.h                        |    2 +
 arch/sh/include/asm/uaccess.h                    |    4 +-
 arch/sh/include/asm/unistd.h                     |    8 ++---
 arch/sh/include/mach-ecovec24/mach/romimage.h    |    2 +
 arch/sh/include/mach-kfr2r09/mach/romimage.h     |    2 +
 arch/unicore32/include/mach/PKUnity.h            |   36 +++++++++++-----------
 arch/unicore32/include/mach/hardware.h           |    2 +
 arch/unicore32/include/mach/uncompress.h         |    4 +-
 arch/x86/include/asm/atomic.h                    |    4 +-
 arch/x86/include/asm/checksum.h                  |    4 +-
 arch/x86/include/asm/cmpxchg.h                   |    4 +-
 arch/x86/include/asm/mmzone.h                    |    4 +-
 arch/x86/include/asm/mutex.h                     |    4 +-
 arch/x86/include/asm/numa.h                      |    4 +-
 arch/x86/include/asm/pci.h                       |    2 +
 arch/x86/include/asm/pgtable.h                   |    4 +-
 arch/x86/include/asm/pgtable_types.h             |    4 +-
 arch/x86/include/asm/posix_types.h               |    8 ++---
 arch/x86/include/asm/seccomp.h                   |    4 +-
 arch/x86/include/asm/string.h                    |    4 +-
 arch/x86/include/asm/suspend.h                   |    4 +-
 arch/x86/include/asm/uaccess.h                   |    4 +-
 arch/x86/include/asm/unistd.h                    |    8 ++---
 arch/x86/include/asm/user.h                      |    4 +-
 arch/x86/include/asm/xen/interface.h             |    4 +-
 arch/x86/include/asm/xor.h                       |    4 +-
 include/acpi/acpi.h                              |   18 ++++++-----
 include/acpi/acpiosxf.h                          |    4 +-
 include/acpi/acpixf.h                            |    4 +-
 include/acpi/platform/acenv.h                    |    2 +
 include/acpi/platform/aclinux.h                  |    2 +
 include/drm/drm.h                                |    2 +
 include/drm/drmP.h                               |   16 +++++-----
 include/drm/drm_buffer.h                         |    2 +
 include/drm/drm_encoder_slave.h                  |    4 +-
 include/drm/drm_memory.h                         |    2 +
 include/drm/drm_sarea.h                          |    2 +
 include/drm/drm_sman.h                           |    4 +-
 include/drm/i915_drm.h                           |    2 +
 include/drm/mga_drm.h                            |    2 +
 include/drm/radeon_drm.h                         |    2 +
 include/drm/ttm/ttm_bo_api.h                     |    2 +
 include/drm/ttm/ttm_bo_driver.h                  |   16 +++++-----
 include/drm/ttm/ttm_execbuf_util.h               |    2 +
 include/drm/ttm/ttm_lock.h                       |    2 +
 include/drm/ttm/ttm_object.h                     |    2 +
 include/drm/ttm/ttm_page_alloc.h                 |    4 +-
 include/drm/via_drm.h                            |    2 +
 include/linux/ceph/ceph_fs.h                     |    4 +-
 include/linux/ceph/debugfs.h                     |    4 +-
 include/linux/ceph/decode.h                      |    2 +
 include/linux/ceph/libceph.h                     |   14 ++++-----
 include/linux/ceph/mdsmap.h                      |    2 +
 include/linux/ceph/messenger.h                   |    4 +-
 include/linux/ceph/mon_client.h                  |    2 +
 include/linux/ceph/msgpool.h                     |    2 +
 include/linux/ceph/osd_client.h                  |    6 ++--
 include/linux/ceph/osdmap.h                      |    4 +-
 include/linux/ceph/rados.h                       |    2 +
 include/linux/ceph/types.h                       |    6 ++--
 include/linux/crush/mapper.h                     |    2 +
 include/linux/drbd_tag_magic.h                   |   10 +++---
 include/linux/netfilter/nf_conntrack_h323_asn1.h |    2 +
 include/scsi/osd_attributes.h                    |    2 +
 include/scsi/osd_initiator.h                     |    4 +-
 include/scsi/osd_sec.h                           |    4 +-
 include/sound/ac97_codec.h                       |    6 ++--
 include/sound/ad1816a.h                          |    6 ++--
 include/sound/ak4531_codec.h                     |    4 +-
 include/sound/cs46xx.h                           |   10 +++---
 include/sound/cs46xx_dsp_spos.h                  |    4 +-
 include/sound/cs46xx_dsp_task_types.h            |    2 +
 include/sound/emu10k1_synth.h                    |    4 +-
 include/sound/emu8000.h                          |    4 +-
 include/sound/emux_legacy.h                      |    2 +
 include/sound/emux_synth.h                       |   14 ++++-----
 include/sound/es1688.h                           |    4 +-
 include/sound/gus.h                              |   10 +++---
 include/sound/mpu401.h                           |    2 +
 include/sound/pcm.h                              |    2 +
 include/sound/rawmidi.h                          |    2 +
 include/sound/sb.h                               |    4 +-
 include/sound/sb16_csp.h                         |    4 +-
 include/sound/seq_kernel.h                       |    2 +
 include/sound/seq_midi_emul.h                    |    2 +
 include/sound/seq_midi_event.h                   |    2 +
 include/sound/seq_oss.h                          |    4 +-
 include/sound/seq_virmidi.h                      |    4 +-
 include/sound/snd_wavefront.h                    |    8 ++---
 include/sound/soundfont.h                        |    4 +-
 include/sound/tea6330t.h                         |    2 +
 include/sound/trident.h                          |    8 ++---
 include/sound/wss.h                              |    8 ++---
 include/sound/ymfpci.h                           |    8 ++---
 include/trace/events/compaction.h                |    2 +
 include/trace/events/kmem.h                      |    2 +
 include/trace/events/vmscan.h                    |    2 +
 include/xen/interface/callback.h                 |    2 +
 include/xen/interface/hvm/params.h               |    2 +
 include/xen/interface/io/blkif.h                 |    4 +-
 include/xen/interface/io/netif.h                 |    4 +-
 include/xen/interface/sched.h                    |    2 +
 include/xen/interface/version.h                  |    2 +
 161 files changed, 335 insertions(+), 335 deletions(-)

diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index 080d74f..8c67ead 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -27,7 +27,7 @@ asmlinkage void do_local_timer(struct pt_regs *);
 
 #ifdef CONFIG_HAVE_ARM_TWD
 
-#include "smp_twd.h"
+#include <asm/smp_twd.h>
 
 #define local_timer_ack()	twd_timer_ack()
 
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index ac75d08..f9629a7 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -19,7 +19,7 @@
 
 #ifndef CONFIG_MMU
 
-#include "page-nommu.h"
+#include <asm/page-nommu.h>
 
 #else
 
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 5750704..0f64e0c 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -16,7 +16,7 @@
 
 #ifndef CONFIG_MMU
 
-#include "pgtable-nommu.h"
+#include <asm/pgtable-nommu.h>
 
 #else
 
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
index 3d5fc41..a7aadbd 100644
--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -5,7 +5,7 @@
  */
 #include <asm/hwcap.h>
 
-#include "vfp.h"
+#include <asm/vfp.h>
 
 @ Macros to allow building with old toolkits (with no VFP support)
 	.macro	VFPFMRX, rd, sysreg, cond
diff --git a/arch/cris/include/arch-v10/arch/sv_addr_ag.h b/arch/cris/include/arch-v10/arch/sv_addr_ag.h
index e4a6b68..5517f04 100644
--- a/arch/cris/include/arch-v10/arch/sv_addr_ag.h
+++ b/arch/cris/include/arch-v10/arch/sv_addr_ag.h
@@ -114,7 +114,7 @@
 
 /*------------------------------------------------------------*/
 
-#include "sv_addr.agh"
+#include <arch/sv_addr.agh>
 
 #if __test_sv_addr__
 /* IO_MASK( R_BUS_CONFIG , CE ) */
diff --git a/arch/cris/include/arch-v10/arch/svinto.h b/arch/cris/include/arch-v10/arch/svinto.h
index 0881a1a..da5c152 100644
--- a/arch/cris/include/arch-v10/arch/svinto.h
+++ b/arch/cris/include/arch-v10/arch/svinto.h
@@ -1,7 +1,7 @@
 #ifndef _ASM_CRIS_SVINTO_H
 #define _ASM_CRIS_SVINTO_H
 
-#include "sv_addr_ag.h"
+#include <arch/sv_addr_ag.h>
 
 extern unsigned int genconfig_shadow; /* defined and set in head.S */
 
diff --git a/arch/cris/include/arch-v32/arch/dma.h b/arch/cris/include/arch-v32/arch/dma.h
index 6190615..6f92f4f 100644
--- a/arch/cris/include/arch-v32/arch/dma.h
+++ b/arch/cris/include/arch-v32/arch/dma.h
@@ -1 +1 @@
-#include "mach/dma.h"
+#include <mach/dma.h>
diff --git a/arch/cris/include/arch-v32/arch/hwregs/dma.h b/arch/cris/include/arch-v32/arch/hwregs/dma.h
index 3ce322b..52bf679 100644
--- a/arch/cris/include/arch-v32/arch/hwregs/dma.h
+++ b/arch/cris/include/arch-v32/arch/hwregs/dma.h
@@ -7,7 +7,7 @@
 #define dma_h
 
 /* registers */ /* Really needed, since both are listed in sw.list? */
-#include "dma_defs.h"
+#include <arch/hwregs/dma_defs.h>
 
 
 /* descriptors */
diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h
index ce163ab..2d13854 100644
--- a/arch/m68k/include/asm/bitops.h
+++ b/arch/m68k/include/asm/bitops.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "bitops_no.h"
+#include <asm/bitops_no.h>
 #else
-#include "bitops_mm.h"
+#include <asm/bitops_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/cacheflush.h b/arch/m68k/include/asm/cacheflush.h
index a70d731..4fc7382 100644
--- a/arch/m68k/include/asm/cacheflush.h
+++ b/arch/m68k/include/asm/cacheflush.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "cacheflush_no.h"
+#include <asm/cacheflush_no.h>
 #else
-#include "cacheflush_mm.h"
+#include <asm/cacheflush_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/delay.h b/arch/m68k/include/asm/delay.h
index d2598e3..5bab01b 100644
--- a/arch/m68k/include/asm/delay.h
+++ b/arch/m68k/include/asm/delay.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "delay_no.h"
+#include <asm/delay_no.h>
 #else
-#include "delay_mm.h"
+#include <asm/delay_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h
index 876eec6..7308daf 100644
--- a/arch/m68k/include/asm/entry.h
+++ b/arch/m68k/include/asm/entry.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "entry_no.h"
+#include <asm/entry_no.h>
 #else
-#include "entry_mm.h"
+#include <asm/entry_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/hardirq.h b/arch/m68k/include/asm/hardirq.h
index 56d0d5d..b9605bc 100644
--- a/arch/m68k/include/asm/hardirq.h
+++ b/arch/m68k/include/asm/hardirq.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "hardirq_no.h"
+#include <asm/hardirq_no.h>
 #else
-#include "hardirq_mm.h"
+#include <asm/hardirq_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index c7210ba..c70cc91 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "io_no.h"
+#include <asm/io_no.h>
 #else
-#include "io_mm.h"
+#include <asm/io_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/m68360.h b/arch/m68k/include/asm/m68360.h
index eb7d39e..4664180 100644
--- a/arch/m68k/include/asm/m68360.h
+++ b/arch/m68k/include/asm/m68360.h
@@ -1,7 +1,7 @@
-#include "m68360_regs.h"
-#include "m68360_pram.h"
-#include "m68360_quicc.h"
-#include "m68360_enet.h"
+#include <asm/m68360_regs.h>
+#include <asm/m68360_pram.h>
+#include <asm/m68360_quicc.h>
+#include <asm/m68360_enet.h>
 
 #ifdef CONFIG_M68360
 
diff --git a/arch/m68k/include/asm/m68360_enet.h b/arch/m68k/include/asm/m68360_enet.h
index c36f4d0..4d04037 100644
--- a/arch/m68k/include/asm/m68360_enet.h
+++ b/arch/m68k/include/asm/m68360_enet.h
@@ -10,7 +10,7 @@
 #ifndef __ETHER_H
 #define __ETHER_H
 
-#include "quicc_simple.h"
+#include <asm/quicc_simple.h>
 
 /*
  * transmit BD's
diff --git a/arch/m68k/include/asm/page.h b/arch/m68k/include/asm/page.h
index dfebb7c..095d829 100644
--- a/arch/m68k/include/asm/page.h
+++ b/arch/m68k/include/asm/page.h
@@ -39,9 +39,9 @@ typedef struct page *pgtable_t;
 #endif /* !__ASSEMBLY__ */
 
 #ifdef CONFIG_MMU
-#include "page_mm.h"
+#include <asm/page_mm.h>
 #else
-#include "page_no.h"
+#include <asm/page_no.h>
 #endif
 
 #include <asm-generic/getorder.h>
diff --git a/arch/m68k/include/asm/pgtable.h b/arch/m68k/include/asm/pgtable.h
index ee6759e..a3d733b 100644
--- a/arch/m68k/include/asm/pgtable.h
+++ b/arch/m68k/include/asm/pgtable.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "pgtable_no.h"
+#include <asm/pgtable_no.h>
 #else
-#include "pgtable_mm.h"
+#include <asm/pgtable_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/q40_master.h b/arch/m68k/include/asm/q40_master.h
index 3907a09..fc5b362 100644
--- a/arch/m68k/include/asm/q40_master.h
+++ b/arch/m68k/include/asm/q40_master.h
@@ -60,7 +60,7 @@
 #define Q40_RTC_WRITE  128
 
 /* define some Q40 specific ints */
-#include "q40ints.h"
+#include <asm/q40ints.h>
 
 /* misc defs */
 #define DAC_LEFT  ((unsigned char *)0xff008000)
diff --git a/arch/m68k/include/asm/system.h b/arch/m68k/include/asm/system.h
index ccea925..f99dcd2 100644
--- a/arch/m68k/include/asm/system.h
+++ b/arch/m68k/include/asm/system.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "system_no.h"
+#include <asm/system_no.h>
 #else
-#include "system_mm.h"
+#include <asm/system_mm.h>
 #endif
diff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h
index 38f92db..639c731 100644
--- a/arch/m68k/include/asm/uaccess.h
+++ b/arch/m68k/include/asm/uaccess.h
@@ -1,5 +1,5 @@
 #ifdef __uClinux__
-#include "uaccess_no.h"
+#include <asm/uaccess_no.h>
 #else
-#include "uaccess_mm.h"
+#include <asm/uaccess_mm.h>
 #endif
diff --git a/arch/microblaze/include/asm/mmu_context.h b/arch/microblaze/include/asm/mmu_context.h
index 24eab16..0ccd8c4 100644
--- a/arch/microblaze/include/asm/mmu_context.h
+++ b/arch/microblaze/include/asm/mmu_context.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_MMU
-# include "mmu_context_mm.h"
+# include <asm/mmu_context_mm.h>
 #else
 # include <asm-generic/mmu_context.h>
 #endif
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
index 91180fa..1e08044 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h
@@ -1,7 +1,7 @@
 #ifndef BCM63XX_IO_H_
 #define BCM63XX_IO_H_
 
-#include "bcm63xx_cpu.h"
+#include <asm/mach-bcm63xx/bcm63xx_cpu.h>
 
 /*
  * Physical memory map, RAM is mapped at 0x0.
diff --git a/arch/mips/include/asm/mach-pnx833x/gpio.h b/arch/mips/include/asm/mach-pnx833x/gpio.h
index ed3a88d..f192acf 100644
--- a/arch/mips/include/asm/mach-pnx833x/gpio.h
+++ b/arch/mips/include/asm/mach-pnx833x/gpio.h
@@ -30,7 +30,7 @@
    - including locking between different uses
 */
 
-#include "pnx833x.h"
+#include <asm/mach-pnx833x/pnx833x.h>
 
 #define SET_REG_BIT(reg, bit)		do { (reg |= (1 << (bit))); } while (0)
 #define CLEAR_REG_BIT(reg, bit)		do { (reg &= ~(1 << (bit))); } while (0)
diff --git a/arch/mips/include/asm/octeon/cvmx-asm.h b/arch/mips/include/asm/octeon/cvmx-asm.h
index 5de5de9..31eacc2 100644
--- a/arch/mips/include/asm/octeon/cvmx-asm.h
+++ b/arch/mips/include/asm/octeon/cvmx-asm.h
@@ -32,7 +32,7 @@
 #ifndef __CVMX_ASM_H__
 #define __CVMX_ASM_H__
 
-#include "octeon-model.h"
+#include <asm/octeon/octeon-model.h>
 
 /* other useful stuff */
 #define CVMX_SYNC asm volatile ("sync" : : : "memory")
diff --git a/arch/mips/include/asm/octeon/cvmx-spinlock.h b/arch/mips/include/asm/octeon/cvmx-spinlock.h
index 2fbf087..a672abb 100644
--- a/arch/mips/include/asm/octeon/cvmx-spinlock.h
+++ b/arch/mips/include/asm/octeon/cvmx-spinlock.h
@@ -35,7 +35,7 @@
 #ifndef __CVMX_SPINLOCK_H__
 #define __CVMX_SPINLOCK_H__
 
-#include "cvmx-asm.h"
+#include <asm/octeon/cvmx-asm.h>
 
 /* Spinlocks for Octeon */
 
diff --git a/arch/mips/include/asm/octeon/cvmx.h b/arch/mips/include/asm/octeon/cvmx.h
index 7e12867..3a143a6 100644
--- a/arch/mips/include/asm/octeon/cvmx.h
+++ b/arch/mips/include/asm/octeon/cvmx.h
@@ -31,24 +31,24 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 
-#include "cvmx-asm.h"
-#include "cvmx-packet.h"
-#include "cvmx-sysinfo.h"
-
-#include "cvmx-ciu-defs.h"
-#include "cvmx-gpio-defs.h"
-#include "cvmx-iob-defs.h"
-#include "cvmx-ipd-defs.h"
-#include "cvmx-l2c-defs.h"
-#include "cvmx-l2d-defs.h"
-#include "cvmx-l2t-defs.h"
-#include "cvmx-led-defs.h"
-#include "cvmx-mio-defs.h"
-#include "cvmx-pow-defs.h"
-
-#include "cvmx-bootinfo.h"
-#include "cvmx-bootmem.h"
-#include "cvmx-l2c.h"
+#include <asm/octeon/cvmx-asm.h>
+#include <asm/octeon/cvmx-packet.h>
+#include <asm/octeon/cvmx-sysinfo.h>
+
+#include <asm/octeon/cvmx-ciu-defs.h>
+#include <asm/octeon/cvmx-gpio-defs.h>
+#include <asm/octeon/cvmx-iob-defs.h>
+#include <asm/octeon/cvmx-ipd-defs.h>
+#include <asm/octeon/cvmx-l2c-defs.h>
+#include <asm/octeon/cvmx-l2d-defs.h>
+#include <asm/octeon/cvmx-l2t-defs.h>
+#include <asm/octeon/cvmx-led-defs.h>
+#include <asm/octeon/cvmx-mio-defs.h>
+#include <asm/octeon/cvmx-pow-defs.h>
+
+#include <asm/octeon/cvmx-bootinfo.h>
+#include <asm/octeon/cvmx-bootmem.h>
+#include <asm/octeon/cvmx-l2c.h>
 
 #ifndef CVMX_ENABLE_DEBUG_PRINTS
 #define CVMX_ENABLE_DEBUG_PRINTS 1
diff --git a/arch/mips/include/asm/octeon/octeon-model.h b/arch/mips/include/asm/octeon/octeon-model.h
index 700f88e..40b81ce 100644
--- a/arch/mips/include/asm/octeon/octeon-model.h
+++ b/arch/mips/include/asm/octeon/octeon-model.h
@@ -336,6 +336,6 @@ static inline int __octeon_is_model_runtime__(uint32_t model)
 const char *octeon_model_get_string(uint32_t chip_id);
 const char *octeon_model_get_string_buffer(uint32_t chip_id, char *buffer);
 
-#include "octeon-feature.h"
+#include <asm/octeon/octeon-feature.h>
 
 #endif /* __OCTEON_MODEL_H__ */
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index f72f768..e314b35 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -8,7 +8,7 @@
 #ifndef __ASM_OCTEON_OCTEON_H
 #define __ASM_OCTEON_OCTEON_H
 
-#include "cvmx.h"
+#include <asm/octeon/cvmx.h>
 
 extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size,
 						uint64_t alignment,
diff --git a/arch/mips/include/asm/sibyte/bcm1480_int.h b/arch/mips/include/asm/sibyte/bcm1480_int.h
index 6109557..fffb224 100644
--- a/arch/mips/include/asm/sibyte/bcm1480_int.h
+++ b/arch/mips/include/asm/sibyte/bcm1480_int.h
@@ -34,7 +34,7 @@
 #ifndef _BCM1480_INT_H
 #define _BCM1480_INT_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  Interrupt Mapper Constants
diff --git a/arch/mips/include/asm/sibyte/bcm1480_l2c.h b/arch/mips/include/asm/sibyte/bcm1480_l2c.h
index fd75817..725d38c 100644
--- a/arch/mips/include/asm/sibyte/bcm1480_l2c.h
+++ b/arch/mips/include/asm/sibyte/bcm1480_l2c.h
@@ -33,7 +33,7 @@
 #ifndef _BCM1480_L2C_H
 #define _BCM1480_L2C_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Format of level 2 cache management address (Table 55)
diff --git a/arch/mips/include/asm/sibyte/bcm1480_mc.h b/arch/mips/include/asm/sibyte/bcm1480_mc.h
index f26a41a..4307a75 100644
--- a/arch/mips/include/asm/sibyte/bcm1480_mc.h
+++ b/arch/mips/include/asm/sibyte/bcm1480_mc.h
@@ -33,7 +33,7 @@
 #ifndef _BCM1480_MC_H
 #define _BCM1480_MC_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Memory Channel Configuration Register (Table 81)
diff --git a/arch/mips/include/asm/sibyte/bcm1480_regs.h b/arch/mips/include/asm/sibyte/bcm1480_regs.h
index b4077bb..84d168d 100644
--- a/arch/mips/include/asm/sibyte/bcm1480_regs.h
+++ b/arch/mips/include/asm/sibyte/bcm1480_regs.h
@@ -32,14 +32,14 @@
 #ifndef _BCM1480_REGS_H
 #define _BCM1480_REGS_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  Pull in the BCM1250's registers since a great deal of the 1480's
     *  functions are the same as the BCM1250.
     ********************************************************************* */
 
-#include "sb1250_regs.h"
+#include <asm/sibyte/sb1250_regs.h>
 
 
 /*  *********************************************************************
diff --git a/arch/mips/include/asm/sibyte/bcm1480_scd.h b/arch/mips/include/asm/sibyte/bcm1480_scd.h
index 25ef24c..2af3706 100644
--- a/arch/mips/include/asm/sibyte/bcm1480_scd.h
+++ b/arch/mips/include/asm/sibyte/bcm1480_scd.h
@@ -32,13 +32,13 @@
 #ifndef _BCM1480_SCD_H
 #define _BCM1480_SCD_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  Pull in the BCM1250's SCD since lots of stuff is the same.
     ********************************************************************* */
 
-#include "sb1250_scd.h"
+#include <asm/sibyte/sb1250_scd.h>
 
 /*  *********************************************************************
     *  Some general notes:
diff --git a/arch/mips/include/asm/sibyte/sb1250_dma.h b/arch/mips/include/asm/sibyte/sb1250_dma.h
index bad5617..6c44dfb 100644
--- a/arch/mips/include/asm/sibyte/sb1250_dma.h
+++ b/arch/mips/include/asm/sibyte/sb1250_dma.h
@@ -36,7 +36,7 @@
 #define _SB1250_DMA_H
 
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  DMA Registers
diff --git a/arch/mips/include/asm/sibyte/sb1250_genbus.h b/arch/mips/include/asm/sibyte/sb1250_genbus.h
index 94e9c7c..a96ded1 100644
--- a/arch/mips/include/asm/sibyte/sb1250_genbus.h
+++ b/arch/mips/include/asm/sibyte/sb1250_genbus.h
@@ -34,7 +34,7 @@
 #ifndef _SB1250_GENBUS_H
 #define _SB1250_GENBUS_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Generic Bus Region Configuration Registers (Table 11-4)
diff --git a/arch/mips/include/asm/sibyte/sb1250_int.h b/arch/mips/include/asm/sibyte/sb1250_int.h
index f2850b4..dbea73d 100644
--- a/arch/mips/include/asm/sibyte/sb1250_int.h
+++ b/arch/mips/include/asm/sibyte/sb1250_int.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_INT_H
 #define _SB1250_INT_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  Interrupt Mapper Constants
diff --git a/arch/mips/include/asm/sibyte/sb1250_l2c.h b/arch/mips/include/asm/sibyte/sb1250_l2c.h
index 6554dcf..b61a749 100644
--- a/arch/mips/include/asm/sibyte/sb1250_l2c.h
+++ b/arch/mips/include/asm/sibyte/sb1250_l2c.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_L2C_H
 #define _SB1250_L2C_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Level 2 Cache Tag register (Table 5-3)
diff --git a/arch/mips/include/asm/sibyte/sb1250_ldt.h b/arch/mips/include/asm/sibyte/sb1250_ldt.h
index 1e76cf1..bf7f320 100644
--- a/arch/mips/include/asm/sibyte/sb1250_ldt.h
+++ b/arch/mips/include/asm/sibyte/sb1250_ldt.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_LDT_H
 #define _SB1250_LDT_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 #define K_LDT_VENDOR_SIBYTE	0x166D
 #define K_LDT_DEVICE_SB1250	0x0002
diff --git a/arch/mips/include/asm/sibyte/sb1250_mac.h b/arch/mips/include/asm/sibyte/sb1250_mac.h
index 77f7872..cfc4d78 100644
--- a/arch/mips/include/asm/sibyte/sb1250_mac.h
+++ b/arch/mips/include/asm/sibyte/sb1250_mac.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_MAC_H
 #define _SB1250_MAC_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  Ethernet MAC Registers
diff --git a/arch/mips/include/asm/sibyte/sb1250_mc.h b/arch/mips/include/asm/sibyte/sb1250_mc.h
index 1eb1b5a..15048dc 100644
--- a/arch/mips/include/asm/sibyte/sb1250_mc.h
+++ b/arch/mips/include/asm/sibyte/sb1250_mc.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_MC_H
 #define _SB1250_MC_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Memory Channel Config Register (table 6-14)
diff --git a/arch/mips/include/asm/sibyte/sb1250_regs.h b/arch/mips/include/asm/sibyte/sb1250_regs.h
index 8f53ec8..29b9f0b 100644
--- a/arch/mips/include/asm/sibyte/sb1250_regs.h
+++ b/arch/mips/include/asm/sibyte/sb1250_regs.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_REGS_H
 #define _SB1250_REGS_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 
 /*  *********************************************************************
diff --git a/arch/mips/include/asm/sibyte/sb1250_scd.h b/arch/mips/include/asm/sibyte/sb1250_scd.h
index e49c3e8..615e165 100644
--- a/arch/mips/include/asm/sibyte/sb1250_scd.h
+++ b/arch/mips/include/asm/sibyte/sb1250_scd.h
@@ -32,7 +32,7 @@
 #ifndef _SB1250_SCD_H
 #define _SB1250_SCD_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*  *********************************************************************
     *  System control/debug registers
diff --git a/arch/mips/include/asm/sibyte/sb1250_smbus.h b/arch/mips/include/asm/sibyte/sb1250_smbus.h
index 0476992..128d6b7 100644
--- a/arch/mips/include/asm/sibyte/sb1250_smbus.h
+++ b/arch/mips/include/asm/sibyte/sb1250_smbus.h
@@ -34,7 +34,7 @@
 #ifndef _SB1250_SMBUS_H
 #define _SB1250_SMBUS_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * SMBus Clock Frequency Register (Table 14-2)
diff --git a/arch/mips/include/asm/sibyte/sb1250_syncser.h b/arch/mips/include/asm/sibyte/sb1250_syncser.h
index d4b8558..274e917 100644
--- a/arch/mips/include/asm/sibyte/sb1250_syncser.h
+++ b/arch/mips/include/asm/sibyte/sb1250_syncser.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_SYNCSER_H
 #define _SB1250_SYNCSER_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /*
  * Serial Mode Configuration Register
diff --git a/arch/mips/include/asm/sibyte/sb1250_uart.h b/arch/mips/include/asm/sibyte/sb1250_uart.h
index d835bf2..bb99eca 100644
--- a/arch/mips/include/asm/sibyte/sb1250_uart.h
+++ b/arch/mips/include/asm/sibyte/sb1250_uart.h
@@ -33,7 +33,7 @@
 #ifndef _SB1250_UART_H
 #define _SB1250_UART_H
 
-#include "sb1250_defs.h"
+#include <asm/sibyte/sb1250_defs.h>
 
 /* **********************************************************************
    * DUART Registers
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 7f065e1..0e15db4 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -24,7 +24,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/device.h>
-#include "cell-pmu.h"
+#include <asm/cell-pmu.h>
 
 union ps3_firmware_version {
 	u64 raw;
diff --git a/arch/powerpc/include/asm/ucc_fast.h b/arch/powerpc/include/asm/ucc_fast.h
index 839aab8..4644c84 100644
--- a/arch/powerpc/include/asm/ucc_fast.h
+++ b/arch/powerpc/include/asm/ucc_fast.h
@@ -19,7 +19,7 @@
 #include <asm/immap_qe.h>
 #include <asm/qe.h>
 
-#include "ucc.h"
+#include <asm/ucc.h>
 
 /* Receive BD's status */
 #define R_E	0x80000000	/* buffer empty */
diff --git a/arch/powerpc/include/asm/ucc_slow.h b/arch/powerpc/include/asm/ucc_slow.h
index 0980e6a..cf131ff 100644
--- a/arch/powerpc/include/asm/ucc_slow.h
+++ b/arch/powerpc/include/asm/ucc_slow.h
@@ -20,7 +20,7 @@
 #include <asm/immap_qe.h>
 #include <asm/qe.h>
 
-#include "ucc.h"
+#include <asm/ucc.h>
 
 /* transmit BD's status */
 #define T_R	0x80000000	/* ready bit */
diff --git a/arch/sh/include/asm/checksum.h b/arch/sh/include/asm/checksum.h
index fc26d1f..34ae262 100644
--- a/arch/sh/include/asm/checksum.h
+++ b/arch/sh/include/asm/checksum.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_SUPERH32
-# include "checksum_32.h"
+# include <asm/checksum_32.h>
 #else
 # include <asm-generic/checksum.h>
 #endif
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 384c747..21c5088 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -46,9 +46,9 @@
 #define MMU_VPN_MASK	0xfffff000
 
 #if defined(CONFIG_SUPERH32)
-#include "mmu_context_32.h"
+#include <asm/mmu_context_32.h>
 #else
-#include "mmu_context_64.h"
+#include <asm/mmu_context_64.h>
 #endif
 
 /*
diff --git a/arch/sh/include/asm/posix_types.h b/arch/sh/include/asm/posix_types.h
index 4eeb723..f08449b 100644
--- a/arch/sh/include/asm/posix_types.h
+++ b/arch/sh/include/asm/posix_types.h
@@ -1,13 +1,13 @@
 #ifdef __KERNEL__
 # ifdef CONFIG_SUPERH32
-#  include "posix_types_32.h"
+#  include <asm/posix_types_32.h>
 # else
-#  include "posix_types_64.h"
+#  include <asm/posix_types_64.h>
 # endif
 #else
 # ifdef __SH5__
-#  include "posix_types_64.h"
+#  include <asm/posix_types_64.h>
 # else
-#  include "posix_types_32.h"
+#  include <asm/posix_types_32.h>
 # endif
 #endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 9c7bdfc..9dc9475 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -164,9 +164,9 @@ int vsyscall_init(void);
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_SUPERH32
-# include "processor_32.h"
+# include <asm/processor_32.h>
 #else
-# include "processor_64.h"
+# include <asm/processor_64.h>
 #endif
 
 #endif /* __ASM_SH_PROCESSOR_H */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 88bd6be..3ba25f3 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -25,9 +25,9 @@
 #define PT_TEXT_LEN		252
 
 #if defined(__SH5__) || defined(CONFIG_CPU_SH5)
-#include "ptrace_64.h"
+#include <asm/ptrace_64.h>
 #else
-#include "ptrace_32.h"
+#include <asm/ptrace_32.h>
 #endif
 
 #ifdef __KERNEL__
diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h
index 8c1ea21d..114011f 100644
--- a/arch/sh/include/asm/string.h
+++ b/arch/sh/include/asm/string.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_SUPERH32
-# include "string_32.h"
+# include <asm/string_32.h>
 #else
-# include "string_64.h"
+# include <asm/string_64.h>
 #endif
diff --git a/arch/sh/include/asm/syscall.h b/arch/sh/include/asm/syscall.h
index aa7777b..847128d 100644
--- a/arch/sh/include/asm/syscall.h
+++ b/arch/sh/include/asm/syscall.h
@@ -4,9 +4,9 @@
 extern const unsigned long sys_call_table[];
 
 #ifdef CONFIG_SUPERH32
-# include "syscall_32.h"
+# include <asm/syscall_32.h>
 #else
-# include "syscall_64.h"
+# include <asm/syscall_64.h>
 #endif
 
 #endif /* __ASM_SH_SYSCALL_H */
diff --git a/arch/sh/include/asm/syscalls.h b/arch/sh/include/asm/syscalls.h
index 507725a..3dbfef0 100644
--- a/arch/sh/include/asm/syscalls.h
+++ b/arch/sh/include/asm/syscalls.h
@@ -11,9 +11,9 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
 			  unsigned long fd, unsigned long pgoff);
 
 #ifdef CONFIG_SUPERH32
-# include "syscalls_32.h"
+# include <asm/syscalls_32.h>
 #else
-# include "syscalls_64.h"
+# include <asm/syscalls_64.h>
 #endif
 
 #endif /* __KERNEL__ */
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 10c8b18..507d082 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -176,9 +176,9 @@ struct mem_access {
 };
 
 #ifdef CONFIG_SUPERH32
-# include "system_32.h"
+# include <asm/system_32.h>
 #else
-# include "system_64.h"
+# include <asm/system_64.h>
 #endif
 
 #endif
diff --git a/arch/sh/include/asm/tlb.h b/arch/sh/include/asm/tlb.h
index ec88bfc..e61d43d 100644
--- a/arch/sh/include/asm/tlb.h
+++ b/arch/sh/include/asm/tlb.h
@@ -2,7 +2,7 @@
 #define __ASM_SH_TLB_H
 
 #ifdef CONFIG_SUPERH64
-# include "tlb_64.h"
+# include <asm/tlb_64.h>
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index 075848f..ee4cf16 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -95,9 +95,9 @@ struct __large_struct { unsigned long buf[100]; };
 })
 
 #ifdef CONFIG_SUPERH32
-# include "uaccess_32.h"
+# include <asm/uaccess_32.h>
 #else
-# include "uaccess_64.h"
+# include <asm/uaccess_64.h>
 #endif
 
 /* Generic arbitrary sized copy.  */
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
index 65be656..5e845e8 100644
--- a/arch/sh/include/asm/unistd.h
+++ b/arch/sh/include/asm/unistd.h
@@ -1,13 +1,13 @@
 #ifdef __KERNEL__
 # ifdef CONFIG_SUPERH32
-#  include "unistd_32.h"
+#  include <asm/unistd_32.h>
 # else
-#  include "unistd_64.h"
+#  include <asm/unistd_64.h>
 # endif
 #else
 # ifdef __SH5__
-#  include "unistd_64.h"
+#  include <asm/unistd_64.h>
 # else
-#  include "unistd_32.h"
+#  include <asm/unistd_32.h>
 # endif
 #endif
diff --git a/arch/sh/include/mach-ecovec24/mach/romimage.h b/arch/sh/include/mach-ecovec24/mach/romimage.h
index d63ef51..60f3e8a 100644
--- a/arch/sh/include/mach-ecovec24/mach/romimage.h
+++ b/arch/sh/include/mach-ecovec24/mach/romimage.h
@@ -6,7 +6,7 @@
  */
 
 #include <asm/romimage-macros.h>
-#include "partner-jet-setup.txt"
+#include <mach/partner-jet-setup.txt>
 
 	/* execute icbi after enabling cache */
 	mov.l	1f, r0
diff --git a/arch/sh/include/mach-kfr2r09/mach/romimage.h b/arch/sh/include/mach-kfr2r09/mach/romimage.h
index 7a88316..1afae21 100644
--- a/arch/sh/include/mach-kfr2r09/mach/romimage.h
+++ b/arch/sh/include/mach-kfr2r09/mach/romimage.h
@@ -6,7 +6,7 @@
  */
 
 #include <asm/romimage-macros.h>
-#include "partner-jet-setup.txt"
+#include <mach/partner-jet-setup.txt>
 
 	/* execute icbi after enabling cache */
 	mov.l	1f, r0
diff --git a/arch/unicore32/include/mach/PKUnity.h b/arch/unicore32/include/mach/PKUnity.h
index 8040d57..46705af 100644
--- a/arch/unicore32/include/mach/PKUnity.h
+++ b/arch/unicore32/include/mach/PKUnity.h
@@ -15,7 +15,7 @@
 #error You must include hardware.h not PKUnity.h
 #endif
 
-#include "bitfield.h"
+#include <mach/bitfield.h>
 
 /*
  * Memory Definitions
@@ -32,7 +32,7 @@
  * 0x98000000 - 0x9FFFFFFF 128MB  PCI PCI-AHB MEM-mapping
  */
 #define PKUNITY_PCI_BASE		io_p2v(0x80000000) /* 0x80000000 - 0xBFFFFFFF 1GB */
-#include "regs-pci.h"
+#include <mach/regs-pci.h>
 
 #define PKUNITY_PCICFG_BASE		(PKUNITY_PCI_BASE + 0x0)
 #define PKUNITY_PCIBRI_BASE		(PKUNITY_PCI_BASE + 0x00010000)
@@ -50,18 +50,18 @@
 #define PKUNITY_ARBITER_BASE		(PKUNITY_AHB_BASE + 0x000000) /* AHB-2 */
 #define PKUNITY_DDR2CTRL_BASE		(PKUNITY_AHB_BASE + 0x100000) /* AHB-3 */
 #define PKUNITY_DMAC_BASE		(PKUNITY_AHB_BASE + 0x200000) /* AHB-4 */
-#include "regs-dmac.h"
+#include <mach/regs-dmac.h>
 #define PKUNITY_UMAL_BASE		(PKUNITY_AHB_BASE + 0x300000) /* AHB-5 */
-#include "regs-umal.h"
+#include <mach/regs-umal.h>
 #define PKUNITY_USB_BASE		(PKUNITY_AHB_BASE + 0x400000) /* AHB-6 */
 #define PKUNITY_SATA_BASE		(PKUNITY_AHB_BASE + 0x500000) /* AHB-7 */
 #define PKUNITY_SMC_BASE		(PKUNITY_AHB_BASE + 0x600000) /* AHB-8 */
 /* AHB-9 is for APB bridge */
 #define PKUNITY_MME_BASE		(PKUNITY_AHB_BASE + 0x700000) /* AHB-10 */
 #define PKUNITY_UNIGFX_BASE		(PKUNITY_AHB_BASE + 0x800000) /* AHB-11 */
-#include "regs-unigfx.h"
+#include <mach/regs-unigfx.h>
 #define PKUNITY_NAND_BASE		(PKUNITY_AHB_BASE + 0x900000) /* AHB-12 */
-#include "regs-nand.h"
+#include <mach/regs-nand.h>
 #define PKUNITY_H264D_BASE		(PKUNITY_AHB_BASE + 0xA00000) /* AHB-13 */
 #define PKUNITY_H264E_BASE		(PKUNITY_AHB_BASE + 0xB00000) /* AHB-14 */
 
@@ -72,27 +72,27 @@
 
 #define PKUNITY_UART0_BASE		(PKUNITY_APB_BASE + 0x000000) /* APB-0 */
 #define PKUNITY_UART1_BASE		(PKUNITY_APB_BASE + 0x100000) /* APB-1 */
-#include "regs-uart.h"
+#include <mach/regs-uart.h>
 #define PKUNITY_I2C_BASE		(PKUNITY_APB_BASE + 0x200000) /* APB-2 */
-#include "regs-i2c.h"
+#include <mach/regs-i2c.h>
 #define PKUNITY_SPI_BASE		(PKUNITY_APB_BASE + 0x300000) /* APB-3 */
-#include "regs-spi.h"
+#include <mach/regs-spi.h>
 #define PKUNITY_AC97_BASE		(PKUNITY_APB_BASE + 0x400000) /* APB-4 */
-#include "regs-ac97.h"
+#include <mach/regs-ac97.h>
 #define PKUNITY_GPIO_BASE		(PKUNITY_APB_BASE + 0x500000) /* APB-5 */
-#include "regs-gpio.h"
+#include <mach/regs-gpio.h>
 #define PKUNITY_INTC_BASE		(PKUNITY_APB_BASE + 0x600000) /* APB-6 */
-#include "regs-intc.h"
+#include <mach/regs-intc.h>
 #define PKUNITY_RTC_BASE		(PKUNITY_APB_BASE + 0x700000) /* APB-7 */
-#include "regs-rtc.h"
+#include <mach/regs-rtc.h>
 #define PKUNITY_OST_BASE		(PKUNITY_APB_BASE + 0x800000) /* APB-8 */
-#include "regs-ost.h"
+#include <mach/regs-ost.h>
 #define PKUNITY_RESETC_BASE		(PKUNITY_APB_BASE + 0x900000) /* APB-9 */
-#include "regs-resetc.h"
+#include <mach/regs-resetc.h>
 #define PKUNITY_PM_BASE			(PKUNITY_APB_BASE + 0xA00000) /* APB-10 */
-#include "regs-pm.h"
+#include <mach/regs-pm.h>
 #define PKUNITY_PS2_BASE		(PKUNITY_APB_BASE + 0xB00000) /* APB-11 */
-#include "regs-ps2.h"
+#include <mach/regs-ps2.h>
 #define PKUNITY_SDC_BASE		(PKUNITY_APB_BASE + 0xC00000) /* APB-12 */
-#include "regs-sdc.h"
+#include <mach/regs-sdc.h>
 
diff --git a/arch/unicore32/include/mach/hardware.h b/arch/unicore32/include/mach/hardware.h
index 930bea6..9e20b5d 100644
--- a/arch/unicore32/include/mach/hardware.h
+++ b/arch/unicore32/include/mach/hardware.h
@@ -15,7 +15,7 @@
 #ifndef __MACH_PUV3_HARDWARE_H__
 #define __MACH_PUV3_HARDWARE_H__
 
-#include "PKUnity.h"
+#include <mach/PKUnity.h>
 
 #ifndef __ASSEMBLY__
 #define io_p2v(x)	(void __iomem *)((x) - PKUNITY_MMIO_BASE)
diff --git a/arch/unicore32/include/mach/uncompress.h b/arch/unicore32/include/mach/uncompress.h
index 142d3e7..9be67c9 100644
--- a/arch/unicore32/include/mach/uncompress.h
+++ b/arch/unicore32/include/mach/uncompress.h
@@ -13,8 +13,8 @@
 #ifndef __MACH_PUV3_UNCOMPRESS_H__
 #define __MACH_PUV3_UNCOMPRESS_H__
 
-#include "hardware.h"
-#include "ocd.h"
+#include <mach/hardware.h>
+#include <mach/ocd.h>
 
 extern char input_data[];
 extern char input_data_end[];
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 952a826..cfe5df8 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -314,9 +314,9 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
 #define smp_mb__after_atomic_inc()	barrier()
 
 #ifdef CONFIG_X86_32
-# include "atomic64_32.h"
+# include <asm/atomic64_32.h>
 #else
-# include "atomic64_64.h"
+# include <asm/atomic64_64.h>
 #endif
 
 #include <asm-generic/atomic-long.h>
diff --git a/arch/x86/include/asm/checksum.h b/arch/x86/include/asm/checksum.h
index 848850f..5f5bb0f 100644
--- a/arch/x86/include/asm/checksum.h
+++ b/arch/x86/include/asm/checksum.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "checksum_32.h"
+# include <asm/checksum_32.h>
 #else
-# include "checksum_64.h"
+# include <asm/checksum_64.h>
 #endif
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index a460fa0..ed14064 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "cmpxchg_32.h"
+# include <asm/cmpxchg_32.h>
 #else
-# include "cmpxchg_64.h"
+# include <asm/cmpxchg_64.h>
 #endif
diff --git a/arch/x86/include/asm/mmzone.h b/arch/x86/include/asm/mmzone.h
index 64217ea..d497bc4 100644
--- a/arch/x86/include/asm/mmzone.h
+++ b/arch/x86/include/asm/mmzone.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "mmzone_32.h"
+# include <asm/mmzone_32.h>
 #else
-# include "mmzone_64.h"
+# include <asm/mmzone_64.h>
 #endif
diff --git a/arch/x86/include/asm/mutex.h b/arch/x86/include/asm/mutex.h
index a731b9c..7d3a482 100644
--- a/arch/x86/include/asm/mutex.h
+++ b/arch/x86/include/asm/mutex.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "mutex_32.h"
+# include <asm/mutex_32.h>
 #else
-# include "mutex_64.h"
+# include <asm/mutex_64.h>
 #endif
diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h
index bfacd2c..49119fc 100644
--- a/arch/x86/include/asm/numa.h
+++ b/arch/x86/include/asm/numa.h
@@ -53,9 +53,9 @@ static inline int numa_cpu_node(int cpu)
 #endif	/* CONFIG_NUMA */
 
 #ifdef CONFIG_X86_32
-# include "numa_32.h"
+# include <asm/numa_32.h>
 #else
-# include "numa_64.h"
+# include <asm/numa_64.h>
 #endif
 
 #ifdef CONFIG_NUMA
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index d498943..65de77d 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -132,7 +132,7 @@ void default_teardown_msi_irqs(struct pci_dev *dev);
 #endif  /* __KERNEL__ */
 
 #ifdef CONFIG_X86_64
-#include "pci_64.h"
+#include <asm/pci_64.h>
 #endif
 
 /* implement the pci_ DMA API in terms of the generic device dma_ one */
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 18601c8..fe8576b 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -384,9 +384,9 @@ pte_t *populate_extra_pte(unsigned long vaddr);
 #endif	/* __ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
-# include "pgtable_32.h"
+# include <asm/pgtable_32.h>
 #else
-# include "pgtable_64.h"
+# include <asm/pgtable_64.h>
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index d56187c..602a028 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -172,9 +172,9 @@
 #endif
 
 #ifdef CONFIG_X86_32
-# include "pgtable_32_types.h"
+# include <asm/pgtable_32_types.h>
 #else
-# include "pgtable_64_types.h"
+# include <asm/pgtable_64_types.h>
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
index bb7133d..8ddf6f5 100644
--- a/arch/x86/include/asm/posix_types.h
+++ b/arch/x86/include/asm/posix_types.h
@@ -1,13 +1,13 @@
 #ifdef __KERNEL__
 # ifdef CONFIG_X86_32
-#  include "posix_types_32.h"
+#  include <asm/posix_types_32.h>
 # else
-#  include "posix_types_64.h"
+#  include <asm/posix_types_64.h>
 # endif
 #else
 # ifdef __i386__
-#  include "posix_types_32.h"
+#  include <asm/posix_types_32.h>
 # else
-#  include "posix_types_64.h"
+#  include <asm/posix_types_64.h>
 # endif
 #endif
diff --git a/arch/x86/include/asm/seccomp.h b/arch/x86/include/asm/seccomp.h
index c62e58a..0f3d7f0 100644
--- a/arch/x86/include/asm/seccomp.h
+++ b/arch/x86/include/asm/seccomp.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "seccomp_32.h"
+# include <asm/seccomp_32.h>
 #else
-# include "seccomp_64.h"
+# include <asm/seccomp_64.h>
 #endif
diff --git a/arch/x86/include/asm/string.h b/arch/x86/include/asm/string.h
index 6dfd6d9..09224d7 100644
--- a/arch/x86/include/asm/string.h
+++ b/arch/x86/include/asm/string.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "string_32.h"
+# include <asm/string_32.h>
 #else
-# include "string_64.h"
+# include <asm/string_64.h>
 #endif
diff --git a/arch/x86/include/asm/suspend.h b/arch/x86/include/asm/suspend.h
index 9bd521f..2fab6c2 100644
--- a/arch/x86/include/asm/suspend.h
+++ b/arch/x86/include/asm/suspend.h
@@ -1,5 +1,5 @@
 #ifdef CONFIG_X86_32
-# include "suspend_32.h"
+# include <asm/suspend_32.h>
 #else
-# include "suspend_64.h"
+# include <asm/suspend_64.h>
 #endif
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 99ddd14..f7d304d 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -567,9 +567,9 @@ extern struct movsl_mask {
 #define ARCH_HAS_NOCACHE_UACCESS 1
 
 #ifdef CONFIG_X86_32
-# include "uaccess_32.h"
+# include <asm/uaccess_32.h>
 #else
-# include "uaccess_64.h"
+# include <asm/uaccess_64.h>
 #endif
 
 #endif /* _ASM_X86_UACCESS_H */
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 2a58ed3..762be46 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -1,13 +1,13 @@
 #ifdef __KERNEL__
 # ifdef CONFIG_X86_32
-#  include "unistd_32.h"
+#  include <asm/unistd_32.h>
 # else
-#  include "unistd_64.h"
+#  include <asm/unistd_64.h>
 # endif
 #else
 # ifdef __i386__
-#  include "unistd_32.h"
+#  include <asm/unistd_32.h>
 # else
-#  include "unistd_64.h"
+#  include <asm/unistd_64.h>
 # endif
 #endif
diff --git a/arch/x86/include/asm/user.h b/arch/x86/include/asm/user.h
index 24532c7..ccab4af 100644
--- a/arch/x86/include/asm/user.h
+++ b/arch/x86/include/asm/user.h
@@ -2,9 +2,9 @@
 #define _ASM_X86_USER_H
 
 #ifdef CONFIG_X86_32
-# include "user_32.h"
+# include <asm/user_32.h>
 #else
-# include "user_64.h"
+# include <asm/user_64.h>
 #endif
 
 #include <asm/types.h>
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h
index 5d4922a..b85afb6 100644
--- a/arch/x86/include/asm/xen/interface.h
+++ b/arch/x86/include/asm/xen/interface.h
@@ -114,9 +114,9 @@ struct arch_shared_info {
 #endif	/* !__ASSEMBLY__ */
 
 #ifdef CONFIG_X86_32
-#include "interface_32.h"
+#include <asm/xen/interface_32.h>
 #else
-#include "interface_64.h"
+#include <asm/xen/interface_64.h>
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/arch/x86/include/asm/xor.h b/arch/x86/include/asm/xor.h
index 7fcf6f3..f8fde90 100644
--- a/arch/x86/include/asm/xor.h
+++ b/arch/x86/include/asm/xor.h
@@ -3,8 +3,8 @@
 # include <asm-generic/xor.h>
 #else
 #ifdef CONFIG_X86_32
-# include "xor_32.h"
+# include <asm/xor_32.h>
 #else
-# include "xor_64.h"
+# include <asm/xor_64.h>
 #endif
 #endif
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index de39915..b187b49 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -53,14 +53,14 @@
  *
  * Note: The order of these include files is important.
  */
-#include "platform/acenv.h"	/* Environment-specific items */
-#include "acnames.h"		/* Common ACPI names and strings */
-#include "actypes.h"		/* ACPICA data types and structures */
-#include "acexcep.h"		/* ACPICA exceptions */
-#include "actbl.h"		/* ACPI table definitions */
-#include "acoutput.h"		/* Error output and Debug macros */
-#include "acrestyp.h"		/* Resource Descriptor structs */
-#include "acpiosxf.h"		/* OSL interfaces (ACPICA-to-OS) */
-#include "acpixf.h"		/* ACPI core subsystem external interfaces */
+#include <acpi/platform/acenv.h>	/* Environment-specific items */
+#include <acpi/acnames.h>		/* Common ACPI names and strings */
+#include <acpi/actypes.h>		/* ACPICA data types and structures */
+#include <acpi/acexcep.h>		/* ACPICA exceptions */
+#include <acpi/actbl.h>		/* ACPI table definitions */
+#include <acpi/acoutput.h>		/* Error output and Debug macros */
+#include <acpi/acrestyp.h>		/* Resource Descriptor structs */
+#include <acpi/acpiosxf.h>		/* OSL interfaces (ACPICA-to-OS) */
+#include <acpi/acpixf.h>		/* ACPI core subsystem external interfaces */
 
 #endif				/* __ACPI_H__ */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index a756bc8..aa7c3d6 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -47,8 +47,8 @@
 #ifndef __ACPIOSXF_H__
 #define __ACPIOSXF_H__
 
-#include "platform/acenv.h"
-#include "actypes.h"
+#include <acpi/platform/acenv.h>
+#include <acpi/actypes.h>
 
 /* Types for acpi_os_execute */
 
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 2ed0a84..dae6451 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -49,8 +49,8 @@
 
 #define ACPI_CA_VERSION                 0x20110413
 
-#include "actypes.h"
-#include "actbl.h"
+#include <acpi/actypes.h>
+#include <acpi/actbl.h>
 
 extern u8 acpi_gbl_permanent_mmap;
 
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 5af3ed5..f6cb696 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -138,7 +138,7 @@
 /*! [Begin] no source code translation */
 
 #if defined(_LINUX) || defined(__linux__)
-#include "aclinux.h"
+#include <acpi/platform/aclinux.h>
 
 #elif defined(_AED_EFI)
 #include "acefi.h"
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5d2a5e9..ab69a6c 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -108,7 +108,7 @@
 
 /* Linux uses GCC */
 
-#include "acgcc.h"
+#include <acpi/platform/acgcc.h>
 
 
 #ifdef __KERNEL__
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4..cc23e0f 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -617,7 +617,7 @@ struct drm_get_cap {
 	__u64 value;
 };
 
-#include "drm_mode.h"
+#include <drm/drm_mode.h>
 
 #define DRM_IOCTL_BASE			'd'
 #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 738b3a5..00c02fc 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -73,7 +73,7 @@
 #include <linux/workqueue.h>
 #include <linux/poll.h>
 #include <asm/pgalloc.h>
-#include "drm.h"
+#include <drm/drm.h>
 
 #include <linux/idr.h>
 
@@ -83,9 +83,9 @@
 struct drm_file;
 struct drm_device;
 
-#include "drm_os_linux.h"
-#include "drm_hashtab.h"
-#include "drm_mm.h"
+#include <drm/drm_os_linux.h>
+#include <drm/drm_hashtab.h>
+#include <drm/drm_mm.h>
 
 #define DRM_UT_CORE 		0x01
 #define DRM_UT_DRIVER		0x02
@@ -653,7 +653,7 @@ struct drm_gem_object {
 	void *driver_private;
 };
 
-#include "drm_crtc.h"
+#include <drm/drm_crtc.h>
 
 /* per-master structure */
 struct drm_master {
@@ -1258,7 +1258,7 @@ extern void drm_vm_close_locked(struct vm_area_struct *vma);
 extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
 
 				/* Memory management support (drm_memory.h) */
-#include "drm_memory.h"
+#include <drm/drm_memory.h>
 extern void drm_mem_init(void);
 extern int drm_mem_info(char *buf, char **start, off_t offset,
 			int request, int *eof, void *data);
@@ -1544,7 +1544,7 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
 void drm_gem_vm_close(struct vm_area_struct *vma);
 int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
 
-#include "drm_global.h"
+#include <drm/drm_global.h>
 
 static inline void
 drm_gem_object_reference(struct drm_gem_object *obj)
@@ -1650,7 +1650,7 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
 {
 }
 
-#include "drm_mem_util.h"
+#include <drm/drm_mem_util.h>
 
 extern int drm_fill_in_dev(struct drm_device *dev,
 			   const struct pci_device_id *ent,
diff --git a/include/drm/drm_buffer.h b/include/drm/drm_buffer.h
index 322dbff..c80d3a3 100644
--- a/include/drm/drm_buffer.h
+++ b/include/drm/drm_buffer.h
@@ -35,7 +35,7 @@
 #ifndef _DRM_BUFFER_H_
 #define _DRM_BUFFER_H_
 
-#include "drmP.h"
+#include <drm/drmP.h>
 
 struct drm_buffer {
 	int iterator;
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
index 2f65633..a8d8053 100644
--- a/include/drm/drm_encoder_slave.h
+++ b/include/drm/drm_encoder_slave.h
@@ -27,8 +27,8 @@
 #ifndef __DRM_ENCODER_SLAVE_H__
 #define __DRM_ENCODER_SLAVE_H__
 
-#include "drmP.h"
-#include "drm_crtc.h"
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
 
 /**
  * struct drm_encoder_slave_funcs - Entry points exposed by a slave encoder driver
diff --git a/include/drm/drm_memory.h b/include/drm/drm_memory.h
index 15af9b3..4baf57a 100644
--- a/include/drm/drm_memory.h
+++ b/include/drm/drm_memory.h
@@ -35,7 +35,7 @@
 
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
-#include "drmP.h"
+#include <drm/drmP.h>
 
 /**
  * Cut down version of drm_memory_debug.h, which used to be called
diff --git a/include/drm/drm_sarea.h b/include/drm/drm_sarea.h
index ee5389d..d3aedc9 100644
--- a/include/drm/drm_sarea.h
+++ b/include/drm/drm_sarea.h
@@ -32,7 +32,7 @@
 #ifndef _DRM_SAREA_H_
 #define _DRM_SAREA_H_
 
-#include "drm.h"
+#include <drm/drm.h>
 
 /* SAREA area needs to be at least a page */
 #if defined(__alpha__)
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h
index 08ecf83..d333112 100644
--- a/include/drm/drm_sman.h
+++ b/include/drm/drm_sman.h
@@ -39,8 +39,8 @@
 #ifndef DRM_SMAN_H
 #define DRM_SMAN_H
 
-#include "drmP.h"
-#include "drm_hashtab.h"
+#include <drm/drmP.h>
+#include <drm/drm_hashtab.h>
 
 /*
  * A class that is an abstration of a simple memory allocator.
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index c4d6dbf..e458c1f 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -27,7 +27,7 @@
 #ifndef _I915_DRM_H_
 #define _I915_DRM_H_
 
-#include "drm.h"
+#include <drm/drm.h>
 
 /* Please note that modifications to all structs defined here are
  * subject to backwards-compatibility constraints.
diff --git a/include/drm/mga_drm.h b/include/drm/mga_drm.h
index fca8170..2375bfd 100644
--- a/include/drm/mga_drm.h
+++ b/include/drm/mga_drm.h
@@ -35,7 +35,7 @@
 #ifndef __MGA_DRM_H__
 #define __MGA_DRM_H__
 
-#include "drm.h"
+#include <drm/drm.h>
 
 /* WARNING: If you change any of these defines, make sure to change the
  * defines in the Xserver file (mga_sarea.h)
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 787f7b6..a86005a 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -33,7 +33,7 @@
 #ifndef __RADEON_DRM_H__
 #define __RADEON_DRM_H__
 
-#include "drm.h"
+#include <drm/drm.h>
 
 /* WARNING: If you change any of these defines, make sure to change the
  * defines in the X server file (radeon_sarea.h)
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 62a0e4c..40d3139 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -31,7 +31,7 @@
 #ifndef _TTM_BO_API_H_
 #define _TTM_BO_API_H_
 
-#include "drm_hashtab.h"
+#include <drm/drm_hashtab.h>
 #include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/wait.h>
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 09af2d7..859a1ef 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -30,14 +30,14 @@
 #ifndef _TTM_BO_DRIVER_H_
 #define _TTM_BO_DRIVER_H_
 
-#include "ttm/ttm_bo_api.h"
-#include "ttm/ttm_memory.h"
-#include "ttm/ttm_module.h"
-#include "drm_mm.h"
-#include "drm_global.h"
-#include "linux/workqueue.h"
-#include "linux/fs.h"
-#include "linux/spinlock.h"
+#include <ttm/ttm_bo_api.h>
+#include <ttm/ttm_memory.h>
+#include <ttm/ttm_module.h>
+#include <drm/drm_mm.h>
+#include <drm/drm_global.h>
+#include <linux/workqueue.h>
+#include <linux/fs.h>
+#include <linux/spinlock.h>
 
 struct ttm_backend;
 
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 26cc7f9..1926cae 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -31,7 +31,7 @@
 #ifndef _TTM_EXECBUF_UTIL_H_
 #define _TTM_EXECBUF_UTIL_H_
 
-#include "ttm/ttm_bo_api.h"
+#include <ttm/ttm_bo_api.h>
 #include <linux/list.h>
 
 /**
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h
index 81ba0b0..9866968 100644
--- a/include/drm/ttm/ttm_lock.h
+++ b/include/drm/ttm/ttm_lock.h
@@ -49,7 +49,7 @@
 #ifndef _TTM_LOCK_H_
 #define _TTM_LOCK_H_
 
-#include "ttm/ttm_object.h"
+#include <ttm/ttm_object.h>
 #include <linux/wait.h>
 #include <asm/atomic.h>
 
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index 0d9db09..0d82477 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -38,7 +38,7 @@
 #define _TTM_OBJECT_H_
 
 #include <linux/list.h>
-#include "drm_hashtab.h"
+#include <drm/drm_hashtab.h>
 #include <linux/kref.h>
 #include <ttm/ttm_memory.h>
 
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 8062890..7879722 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -26,8 +26,8 @@
 #ifndef TTM_PAGE_ALLOC
 #define TTM_PAGE_ALLOC
 
-#include "ttm_bo_driver.h"
-#include "ttm_memory.h"
+#include <drm/ttm/ttm_bo_driver.h>
+#include <drm/ttm/ttm_memory.h>
 
 /**
  * Get count number of pages from pool to pages list.
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index fd11a5b..45bc80c 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -24,7 +24,7 @@
 #ifndef _VIA_DRM_H_
 #define _VIA_DRM_H_
 
-#include "drm.h"
+#include <drm/drm.h>
 
 /* WARNING: These defines must be the same as what the Xserver uses.
  * if you change them, you must change the defines in the Xserver.
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index b8c6069..b8d618a 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -12,8 +12,8 @@
 #ifndef CEPH_FS_H
 #define CEPH_FS_H
 
-#include "msgr.h"
-#include "rados.h"
+#include <linux/ceph/msgr.h>
+#include <linux/ceph/rados.h>
 
 /*
  * subprotocol versions.  when specific messages types or high-level
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index 2a79702..1df086d 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -1,8 +1,8 @@
 #ifndef _FS_CEPH_DEBUGFS_H
 #define _FS_CEPH_DEBUGFS_H
 
-#include "ceph_debug.h"
-#include "types.h"
+#include <linux/ceph/ceph_debug.h>
+#include <linux/ceph/types.h>
 
 #define CEPH_DEFINE_SHOW_FUNC(name)					\
 static int name##_open(struct inode *inode, struct file *file)		\
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index c5b6939..930441d 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -4,7 +4,7 @@
 #include <asm/unaligned.h>
 #include <linux/time.h>
 
-#include "types.h"
+#include <linux/ceph/types.h>
 
 /*
  * in all cases,
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 6365f04..54e054c 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -1,7 +1,7 @@
 #ifndef _FS_CEPH_LIBCEPH_H
 #define _FS_CEPH_LIBCEPH_H
 
-#include "ceph_debug.h"
+#include <linux/ceph/ceph_debug.h>
 
 #include <asm/unaligned.h>
 #include <linux/backing-dev.h>
@@ -14,12 +14,12 @@
 #include <linux/writeback.h>
 #include <linux/slab.h>
 
-#include "types.h"
-#include "messenger.h"
-#include "msgpool.h"
-#include "mon_client.h"
-#include "osd_client.h"
-#include "ceph_fs.h"
+#include <linux/ceph/types.h>
+#include <linux/ceph/messenger.h>
+#include <linux/ceph/msgpool.h>
+#include <linux/ceph/mon_client.h>
+#include <linux/ceph/osd_client.h>
+#include <linux/ceph/ceph_fs.h>
 
 /*
  * Supported features
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index 4c5cb08..3abff9e 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -1,7 +1,7 @@
 #ifndef _FS_CEPH_MDSMAP_H
 #define _FS_CEPH_MDSMAP_H
 
-#include "types.h"
+#include <linux/ceph/types.h>
 
 /*
  * mds map - describe servers in the mds cluster.
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 31d91a6..50a785c 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -9,8 +9,8 @@
 #include <linux/version.h>
 #include <linux/workqueue.h>
 
-#include "types.h"
-#include "buffer.h"
+#include <linux/ceph/types.h>
+#include <linux/ceph/buffer.h>
 
 struct ceph_msg;
 struct ceph_connection;
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 545f859..6b80e63 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -5,7 +5,7 @@
 #include <linux/kref.h>
 #include <linux/rbtree.h>
 
-#include "messenger.h"
+#include <linux/ceph/messenger.h>
 
 struct ceph_client;
 struct ceph_mount_args;
diff --git a/include/linux/ceph/msgpool.h b/include/linux/ceph/msgpool.h
index a362605..0d92733 100644
--- a/include/linux/ceph/msgpool.h
+++ b/include/linux/ceph/msgpool.h
@@ -2,7 +2,7 @@
 #define _FS_CEPH_MSGPOOL
 
 #include <linux/mempool.h>
-#include "messenger.h"
+#include <linux/ceph/messenger.h>
 
 /*
  * we use memory pools for preallocating messages we may receive, to
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index f88eacb..caaf03a 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -6,9 +6,9 @@
 #include <linux/mempool.h>
 #include <linux/rbtree.h>
 
-#include "types.h"
-#include "osdmap.h"
-#include "messenger.h"
+#include <linux/ceph/types.h>
+#include <linux/ceph/osdmap.h>
+#include <linux/ceph/messenger.h>
 
 struct ceph_msg;
 struct ceph_snap_context;
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index ba4c205..4ae6e27 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -2,8 +2,8 @@
 #define _FS_CEPH_OSDMAP_H
 
 #include <linux/rbtree.h>
-#include "types.h"
-#include "ceph_fs.h"
+#include <linux/ceph/types.h>
+#include <linux/ceph/ceph_fs.h>
 #include <linux/crush/crush.h>
 
 /*
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 0a99099..de91fbd 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -6,7 +6,7 @@
  * (Reliable Autonomic Distributed Object Store).
  */
 
-#include "msgr.h"
+#include <linux/ceph/msgr.h>
 
 /*
  * osdmap encoding versions
diff --git a/include/linux/ceph/types.h b/include/linux/ceph/types.h
index 28b35a0..d3ff1cf 100644
--- a/include/linux/ceph/types.h
+++ b/include/linux/ceph/types.h
@@ -7,9 +7,9 @@
 #include <linux/fcntl.h>
 #include <linux/string.h>
 
-#include "ceph_fs.h"
-#include "ceph_frag.h"
-#include "ceph_hash.h"
+#include <linux/ceph/ceph_fs.h>
+#include <linux/ceph/ceph_frag.h>
+#include <linux/ceph/ceph_hash.h>
 
 /*
  * Identify inodes by both their ino AND snapshot id (a u64).
diff --git a/include/linux/crush/mapper.h b/include/linux/crush/mapper.h
index c46b99c..bfe81a5 100644
--- a/include/linux/crush/mapper.h
+++ b/include/linux/crush/mapper.h
@@ -8,7 +8,7 @@
  * LGPL2
  */
 
-#include "crush.h"
+#include <linux/crush/crush.h>
 
 extern int crush_find_rule(struct crush_map *map, int pool, int type, int size);
 extern int crush_do_rule(struct crush_map *map,
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
index 0695431..82de1f9 100644
--- a/include/linux/drbd_tag_magic.h
+++ b/include/linux/drbd_tag_magic.h
@@ -12,7 +12,7 @@ enum packet_types {
 #define NL_INT64(pn, pr, member)
 #define NL_BIT(pn, pr, member)
 #define NL_STRING(pn, pr, member, len)
-#include "drbd_nl.h"
+#include <linux/drbd_nl.h>
 	P_nl_after_last_packet,
 };
 
@@ -28,7 +28,7 @@ enum packet_types {
 #define NL_STRING(pn, pr, member, len)	\
 	unsigned char member[len]; int member ## _len; \
 	int tag_and_len ## member;
-#include "linux/drbd_nl.h"
+#include <linux/drbd_nl.h>
 
 /* declare tag-list-sizes */
 static const int tag_list_sizes[] = {
@@ -37,7 +37,7 @@ static const int tag_list_sizes[] = {
 #define NL_INT64(pn, pr, member)        + 4 + 8
 #define NL_BIT(pn, pr, member)          + 4 + 1
 #define NL_STRING(pn, pr, member, len)  + 4 + (len)
-#include "drbd_nl.h"
+#include <linux/drbd_nl.h>
 };
 
 /* The two highest bits are used for the tag type */
@@ -62,7 +62,7 @@ enum drbd_tags {
 #define NL_INT64(pn, pr, member)       T_ ## member = pn | TT_INT64   | pr ,
 #define NL_BIT(pn, pr, member)         T_ ## member = pn | TT_BIT     | pr ,
 #define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING  | pr ,
-#include "drbd_nl.h"
+#include <linux/drbd_nl.h>
 };
 
 struct tag {
@@ -78,7 +78,7 @@ static const struct tag tag_descriptions[] = {
 #define NL_INT64(pn, pr, member)       [ pn ] = { #member, TT_INT64   | pr, sizeof(__u64) },
 #define NL_BIT(pn, pr, member)         [ pn ] = { #member, TT_BIT     | pr, sizeof(int)   },
 #define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING  | pr, (len)         },
-#include "drbd_nl.h"
+#include <linux/drbd_nl.h>
 };
 
 #endif
diff --git a/include/linux/netfilter/nf_conntrack_h323_asn1.h b/include/linux/netfilter/nf_conntrack_h323_asn1.h
index 8dab596..3176a27 100644
--- a/include/linux/netfilter/nf_conntrack_h323_asn1.h
+++ b/include/linux/netfilter/nf_conntrack_h323_asn1.h
@@ -40,7 +40,7 @@
 /*****************************************************************************
  * H.323 Types
  ****************************************************************************/
-#include "nf_conntrack_h323_types.h"
+#include <linux/netfilter/nf_conntrack_h323_types.h>
 
 typedef struct {
 	enum {
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
index 56e920a..303ba11 100644
--- a/include/scsi/osd_attributes.h
+++ b/include/scsi/osd_attributes.h
@@ -1,7 +1,7 @@
 #ifndef __OSD_ATTRIBUTES_H__
 #define __OSD_ATTRIBUTES_H__
 
-#include "osd_protocol.h"
+#include <scsi/osd_protocol.h>
 
 /*
  * Contains types and constants that define attribute pages and attribute
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index 0a50799..8463233 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -14,8 +14,8 @@
 #ifndef __OSD_INITIATOR_H__
 #define __OSD_INITIATOR_H__
 
-#include "osd_protocol.h"
-#include "osd_types.h"
+#include <scsi/osd_protocol.h>
+#include <scsi/osd_types.h>
 
 #include <linux/blkdev.h>
 #include <scsi/scsi_device.h>
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
index 4c09fee..f96151c 100644
--- a/include/scsi/osd_sec.h
+++ b/include/scsi/osd_sec.h
@@ -14,8 +14,8 @@
 #ifndef __OSD_SEC_H__
 #define __OSD_SEC_H__
 
-#include "osd_protocol.h"
-#include "osd_types.h"
+#include <scsi/osd_protocol.h>
+#include <scsi/osd_types.h>
 
 /*
  * Contains types and constants of osd capabilities and security
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 02cbb50..fdeb8dc 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -28,9 +28,9 @@
 #include <linux/bitops.h>
 #include <linux/device.h>
 #include <linux/workqueue.h>
-#include "pcm.h"
-#include "control.h"
-#include "info.h"
+#include <sound/pcm.h>
+#include <sound/control.h>
+#include <sound/info.h>
 
 /* maximum number of devices on the AC97 bus */
 #define	AC97_BUS_MAX_DEVICES	4
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index d010858..a7d8dc7 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -20,9 +20,9 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 */
 
-#include "control.h"
-#include "pcm.h"
-#include "timer.h"
+#include <sound/control.h>
+#include <sound/pcm.h>
+#include <sound/timer.h>
 
 #define AD1816A_REG(r)			(chip->port + r)
 
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 575296c..85ea86e 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -25,8 +25,8 @@
  *
  */
 
-#include "info.h"
-#include "control.h"
+#include <sound/info.h>
+#include <sound/control.h>
 
 /*
  *  ASAHI KASEI - AK4531 codec
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index e3005a6..bc246a1 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -23,11 +23,11 @@
  *
  */
 
-#include "pcm.h"
-#include "pcm-indirect.h"
-#include "rawmidi.h"
-#include "ac97_codec.h"
-#include "cs46xx_dsp_spos.h"
+#include <sound/pcm.h>
+#include <sound/pcm-indirect.h>
+#include <sound/rawmidi.h>
+#include <sound/ac97_codec.h>
+#include <sound/cs46xx_dsp_spos.h>
 
 /*
  *  Direct registers
diff --git a/include/sound/cs46xx_dsp_spos.h b/include/sound/cs46xx_dsp_spos.h
index 8008c59..b4ed2b4 100644
--- a/include/sound/cs46xx_dsp_spos.h
+++ b/include/sound/cs46xx_dsp_spos.h
@@ -22,8 +22,8 @@
 #ifndef __CS46XX_DSP_SPOS_H__
 #define __CS46XX_DSP_SPOS_H__
 
-#include "cs46xx_dsp_scb_types.h"
-#include "cs46xx_dsp_task_types.h"
+#include <sound/cs46xx_dsp_scb_types.h>
+#include <sound/cs46xx_dsp_task_types.h>
 
 #define SYMBOL_CONSTANT  0x0
 #define SYMBOL_SAMPLE    0x1
diff --git a/include/sound/cs46xx_dsp_task_types.h b/include/sound/cs46xx_dsp_task_types.h
index 5cf920b..27df60e 100644
--- a/include/sound/cs46xx_dsp_task_types.h
+++ b/include/sound/cs46xx_dsp_task_types.h
@@ -27,7 +27,7 @@
 #ifndef __CS46XX_DSP_TASK_TYPES_H__
 #define __CS46XX_DSP_TASK_TYPES_H__
 
-#include "cs46xx_dsp_scb_types.h"
+#include <sound/cs46xx_dsp_scb_types.h>
 
 /*********************************************************************************************
 Example hierarchy of stream control blocks in the SP
diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h
index 6ef61c4..9f211e9 100644
--- a/include/sound/emu10k1_synth.h
+++ b/include/sound/emu10k1_synth.h
@@ -20,8 +20,8 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "emu10k1.h"
-#include "emux_synth.h"
+#include <sound/emu10k1.h>
+#include <sound/emux_synth.h>
 
 /* sequencer device id */
 #define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH	"emu10k1-synth"
diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h
index c8f66bd..c321302 100644
--- a/include/sound/emu8000.h
+++ b/include/sound/emu8000.h
@@ -21,8 +21,8 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "emux_synth.h"
-#include "seq_kernel.h"
+#include <sound/emux_synth.h>
+#include <sound/seq_kernel.h>
 
 /*
  * Hardware parameters.
diff --git a/include/sound/emux_legacy.h b/include/sound/emux_legacy.h
index 6fe3da2..baf43fc 100644
--- a/include/sound/emux_legacy.h
+++ b/include/sound/emux_legacy.h
@@ -22,7 +22,7 @@
  *
  */
 
-#include "seq_oss_legacy.h"
+#include <sound/seq_oss_legacy.h>
 
 /*
  * awe hardware controls
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index d8cb51b..fb81f37 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -21,15 +21,15 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "seq_kernel.h"
-#include "seq_device.h"
-#include "soundfont.h"
-#include "seq_midi_emul.h"
+#include <sound/seq_kernel.h>
+#include <sound/seq_device.h>
+#include <sound/soundfont.h>
+#include <sound/seq_midi_emul.h>
 #ifdef CONFIG_SND_SEQUENCER_OSS
-#include "seq_oss.h"
+#include <sound/seq_oss.h>
 #endif
-#include "emux_legacy.h"
-#include "seq_virmidi.h"
+#include <sound/emux_legacy.h>
+#include <sound/seq_virmidi.h>
 
 /*
  * compile flags
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index 3ec7ecb..7bd4243 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -22,8 +22,8 @@
  *
  */
 
-#include "control.h"
-#include "pcm.h"
+#include <sound/control.h>
+#include <sound/pcm.h>
 #include <linux/interrupt.h>
 
 #define ES1688_HW_AUTO		0x0000
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 841bb8d..42905d8 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -22,11 +22,11 @@
  *
  */
 
-#include "pcm.h"
-#include "rawmidi.h"
-#include "timer.h"
-#include "seq_midi_emul.h"
-#include "seq_device.h"
+#include <sound/pcm.h>
+#include <sound/rawmidi.h>
+#include <sound/timer.h>
+#include <sound/seq_midi_emul.h>
+#include <sound/seq_device.h>
 #include <asm/io.h>
 
 /* IO ports */
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index 1f1d53f..a85ce16 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -22,7 +22,7 @@
  *
  */
 
-#include "rawmidi.h"
+#include <sound/rawmidi.h>
 #include <linux/interrupt.h>
 
 #define MPU401_HW_MPU401		1	/* native MPU401 */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index e1bad11..720402c 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -35,7 +35,7 @@
 #define snd_pcm_chip(pcm) ((pcm)->private_data)
 
 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
-#include "pcm_oss.h"
+#include <sound/pcm_oss.h>
 #endif
 
 /*
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 2480e7d..956fa35 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -29,7 +29,7 @@
 #include <linux/mutex.h>
 
 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
-#include "seq_device.h"
+#include <sound/seq_device.h>
 #endif
 
 /*
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 9535354..ba39603 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -22,8 +22,8 @@
  *
  */
 
-#include "pcm.h"
-#include "rawmidi.h"
+#include <sound/pcm.h>
+#include <sound/rawmidi.h>
 #include <linux/interrupt.h>
 #include <asm/io.h>
 
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index 736eac7..66bdfe6 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -112,8 +112,8 @@ struct snd_sb_csp_info {
 #define SNDRV_SB_CSP_IOCTL_RESTART	_IO('H', 0x16)
 
 #ifdef __KERNEL__
-#include "sb.h"
-#include "hwdep.h"
+#include <sound/sb.h>
+#include <sound/hwdep.h>
 #include <linux/firmware.h>
 
 struct snd_sb_csp;
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index 3d9afb6..34fb34c 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -22,7 +22,7 @@
  *
  */
 #include <linux/time.h>
-#include "asequencer.h"
+#include <sound/asequencer.h>
 
 typedef struct snd_seq_real_time snd_seq_real_time_t;
 typedef union snd_seq_timestamp snd_seq_timestamp_t;
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index d6c4615..8139d8c 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -22,7 +22,7 @@
  *
  */
 
-#include "seq_kernel.h"
+#include <sound/seq_kernel.h>
 
 /*
  * This structure is used to keep track of the current state on each
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 5efab8b..e40f43e 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -22,7 +22,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "asequencer.h"
+#include <sound/asequencer.h>
 
 #define MAX_MIDI_EVENT_BUF	256
 
diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h
index 9b060bb..d0b27ec 100644
--- a/include/sound/seq_oss.h
+++ b/include/sound/seq_oss.h
@@ -21,8 +21,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "asequencer.h"
-#include "seq_kernel.h"
+#include <sound/asequencer.h>
+#include <sound/seq_kernel.h>
 
 /*
  * argument structure for synthesizer operations
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index d888433..a03acd0 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -22,8 +22,8 @@
  *
  */
 
-#include "rawmidi.h"
-#include "seq_midi_event.h"
+#include <sound/rawmidi.h>
+#include <sound/seq_midi_event.h>
 
 /*
  * device file instance:
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index fa149ca..35e94b3 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -1,10 +1,10 @@
 #ifndef __SOUND_SND_WAVEFRONT_H__
 #define __SOUND_SND_WAVEFRONT_H__
 
-#include "mpu401.h"
-#include "hwdep.h"
-#include "rawmidi.h"
-#include "wavefront.h"  /* generic OSS/ALSA/user-level wavefront header */
+#include <sound/mpu401.h>
+#include <sound/hwdep.h>
+#include <sound/rawmidi.h>
+#include <sound/wavefront.h>  /* generic OSS/ALSA/user-level wavefront header */
 
 /* MIDI interface */
 
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index f95d99b..337ff47 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -22,8 +22,8 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include "sfnt_info.h"
-#include "util_mem.h"
+#include <sound/sfnt_info.h>
+#include <sound/util_mem.h>
 
 #define SF_MAX_INSTRUMENTS	128	/* maximum instrument number */
 #define SF_MAX_PRESETS  256	/* drums are mapped from 128 to 256 */
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 51b282b..e6beec2 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -22,7 +22,7 @@
  *
  */
 
-#include "i2c.h"		/* generic i2c support */
+#include <sound/i2c.h>		/* generic i2c support */
 
 int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
 int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
diff --git a/include/sound/trident.h b/include/sound/trident.h
index 9f191a0..9b3b03e 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -23,10 +23,10 @@
  *
  */
 
-#include "pcm.h"
-#include "mpu401.h"
-#include "ac97_codec.h"
-#include "util_mem.h"
+#include <sound/pcm.h>
+#include <sound/mpu401.h>
+#include <sound/ac97_codec.h>
+#include <sound/util_mem.h>
 
 #define TRIDENT_DEVICE_ID_DX		((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX)
 #define TRIDENT_DEVICE_ID_NX		((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
diff --git a/include/sound/wss.h b/include/sound/wss.h
index fd01f22..0c7f034 100644
--- a/include/sound/wss.h
+++ b/include/sound/wss.h
@@ -22,11 +22,11 @@
  *
  */
 
-#include "control.h"
-#include "pcm.h"
-#include "timer.h"
+#include <sound/control.h>
+#include <sound/pcm.h>
+#include <sound/timer.h>
 
-#include "cs4231-regs.h"
+#include <sound/cs4231-regs.h>
 
 /* defines for codec.mode */
 
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 444cd6b..5db53b6 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -22,10 +22,10 @@
  *
  */
 
-#include "pcm.h"
-#include "rawmidi.h"
-#include "ac97_codec.h"
-#include "timer.h"
+#include <sound/pcm.h>
+#include <sound/rawmidi.h>
+#include <sound/ac97_codec.h>
+#include <sound/timer.h>
 #include <linux/gameport.h>
 
 /*
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 388bcdd..fde1b3e 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -6,7 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/tracepoint.h>
-#include "gfpflags.h"
+#include <trace/events/gfpflags.h>
 
 DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
 
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index a9c87ad..f0e1523 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -6,7 +6,7 @@
 
 #include <linux/types.h>
 #include <linux/tracepoint.h>
-#include "gfpflags.h"
+#include <trace/events/gfpflags.h>
 
 DECLARE_EVENT_CLASS(kmem_alloc,
 
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index b2c33bd..4d50427 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -8,7 +8,7 @@
 #include <linux/tracepoint.h>
 #include <linux/mm.h>
 #include <linux/memcontrol.h>
-#include "gfpflags.h"
+#include <trace/events/gfpflags.h>
 
 #define RECLAIM_WB_ANON		0x0001u
 #define RECLAIM_WB_FILE		0x0002u
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h
index 2ae3cd2..8c5fa0e 100644
--- a/include/xen/interface/callback.h
+++ b/include/xen/interface/callback.h
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_CALLBACK_H__
 #define __XEN_PUBLIC_CALLBACK_H__
 
-#include "xen.h"
+#include <xen/interface/xen.h>
 
 /*
  * Prototype for this hypercall is:
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
index 1888d8c..f5bc22b 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -21,7 +21,7 @@
 #ifndef __XEN_PUBLIC_HVM_PARAMS_H__
 #define __XEN_PUBLIC_HVM_PARAMS_H__
 
-#include "hvm_op.h"
+#include <xen/interface/hvm/hvm_op.h>
 
 /*
  * Parameter space for HVMOP_{set,get}_param.
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index 3d5d6db..2165651 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -9,8 +9,8 @@
 #ifndef __XEN_PUBLIC_IO_BLKIF_H__
 #define __XEN_PUBLIC_IO_BLKIF_H__
 
-#include "ring.h"
-#include "../grant_table.h"
+#include <xen/interface/io/ring.h>
+#include <xen/interface/grant_table.h>
 
 /*
  * Front->back notifications: When enqueuing a new request, sending a
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index cb94668..9dfc120 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -9,8 +9,8 @@
 #ifndef __XEN_PUBLIC_IO_NETIF_H__
 #define __XEN_PUBLIC_IO_NETIF_H__
 
-#include "ring.h"
-#include "../grant_table.h"
+#include <xen/interface/io/ring.h>
+#include <xen/interface/grant_table.h>
 
 /*
  * Notifications after enqueuing any type of message should be conditional on
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index dd55dac..9ce0839 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -9,7 +9,7 @@
 #ifndef __XEN_PUBLIC_SCHED_H__
 #define __XEN_PUBLIC_SCHED_H__
 
-#include "event_channel.h"
+#include <xen/interface/event_channel.h>
 
 /*
  * The prototype for this hypercall is:
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index e8b6519..ff372a5 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -55,7 +55,7 @@ struct xen_feature_info {
 };
 
 /* Declares the features reported by XENVER_get_features. */
-#include "features.h"
+#include <xen/interface/features.h>
 
 /* arg == NULL; returns host memory page size. */
 #define XENVER_pagesize 7

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 03/35] UAPI: Add uapi/ include directory to build
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
  2011-07-02 11:07 ` [PATCH 01/35] UAPI: Convert #include "..." to #include <path/...> in kernel system headers David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 04/35] UAPI: Differentiate userspace build and kernelspace build include path sets David Howells
                   ` (33 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Add uapi/ include directory to build after the ordinary include directories so
that #include_next will work correctly.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index dc67046..f7e6a60 100644
--- a/Makefile
+++ b/Makefile
@@ -357,8 +357,12 @@ 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 \
-                   -Iarch/$(hdr-arch)/include/generated -Iinclude \
+LINUXINCLUDE    := \
+		-I$(srctree)/arch/$(hdr-arch)/include \
+		-Iarch/$(hdr-arch)/include/generated \
+		-I$(srctree)/arch/$(hdr-arch)/uapi \
+		-Iinclude \
+		-Iuapi \
                    $(if $(KBUILD_SRC), -I$(srctree)/include) \
                    -include include/generated/autoconf.h
 

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 04/35] UAPI: Differentiate userspace build and kernelspace build include path sets
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
  2011-07-02 11:07 ` [PATCH 01/35] UAPI: Convert #include "..." to #include <path/...> in kernel system headers David Howells
  2011-07-02 11:08 ` [PATCH 03/35] UAPI: Add uapi/ include directory to build David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 05/35] UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed David Howells
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Differentiate userspace build and kernelspace build (LINUXINCLUDE) include path
sets by adding a new make variable (USERINCLUDE) that has everything barring
the kernel-specific include paths, and then make LINUXINCLUDE simply preface
that with the kernel-specific include paths.

Then use USERINCLUDE in building the x86 boot code.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile                          |   13 +++++++++----
 arch/x86/boot/Makefile            |    4 ++--
 arch/x86/boot/mkcpustr.c          |    2 ++
 arch/x86/include/asm/cpufeature.h |    2 ++
 arch/x86/kernel/cpu/mkcapflags.pl |    5 ++++-
 5 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index f7e6a60..5d8d91e 100644
--- a/Makefile
+++ b/Makefile
@@ -355,16 +355,21 @@ AFLAGS_KERNEL	=
 CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage
 
 
+# Use USERINCLUDE when you must reference the uapi/ directories only.
+USERINCLUDE    := \
+		-I$(srctree)/arch/$(hdr-arch)/uapi \
+		-Iuapi \
+                   $(if $(KBUILD_SRC), -I$(srctree)/include) \
+                   -include include/generated/autoconf.h
+
 # Use LINUXINCLUDE when you must reference the include/ directory.
 # Needed to be compatible with the O= option
 LINUXINCLUDE    := \
 		-I$(srctree)/arch/$(hdr-arch)/include \
 		-Iarch/$(hdr-arch)/include/generated \
-		-I$(srctree)/arch/$(hdr-arch)/uapi \
 		-Iinclude \
-		-Iuapi \
-                   $(if $(KBUILD_SRC), -I$(srctree)/include) \
-                   -include include/generated/autoconf.h
+		$(USERINCLUDE)
+
 
 KBUILD_CPPFLAGS := -D__KERNEL__
 
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index f7cb086..84592cf 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -43,7 +43,7 @@ setup-y		+= video-bios.o
 targets		+= $(setup-y)
 hostprogs-y	:= mkcpustr tools/build
 
-HOST_EXTRACFLAGS += $(LINUXINCLUDE)
+HOST_EXTRACFLAGS += $(USERINCLUDE)
 
 $(obj)/cpu.o: $(obj)/cpustr.h
 
@@ -57,7 +57,7 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE
 
 # How to compile the 16-bit code.  Note we always compile for -march=i386,
 # that way we can complain to the user if the CPU is insufficient.
-KBUILD_CFLAGS	:= $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
+KBUILD_CFLAGS	:= $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
 		   -DDISABLE_BRANCH_PROFILING \
 		   -Wall -Wstrict-prototypes \
 		   -march=i386 -mregparm=3 \
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c
index 919257f..4579eff 100644
--- a/arch/x86/boot/mkcpustr.c
+++ b/arch/x86/boot/mkcpustr.c
@@ -15,6 +15,8 @@
 
 #include <stdio.h>
 
+#include "../include/asm/required-features.h"
+#include "../include/asm/cpufeature.h"
 #include "../kernel/cpu/capflags.c"
 
 int main(void)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 71cc380..eba9354 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -4,7 +4,9 @@
 #ifndef _ASM_X86_CPUFEATURE_H
 #define _ASM_X86_CPUFEATURE_H
 
+#ifndef _ASM_X86_REQUIRED_FEATURES_H
 #include <asm/required-features.h>
+#endif
 
 #define NCAPINTS	10	/* N 32-bit words worth of info */
 
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
index dfea390..6c3c4f1 100644
--- a/arch/x86/kernel/cpu/mkcapflags.pl
+++ b/arch/x86/kernel/cpu/mkcapflags.pl
@@ -8,7 +8,10 @@
 open(IN, "< $in\0")   or die "$0: cannot open: $in: $!\n";
 open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
 
-print OUT "#include <asm/cpufeature.h>\n\n";
+print OUT "#ifndef _ASM_X86_CPUFEATURE_H\n";
+print OUT "#include <asm/cpufeature.h>\n";
+print OUT "#endif\n";
+print OUT "\n";
 print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
 
 while (defined($line = <IN>)) {

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 05/35] UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (2 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 04/35] UAPI: Differentiate userspace build and kernelspace build include path sets David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 06/35] UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards David Howells
                   ` (31 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/acct.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3e4737f..d537aa0 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -146,6 +146,9 @@ extern void acct_exit_ns(struct pid_namespace *);
  *
  */
 
+#undef ACCT_VERSION
+#undef AHZ
+
 #ifdef CONFIG_BSD_PROCESS_ACCT_V3
 #define ACCT_VERSION	3
 #define AHZ		100

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 06/35] UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (3 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 05/35] UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 07/35] UAPI: Make linux/patchkey.h easier to parse David Howells
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

ac_etime in linux/acct.h must keep its __KERNEL__ guards.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/acct.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/acct.h b/include/linux/acct.h
index d537aa0..55e88b5 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -81,7 +81,7 @@ struct acct_v3
 	__u32		ac_pid;			/* Process ID */
 	__u32		ac_ppid;		/* Parent Process ID */
 	__u32		ac_btime;		/* Process Creation Time */
-#ifdef __KERNEL__
+#ifdef __KERNEL__ // DISINTEGRATE: RETAIN
 	__u32		ac_etime;		/* Elapsed Time */
 #else
 	float		ac_etime;		/* Elapsed Time */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 07/35] UAPI: Make linux/patchkey.h easier to parse
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (4 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 06/35] UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 08/35] UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h David Howells
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Make linux/patchkey.h easier to parse by:

 (1) Switching the reinclusion guard and the indirect-inclusion checks in
     linux/patchkey.h to put the guard around the outside.

 (2) Making the #elif case associated with the __KERNEL__ guard a nested #if
     in a #else of the __KERNEL__ guard.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/patchkey.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/linux/patchkey.h b/include/linux/patchkey.h
index d974a6e..aefda0e 100644
--- a/include/linux/patchkey.h
+++ b/include/linux/patchkey.h
@@ -32,7 +32,8 @@
 #  else
 #    error "could not determine byte order"
 #  endif
-#elif defined(__BYTE_ORDER)
+#else
+#if defined(__BYTE_ORDER)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define _PATCHKEY(id) (0xfd00|id)
 #  elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -41,5 +42,6 @@
 #    error "could not determine byte order"
 #  endif
 #endif
+#endif
 
 #endif /* _LINUX_PATCHKEY_H */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 08/35] UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (5 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 07/35] UAPI: Make linux/patchkey.h easier to parse David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:08 ` [PATCH 09/35] UAPI: Fix nested __KERNEL__ guards in video/edid.h David Howells
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h to make
parsing easier.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/soundcard.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index fe204fe..dfcf86f 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -198,7 +198,8 @@ typedef struct seq_event_rec {
 #  else
 #    error "could not determine byte order"
 #  endif
-#elif defined(__BYTE_ORDER)
+#else
+# if defined(__BYTE_ORDER)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define AFMT_S16_NE AFMT_S16_BE
 #  elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -206,6 +207,7 @@ typedef struct seq_event_rec {
 #  else
 #    error "could not determine byte order"
 #  endif
+# endif
 #endif
 
 /*

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 09/35] UAPI: Fix nested __KERNEL__ guards in video/edid.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (6 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 08/35] UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h David Howells
@ 2011-07-02 11:08 ` David Howells
  2011-07-02 11:09 ` [PATCH 10/35] UAPI: Split trivial #if defined(__KERNEL__) && X conditionals David Howells
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:08 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix nested __KERNEL__ guards in video/edid.h to make parsing easier.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/video/edid.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/video/edid.h b/include/video/edid.h
index 928c342..c5f1987 100644
--- a/include/video/edid.h
+++ b/include/video/edid.h
@@ -1,16 +1,14 @@
 #ifndef __linux_video_edid_h__
 #define __linux_video_edid_h__
 
-#if !defined(__KERNEL__) || defined(CONFIG_X86)
-
 struct edid_info {
 	unsigned char dummy[128];
 };
 
 #ifdef __KERNEL__
+#ifdef CONFIG_X86
 extern struct edid_info edid_info;
-#endif /* __KERNEL__ */
-
+#endif
 #endif
 
 #endif /* __linux_video_edid_h__ */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 10/35] UAPI: Split trivial #if defined(__KERNEL__) && X conditionals
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (7 preceding siblings ...)
  2011-07-02 11:08 ` [PATCH 09/35] UAPI: Fix nested __KERNEL__ guards in video/edid.h David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 11/35] UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h David Howells
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Split trivial #if defined(__KERNEL__) && X conditionals to make automated
disintegration easier.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/arm/include/asm/hwcap.h       |    4 +++-
 arch/arm/include/asm/swab.h        |    7 +++++--
 arch/arm/include/asm/unistd.h      |    4 +++-
 arch/ia64/include/asm/intrinsics.h |   21 +++++++++++++--------
 arch/mips/include/asm/types.h      |   10 +++++++---
 arch/s390/include/asm/mman.h       |    4 +++-
 arch/tile/include/asm/signal.h     |    4 +++-
 include/linux/mroute6.h            |    4 +++-
 8 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/arch/arm/include/asm/hwcap.h b/arch/arm/include/asm/hwcap.h
index c1062c3..aedc859 100644
--- a/arch/arm/include/asm/hwcap.h
+++ b/arch/arm/include/asm/hwcap.h
@@ -21,7 +21,8 @@
 #define HWCAP_VFPv3D16	16384
 #define HWCAP_TLS	32768
 
-#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+#if defined(__KERNEL__)
+#if !defined(__ASSEMBLY__)
 /*
  * This yields a mask that user programs can use to figure out what
  * instruction set this cpu supports.
@@ -29,5 +30,6 @@
 #define ELF_HWCAP	(elf_hwcap)
 extern unsigned int elf_hwcap;
 #endif
+#endif
 
 #endif
diff --git a/arch/arm/include/asm/swab.h b/arch/arm/include/asm/swab.h
index 9997ad2..e82adf6 100644
--- a/arch/arm/include/asm/swab.h
+++ b/arch/arm/include/asm/swab.h
@@ -22,7 +22,8 @@
 #  define __SWAB_64_THRU_32__
 #endif
 
-#if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6
+#if defined(__KERNEL__)
+#if __LINUX_ARM_ARCH__ >= 6
 
 static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
 {
@@ -38,8 +39,10 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 }
 #define __arch_swab32 __arch_swab32
 
-#else
+#endif
+#endif
 
+#if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6
 static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 {
 	__u32 t;
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 2c04ed5..59d0f02 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -425,7 +425,8 @@
 /*
  * The following syscalls are obsolete and no longer available for EABI.
  */
-#if defined(__ARM_EABI__) && !defined(__KERNEL__)
+#if !defined(__KERNEL__)
+#if defined(__ARM_EABI__)
 #undef __NR_time
 #undef __NR_umount
 #undef __NR_stime
@@ -439,6 +440,7 @@
 #undef __NR_syscall
 #undef __NR_ipc
 #endif
+#endif
 
 #ifdef __KERNEL__
 
diff --git a/arch/ia64/include/asm/intrinsics.h b/arch/ia64/include/asm/intrinsics.h
index 111ed52..e4076b5 100644
--- a/arch/ia64/include/asm/intrinsics.h
+++ b/arch/ia64/include/asm/intrinsics.h
@@ -201,16 +201,21 @@ extern long ia64_cmpxchg_called_with_bad_pointer (void);
 #endif
 
 #ifndef __ASSEMBLY__
-#if defined(CONFIG_PARAVIRT) && defined(__KERNEL__)
-#ifdef ASM_SUPPORTED
-# define IA64_INTRINSIC_API(name)	paravirt_ ## name
-#else
-# define IA64_INTRINSIC_API(name)	pv_cpu_ops.name
-#endif
-#define IA64_INTRINSIC_MACRO(name)	paravirt_ ## name
-#else
+
 #define IA64_INTRINSIC_API(name)	ia64_native_ ## name
 #define IA64_INTRINSIC_MACRO(name)	ia64_native_ ## name
+
+#if defined(__KERNEL__)
+#if defined(CONFIG_PARAVIRT)
+# undef IA64_INTRINSIC_API
+# undef IA64_INTRINSIC_MACRO
+# ifdef ASM_SUPPORTED
+#  define IA64_INTRINSIC_API(name)	paravirt_ ## name
+# else
+#  define IA64_INTRINSIC_API(name)	pv_cpu_ops.name
+# endif
+#define IA64_INTRINSIC_MACRO(name)	paravirt_ ## name
+#endif
 #endif
 
 /************************************************/
diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h
index 533812b..9b96461 100644
--- a/arch/mips/include/asm/types.h
+++ b/arch/mips/include/asm/types.h
@@ -15,10 +15,14 @@
  * We don't use int-l64.h for the kernel anymore but still use it for
  * userspace to avoid code changes.
  */
-#if (_MIPS_SZLONG == 64) && !defined(__KERNEL__)
-# include <asm-generic/int-l64.h>
-#else
+#ifdef __KERNEL__
 # include <asm-generic/int-ll64.h>
+#else
+# if _MIPS_SZLONG == 64
+#  include <asm-generic/int-l64.h>
+# else
+#  include <asm-generic/int-ll64.h>
+# endif
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h
index 4e9c8ae..d49760e 100644
--- a/arch/s390/include/asm/mman.h
+++ b/arch/s390/include/asm/mman.h
@@ -11,9 +11,11 @@
 
 #include <asm-generic/mman.h>
 
-#if defined(__KERNEL__) && !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
+#if defined(__KERNEL__)
+#if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
 int s390_mmap_check(unsigned long addr, unsigned long len);
 #define arch_mmap_check(addr,len,flags)	s390_mmap_check(addr,len)
 #endif
+#endif
 
 #endif /* __S390_MMAN_H__ */
diff --git a/arch/tile/include/asm/signal.h b/arch/tile/include/asm/signal.h
index 1e1e616..1e5e49a 100644
--- a/arch/tile/include/asm/signal.h
+++ b/arch/tile/include/asm/signal.h
@@ -23,7 +23,8 @@
 
 #include <asm-generic/signal.h>
 
-#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+#if defined(__KERNEL__)
+#if !defined(__ASSEMBLY__)
 struct pt_regs;
 int restore_sigcontext(struct pt_regs *, struct sigcontext __user *);
 int setup_sigcontext(struct sigcontext __user *, struct pt_regs *);
@@ -33,5 +34,6 @@ void signal_fault(const char *type, struct pt_regs *,
 void trace_unhandled_signal(const char *type, struct pt_regs *regs,
 			    unsigned long address, int signo);
 #endif
+#endif
 
 #endif /* _ASM_TILE_SIGNAL_H */
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index a3759cb..6d8c725 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -43,9 +43,11 @@ typedef unsigned short mifi_t;
 typedef	__u32		if_mask;
 #define NIFBITS (sizeof(if_mask) * 8)        /* bits per mask */
 
-#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
+#if !defined(__KERNEL__)
+#if !defined(DIV_ROUND_UP)
 #define	DIV_ROUND_UP(x,y)	(((x) + ((y) - 1)) / (y))
 #endif
+#endif
 
 typedef struct if_set {
 	if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 11/35] UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (8 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 10/35] UAPI: Split trivial #if defined(__KERNEL__) && X conditionals David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 12/35] UAPI: Fix definition of HZ in asm-generic/param.h David Howells
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Remove the inclusion of linux/types.h from x86's asm/page.h as it's included
via asm/page_types.h.  Make asm/page_types.h's inclusion dependent on not being
in assembly.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/x86/include/asm/page.h       |    2 --
 arch/x86/include/asm/page_types.h |    3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h
index 8ca8283..d4ee8d8 100644
--- a/arch/x86/include/asm/page.h
+++ b/arch/x86/include/asm/page.h
@@ -1,8 +1,6 @@
 #ifndef _ASM_X86_PAGE_H
 #define _ASM_X86_PAGE_H
 
-#include <linux/types.h>
-
 #ifdef __KERNEL__
 
 #include <asm/page_types.h>
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
index bce688d..eeff662 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -2,7 +2,10 @@
 #define _ASM_X86_PAGE_DEFS_H
 
 #include <linux/const.h>
+
+#ifndef __ASSEMBLY__
 #include <linux/types.h>
+#endif
 
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	12

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 12/35] UAPI: Fix definition of HZ in asm-generic/param.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (9 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 11/35] UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 13/35] UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace David Howells
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix definition of HZ in asm-generic/param.h so that the user-specific one is
#undef'd before the kernel-specific one is defined.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/asm-generic/param.h |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
index cdf8251..835632a 100644
--- a/include/asm-generic/param.h
+++ b/include/asm-generic/param.h
@@ -1,12 +1,6 @@
 #ifndef __ASM_GENERIC_PARAM_H
 #define __ASM_GENERIC_PARAM_H
 
-#ifdef __KERNEL__
-# define HZ		CONFIG_HZ	/* Internal kernel timer frequency */
-# define USER_HZ	100		/* some user interfaces are */
-# define CLOCKS_PER_SEC	(USER_HZ)       /* in "ticks" like times() */
-#endif
-
 #ifndef HZ
 #define HZ 100
 #endif
@@ -21,4 +15,11 @@
 
 #define MAXHOSTNAMELEN	64	/* max length of hostname */
 
+#ifdef __KERNEL__
+# undef HZ
+# define HZ		CONFIG_HZ	/* Internal kernel timer frequency */
+# define USER_HZ	100		/* some user interfaces are */
+# define CLOCKS_PER_SEC	(USER_HZ)       /* in "ticks" like times() */
+#endif
+
 #endif /* __ASM_GENERIC_PARAM_H */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 13/35] UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (10 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 12/35] UAPI: Fix definition of HZ in asm-generic/param.h David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 14/35] UAPI: Fix sigset_t ordering problem David Howells
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

elf_read_implies_exec() is a kernel-only feature as the second parameter is a
constant that isn't exported to userspace.  Not only that, but the
arch-specific overrides are not exported either.

So hide the macro from userspace.

Similarly, struct file should not be predeclared in userspace.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/elf.h |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/elf.h b/include/linux/elf.h
index 110821c..411d7b8 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -7,15 +7,6 @@
 #include <asm/elf.h>
 #endif
 
-struct file;
-
-#ifndef elf_read_implies_exec
-  /* Executables for which elf_read_implies_exec() returns TRUE will
-     have the READ_IMPLIES_EXEC personality flag set automatically.
-     Override in asm/elf.h as needed.  */
-# define elf_read_implies_exec(ex, have_pt_gnu_stack)	0
-#endif
-
 /* 32-bit ELF base types. */
 typedef __u32	Elf32_Addr;
 typedef __u16	Elf32_Half;
@@ -413,6 +404,13 @@ typedef struct elf64_note {
 } Elf64_Nhdr;
 
 #ifdef __KERNEL__
+#ifndef elf_read_implies_exec
+  /* Executables for which elf_read_implies_exec() returns TRUE will
+     have the READ_IMPLIES_EXEC personality flag set automatically.
+     Override in asm/elf.h as needed.  */
+# define elf_read_implies_exec(ex, have_pt_gnu_stack)	0
+#endif
+
 #if ELF_CLASS == ELFCLASS32
 
 extern Elf32_Dyn _DYNAMIC [];
@@ -436,6 +434,8 @@ extern Elf64_Dyn _DYNAMIC [];
 #endif
 
 /* Optional callbacks to write extra ELF notes. */
+struct file;
+
 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES
 static inline int elf_coredump_extra_notes_size(void) { return 0; }
 static inline int elf_coredump_extra_notes_write(struct file *file,

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 14/35] UAPI: Fix sigset_t ordering problem
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (11 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 13/35] UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 15/35] UAPI: Fix E820_X_MAX " David Howells
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

There's an ordering problem around the definition of sigset_t: the definition
in the kernel-specific header is referred to in the user-specific header data
structures, at least for x86.  When compiling userspace, the user-specific
header provides an alternate version of sigset_t.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/x86/include/asm/signal.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 598457c..40ef827 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -40,6 +40,8 @@ typedef unsigned long sigset_t;
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 
+// DISINTEGRATE: INCLUDE UAPI HERE
+
 #define SIGHUP		 1
 #define SIGINT		 2
 #define SIGQUIT		 3

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 15/35] UAPI: Fix E820_X_MAX ordering problem
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (12 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 14/35] UAPI: Fix sigset_t ordering problem David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:09 ` [PATCH 16/35] UAPI: Fix linux/netfilter.h inclusion order David Howells
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

There's an ordering problem around the definition of E820_X_MAX: the definition
in the kernel-specific header is referred to in the user-specific header data
structures, at least for x86.  When compiling userspace, the user-specific
header provides an alternate version of E820_X_MAX.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/x86/include/asm/e820.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 908b969..e02512f 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -45,6 +45,8 @@
 #define E820_NVS	4
 #define E820_UNUSABLE	5
 
+// DISINTEGRATE: INCLUDE UAPI HERE
+
 /*
  * reserved RAM used by kernel itself
  * if CONFIG_INTEL_TXT is enabled, memory of this type will be

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 16/35] UAPI: Fix linux/netfilter.h inclusion order
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (13 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 15/35] UAPI: Fix E820_X_MAX " David Howells
@ 2011-07-02 11:09 ` David Howells
  2011-07-02 11:10 ` [PATCH 17/35] UAPI: Fix linux/input.h " David Howells
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:09 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix linux/netfilter.h inclusion order to make sure that the inclusion of the
user-specific file happens after the inclusion of the header file that
provides struct in_addr and struct in6_addr.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/netfilter.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 857f502..4faf53d 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -15,6 +15,8 @@
 #include <linux/compiler.h>
 #include <linux/sysctl.h>
 
+// DISINTEGRATE: INCLUDE UAPI HERE
+
 /* Responses from hook functions. */
 #define NF_DROP 0
 #define NF_ACCEPT 1

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 17/35] UAPI: Fix linux/input.h inclusion order
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (14 preceding siblings ...)
  2011-07-02 11:09 ` [PATCH 16/35] UAPI: Fix linux/netfilter.h inclusion order David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 18/35] UAPI: Fix up linux/netfilter/xt_policy.h David Howells
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix linux/input.h inclusion order to make sure that the inclusion of the
user-specific file happens after the inclusion of the header file that
provides struct timeval.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/input.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/input.h b/include/linux/input.h
index 771d6d8..ad6a33f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -19,6 +19,8 @@
 #include <linux/types.h>
 #endif
 
+// DISINTEGRATE: INCLUDE UAPI HERE
+
 /*
  * The event structure itself
  */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 18/35] UAPI: Fix up linux/netfilter/xt_policy.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (15 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 17/35] UAPI: Fix linux/input.h " David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 19/35] UAPI: Fix linux/auto_fs.h inclusion order David Howells
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix up linux/netfilter/xt_policy.h to make it splittable.  This requires a
mark to be placed on the #ifdef __KERNEL__ in struct xt_policy_elem to tell
the splitter to ignore it.

Would it be possible, I wonder, to rename union nf_inet_addr to xt_policy_addr
instead?

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/netfilter/xt_policy.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index be8ead0..573da52 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -35,7 +35,7 @@ union xt_policy_addr {
 
 struct xt_policy_elem {
 	union {
-#ifdef __KERNEL__
+#ifdef __KERNEL__ // DISINTEGRATE: RETAIN
 		struct {
 			union nf_inet_addr saddr;
 			union nf_inet_addr smask;

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 19/35] UAPI: Fix linux/auto_fs.h inclusion order
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (16 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 18/35] UAPI: Fix up linux/netfilter/xt_policy.h David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 20/35] UAPI: Fix drmP.h to use #include <...> when referring to system header files David Howells
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix linux/auto_fs.h inclusion order to make sure that the inclusion of the
user-specific file happens after the inclusion of the header file that
provides NAME_MAX.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/auto_fs.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index da64e15..f9ca4e6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -23,6 +23,8 @@
 #include <sys/ioctl.h>
 #endif /* __KERNEL__ */
 
+// DISINTEGRATE: INCLUDE UAPI HERE
+
 /* This file describes autofs v3 */
 #define AUTOFS_PROTO_VERSION	3
 

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 20/35] UAPI: Fix drmP.h to use #include <...> when referring to system header files
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (17 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 19/35] UAPI: Fix linux/auto_fs.h inclusion order David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 21/35] UAPI: sound/sound_core.c should include linux/fs.h David Howells
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix drmP.h to use #include <...> when referring to system header files,
otherwise #include_next breaks.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/drm/drmP.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 00c02fc..fc13402 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -73,7 +73,11 @@
 #include <linux/workqueue.h>
 #include <linux/poll.h>
 #include <asm/pgalloc.h>
+#ifdef __KERNEL__
 #include <drm/drm.h>
+#else
+#include "drm.h"
+#endif
 
 #include <linux/idr.h>
 
@@ -83,9 +87,15 @@
 struct drm_file;
 struct drm_device;
 
+#ifdef __KERNEL__
 #include <drm/drm_os_linux.h>
 #include <drm/drm_hashtab.h>
 #include <drm/drm_mm.h>
+#else
+#include "drm_os_linux.h"
+#include "drm_hashtab.h"
+#include "drm_mm.h"
+#endif
 
 #define DRM_UT_CORE 		0x01
 #define DRM_UT_DRIVER		0x02

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 21/35] UAPI: sound/sound_core.c should include linux/fs.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (18 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 20/35] UAPI: Fix drmP.h to use #include <...> when referring to system header files David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 22/35] UAPI: Fix SNDRV_*_ENDIAN ordering problem David Howells
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

sound/sound_core.c should include linux/fs.h to get the definition of struct
file_operations.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 sound/sound_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/sound_core.c b/sound/sound_core.c
index 6ce2778..b6bc127 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -12,6 +12,7 @@
 #include <linux/err.h>
 #include <linux/kdev_t.h>
 #include <linux/major.h>
+#include <linux/fs.h>
 #include <sound/core.h>
 
 #ifdef CONFIG_SOUND_OSS_CORE

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 22/35] UAPI: Fix SNDRV_*_ENDIAN ordering problem
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (19 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 21/35] UAPI: sound/sound_core.c should include linux/fs.h David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:10 ` [PATCH 23/35] UAPI: Fix u_quad_t ordering problem in linux/coda.h David Howells
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

There's an ordering problem around the definition of SNDRV_*_ENDIAN: the
definition in the kernel-specific header is referred to in the user-specific
header data structures.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/sound/asound.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/sound/asound.h b/include/sound/asound.h
index 5d6074f..e4918f6 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -40,6 +40,7 @@
 #endif
 #endif
 
+// DISINTEGRATE: INCLUDE UAPI HERE
 #endif /* __KERNEL__ **/
 
 /*

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 23/35] UAPI: Fix u_quad_t ordering problem in linux/coda.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (20 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 22/35] UAPI: Fix SNDRV_*_ENDIAN ordering problem David Howells
@ 2011-07-02 11:10 ` David Howells
  2011-07-02 11:11 ` [PATCH 24/35] UAPI: Fix linux/coda.h David Howells
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:10 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

There's an ordering problem around the definition of u_quad_t in linux/coda.h:
the definition in the kernel-specific header is referred to in the
user-specific header data structures.  When compiling userspace, the
user-specific header provides an alternate version of u_quad_t.

To get around this problem, place a marker specifically to indicate the point
at which the #include_next should be placed in the kernel-specific file.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/coda.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/coda.h b/include/linux/coda.h
index 96c8769..5a2c1a0 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -111,6 +111,7 @@ typedef unsigned long long u_quad_t;
 #else
 #define cdev_t dev_t
 #endif
+// DISINTEGRATE: INCLUDE UAPI HERE
 
 #ifdef __CYGWIN32__
 struct timespec {

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 24/35] UAPI: Fix linux/coda.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (21 preceding siblings ...)
  2011-07-02 11:10 ` [PATCH 23/35] UAPI: Fix u_quad_t ordering problem in linux/coda.h David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:11 ` [PATCH 25/35] UAPI: Guard linux/isdn_divertif.h David Howells
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix linux/coda.h to retain the #ifdef __KERNEL__ in struct coda_open_by_fd_out
in the userspace struct rather than splitting that member out into a separate
header.

This is done by placing a marker to manually control the splitter script.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/coda.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/coda.h b/include/linux/coda.h
index 5a2c1a0..2ae9dcd 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -618,7 +618,7 @@ struct coda_open_by_fd_out {
     struct coda_out_hdr oh;
     int fd;
 
-#ifdef __KERNEL__
+#ifdef __KERNEL__ // DISINTEGRATE: RETAIN
     struct file *fh; /* not passed from userspace but used in-kernel only */
 #endif
 };

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 25/35] UAPI: Guard linux/isdn_divertif.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (22 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 24/35] UAPI: Fix linux/coda.h David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:11 ` [PATCH 26/35] UAPI: Guard linux/sound.h David Howells
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Place reinclusion guards on linux/isdn_divertif.h otherwise the splitter
script won't insert a #include_next.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/isdn_divertif.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
index 07821ca..a5a50f5 100644
--- a/include/linux/isdn_divertif.h
+++ b/include/linux/isdn_divertif.h
@@ -10,6 +10,8 @@
  *
  */
 
+#ifndef _LINUX_ISDN_DIVERTIF_H
+#define _LINUX_ISDN_DIVERTIF_H
 
 /***********************************************************/
 /* magic value is also used to control version information */
@@ -45,3 +47,5 @@ typedef struct
 /*********************/
 extern int DIVERT_REG_NAME(isdn_divert_if *);
 #endif
+
+#endif /* _LINUX_ISDN_DIVERTIF_H */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 26/35] UAPI: Guard linux/sound.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (23 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 25/35] UAPI: Guard linux/isdn_divertif.h David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:11 ` [PATCH 27/35] UAPI: Fix linux/ncp.h David Howells
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Place reinclusion guards on linux/sound.h otherwise the splitter script won't
insert a #include_next.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/sound.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/sound.h b/include/linux/sound.h
index 44dcf05..fae20ba 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -1,3 +1,5 @@
+#ifndef _LINUX_SOUND_H
+#define _LINUX_SOUND_H
 
 /*
  * Minor numbers for the sound driver.
@@ -42,3 +44,5 @@ extern void unregister_sound_mixer(int unit);
 extern void unregister_sound_midi(int unit);
 extern void unregister_sound_dsp(int unit);
 #endif /* __KERNEL__ */
+
+#endif /* _LINUX_SOUND_H */

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 27/35] UAPI: Fix linux/ncp.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (24 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 26/35] UAPI: Guard linux/sound.h David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:11 ` [PATCH 28/35] UAPI: Fix x86_64 system call count and generation David Howells
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix linux/coda.h to retain the #ifdef __KERNEL__ in struct nw_info_struct in
the userspace struct rather than splitting that member out into a separate
header.

This is done by placing a marker to manually control the splitter script.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/ncp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f0ade..4717262 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -155,7 +155,7 @@ struct nw_info_struct {
 	__u8 nameLen;
 	__u8 entryName[256];
 	/* libncp may depend on there being nothing after entryName */
-#ifdef __KERNEL__
+#ifdef __KERNEL__ // DISINTEGRATE: RETAIN
 	struct nw_nfs_info nfs;
 #endif
 } __attribute__((packed));

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 28/35] UAPI: Fix x86_64 system call count and generation
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (25 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 27/35] UAPI: Fix linux/ncp.h David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:11 ` [PATCH 29/35] UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines David Howells
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

The x86_64 system call count and system call pointer table are generated by
#undef'ing the guard on asm/unistd.h and reincluding it with the __SYSCALL()
macro suitably set.

To achieve this once the header has been split, the UAPI header guard must also
be #undef'd.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/x86/kernel/asm-offsets_64.c |    1 +
 arch/x86/kernel/syscall_64.c     |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index e72a119..8cad3e3 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -3,6 +3,7 @@
 #define __NO_STUBS 1
 #undef __SYSCALL
 #undef _ASM_X86_UNISTD_64_H
+#undef _UAPI_ASM_X86_UNISTD_64_H
 #define __SYSCALL(nr, sym) [nr] = 1,
 static char syscalls[] = {
 #include <asm/unistd.h>
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c
index de87d60..b659abc 100644
--- a/arch/x86/kernel/syscall_64.c
+++ b/arch/x86/kernel/syscall_64.c
@@ -9,11 +9,13 @@
 
 #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
 #undef _ASM_X86_UNISTD_64_H
+#undef _UAPI_ASM_X86_UNISTD_64_H
 #include <asm/unistd_64.h>
 
 #undef __SYSCALL
 #define __SYSCALL(nr, sym) [nr] = sym,
 #undef _ASM_X86_UNISTD_64_H
+#undef _UAPI_ASM_X86_UNISTD_64_H
 
 typedef void (*sys_call_ptr_t)(void);
 

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 29/35] UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (26 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 28/35] UAPI: Fix x86_64 system call count and generation David Howells
@ 2011-07-02 11:11 ` David Howells
  2011-07-02 11:12 ` [PATCH 31/35] UAPI: Plumb the UAPI Kbuilds into the user header handling system David Howells
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:11 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix arch/mips/include/asm/Kbuild to have a separate header-y line for each
header to make them easier to delete individually.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mips/include/asm/Kbuild |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 7897f05..f53f9ca 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -1,3 +1,5 @@
 include include/asm-generic/Kbuild.asm
 
-header-y += cachectl.h sgidefs.h sysmips.h
+header-y += cachectl.h
+header-y += sgidefs.h
+header-y += sysmips.h

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 31/35] UAPI: Plumb the UAPI Kbuilds into the user header handling system
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (27 preceding siblings ...)
  2011-07-02 11:11 ` [PATCH 29/35] UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines David Howells
@ 2011-07-02 11:12 ` David Howells
  2011-07-02 11:12 ` [PATCH 32/35] UAPI: Set up uapi/asm/Kbuild.asm David Howells
                   ` (6 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:12 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Plumb the UAPI Kbuilds into the user header handling system.  As the headers
are split the entries will be transferred across.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 5d8d91e..7231c4b 100644
--- a/Makefile
+++ b/Makefile
@@ -1070,6 +1070,10 @@ headers_install: __headers
 	$(error Headers not exportable for the $(SRCARCH) architecture))
 	$(Q)$(MAKE) $(hdr-inst)=include
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst)
+	$(if $(wildcard $(srctree)/arch/$(hdr-arch)/uapi/asm/Kbuild),, \
+	$(error Headers not exportable for the $(SRCARCH) architecture))
+	$(Q)$(MAKE) $(hdr-inst)=uapi
+	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/uapi/asm $(hdr-dst)
 
 PHONY += headers_check_all
 headers_check_all: headers_install_all
@@ -1079,6 +1083,8 @@ 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)=uapi HDRCHECK=1
+	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/uapi/asm $(hdr-dst) HDRCHECK=1
 
 # ---------------------------------------------------------------------------
 # Modules

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 32/35] UAPI: Set up uapi/asm/Kbuild.asm
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (28 preceding siblings ...)
  2011-07-02 11:12 ` [PATCH 31/35] UAPI: Plumb the UAPI Kbuilds into the user header handling system David Howells
@ 2011-07-02 11:12 ` David Howells
  2011-07-02 11:12 ` [PATCH 33/35] UAPI: Move linux/version.h David Howells
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:12 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Set up uapi/asm/Kbuild.asm.  This requires the mandatory headers to be
dynamically detected.  The same goes for include/asm/Kbuild.asm.  The problem
is that the header files will be split or moved one at a time, but each header
file in Kbuild.asm's list applies to all arch headers of that name
simultaneously.

The dynamic detection of mandatory files can be undone later.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/asm-generic/Kbuild.asm |   85 ++++++++++++++++++++--------------------
 uapi/asm-generic/Kbuild.asm    |   44 +++++++++++++++++++++
 2 files changed, 86 insertions(+), 43 deletions(-)
 create mode 100644 uapi/asm-generic/Kbuild.asm

diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index c5d2e5d..4923b27 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,45 +1,44 @@
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
-		  $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
-header-y  += kvm.h
-endif
+#
+# Headers that are optional in arch/*/include/asm/
+#
+opt-header += kvm.h
+opt-header += kvm_para.h
+opt-header += a.out.h
 
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
-		  $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
-header-y  += kvm_para.h
-endif
+#
+# Headers that are mandatory in arch/*/include/asm/
+#
+asm-headers += auxvec.h
+asm-headers += bitsperlong.h
+asm-headers += byteorder.h
+asm-headers += errno.h
+asm-headers += fcntl.h
+asm-headers += ioctl.h
+asm-headers += ioctls.h
+asm-headers += ipcbuf.h
+asm-headers += mman.h
+asm-headers += msgbuf.h
+asm-headers += param.h
+asm-headers += poll.h
+asm-headers += posix_types.h
+asm-headers += ptrace.h
+asm-headers += resource.h
+asm-headers += sembuf.h
+asm-headers += setup.h
+asm-headers += shmbuf.h
+asm-headers += sigcontext.h
+asm-headers += siginfo.h
+asm-headers += signal.h
+asm-headers += socket.h
+asm-headers += sockios.h
+asm-headers += stat.h
+asm-headers += statfs.h
+asm-headers += swab.h
+asm-headers += termbits.h
+asm-headers += termios.h
+asm-headers += types.h
+asm-headers += unistd.h
 
-ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
-		  $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
-header-y += a.out.h
-endif
-
-header-y += auxvec.h
-header-y += bitsperlong.h
-header-y += byteorder.h
-header-y += errno.h
-header-y += fcntl.h
-header-y += ioctl.h
-header-y += ioctls.h
-header-y += ipcbuf.h
-header-y += mman.h
-header-y += msgbuf.h
-header-y += param.h
-header-y += poll.h
-header-y += posix_types.h
-header-y += ptrace.h
-header-y += resource.h
-header-y += sembuf.h
-header-y += setup.h
-header-y += shmbuf.h
-header-y += sigcontext.h
-header-y += siginfo.h
-header-y += signal.h
-header-y += socket.h
-header-y += sockios.h
-header-y += stat.h
-header-y += statfs.h
-header-y += swab.h
-header-y += termbits.h
-header-y += termios.h
-header-y += types.h
-header-y += unistd.h
+header-y := $(foreach hdr,$(asm-headers) $(opt-headers), \
+		$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/$(hdr)), \
+		  $(hdr)))
diff --git a/uapi/asm-generic/Kbuild.asm b/uapi/asm-generic/Kbuild.asm
new file mode 100644
index 0000000..5789ed6
--- /dev/null
+++ b/uapi/asm-generic/Kbuild.asm
@@ -0,0 +1,44 @@
+#
+# Headers that are optional in arch/*/uapi/asm/
+#
+opt-header += kvm.h
+opt-header += kvm_para.h
+opt-header += a.out.h
+
+#
+# Headers that are mandatory in arch/*/uapi/asm/
+#
+asm-headers += auxvec.h
+asm-headers += bitsperlong.h
+asm-headers += byteorder.h
+asm-headers += errno.h
+asm-headers += fcntl.h
+asm-headers += ioctl.h
+asm-headers += ioctls.h
+asm-headers += ipcbuf.h
+asm-headers += mman.h
+asm-headers += msgbuf.h
+asm-headers += param.h
+asm-headers += poll.h
+asm-headers += posix_types.h
+asm-headers += ptrace.h
+asm-headers += resource.h
+asm-headers += sembuf.h
+asm-headers += setup.h
+asm-headers += shmbuf.h
+asm-headers += sigcontext.h
+asm-headers += siginfo.h
+asm-headers += signal.h
+asm-headers += socket.h
+asm-headers += sockios.h
+asm-headers += stat.h
+asm-headers += statfs.h
+asm-headers += swab.h
+asm-headers += termbits.h
+asm-headers += termios.h
+asm-headers += types.h
+asm-headers += unistd.h
+
+header-y := $(foreach hdr,$(asm-headers) $(opt-headers), \
+		$(if $(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/$(hdr)), \
+		  $(hdr)))

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 33/35] UAPI: Move linux/version.h
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (29 preceding siblings ...)
  2011-07-02 11:12 ` [PATCH 32/35] UAPI: Set up uapi/asm/Kbuild.asm David Howells
@ 2011-07-02 11:12 ` David Howells
  2011-07-02 11:12 ` [PATCH 34/35] UAPI: Make UAPI headers install to usr/include/ David Howells
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:12 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Move include/linux/version.h to the UAPI header directory.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile             |   10 +++++-----
 include/linux/Kbuild |    1 -
 uapi/linux/Kbuild    |    3 +++
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 7231c4b..3192b2e 100644
--- a/Makefile
+++ b/Makefile
@@ -451,7 +451,7 @@ asm-generic:
 
 no-dot-config-targets := clean mrproper distclean \
 			 cscope gtags TAGS tags help %docs check% coccicheck \
-			 include/linux/version.h headers_% \
+			 uapi/linux/version.h headers_% \
 			 kernelversion %src-pkg
 
 config-targets := 0
@@ -984,7 +984,7 @@ endif
 # prepare2 creates a makefile if using a separate output directory
 prepare2: prepare3 outputmakefile asm-generic
 
-prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
+prepare1: prepare2 uapi/linux/version.h include/generated/utsrelease.h \
                    include/config/auto.conf
 	$(cmd_crmodverdir)
 
@@ -1018,7 +1018,7 @@ define filechk_version.h
 	echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
 endef
 
-include/linux/version.h: $(srctree)/Makefile FORCE
+uapi/linux/version.h: $(srctree)/Makefile FORCE
 	$(call filechk,version.h)
 
 include/generated/utsrelease.h: include/config/kernel.release FORCE
@@ -1057,7 +1057,7 @@ hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
 hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
 
 PHONY += __headers
-__headers: include/linux/version.h scripts_basic asm-generic FORCE
+__headers: uapi/linux/version.h scripts_basic asm-generic FORCE
 	$(Q)$(MAKE) $(build)=scripts build_unifdef
 
 PHONY += headers_install_all
@@ -1176,7 +1176,7 @@ CLEAN_FILES +=	vmlinux System.map \
 MRPROPER_DIRS  += include/config usr/include include/generated          \
                   arch/*/include/generated
 MRPROPER_FILES += .config .config.old .version .old_version             \
-                  include/linux/version.h                               \
+                  uapi/linux/version.h                               \
 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
 
 # clean - Delete most, but leave enough to build external modules
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 01f6362..f429b36 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -19,7 +19,6 @@ header-y += netfilter_ipv6/
 header-y += usb/
 header-y += wimax/
 
-objhdr-y += version.h
 
 ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
 		  $(srctree)/include/asm-$(SRCARCH)/a.out.h \
diff --git a/uapi/linux/Kbuild b/uapi/linux/Kbuild
index b29b895..2731127 100644
--- a/uapi/linux/Kbuild
+++ b/uapi/linux/Kbuild
@@ -12,3 +12,6 @@ header-y += sunrpc/
 header-y += netfilter/
 header-y += usb/
 header-y += wimax/
+
+objhdr-y += version.h
+

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 34/35] UAPI: Make UAPI headers install to usr/include/
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (30 preceding siblings ...)
  2011-07-02 11:12 ` [PATCH 33/35] UAPI: Move linux/version.h David Howells
@ 2011-07-02 11:12 ` David Howells
  2011-07-02 11:12 ` [PATCH 35/35] UAPI: Fix the page-types query program in the docs David Howells
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:12 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Make core UAPI headers install to the usr/include/ directory.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3192b2e..8dff6e8 100644
--- a/Makefile
+++ b/Makefile
@@ -1072,7 +1072,7 @@ headers_install: __headers
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst)
 	$(if $(wildcard $(srctree)/arch/$(hdr-arch)/uapi/asm/Kbuild),, \
 	$(error Headers not exportable for the $(SRCARCH) architecture))
-	$(Q)$(MAKE) $(hdr-inst)=uapi
+	$(Q)$(MAKE) $(hdr-inst)=uapi dst=include
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/uapi/asm $(hdr-dst)
 
 PHONY += headers_check_all
@@ -1083,7 +1083,7 @@ 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)=uapi HDRCHECK=1
+	$(Q)$(MAKE) $(hdr-inst)=uapi HDRCHECK=1 dst=include
 	$(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/uapi/asm $(hdr-dst) HDRCHECK=1
 
 # ---------------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 35/35] UAPI: Fix the page-types query program in the docs
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (31 preceding siblings ...)
  2011-07-02 11:12 ` [PATCH 34/35] UAPI: Make UAPI headers install to usr/include/ David Howells
@ 2011-07-02 11:12 ` David Howells
  2011-07-02 11:33 ` [PATCH 00/35] UAPI header file split - scripts David Howells
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:12 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

Fix the page-types query program in Documentation/vm/ as that refers to the
magic numbers header file directly, but the magic numbers are now in the UAPI
headers.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 Documentation/vm/page-types.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c
index 7445caa..658ec74 100644
--- a/Documentation/vm/page-types.c
+++ b/Documentation/vm/page-types.c
@@ -34,7 +34,7 @@
 #include <sys/fcntl.h>
 #include <sys/mount.h>
 #include <sys/statfs.h>
-#include "../../include/linux/magic.h"
+#include "../../uapi/linux/magic.h"
 
 
 #ifndef MAX_PATH

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 00/35] UAPI header file split - scripts
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (32 preceding siblings ...)
  2011-07-02 11:12 ` [PATCH 35/35] UAPI: Fix the page-types query program in the docs David Howells
@ 2011-07-02 11:33 ` David Howells
  2011-07-05 20:46 ` [PATCH 00/35] UAPI header file split Randy Dunlap
  2011-07-06 11:04 ` David Howells
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-02 11:33 UTC (permalink / raw)
  To: linux-arch; +Cc: dhowells

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]


Here are the scripts for splitting the headers.  There are three:

 (1) A script to disintegrate a single header file.

 (2) A script to scan all the Kbuild files and work out what headers are
     exported to userspace.

 (3) A script to make use of the above two and to drive git to build a commit
     per directory of exported headers.

David


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: disintegrate-one.pl --]
[-- Type: text/x-perl, Size: 29596 bytes --]

#!/usr/bin/perl -w
#
# Disintegrate a file to extract out the userspace API bits into their own file
# in a separate directory.  The original file retains the residue.
#
# The original file is given a #include_next to refer to the UAPI file, and
# both headers will get guards, unless one of them is simply turned into a
# #include_next.
#
# Call as: disintegrate-one.pl <orig_header_file> <uapi_header_file>
#

use File::Path;
use strict;

sub reduce_file(@);

# Don't put a "don't include this in asm" notice in the following files
my %asm_includeable_linux_files = (
    "include/linux/const.h"		=> 1,
    "include/linux/elf-em.h"		=> 1,
    "include/linux/errno.h"		=> 1,
    "include/linux/serial_reg.h"	=> 1,
    );

die if ($#ARGV != 1);
my $linuxhdr = $ARGV[0];
my $uapihdr = $ARGV[1];

#
# The UAPI header file is called the same as the Linux header file as far as
# cpp is concerned - the latter just #include_next's the former, and if the
# latter doesn't exist, the former is used directly.
#
my $inchdr = $linuxhdr;
$inchdr =~ s@.*include/@@;

#
# Read the entire Linux header file into an array of lines.
#
open(FD, '<', $linuxhdr) or die $linuxhdr, ": $!\n";
my @lines = <FD> or die $linuxhdr, ": $!\n";
close(FD) or die $linuxhdr, ": $!\n";

my @kernellines = ();
my @uapilines = ();

#
# If the entire file is just a single #include, then don't change it
#
# We do want to create the API file _if_ the included file is an API file
#
if ($#lines == 0 && $lines[0] =~ /^#\s*include\s+<([^>]+)>/) {
    @kernellines = "#include_next <$1>\n";
    @uapilines = @lines;
    goto output;
}

goto output if ($#lines == -1);

#
# Attempt to disintegrate the file
# - The initial banner comment gets duplicated if there is one
# - The reinclusion guard is duplicated and modified for the API file
# - non-__KERNEL__ lines get put into the API file
#

my $nr_blocks = 0;
sub new_block($$$$)
{
    my ($type, $l, $parent, $prev) = @_;
    my %block = (
	type		=> $type,	# n = normal block, c = conditional block
	l		=> $l + 1,
	next_block	=> undef,
	prev_block	=> $prev,
	nr		=> ++$nr_blocks,
	parent		=> $parent,
    );
    $block{lines} = [] if ($type eq "n");
    $block{kernel_mark} = 0 if ($type ne "n");
    $prev->{next_block} = \%block if ($prev);
    return \%block;
}

#
# First of all, build a tree of normal blocks and conditionals
#
my $first_block = new_block("n", 0, undef, undef);
my $conditional_tree = $first_block;
my $cur_body = $first_block;
my $specified_include_point = 0;

my @conditional_stack = ();
my @body_stack = ( $first_block );

my $l = 0;

if ($lines[$l] =~ m@^/[*]@) {
    my @buffer = ();
    for (; $l <= $#lines; $l++) {
	if ($lines[$l] =~ "(.*)[*]/(.*)") {
	    push @buffer, "$1*/\n";
	    $lines[$l] = $2;
	    $l++;
	    goto got_banner_comment;
	}
	push @buffer, $lines[$l];
    }
  got_banner_comment:
    $first_block->{lines} = \@buffer;
    $first_block->{banner} = 1;
    $first_block->{next_block} = new_block("n", $l, undef, $first_block);
    $cur_body = $first_block->{next_block};
    $body_stack[0] = $cur_body;
}

for (; $l <= $#lines; $l++) {
    my $line = $lines[$l];
    my @buffer = ( $line );

    # parse out the actual CPP directive
    # - this may be split over multiple lines using backslashes and comments
    #   that have embedded newlines
    my $cpp = $line;
  restart:
    $cpp =~ s@\s+$@@g;
    $cpp =~ s@\s+@ @g;

    while ($cpp =~ m@(/[*])@) {
	my $o = index($cpp, "/*");
	if ($cpp =~ m@([*]/)@) {
	    my $c = index($cpp, "*/") + 2;
	    substr($cpp, $o, $c - $o) = "";
	} else {
	    $l++;
	    $cpp .= $lines[$l];
	    push @buffer, $lines[$l];
	    goto restart;
	}
    }

    if ($cpp =~ /^(.*)[\\]$/) {
	$l++;
	$cpp = $1 . $lines[$l];
	push @buffer, $lines[$l];
	goto restart;
    }

    $cpp =~ s@\s+$@@g;
    $cpp =~ s@\s\s+@ @g;

    if ($cpp eq "// DISINTEGRATE: INCLUDE UAPI HERE") {
	die if ($specified_include_point);

	my $marker;
	if ($#{$cur_body->{lines}} == -1) {
	    $marker = $cur_body;
	    $marker->{type} = "i";
	    $marker->{include_point} = undef;
	    delete $marker->{lines};
	} else {
	    my $marker = new_block("i", $l, $cur_body->{parent}, $cur_body);
	    $cur_body = $marker;
	    $body_stack[$#body_stack] = $marker;
	}
	die if ($marker->{lines});

	my $body_block = new_block("n", $l + 1, $cur_body->{parent}, $cur_body);
	$body_stack[$#body_stack] = $body_block;
	$cur_body = $body_block;
	$specified_include_point = 1;
	next;
    }

    my $retain_next = 0;
    if ($line =~ "(.*) // DISINTEGRATE: RETAIN\n") {
	$line = "$1\n";
	$retain_next = 1;
    }

    if ($line =~ /^#/) {
	#print "r:\e[36m", $cpp, "\e[m@@@ $l\n";

	# handle conditional macros
	if ($cpp =~ /^#\s*if/) {
	    #print "#if ", $#conditional_stack + 1, ": ", $#body_stack + 1, "\n";
	    my $cond_block = new_block("c", $l, $cur_body->{parent}, $cur_body);
	    $cond_block->{clauses} = [];	# #if..#elif..#elif..#else..#endif
	    $cond_block->{retain} = 1 if ($retain_next == 1);
	    push @conditional_stack, $cond_block;

	    my $clause = new_block("if", $l, $cond_block, undef);
	    $clause->{cpp} = $cpp;
	    push @{$clause->{lines}}, @buffer;
	    push @{$cond_block->{clauses}}, $clause;

	    my $body_block = new_block("n", $l + 1, $clause, undef);
	    $clause->{body} = $body_block;

	    $cur_body->{next_block} = $cond_block;
	    $body_stack[$#body_stack] = $cond_block;
	    push @body_stack, $body_block;

	    $cur_body = $body_block;

	    die ("Unexpected body types '",
		 join("", map {$_->{type};} @body_stack),
		 "' after #if\n")
		if ($body_stack[$#body_stack]->{type} ne "n" ||
		    $body_stack[$#body_stack - 1]->{type} ne "c");

	    if ($#conditional_stack == 0 &&
		$cpp =~ /^#\s*ifndef\s+([_A-Za-z0-9]+)/) {
		# keep an eye open for a guard's #define or an include-order check's #error
		my $macro = $1;
		$cur_body->{check_first_line} = $macro
		    if ($macro ne "__KERNEL__" && $macro !~ /^CONFIG_/);
	    }
	    next;
	}

	my $cond_block = $conditional_stack[$#conditional_stack];
	my $cur_clause = $cond_block->{clauses}->[$#{$cond_block->{clauses}}];

	if ($cpp =~ /^#\s*elif/) {
	    die if ($#conditional_stack < 0);
	    die if (exists $cond_block->{has_else});

	    my $clause = new_block("elif", $l, $cond_block, $cur_clause);
	    $clause->{cpp} = $cpp;
	    push @{$clause->{lines}}, @buffer;
	    push @{$cond_block->{clauses}}, $clause;

	    my $body_block = new_block("n", $l + 1, $clause, undef);
	    $clause->{body} = $body_block;

	    $body_stack[$#body_stack] = $body_block;
	    $cur_body = $body_block;
	    next;
	}

	if ($cpp =~ /^#\s*else/) {
	    #print "#else ", $#conditional_stack + 1, ": ", $#body_stack + 1, "\n";
	    die if ($#conditional_stack < 0);
	    die if (exists $cond_block->{has_else});
	    $cond_block->{has_else} = 1;

	    my $clause = new_block("else", $l, $cond_block, $cur_clause);
	    push @{$clause->{lines}}, @buffer;
	    push @{$cond_block->{clauses}}, $clause;

	    my $body_block = new_block("n", $l + 1, $clause, undef);
	    $clause->{body} = $body_block;

	    $body_stack[$#body_stack] = $body_block;
	    $cur_body = $body_block;
	    next;
	}

	if ($cpp =~ /^#\s*endif/) {
	    #print "#endif ", $#conditional_stack + 1, ": ", $#body_stack + 1, "\n";
	    die if ($#conditional_stack < 0);

	    my $clause = new_block("endif", $l, $cond_block, $cur_clause);
	    push @{$clause->{lines}}, @buffer;
	    push @{$cond_block->{clauses}}, $clause;

	    pop @conditional_stack;
	    pop @body_stack;
	    $cur_body = $body_stack[$#body_stack];

	    my $body_block = new_block("n", $l + 1, $cur_body->{parent}, $cur_body);

	    die "Unexpected body type '", $cur_body->{type}, "' at #endif\n"
		if ($cur_body->{type} ne "c");

	    $body_stack[$#body_stack] = $body_block;
	    $cur_body = $body_block;
	    next;
	}

	if (($cpp =~ /^#\s*define\s+([_A-Za-z0-9]+)$/ ||
	     $cpp =~ /^#\s*define\s+([_A-Za-z0-9]+)\s+1$/) &&
	    exists $cur_body->{check_first_line}
	    ) {
	    my $macro = $1;
	    #print "GUARD $macro\n";
	    if ($macro eq $cur_body->{check_first_line}) {
		$cond_block->{guard_label} = $cur_body->{check_first_line};
		$cur_clause->{guard} = \@buffer;
		delete $cur_body->{check_first_line};
		next;
	    }
	}

	if ($cpp =~ /^#\s*error/ &&
	    exists $cur_body->{check_first_line}
	    ) {
	    delete $cur_body->{check_first_line};
	    $cur_clause->{order_check} = \@buffer;
	    next;
	}
    }

    delete $cur_body->{check_first_line} if (exists $cur_body->{check_first_line});
    push @{$cur_body->{lines}}, @buffer;
}

die "Conditional level mismatch (", $#conditional_stack, ")\n"
    if ($#conditional_stack != -1);
die "Body level mismatch (", $#body_stack, ")\n"
    if ($#body_stack != 0);

###############################################################################
#
# Dump the parse tree
#
###############################################################################
sub dump_tree(@);
sub dump_tree(@)
{
    my $root = $#_ >= 0 ? $_[0] : $first_block;
    my $level = $#_ >= 1 ? $_[1] : 0;

    for (my $block = $root; $block; $block = $block->{next_block}) {
	my $l = $block->{l};
	my $nr = $block->{nr};
	my $lines = $block->{lines};
	print " " x $level;
	if ($block->{type} eq "n") {
	    if ($#{$lines} < 0) {
		print '- Empty (line ', $l, " nr ", $nr, ")\n";
	    } elsif ($#{$lines} == 0) {
		print '- Body (line ', $l, " nr ", $nr, ")\n";
	    } else {
		print '- Body (lines ', $l, "-", $l + $#{$lines} + 1, " nr ", $nr, ")";
		print " BANNER" if (exists $block->{banner});
		print "\n";
	    }
	    #print map {"\t\t\t>" . $_; } @{$block->{lines}} if (exists $block->{lines});
	} elsif ($block->{type} eq "i") {
		print '- UAPI Inclusion (line ', $l, " nr ", $nr, ")\n";
	} elsif ($block->{type} eq "c") {
	    my $clauses = $block->{clauses};
	    die "Must be at least 2 clauses\n" if ($#{$clauses} < 1);
	    print '@ Cond (line ', $l, " nr ", $nr, ") ", $#{$clauses}, " clauses";
	    if (exists $block->{kernel_mark}) {
		print " KO" if ($block->{kernel_mark} & 1);
		print " UO" if ($block->{kernel_mark} & 2);
		print " IK" if ($block->{kernel_mark} & 4);
		print " IU" if ($block->{kernel_mark} & 8);
		print " GUARD" if (exists $block->{guard});
		print " ORDER_CHECK" if (exists $block->{order_check});
		print " RETAIN" if (exists $block->{retain});
	    }
	    print "\n";
	    foreach my $clause (@{$clauses}) {
		my $nr = $clause->{nr};
		print " " x ($level + 1);
		print "#", $clause->{type}, " nr ", $nr;
		if (exists $clause->{kernel_mark}) {
		    print " KO" if ($clause->{kernel_mark} & 1);
		    print " UO" if ($clause->{kernel_mark} & 2);
		    print " IK" if ($clause->{kernel_mark} & 4);
		    print " IU" if ($clause->{kernel_mark} & 8);
		}
		print "\n";
		#print map {"\t\t\t>" . $_; } @{$clause->{lines}} if (exists $clause->{lines});
		dump_tree($clause->{body}, $level + 2);
	    }
	} else {
	    die;
	}
    }
}

###############################################################################
#
# Validate the parse tree structure
#
###############################################################################
sub validate_tree(@);
sub validate_tree(@)
{
    my ($parent, $body) = @_;

    if ($#_ == -1) {
	$parent = undef;
	$body = $first_block;
    }

    my $previous = undef;

    #print "-->validate_tree(", $parent ? $parent->{nr} : "-", ",", $body->{nr}, ")\n";

    for (my $block = $body; $block; $previous = $block, $block = $block->{next_block}) {
	my $nr = $block->{nr};

	die $nr, ": Unset parent\n" unless (exists $block->{parent});
	if (!$parent) {
	    die $nr, ": Unexpected parent\n" if ($block->{parent});
	} else {
	    die $nr, ": Missing parent\n" if (!$block->{parent});
	    die $nr, ": Incorrect parent", $block->{parent}->{nr}, "!=", $parent->{nr}, "\n"
		unless ($block->{parent} == $parent);
	}

	if ($previous) {
	    die($nr, ": Incorrect prev_block ",  $block->{prev_block}->{nr},
		" not ", $previous->{nr}, "\n")
		unless ($block->{prev_block} == $previous);
	} else {
	    die $nr, ": Unexpected prev_block ", $block->{prev_block}->{nr}, "\n"
		if ($block->{prev_block});
	}


	if ($block->{type} eq "n") {
	    die $nr, ": Missing line array\n" unless (exists $block->{lines});
	    die $nr, ": Unexpected __KERNEL__ mark\n" if (exists $block->{kernel_mark});
	    die $nr, ": Unexpected guard\n" if (exists $block->{guard});
	    die $nr, ": Unexpected order check\n" if (exists $block->{order_check});

	} elsif ($block->{type} eq "i") {
	    die $nr, ": Unexpected line array\n" if (exists $block->{lines});
	    die $nr, ": Unexpected guard\n" if (exists $block->{guard});
	    die $nr, ": Unexpected order check\n" if (exists $block->{order_check});

	} elsif ($block->{type} eq "c") {
	    die $nr, ": Unexpected line array\n" if (exists $block->{lines});
	    die $nr, ": Missing clause array\n" unless (exists $block->{clauses});

	    my $clauses = $block->{clauses};
	    my $nc = $#{$clauses};
	    die $nr, ": Must be at least 2 clauses\n" if ($nc < 1);

	    die $nr, ": Missing #if clause\n" if ($clauses->[0]->{type} ne "if");
	    die $nr, ": Missing #endif clause\n" if ($clauses->[$nc]->{type} ne "endif");
	    if ($nc >= 2) {
		for (my $i = 1; $i < $nc - 1; $i++) {
		    my $j = $clauses->[$i]->{nr};
		    die $nr, ": Missing #elif clause [$j]\n"
			if ($clauses->[$i]->{type} ne "elif");
		}

		my $j = $clauses->[$nc - 1]->{nr};
		die $nr, ": Missing #elif/#else clause [$j]\n"
		    if ($clauses->[$nc - 1]->{type} ne "elif" &&
			$clauses->[$nc - 1]->{type} ne "else");
	    }

	    foreach my $clause (@{$clauses}) {
		my $j = $clause->{nr};

		die "$j: Clause missing parent\n" unless ($clause->{parent});
		die "$j: Clause has wrong parent: ", $clause->{parent}->{nr}, "\n"
		    unless ($clause->{parent} == $block);
		die "$j: Unexpected body in #endif: ", $clause->{body}->{nr}, "\n"
		    if ($clause->{type} eq "endif" && exists $clause->{body});
		die "$j: Missing clause line array\n" unless (exists $clause->{lines});

		validate_tree($clause, $clause->{body}) if (exists $clause->{body});
	    }
	} else {
	    die "$nr: Invalid block type: '", $block->{type}, "'\n";
	}
    }

    #print "<--validate_tree()\n";
}

validate_tree();
#dump_tree(); exit 123;

###############################################################################
#
# Eliminate empty bodies from the tree
#
###############################################################################
sub discard_empties($);
sub discard_empties($)
{
    my ($block) = @_;

    while ($block) {
	die unless exists $block->{type};
	if ($block->{type} eq "n") {
	    if ($#{$block->{lines}} < 0) {
		#print "EMPTY: ", $block->{nr};
		my $parent = $block->{parent};
		my $prev = $block->{prev_block};
		my $next = $block->{next_block};
		delete $block->{type};

		if ($next) {
		    #print " next";
		    die if ($next->{prev_block} != $block);
		    $next->{prev_block} = $prev;
		}

		if ($prev) {
		    #print " prev";
		    die if ($prev->{next_block} != $block);
		    $prev->{next_block} = $next;
		} else {
		    if ($parent) {
			#print " parent(", $parent->{nr}, ")";
			die unless ($parent->{body} == $block);
			$parent->{body} = $next;
		    } else {
			#print " root";
			die "Mismatch ", $first_block->{nr}, " != ", $block->{nr}, "\n"
			    if ($first_block != $block);
			$first_block = $next;
		    }
		}
		die if ($next && $block == $next);
		$block = $next;
		#print "\n";
		next;
	    } else {
		$block = $block->{next_block};
		next;
	    }
	} elsif ($block->{type} eq "i") {
	    ;
	} elsif ($block->{type} eq "c") {
	    my $clauses = $block->{clauses};
	    die "Must be at least 2 clauses\n" if ($#{$clauses} < 1);
	    foreach my $clause (@{$clauses}) {
		discard_empties($clause->{body});
	    }
	} else {
	    die;
	}

	$block = $block->{next_block};
	next;
    }
}

discard_empties($first_block);
validate_tree();

###############################################################################
#
# Mark up single variable only __KERNEL__ conditions and percolate marks up the
# tree.
#
###############################################################################
sub mark__KERNEL__($);
sub mark__KERNEL__($)
{
    my ($first) = @_;
    my $combined_kernel_mark = 0;

    for (my $block = $_[0]; $block; $block = $block->{next_block}) {
	next if ($block->{type} ne "c");

	my $clauses = $block->{clauses};
	my $cpp = $clauses->[0]->{cpp};

	my $kernel_mark = 0;

	if ($block->{retain}) {
	    ;
	} elsif ($cpp =~ /^#\s*ifdef\s+__KERNEL__/ ||
	    ($cpp =~ /^#\s*if\s+defined\s*\(\s*__KERNEL__\s*\)/ &&
	     $cpp !~ /[|][|]|[&][&]/)) {
	    $kernel_mark |= 1 | 4;
	} elsif ($cpp =~ /^#\s*ifndef\s+__KERNEL__/ ||
		 ($cpp =~ /^#\s*if\s+!\s*defined\s*\(\s*__KERNEL__\s*\)/ &&
		  $cpp !~ /[|][|]|[&][&]/)) {
	    $kernel_mark |= 2 | 8;
	}

	if ($kernel_mark) {
	    $clauses->[0]->{kernel_mark} = $kernel_mark;
	    if ($#{$clauses} > 1) {
		die $linuxhdr, ":", $clauses->[1]->{l}, ": __KERNEL__ guard has #elif clause\n"
		    if ($#{$clauses} > 2 || $clauses->[1]->{type} eq "elif");
		$clauses->[1]->{kernel_mark} = $kernel_mark ^ 15;
		$kernel_mark = 15;
		$clauses->[2]->{kernel_mark} = $kernel_mark;
	    } else {
		$clauses->[1]->{kernel_mark} = $kernel_mark;
	    }
	}

	foreach my $clause (@{$clauses}) {
	    die $linuxhdr, ":", $clause->{l}, ": #elif contains __KERNEL__\n"
		if ($clause->{type} eq "elif" && $clause->{cpp} =~ /__KERNEL__/);

	    if (exists $clause->{body}) {
		my $k = mark__KERNEL__($clause->{body});
		if ($k) {
		    die $linuxhdr, ":", $clause->{l}, ": Body contains nested __KERNEL__\n"
			if ($kernel_mark & 3);
		    $clause->{kernel_mark} |= $k | 8;
		    $kernel_mark = $k | 8;
		}
	    }
	}

	$block->{kernel_mark} = $kernel_mark;

	$combined_kernel_mark |= $kernel_mark;
    }

    return $combined_kernel_mark & (4 | 8);
}

mark__KERNEL__($first_block);
validate_tree();
#dump_tree(); exit 123;

###############################################################################
#
# Determine reinclusion guards and validate inclusion order checks that are
# outside the guards
#
###############################################################################
sub determine_guards()
{
    for (my $block = $first_block; $block; $block = $block->{next_block}) {
	next if ($block->{type} ne "c");

	if ($block->{clauses}->[0]->{guard}) {
	    $block->{guard} = 1;
	    $block->{kernel_mark} = 8;
	    die unless (exists $block->{guard_label});
	} elsif ($block->{clauses}->[0]->{order_check}) {
	    $block->{order_check} = 1;
	    $block->{kernel_mark} = 8;
	    die $linuxhdr, ":", $block->{l}, ": Inclusion order check with multiple clauses\n"
		unless ($#{$block->{clauses}} == 1);
	    die $linuxhdr, ":", $block->{l}, ": Inclusion order check with extra body\n"
		if ($block->{clauses}->[0]->{body});
	}
    }
}

determine_guards();
#dump_tree();
validate_tree();

###############################################################################
#
# Render the two header files
#
###############################################################################
my $include_next_at = -1;

sub render(@);
sub render(@)
{
    my $root = $#_ >= 0 ? $_[0] : $first_block;
    my $parent_kernel_mark = $#_ >= 1 ? $_[1] : 8;

    for (my $block = $root; $block; $block = $block->{next_block}) {
	my $kernel_mark = $parent_kernel_mark;

	#push @kernellines, "KM$kernel_mark\n";

	if ($block->{type} eq "n") {
	    my $is_banner = exists $block->{banner};
	    my $lines = $block->{lines};
	    push @kernellines, @{$lines} if ($is_banner || !($kernel_mark & 8));
	    push @uapilines, @{$lines} if ($is_banner || $kernel_mark & 8);
	    next;
	}

	if ($block->{type} eq "i") {
	    push @kernellines, "#include_next <$inchdr>\n";
	    next;
	}

	if ($block->{type} eq "c") {
	    my $clauses = $block->{clauses};

	    if ($block->{order_check}) {
		push(@uapilines,
		     @{$clauses->[0]->{lines}},
		     @{$clauses->[0]->{order_check}},
		     @{$clauses->[1]->{lines}});
		next;
	    }

	    if ($block->{guard}) {
		push(@kernellines,
		     @{$clauses->[0]->{lines}},
		     @{$clauses->[0]->{guard}});
		push @kernellines, "\n";

		if ($linuxhdr =~ m!^include/! &&
		    $linuxhdr !~ m@^include/asm-generic/@ &&
		    !exists($asm_includeable_linux_files{$linuxhdr})) {
		    push @kernellines, "#ifdef __ASSEMBLY__\n";
		    push @kernellines, "#error include/linux headers may not be included in .S files\n";
		    push @kernellines, "#endif\n";
		    push @kernellines, "\n";
		}

		push @kernellines, "#define __EXPORTED_HEADERS__\n"
		    if ($linuxhdr eq "include/linux/types.h");

		unless ($specified_include_point) {
		    push @kernellines, "#include_next <$inchdr>\n";
		    $include_next_at = $#kernellines;
		    push @kernellines, "\n";
		}

		push(@uapilines,
		     "#ifndef _UAPI" . $block->{guard_label} . "\n",
		     "#define _UAPI" . $block->{guard_label} . "\n");

		render($block->{clauses}->[0]->{body}, $kernel_mark);
		push(@kernellines,
		     @{$clauses->[1]->{lines}});
		push(@uapilines,
		     "#endif /* _UAPI" . $block->{guard_label} . " */\n");
		next;
	    }

	    $kernel_mark = $block->{kernel_mark} if ($block->{kernel_mark});

	    if (($kernel_mark & 3) == 0) {
		# no mention of __KERNEL__ only
		foreach my $clause (@{$clauses}) {
		    my $lines = $clause->{lines};

		    push @kernellines, @{$clause->{lines}} if ($kernel_mark & 4);
		    push @uapilines, @{$clause->{lines}} if ($kernel_mark & 8);
		    render($clause->{body}, $kernel_mark)
			if (exists $clause->{body});
		}
	    } elsif (($kernel_mark & 3) == 1) {
		# #ifdef __KERNEL__
		render($block->{clauses}->[0]->{body}, 4);
	    } elsif (($kernel_mark & 3) == 2) {
		# #ifndef __KERNEL__
		push @uapilines, @{$block->{clauses}->[0]->{lines}};
		render($block->{clauses}->[0]->{body}, 8);
		push @uapilines, @{$block->{clauses}->[1]->{lines}};
	    } else {
		if ($block->{clauses}->[0]->{kernel_mark} & 1) {
		    # #ifdef __KERNEL__ ... #else
		    render($block->{clauses}->[0]->{body}, 4);

		    my @iflines = @{$block->{clauses}->[0]->{lines}};
		    $iflines[0] =~ s/#(\s*if)def/#$1ndef/;
		    $iflines[0] =~ s/#(\s*if\s+)defined/#$1!defined/;
		    push @uapilines, @iflines;
		    render($block->{clauses}->[1]->{body}, 8);
		    push @uapilines, @{$block->{clauses}->[2]->{lines}};
		} else {
		    # #ifndef __KERNEL__ ... #else
		    render($block->{clauses}->[1]->{body}, 4);

		    push @uapilines, @{$block->{clauses}->[0]->{lines}};
		    render($block->{clauses}->[0]->{body}, 8);
		    push @uapilines, @{$block->{clauses}->[2]->{lines}};
		}
	    }
	}
    }
}

render();

###############################################################################
#
# See if a file actually has anything left in it after all the blank lines,
# comments and CPP conditionals and inclusions are removed.
#
# Returns:
#  0: non-reducible
#  1: reducible to nothing
#  2: reducible to a single #include
#  3: reducible to a multiple #includes
#
###############################################################################
sub reduce_file(@)
{
    my (@lines) = @_;

    my $blocks = 0;
    my $level = 0;
    my $guarded = 0;
    my $guardname = "";
    my $guarddefline = -2;
    my $first_if = 1;
    my $includes = 0;

    for (my $l = 0; $l <= $#lines; $l++) {
	my $line = $lines[$l];
	my $suppress = 0;

	# parse out the blocks
	# - this may be split over multiple lines using backslashes and comments
	#   that have embedded newlines
	my $block = $line;
      restart:
	$block =~ s@\s+$@@g;
	$block =~ s@\s+@ @g;

	while ($block =~ m@(/[*])@) {
	    my $o = index($block, "/*");
	    if ($block =~ m@([*]/)@) {
		my $c = index($block, "*/") + 2;
		substr($block, $o, $c - $o) = "";
	    } else {
		$l++;
		$block .= $lines[$l];
		#push @buffer, $lines[$l];
		goto restart;
	    }
	}

	if ($block =~ /^(.*)[\\]$/) {
	    $l++;
	    $block = $1 . $lines[$l];
	    #push @buffer, $lines[$l];
	    goto restart;
	}

	$block =~ s@\s+$@@g;
	$block =~ s@\s\s+@ @g;

	if ($line =~ /^#/) {
	    # handle conditional macros
	    if ($block =~ /^#\s*if/) {
		$level++;
		if ($block =~ /^#\s*ifndef\s+([_A-Za-z0-9]+)/ && $first_if == 1) {
		    $guardname = $1;
		    $guarddefline = $l + 1;
		    $first_if = 0;
		    next;
		}

		$first_if = 0;
	    } elsif ($block =~ /^#\s*endif/) {
		$level--;
		next;
	    } elsif ($block =~ /^#\s*else/) {
		next;
	    } elsif ($block =~ /^#\s*elif/) {
		next;
	    } elsif ($l == $guarddefline && $block =~ /^#\s*define\s+$guardname/) {
		next;
	    } elsif ($block =~ /^#\s*include_next/) {
		next;
	    } elsif ($block =~ /^#\s*include/) {
		$includes++;
		next;
	    } elsif ($block =~ /^#error only arch headers may be included in asm/) {
		next;
	    }
 
	} elsif ($block eq "") {
	    next;
	}

	#print "[", $block, "]\n";
	$blocks++;
    }

    die $linuxhdr, ": #if/#endif level mismatch ($level)\n"
	if ($level != 0);

    return 0 if ($blocks > 0);
    return 2 if ($includes == 1);
    return 3 if ($includes > 0);
    return 1;
}

###############################################################################
#
# Attempt to slide down the #include_next to after the #include set if it was
# added automatically (if it was manually specified, then we leave it where it
# is).
#
###############################################################################
sub slide_include_next()
{
    # first of all, locate the #include_next
    my $include_next = $kernellines[$include_next_at];
    die if ($include_next !~ m/#include_next/);

    my $here = -1;
    my $if_level = 0;
    my $cond_include = 0;
    for (my $l = $include_next_at + 1; $l <= $#kernellines; $l++) {
	my $line = $kernellines[$l];
	chomp $line;

	if ($line eq "") {
	} elsif ($line =~ /#\s*include\s+<([^>]*)>/) {
	    last if ($1 eq "linux/byteorder/generic.h");
	    if ($if_level == 0) {
		$here = $l;
	    } else {
		$cond_include = 1;
	    }
	} elsif ($line =~ /#\s*if/) {
	    $if_level++;
	} elsif ($line =~ /#\s*else/) {
	} elsif ($line =~ /#\s*elif/) {
	} elsif ($line =~ /#\s*endif/) {
	    $if_level--;
	    if ($if_level == 0) {
		$here = $l if ($cond_include);
		$cond_include = 0;
	    }
	} else {
	    last;
	}
    }

    if ($here > -1) {
	splice @kernellines, $include_next_at, 2;
	splice @kernellines, $here - 1, 0, $include_next;
	splice @kernellines, $here, 0, "\n" unless ($kernellines[$here] eq "\n");
    }
}

slide_include_next() if ($include_next_at > -1);

###############################################################################
#
#
#
###############################################################################
output:
    ;

#print @kernellines;
#print "_" x 79, "\n";
#print @uapilines;

my $kred = reduce_file(@kernellines);
my $ured = reduce_file(@uapilines);

#print "kred: ", $kred, "\n";
#print "ured: ", $ured, "\n";
#exit 123;

if ($ured == 2) {
    @uapilines = grep /^#\s*include/, @uapilines;
} elsif ($ured == 1) {
    @uapilines = ();
}

if ($kred == 1) {
    # if all we're doing is #include_next'ing the UAPI header, then we may as
    # well delete the file and let CPP include the UAPI header directly
    @kernellines = ();
    @uapilines = @lines;
}

my $uapidir = $uapihdr;
$uapidir = $1 if ($uapidir =~ m!(.*)/!);
mkpath($uapidir) if (! -d $uapidir);

if ($#kernellines >= 0) {
    # we must create a UAPI header, even if it is blank
    open(FD, '>', $uapihdr) or die "$uapihdr: $!\n";
    print FD @uapilines or die "$uapihdr: $!\n";
    close FD or die "$uapihdr: $!\n";

    my $linuxhdrorig = $linuxhdr . ".orig";
    open(FD, '>', $linuxhdrorig) or die $linuxhdrorig, ": $!\n";
    print FD @kernellines or die $linuxhdrorig, ": $!\n";
    close FD or die $linuxhdrorig, ": $!\n";
    rename $linuxhdrorig, $linuxhdr or die $linuxhdr, ": $!\n";
} else {
    rename $linuxhdr, $uapihdr or die $uapihdr, ": $!\n";
}

###############################################################################
#
# Add the file to the uapi Kbuild file
#
###############################################################################
my $uapi_kbuild = $uapidir . "/Kbuild";

die "$uapi_kbuild: Not found\n" unless (-f $uapi_kbuild);

my $hdrname;
$uapihdr =~ m@([^/]*)$@, $hdrname = $1;

open(FD, '>>', $uapi_kbuild) or die "$uapi_kbuild: $!\n";

if ($linuxhdr eq "include/linux/a.out.h" ||
    $linuxhdr eq "include/linux/kvm.h" ||
    $linuxhdr eq "include/linux/kvm_para.h"
    ) {
    print FD
	"\n",
	'ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/', $hdrname, " \\\n",
	"\t\t", '  $(srctree)/include/asm-$(SRCARCH)/', $hdrname, " \\\n",
	"\t\t", '  $(INSTALL_HDR_PATH)/include/asm-*/', $hdrname, "),)\n",
	"header-y += ", $hdrname, "\n",
	"endif\n\n"
	or die "$uapi_kbuild: $!\n";
} else {
    print FD "header-y += $hdrname\n" or die "$uapi_kbuild: $!\n";
}

close FD or die "$uapi_kbuild: $!\n";


###############################################################################
#
# Delete the file from the include/ Kbuild file
#
###############################################################################
my $linuxdir;
$linuxhdr =~ m@(.*)/[^/]*$@, $linuxdir = $1;
my $linux_kbuild = $linuxdir . "/Kbuild";

open(FD, '<', $linux_kbuild) or die $linux_kbuild, ": $!\n";
my @kblines = <FD> or die $linux_kbuild, ": $!\n";
close(FD) or die $linux_kbuild, ": $!\n";

my $temp = $linux_kbuild . ".temp";
open(FD, '>', $temp) or die "$temp: $!\n";
foreach my $kbline (@kblines) {
    if ($kbline =~ m@^header-y\s+[+]=\s+([a-zA-Z0-9_.-]+)@) {
	next if ($1 eq $hdrname);
    }
    print FD $kbline or die "$temp: $!\n";
}
close FD or die "$temp: $!\n";
rename $temp, $linux_kbuild or die "$temp -> $linux_kbuild: $!\n";

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: genlist.pl --]
[-- Type: text/x-perl, Size: 1828 bytes --]

#!/usr/bin/perl -w

use File::Find;

#
# We assume that only Kbuild files in include directories are pertinent to
# determining which headers are UAPI headers.
#
@kbuilds = ();
%headers = ();
sub find_Kbuild()
{
    push(@kbuilds, $File::Find::name) if ($_ eq "Kbuild");
    $headers{$File::Find::name} = 1 if ($_ =~ /[.]h$/ || $_ =~ /[.]agh$/);
}

find(\&find_Kbuild, "arch", "include");

# Read the common arch list
open FD, '<include/asm-generic/Kbuild.asm' or die "open Kbuild.asm: $!\n";
my @kbuild_asm = <FD>;
close FD or die;

my %uapihdrs = ();

foreach my $i (sort(grep { $_ !~ m@uapi/@ } @kbuilds)) {
    #print "[[[ $i ]]]\n";

    my $dir = $i;
    $dir =~ m@(^.*)/@, $dir = $1;

    open FD, '<', $i or die "open $i: $!\n";
    my @lines = <FD>;
    close FD or die;

    for (my $l = 0; $l <= $#lines; $l++) {
	my $line = $lines[$l];

	# parse out the blocks
	# - this may be split over multiple lines using backslashes
	my $block = $line;
      restart:
	$block =~ s@#.*$@@;
	$block =~ s@\s+$@@g;
	$block =~ s@\s+@ @g;

	if ($block =~ /^(.*)[\\]$/) {
	    $l++;
	    $block = $1 . $lines[$l];
	    goto restart;
	}

	$block =~ s@\s+$@@g;
	$block =~ s@\s\s+@ @g;

	if ($block =~ m@^include include/asm-generic/Kbuild.asm@) {
	    push @lines, @kbuild_asm;
	}

	if ($block =~ m@^header-y\s*[+:]?=\s*(.*)@ ||
	    $block =~ m@^opt-header\s*[+:]?=\s*(.*)@ ||
	    $block =~ m@^asm-headers\s*[+:]?=\s*(.*)@
	    ) {
	    foreach $h (map { "$dir/" . $_ } grep m@[^/]$@, split /\s+/, $1) {
		if (exists $headers{$h}) {
		    $uapihdrs{$h} = 1;
		}
	    }
	}
    }
}

if ($#ARGV == -1) {
    # no arguments: all listed header files
    print map { $_ . "\n"; } sort keys %uapihdrs;
} else {
    # any arguments: all unlisted header files
    print map { $_ . "\n"; } sort grep { !exists $uapihdrs{$_}; } keys %headers;
}

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: disintegrate-to-git-by-dir.pl --]
[-- Type: text/x-perl, Size: 1525 bytes --]

#!/usr/bin/perl -w
#
# Perform header disintegration of the user API, producing commits on a
# dir-by-dir basis to GIT
#

use strict;
use File::Basename;

my $main_branch = "uapi-split";

my $UAPI = "uapi";

$ENV{UAPI} = "uapi";

my $execdir = dirname($0);

sub commit($@) {
    my ($dirname, @files) = @_;

    system("git commit -m 'UAPI: Disintegrate $dirname\n\nSigned-off-by: David Howells <dhowells\@redhat.com>\n' " . join(" ", @files)) == 0 or die;
}

###############################################################################
#
#
#
###############################################################################
system("git checkout $main_branch") == 0 or die;

my $curdir = "xxxxx";

my @headerlist = sort {
    dirname($a) cmp dirname($b) || $a cmp $b;
} `$execdir/genlist.pl`;

my @files = ();
foreach my $origfile (@headerlist) {
    chomp $origfile;
    if (! -f $origfile) {
	print "Skip $origfile\n";
	next;
    }

    my $odir = dirname($origfile);

    if ($odir ne $curdir) {
	print "[]";

	commit($curdir, @files) unless ($curdir eq "xxxxx");
	$curdir = $odir;
	@files = ();
    }

    print "$origfile\n";
    my $uapifile = $origfile;
    $uapifile =~ s@include/@$UAPI/@;
    my $udir = dirname($uapifile);

    system("$execdir/disintegrate-one.pl $origfile $uapifile") == 0 or die;

    if (-r $uapifile) {
	push @files, $uapifile;
	system("git add $uapifile") == 0 or die;
    }
    push @files, "$udir/Kbuild", $origfile, "$odir/Kbuild";
}

commit($curdir, @files) unless ($curdir eq "xxxxx");

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 00/35] UAPI header file split
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (33 preceding siblings ...)
  2011-07-02 11:33 ` [PATCH 00/35] UAPI header file split - scripts David Howells
@ 2011-07-05 20:46 ` Randy Dunlap
  2011-07-06 11:04 ` David Howells
  35 siblings, 0 replies; 37+ messages in thread
From: Randy Dunlap @ 2011-07-05 20:46 UTC (permalink / raw)
  To: David Howells; +Cc: linux-arch

On Sat, 02 Jul 2011 12:07:26 +0100 David Howells wrote:

> 
> Here's my first installment of patches to clean up the kernel header files and
> sort out the recursion problems.  The planned steps are:
> ==
> 
> The patches actually posted here are the manual preparation for the UAPI split
> in step (1) above.  I haven't posted the patches that do the actual splitting
> by email as the largest of them is in excess of 120,000 lines.  However, the
> patches are available through GIT:
> 
> 	http://git.infradead.org/users/dhowells/linux-headers.git


Hi,

I didn't see patch 02/35 nor patch 30/35.
Were they too large to be posted?

thanks,
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 00/35] UAPI header file split
  2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
                   ` (34 preceding siblings ...)
  2011-07-05 20:46 ` [PATCH 00/35] UAPI header file split Randy Dunlap
@ 2011-07-06 11:04 ` David Howells
  35 siblings, 0 replies; 37+ messages in thread
From: David Howells @ 2011-07-06 11:04 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: dhowells, linux-arch

Randy Dunlap <rdunlap@xenotime.net> wrote:

> I didn't see patch 02/35 nor patch 30/35.
> Were they too large to be posted?

Well, too large to go through the linux-arch list.  They are both script
produced:

[PATCH 02/35] UAPI: Audit drivers/gpu/ for #include "..." referring to system headers
[PATCH 30/35] UAPI: Set up UAPI Kbuild files

The first is >4800 lines and the second is >7800 lines.

They are in GIT:

http://git.infradead.org/users/dhowells/linux-headers.git/commit/c748988cf4f4fe34f609e122f4af5e1274b9b8af

http://git.infradead.org/users/dhowells/linux-headers.git/commit/57685bc646eb0da571faf7b8f50bd5acd22a229f

David

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2011-07-06 11:04 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-02 11:07 [PATCH 00/35] UAPI header file split David Howells
2011-07-02 11:07 ` [PATCH 01/35] UAPI: Convert #include "..." to #include <path/...> in kernel system headers David Howells
2011-07-02 11:08 ` [PATCH 03/35] UAPI: Add uapi/ include directory to build David Howells
2011-07-02 11:08 ` [PATCH 04/35] UAPI: Differentiate userspace build and kernelspace build include path sets David Howells
2011-07-02 11:08 ` [PATCH 05/35] UAPI: Fix AHZ multiple inclusion when __KERNEL__ is removed David Howells
2011-07-02 11:08 ` [PATCH 06/35] UAPI: ac_etime in linux/acct.h must keep its __KERNEL__ guards David Howells
2011-07-02 11:08 ` [PATCH 07/35] UAPI: Make linux/patchkey.h easier to parse David Howells
2011-07-02 11:08 ` [PATCH 08/35] UAPI: Don't have a #elif clause in a __KERNEL__ guard in linux/soundcard.h David Howells
2011-07-02 11:08 ` [PATCH 09/35] UAPI: Fix nested __KERNEL__ guards in video/edid.h David Howells
2011-07-02 11:09 ` [PATCH 10/35] UAPI: Split trivial #if defined(__KERNEL__) && X conditionals David Howells
2011-07-02 11:09 ` [PATCH 11/35] UAPI: Remove the inclusion of linux/types.h from x86's asm/page.h David Howells
2011-07-02 11:09 ` [PATCH 12/35] UAPI: Fix definition of HZ in asm-generic/param.h David Howells
2011-07-02 11:09 ` [PATCH 13/35] UAPI: elf_read_implies_exec() is a kernel-only feature - so hide from userspace David Howells
2011-07-02 11:09 ` [PATCH 14/35] UAPI: Fix sigset_t ordering problem David Howells
2011-07-02 11:09 ` [PATCH 15/35] UAPI: Fix E820_X_MAX " David Howells
2011-07-02 11:09 ` [PATCH 16/35] UAPI: Fix linux/netfilter.h inclusion order David Howells
2011-07-02 11:10 ` [PATCH 17/35] UAPI: Fix linux/input.h " David Howells
2011-07-02 11:10 ` [PATCH 18/35] UAPI: Fix up linux/netfilter/xt_policy.h David Howells
2011-07-02 11:10 ` [PATCH 19/35] UAPI: Fix linux/auto_fs.h inclusion order David Howells
2011-07-02 11:10 ` [PATCH 20/35] UAPI: Fix drmP.h to use #include <...> when referring to system header files David Howells
2011-07-02 11:10 ` [PATCH 21/35] UAPI: sound/sound_core.c should include linux/fs.h David Howells
2011-07-02 11:10 ` [PATCH 22/35] UAPI: Fix SNDRV_*_ENDIAN ordering problem David Howells
2011-07-02 11:10 ` [PATCH 23/35] UAPI: Fix u_quad_t ordering problem in linux/coda.h David Howells
2011-07-02 11:11 ` [PATCH 24/35] UAPI: Fix linux/coda.h David Howells
2011-07-02 11:11 ` [PATCH 25/35] UAPI: Guard linux/isdn_divertif.h David Howells
2011-07-02 11:11 ` [PATCH 26/35] UAPI: Guard linux/sound.h David Howells
2011-07-02 11:11 ` [PATCH 27/35] UAPI: Fix linux/ncp.h David Howells
2011-07-02 11:11 ` [PATCH 28/35] UAPI: Fix x86_64 system call count and generation David Howells
2011-07-02 11:11 ` [PATCH 29/35] UAPI: Fix arch/mips/include/asm/Kbuild to have separate header-y lines David Howells
2011-07-02 11:12 ` [PATCH 31/35] UAPI: Plumb the UAPI Kbuilds into the user header handling system David Howells
2011-07-02 11:12 ` [PATCH 32/35] UAPI: Set up uapi/asm/Kbuild.asm David Howells
2011-07-02 11:12 ` [PATCH 33/35] UAPI: Move linux/version.h David Howells
2011-07-02 11:12 ` [PATCH 34/35] UAPI: Make UAPI headers install to usr/include/ David Howells
2011-07-02 11:12 ` [PATCH 35/35] UAPI: Fix the page-types query program in the docs David Howells
2011-07-02 11:33 ` [PATCH 00/35] UAPI header file split - scripts David Howells
2011-07-05 20:46 ` [PATCH 00/35] UAPI header file split Randy Dunlap
2011-07-06 11:04 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).