From: Randy Dunlap <randy.dunlap@oracle.com>

Fixes kernel bugzilla #8242:

CONFIG_BLK_DEV_MD (md/raid driver) needs csum_partial(),
even when CONFIG_NET=n and BLK_DEV_MD=m, so build it as an
object to force it being built and available.

Having it only in lib-y allows it to be dropped at kernel
build time if no other builtin code uses it.
However, having it listed in both lib-y and obj-[ym] is not
a problem (according to Doc/kbuild/makefiles.txt).

powerpc, ppc, & um use obj-, not lib-, so they don't need
any changes.

I don't see s390 providing csum_partial() at all.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 arch/alpha/Kconfig              |    4 ++++
 arch/alpha/lib/Makefile         |    4 ++++
 arch/arm/Kconfig                |    4 ++++
 arch/arm/lib/Makefile           |    4 ++++
 arch/arm26/Kconfig              |    4 ++++
 arch/arm26/lib/Makefile         |    4 ++++
 arch/avr32/Kconfig              |    4 ++++
 arch/avr32/lib/Makefile         |    4 ++++
 arch/cris/Kconfig               |    4 ++++
 arch/cris/arch-v10/lib/Makefile |    3 +++
 arch/cris/arch-v32/lib/Makefile |    3 +++
 arch/frv/Kconfig                |    4 ++++
 arch/frv/lib/Makefile           |    4 ++++
 arch/h8300/Kconfig              |    4 ++++
 arch/h8300/lib/Makefile         |    4 ++++
 arch/i386/Kconfig               |    4 ++++
 arch/i386/lib/Makefile          |    5 +++++
 arch/ia64/Kconfig               |    4 ++++
 arch/ia64/lib/Makefile          |    2 ++
 arch/m32r/Kconfig               |    4 ++++
 arch/m32r/lib/Makefile          |    3 +++
 arch/m68k/Kconfig               |    4 ++++
 arch/m68k/lib/Makefile          |    4 ++++
 arch/m68knommu/Kconfig          |    4 ++++
 arch/m68knommu/lib/Makefile     |    4 ++++
 arch/mips/Kconfig               |    4 ++++
 arch/mips/lib/Makefile          |    2 ++
 arch/parisc/Kconfig             |    4 ++++
 arch/parisc/lib/Makefile        |    2 ++
 arch/powerpc/Kconfig            |    3 +++
 arch/sh/Kconfig                 |    4 ++++
 arch/sh/lib/Makefile            |    3 +++
 arch/sh64/Kconfig               |    4 ++++
 arch/sh64/lib/Makefile          |    3 +++
 arch/sparc/Kconfig              |    4 ++++
 arch/sparc/lib/Makefile         |    4 ++--
 arch/sparc64/Kconfig            |    4 ++++
 arch/sparc64/lib/Makefile       |    2 ++
 arch/v850/Kconfig               |    4 ++++
 arch/v850/lib/Makefile          |    4 ++++
 arch/x86_64/Kconfig             |    4 ++++
 arch/x86_64/lib/Makefile        |    2 ++
 arch/xtensa/Kconfig             |    4 ++++
 arch/xtensa/lib/Makefile        |    4 ++++
 drivers/md/Kconfig              |    1 +
 45 files changed, 160 insertions(+), 2 deletions(-)

--- linux-2621-rc4g7-csum.orig/arch/x86_64/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/x86_64/lib/Makefile
@@ -5,7 +5,9 @@
 CFLAGS_csum-partial.o := -funroll-loops
 
 obj-y := io.o iomap_copy.o
+obj-m :=
 obj-$(CONFIG_SMP)	+= msr-on-cpu.o
+obj-$(CONFIG_CSUM_PARTIAL)	+= csum-partial.o
 
 lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \
 	usercopy.o getuser.o putuser.o  \
--- linux-2621-rc4g7-csum.orig/drivers/md/Kconfig
+++ linux-2621-rc4g7-csum/drivers/md/Kconfig
@@ -15,6 +15,7 @@ config MD
 config BLK_DEV_MD
 	tristate "RAID support"
 	depends on MD
+	select CSUM_PARTIAL
 	---help---
 	  This driver lets you combine several hard disk partitions into one
 	  logical block device. This can be used to simply append one
