mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
ff94bc40af
resync ubi subsystem with linux: commit 455c6fdbd219161bd09b1165f11699d6d73de11c Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Mar 30 20:40:15 2014 -0700 Linux 3.14 A nice side effect of this, is we introduce UBI Fastmap support to U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Tom Rini <trini@ti.com> Cc: Marek Vasut <marex@denx.de> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Scott Wood <scottwood@freescale.com> Cc: Joerg Krause <jkrause@posteo.de>
40 lines
936 B
C
40 lines
936 B
C
/*
|
|
* Copyright (c) 2011 Samsung Electronics
|
|
* Lukasz Majewski <l.majewski@samsung.com>
|
|
*
|
|
* This is a Linux kernel compatibility layer for USB Gadget
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#ifndef __LIN_COMPAT_H__
|
|
#define __LIN_COMPAT_H__
|
|
|
|
#include <linux/compat.h>
|
|
|
|
/* common */
|
|
#define ENOTSUPP 524 /* Operation is not supported */
|
|
|
|
#define BITS_PER_BYTE 8
|
|
#define BITS_TO_LONGS(nr) \
|
|
DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
|
#define DECLARE_BITMAP(name, bits) \
|
|
unsigned long name[BITS_TO_LONGS(bits)]
|
|
|
|
#define small_const_nbits(nbits) \
|
|
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
|
|
|
|
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
|
{
|
|
if (small_const_nbits(nbits))
|
|
*dst = 0UL;
|
|
else {
|
|
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
memset(dst, 0, len);
|
|
}
|
|
}
|
|
|
|
#define dma_cache_maint(addr, size, mode) cache_flush()
|
|
void cache_flush(void);
|
|
|
|
#endif /* __LIN_COMPAT_H__ */
|