diff options
author | Lukasz Majewski <lukma@denx.de> | 2018-11-23 17:36:19 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-12-14 17:59:08 +0100 |
commit | 916fa097997a5e1b70768ce944de28e038d4bebf (patch) | |
tree | b12672e9413e8a44117984d84416ba4c400356f3 /include | |
parent | bb00a015d624f683c66c9e30341f93b678d03d2e (diff) |
usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
The BITMAP related operations can now be moved to ./include/linux/bitmap.h
file to mimic the Linux kernel directory tree.
This change also allows to remove the lin_gadget_compat.h header file
(which is a legacy code only for composite U-boot layer).
It was also possible to remove #includes from several USB gadget drivers.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bitmap.h | 23 | ||||
-rw-r--r-- | include/linux/types.h | 3 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 2 | ||||
-rw-r--r-- | include/usb/lin_gadget_compat.h | 35 |
4 files changed, 27 insertions, 36 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h new file mode 100644 index 00000000000..4a54ae05091 --- /dev/null +++ b/include/linux/bitmap.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +#ifndef __LINUX_BITMAP_H +#define __LINUX_BITMAP_H + +#include <asm/types.h> +#include <linux/types.h> +#include <linux/bitops.h> + +#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); + } +} + +#endif /* __LINUX_BITMAP_H */ diff --git a/include/linux/types.h b/include/linux/types.h index 1f3cd63b8f2..cc6f7cb39ee 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -158,4 +158,7 @@ struct ustat { char f_fpack[6]; }; +#define DECLARE_BITMAP(name, bits) \ + unsigned long name[BITS_TO_LONGS(bits)] + #endif /* _LINUX_TYPES_H */ diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 30c464ce39d..a49a66f2f82 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -24,7 +24,7 @@ #include <common.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> -#include <usb/lin_gadget_compat.h> +#include <linux/bitmap.h> /* * USB function drivers should return USB_GADGET_DELAYED_STATUS if they diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h deleted file mode 100644 index e5dba473b7a..00000000000 --- a/include/usb/lin_gadget_compat.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (c) 2011 Samsung Electronics - * Lukasz Majewski <l.majewski@samsung.com> - * - * This is a Linux kernel compatibility layer for USB Gadget - */ - -#ifndef __LIN_COMPAT_H__ -#define __LIN_COMPAT_H__ - -#include <linux/bitops.h> -#include <linux/compat.h> - -/* common */ -#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__ */ |