Subject: Re: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch)

From: Arnd Bergmann <[email-masked]>
Date: Fri, 5 Aug 2005 13:53:22 +0200

On Freedag 05 August 2005 09:47, Stephen Rothwell wrote:
> cd linux/include
> mkdir asm-powerpc
> cd asm-ppc
> for i in *
> do
>         [ -e ../asm-ppc64/$i ] || mv $i ../asm-powerpc/$i
> done
> cd ../asm-ppc64
> for i in *
> do
>         [ -e ../asm-ppc/$i ] || mv $i ../asm-powerpc/$i
> done

While I really like your approach in general (I've done it the
same way when merging asm-s390{,x]), I think we should take
a little care to move only the files that we really want in
asm/powerpc.
E.g, most of the files that are in asm-ppc but not in asm-ppc64
seem so be board-specific or cpu-specific, so I'd not move them
around before (unless) moving the platform code for those as well.

Also, for everything below include/asm-ppc64/iSeries, it would
make sense to rename the files to lowercase in the same
step and change all their users.

> for i in *
> do
>         [ -f ../asm-ppc64/$i ] && cmp -s $i ../asm-ppc64/$i &&
>                 mv $i ../asm-powerpc/$i && rm ../asm-ppc64/$i
> done

Another help for merging further is to do 

for i in `ls include/asm-ppc` ; do 
	if [ -e include/asm-ppc64/$i ] ; then
		diff --ifdef __powerpc64__ include/asm-{ppc,ppc64}/$i > \
			include/asm-generic/$i ;
	fi
done

Note that you need to hand-edit practically every file that you get from
this, but many of them become trivial to merge.

Another interesting point about it is which define to use. For s390, we
decided to '#ifdef __s390x__' rather than '#ifdef CONFIG_ARCH_S390X' or
'ifdef CONFIG_64BIT', because CONFIG_* does not work when including the
headers from user space.
Using CONFIG_64BIT instead of __powerpc64__ only within #ifdef __KERNEL__
would be correct but less consistant.

	Arnd <><