--- linux-2621-rc4g7-csum.orig/arch/x86_64/Kconfig
+++ linux-2621-rc4g7-csum/arch/x86_64/Kconfig
@@ -121,6 +121,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default n
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 
--- linux-2621-rc4g7-csum.orig/arch/alpha/Kconfig
+++ linux-2621-rc4g7-csum/arch/alpha/Kconfig
@@ -66,6 +66,10 @@ config AUTO_IRQ_AFFINITY
 	depends on SMP
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 
--- linux-2621-rc4g7-csum.orig/arch/alpha/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/alpha/lib/Makefile
@@ -42,6 +42,10 @@ lib-y =	__divqu.o __remqu.o __divlu.o __
 
 lib-$(CONFIG_SMP) += dec_and_lock.o
 
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
+
 # The division routines are built from single source, with different defines.
 AFLAGS___divqu.o = -DDIV
 AFLAGS___remqu.o =       -DREM
--- linux-2621-rc4g7-csum.orig/arch/frv/Kconfig
+++ linux-2621-rc4g7-csum/arch/frv/Kconfig
@@ -53,6 +53,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 mainmenu "Fujitsu FR-V Kernel Configuration"
 
 source "init/Kconfig"
--- linux-2621-rc4g7-csum.orig/arch/frv/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/frv/lib/Makefile
@@ -6,3 +6,7 @@ lib-y := \
 	__ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \
 	checksum.o memcpy.o memset.o atomic-ops.o \
 	outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o
+
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/h8300/Kconfig
+++ linux-2621-rc4g7-csum/arch/h8300/Kconfig
@@ -68,6 +68,10 @@ config PCI
 	bool
 	default n
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 source "arch/h8300/Kconfig.cpu"
--- linux-2621-rc4g7-csum.orig/arch/h8300/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/h8300/lib/Makefile
@@ -6,3 +6,7 @@
 	$(CC) $(AFLAGS) -D__ASSEMBLY__ -c $< -o $@
 
 lib-y  = ashrdi3.o checksum.o memcpy.o memset.o abs.o romfs.o
+
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/m32r/Kconfig
+++ linux-2621-rc4g7-csum/arch/m32r/Kconfig
@@ -31,6 +31,10 @@ config GENERIC_IRQ_PROBE
 config NO_IOPORT
 	def_bool y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 
--- linux-2621-rc4g7-csum.orig/arch/m32r/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/m32r/lib/Makefile
@@ -5,3 +5,6 @@
 lib-y  := checksum.o ashxdi3.o memset.o memcpy.o \
 	  delay.o strlen.o usercopy.o csum_partial_copy.o
 
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/sh64/Kconfig
+++ linux-2621-rc4g7-csum/arch/sh64/Kconfig
@@ -44,6 +44,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default n
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source init/Kconfig
 
 menu "System type"
--- linux-2621-rc4g7-csum.orig/arch/sh64/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/sh64/lib/Makefile
@@ -17,3 +17,6 @@
 lib-y  := udelay.o c-checksum.o dbg.o io.o panic.o memcpy.o copy_user_memcpy.o \
 		page_copy.o page_clear.o iomap.o
 
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += c-checksum.o
--- linux-2621-rc4g7-csum.orig/arch/v850/Kconfig
+++ linux-2621-rc4g7-csum/arch/v850/Kconfig
@@ -49,6 +49,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default n
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 # Turn off some random 386 crap that can affect device config
 config ISA
 	bool
--- linux-2621-rc4g7-csum.orig/arch/v850/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/v850/lib/Makefile
@@ -4,3 +4,7 @@
 
 lib-y  = ashrdi3.o ashldi3.o lshrdi3.o muldi3.o negdi2.o \
 	 checksum.o memcpy.o memset.o
+
+obj-y :=
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/parisc/Kconfig
+++ linux-2621-rc4g7-csum/arch/parisc/Kconfig
@@ -81,6 +81,10 @@ config ARCH_MAY_HAVE_PC_FDC
 	depends on BROKEN
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 
--- linux-2621-rc4g7-csum.orig/arch/parisc/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/parisc/lib/Makefile
@@ -5,3 +5,5 @@
 lib-y	:= lusercopy.o bitops.o checksum.o io.o memset.o fixup.o memcpy.o
 
 obj-y	:= iomap.o
+obj-m	:=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/ia64/Kconfig
+++ linux-2621-rc4g7-csum/arch/ia64/Kconfig
@@ -85,6 +85,10 @@ config AUDIT_ARCH
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 choice
 	prompt "System type"
 	default IA64_GENERIC
--- linux-2621-rc4g7-csum.orig/arch/ia64/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/ia64/lib/Makefile
@@ -3,6 +3,8 @@
 #
 
 obj-y := io.o
+obj-m :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
 
 lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o			\
 	__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o			\
