md:Add place to update ->recovery_cp.

In resyncing, recovery_cp only updated when resync aborted or completed.
But in md drives,many place used it to judge.So add a place to update.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
md: Update checkpoint of resync/recovery based on time.

md will current only only checkpoint recovery or resync ever 1/16th
of the device size.  As devices get larger this can become a long time
an so a lot of work that might need to be duplicated after a shutdown.

So add a time-based checkpoint.  Every 5 minutes limits the amount of
duplicated effort to at most 5 minutes, and has almost zero impact on
performance.

[changelog entry re-written by NeilBrown]

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
lib/raid6: Add AVX2 optimized recovery functions

Optimize RAID6 recovery functions to take advantage of
the 256-bit YMM integer instructions introduced in AVX2.

The patch was tested and benchmarked before submission.
However hardware is not yet released so benchmark numbers
cannot be reported.

Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
UAPI: (Scripted) Disintegrate arch/blackfin/include/asm

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
blackfin: Use Kbuild infrastructure for kvm_para.h

All the headers but kvm_para.h use the Kbuild infrastructure to
get to the asm-generic headers.

Cc: linux-kbuild@vger.kernel.org
Cc: uclinux-dist-devel@blackfin.uclinux.org
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: Annotate strncpy_from_user src parameter with __user

The src parameter of strncpy_from_user is supposed to take a string from
userspace, so it should be annotated with __user. Doing so fixes the following
and similar warnings from sparse:

	kernel/sys.c:491:51: warning: incorrect type in argument 2 (different address spaces)
	kernel/sys.c:491:51:    expected char const *src
	kernel/sys.c:491:51:    got void [noderef] <asn:1>*arg
	kernel/sys.c:2061:54: warning: incorrect type in argument 2 (different address spaces)
	kernel/sys.c:2061:54:    expected char const *src
	kernel/sys.c:2061:54:    got char [noderef] <asn:1>*<noident>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: Add missing __user annotations to put_user

typeof() will not inherit the __user annotation so we have to explicitly
specify this for '_p'.

This fixes the following and quite a few similar warnings from spatch:

	kernel/sys.c:884:26: warning: incorrect type in initializer (different address spaces)
	kernel/sys.c:884:26:    expected unsigned int *_p
	kernel/sys.c:884:26:    got unsigned int [noderef] [usertype] <asn:1>*ruidp
	kernel/sys.c:885:26: warning: incorrect type in initializer (different address spaces)
	kernel/sys.c:885:26:    expected unsigned int *_p
	kernel/sys.c:885:26:    got unsigned int [noderef] [usertype] <asn:1>*euidp
	kernel/sys.c:886:26: warning: incorrect type in initializer (different address spaces)
	kernel/sys.c:886:26:    expected unsigned int *_p
	kernel/sys.c:886:26:    got unsigned int [noderef] [usertype] <asn:1>*suidp

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: Annotate clear_user 'to' parameter with __user

The 'to' parameter of clear_user is supposed to take a userspace pointer, so
annotate it with __user. This fixes the following and similar sparse warnings:

	fs/binfmt_elf_fdpic.c:714:35: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:714:35:    expected void [noderef] <asn:1>*to
	fs/binfmt_elf_fdpic.c:714:35:    got void *<noident>
	fs/binfmt_elf_fdpic.c:1119:29: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:1119:29:    expected void *to
	fs/binfmt_elf_fdpic.c:1119:29:    got void [noderef] <asn:1>*<noident>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: Annotate strnlen_user and strlen_user 'src' parameter with __user

The 'src' parameter of strnlen_user and strlen_user is supposed to take a
userspace pointer, so annotate it with __user. This fixes the following and
similar sparse warnings:

	fs/binfmt_elf_fdpic.c:671:36: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:671:36:    expected char const *src
	fs/binfmt_elf_fdpic.c:671:36:    got char [noderef] <asn:1>*[assigned] p
	fs/binfmt_elf_fdpic.c:683:36: warning: incorrect type in argument 1 (different address spaces)
	fs/binfmt_elf_fdpic.c:683:36:    expected char const *src
	fs/binfmt_elf_fdpic.c:683:36:    got char [noderef] <asn:1>*[assigned] p

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: twi: Add missing __iomem annotation