--- linux-2621-rc4g7-csum.orig/arch/m68k/Kconfig
+++ linux-2621-rc4g7-csum/arch/m68k/Kconfig
@@ -45,6 +45,10 @@ config ARCH_MAY_HAVE_PC_FDC
 config NO_IOPORT
 	def_bool y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 mainmenu "Linux/68k Kernel Configuration"
 
 source "init/Kconfig"
--- linux-2621-rc4g7-csum.orig/arch/m68k/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/m68k/lib/Makefile
@@ -6,3 +6,7 @@ EXTRA_AFLAGS := -traditional
 
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
 	   checksum.o string.o semaphore.o uaccess.o
+
+obj-y	:=
+obj-m	:=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/m68knommu/Kconfig
+++ linux-2621-rc4g7-csum/arch/m68knommu/Kconfig
@@ -56,6 +56,10 @@ config TIME_LOW_RES
 config NO_IOPORT
 	def_bool y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "Processor type and features"
--- linux-2621-rc4g7-csum.orig/arch/m68knommu/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/m68knommu/lib/Makefile
@@ -5,3 +5,7 @@
 lib-y	:= ashldi3.o ashrdi3.o lshrdi3.o \
 	   muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
 	   checksum.o semaphore.o memcpy.o memset.o delay.o
+
+obj-y	:=
+obj-m	:=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/i386/Kconfig
+++ linux-2621-rc4g7-csum/arch/i386/Kconfig
@@ -83,6 +83,10 @@ config DMI
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "Processor type and features"
--- linux-2621-rc4g7-csum.orig/arch/i386/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/i386/lib/Makefile
@@ -8,4 +8,9 @@ lib-y = checksum.o delay.o usercopy.o ge
 
 lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
 
+$(obj)/checksum.o: $(src)checksum.S
+
+obj-y :=
+obj-m :=
 obj-$(CONFIG_SMP)	+= msr-on-cpu.o
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/cris/Kconfig
+++ linux-2621-rc4g7-csum/arch/cris/Kconfig
@@ -51,6 +51,10 @@ config CRIS
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "General setup"
--- linux-2621-rc4g7-csum.orig/arch/cris/arch-v10/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/cris/arch-v10/lib/Makefile
@@ -7,3 +7,6 @@ EXTRA_AFLAGS := -traditional
 
 lib-y  = checksum.o checksumcopy.o string.o usercopy.o memset.o csumcpfruser.o
 
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/cris/arch-v32/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/cris/arch-v32/lib/Makefile
@@ -4,3 +4,6 @@
 
 lib-y  = checksum.o checksumcopy.o string.o usercopy.o memset.o csumcpfruser.o spinlock.o
 
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/sh/Kconfig
+++ linux-2621-rc4g7-csum/arch/sh/Kconfig
@@ -70,6 +70,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default n
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "System type"
--- linux-2621-rc4g7-csum.orig/arch/sh/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/sh/lib/Makefile
@@ -11,3 +11,6 @@ memcpy-$(CONFIG_CPU_SH4)	:= memcpy-sh4.o
 
 lib-y	+= $(memcpy-y)
 
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/sparc/Kconfig
+++ linux-2621-rc4g7-csum/arch/sparc/Kconfig
@@ -21,6 +21,10 @@ config GENERIC_ISA_DMA
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "General machine setup"
--- linux-2621-rc4g7-csum.orig/arch/sparc/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/sparc/lib/Makefile
@@ -5,9 +5,9 @@
 EXTRA_AFLAGS := -ansi -DST_DIV0=0x02
 
 lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
-         strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \
+         strlen.o blockops.o memscan.o memcmp.o strncmp.o \
 	 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
 	 copy_user.o locks.o atomic.o \
 	 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o
 
-obj-y += iomap.o atomic32.o
+obj-y += iomap.o atomic32.o checksum.o
--- linux-2621-rc4g7-csum.orig/arch/sparc64/Kconfig
+++ linux-2621-rc4g7-csum/arch/sparc64/Kconfig
@@ -98,6 +98,10 @@ config SECCOMP
 
 	  If unsure, say Y. Only embedded should say N here.
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source kernel/Kconfig.hz
 
 source "init/Kconfig"
--- linux-2621-rc4g7-csum.orig/arch/sparc64/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/sparc64/lib/Makefile
@@ -17,3 +17,5 @@ lib-y := PeeCeeI.o copy_page.o clear_pag
 	 mcount.o ipcsum.o rwsem.o xor.o delay.o
 
 obj-y += iomap.o
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/xtensa/Kconfig
+++ linux-2621-rc4g7-csum/arch/xtensa/Kconfig
@@ -49,6 +49,10 @@ config ARCH_HAS_ILOG2_U64
 config NO_IOPORT
 	def_bool y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "Processor type and features"
--- linux-2621-rc4g7-csum.orig/arch/xtensa/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/xtensa/lib/Makefile
@@ -5,3 +5,7 @@
 lib-y	+= memcopy.o memset.o checksum.o strcasecmp.o \
 	   usercopy.o strncpy_user.o strnlen_user.o
 lib-$(CONFIG_PCI) += pci-auto.o
+
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += checksum.o
--- linux-2621-rc4g7-csum.orig/arch/mips/Kconfig
+++ linux-2621-rc4g7-csum/arch/mips/Kconfig
@@ -12,6 +12,10 @@ config ZONE_DMA
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 choice
 	prompt "System type"
 	default SGI_IP22
--- linux-2621-rc4g7-csum.orig/arch/mips/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/mips/lib/Makefile
@@ -6,7 +6,9 @@ lib-y	+= csum_partial.o memcpy.o memcpy-
 	   strncpy_user.o strnlen_user.o uncached.o
 
 obj-y			+= iomap.o
+obj-m :=
 obj-$(CONFIG_PCI)	+= iomap-pci.o
+obj-$(CONFIG_CSUM_PARTIAL) += csum_partial.o
 
 # libgcc-style stuff needed in the kernel
 lib-y += ashldi3.o ashrdi3.o lshrdi3.o
--- linux-2621-rc4g7-csum.orig/arch/avr32/Kconfig
+++ linux-2621-rc4g7-csum/arch/avr32/Kconfig
@@ -68,6 +68,10 @@ config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "System Type and features"
--- linux-2621-rc4g7-csum.orig/arch/avr32/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/avr32/lib/Makefile
@@ -9,3 +9,7 @@ lib-y	+= csum_partial.o csum_partial_cop
 lib-y	+= io-readsw.o io-readsl.o io-writesw.o io-writesl.o
 lib-y	+= io-readsb.o io-writesb.o
 lib-y	+= __avr32_lsl64.o __avr32_lsr64.o __avr32_asr64.o
+
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += csum_partial.o
--- linux-2621-rc4g7-csum.orig/arch/arm/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/arm/lib/Makefile
@@ -42,5 +42,9 @@ lib-$(CONFIG_ARCH_CLPS7500)	+= io-acorn.
 lib-$(CONFIG_ARCH_L7200)	+= io-acorn.o
 lib-$(CONFIG_ARCH_SHARK)	+= io-shark.o
 
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += csumpartial.o
+
 $(obj)/csumpartialcopy.o:	$(obj)/csumpartialcopygeneric.S
 $(obj)/csumpartialcopyuser.o:	$(obj)/csumpartialcopygeneric.S
--- linux-2621-rc4g7-csum.orig/arch/arm26/Kconfig
+++ linux-2621-rc4g7-csum/arch/arm26/Kconfig
@@ -70,6 +70,10 @@ config GENERIC_ISA_DMA
 config ARCH_MAY_HAVE_PC_FDC
 	bool
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 
--- linux-2621-rc4g7-csum.orig/arch/arm26/lib/Makefile
+++ linux-2621-rc4g7-csum/arch/arm26/lib/Makefile
@@ -21,6 +21,10 @@ lib-n		:=
 
 lib-$(CONFIG_VT)+= kbd.o
 
+obj-y  :=
+obj-m  :=
+obj-$(CONFIG_CSUM_PARTIAL) += csumpartial.o
+
 csumpartialcopy.o: csumpartialcopygeneric.S
 csumpartialcopyuser.o: csumpartialcopygeneric.S
 
--- linux-2621-rc4g7-csum.orig/arch/powerpc/Kconfig
+++ linux-2621-rc4g7-csum/arch/powerpc/Kconfig
@@ -118,6 +118,9 @@ config DEFAULT_UIMAGE
 	  Used to allow a board to specify it wants a uImage built by default
 	default n
 
+config CSUM_PARTIAL
+	def_bool y
+
 menu "Processor support"
 choice
 	prompt "Processor Type"
--- linux-2621-rc4g7-csum.orig/arch/arm/Kconfig
+++ linux-2621-rc4g7-csum/arch/arm/Kconfig
@@ -129,6 +129,10 @@ config VECTORS_BASE
 	help
 	  The base address of exception vectors.
 
+config CSUM_PARTIAL
+	tristate
+	default n
+
 source "init/Kconfig"
 
 menu "System Type"