Add a missing __iomem to the bfin_twi_iface struct's regs_base field. This fixes
the following sparse warnings:

Fixes the following sparse warnings:
	drivers/i2c/busses/i2c-bfin-twi.c:641:26: warning: incorrect type in assignment (different address spaces)
	drivers/i2c/busses/i2c-bfin-twi.c:641:26:    expected struct bfin_twi_regs 	*regs_base
	drivers/i2c/busses/i2c-bfin-twi.c:641:26:    got void [noderef] <asn:2>*
	drivers/i2c/busses/i2c-bfin-twi.c:715:22: warning: incorrect type in argument 1 (different address spaces)
	drivers/i2c/busses/i2c-bfin-twi.c:715:22:    expected void [noderef] <asn:2>*addr
	drivers/i2c/busses/i2c-bfin-twi.c:715:22:    got struct bfin_twi_regs *regs_base
	drivers/i2c/busses/i2c-bfin-twi.c:732:22: warning: incorrect type in argument 1 (different address spaces)
	drivers/i2c/busses/i2c-bfin-twi.c:732:22:    expected void [noderef] <asn:2>*addr
	drivers/i2c/busses/i2c-bfin-twi.c:732:22:    got struct bfin_twi_regs *regs_base

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: remove unnecessary prototype for kobjsize()

The prototype for kobjsize() is already defined in linux/mm.h which is
included where kobjsize() is used.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: remove unused is_in_rom()

The function is not used anywhere in the whole tree (anymore), so remove
it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Blackfin: dpmc: use module_platform_driver macro

This patch removes some code duplication by using
module_platform_driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
blackfin: anomaly: add anomaly 16000030 for bf5xx

Drivers common to both bf5xx and bf60x chip families may use this anomaly id.
So add it to bf5xx header files also.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
blackfin: kgdb: call generic_exec_single() directly

Current generic API smp_call_function_single() is changed to avoid raise IPI
and call function in IPI handler on the same core which is necessary to support
KGDB switch master core in SMP case, so call generic_exec_single() directly
instead of smp_call_function_single().

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
lib/raid6: Add AVX2 optimized gen_syndrome functions

Add AVX2 optimized gen_syndrom functions, which is simply based on
sse2.c written by hpa.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
lib/raid6: build proper files on corresponding arch

sse and avx2 stuff only exist on x86 arch, and we don't need to build
altivec on x86. And we can do that at lib/raid6/Makefile.

Proposed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
md: Use ->curr_resync as last completed request when cleanly aborting resync.

If a resync is aborted cleanly, ->curr_resync is a reliable
record of where we got up to.
If there was an error it is less reliable but we always know that
->curr_resync_completed is safe.

So add a flag MD_RECOVERY_ERROR to differentiate between these cases
and set recovery_cp accordingly.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
md/raid5: use async_tx_quiesce() instead of open-coding it.

handle_stripe_expansion contains:

        if (tx) {
                async_tx_ack(tx);
                dma_wait_for_async_tx(tx);
        }

which is very similar to the body of async_tx_quiesce(),
except that the later handles an error from dma_wait_for_async_tx()
(admittedly by panicing, but that decision belongs in the dma
code, not the md code).

So just us async_tx_quiesce().

Acked-by: Dan Williams <djbw@fb.com>
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: NeilBrown <neilb@suse.de>
OMAPFB: use devm_kzalloc to allocate omapfb2_device

Use devm_kzalloc to allocate omapfb2_device. This fixes possible memory
leak:

drivers/video/omap2/omapfb/omapfb-main.c:2553 omapfb_probe() warn:
possible memory leak of 'fbdev'

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>