diff options
| author | Tom Rini <trini@konsulko.com> | 2018-12-15 17:49:49 -0500 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2018-12-15 17:49:57 -0500 |
| commit | 401c2540445aad08816382c0dc208d2516d90d89 (patch) | |
| tree | 89c26f23edfb8da3d7a517d07fedd61fa5faf769 /include/linux | |
| parent | 0dc526d98eb216003ea884739abc17f6eb05c0df (diff) | |
| parent | 46a3f276549f3e5720b6e80278cda354c7fa859f (diff) | |
| download | u-boot-401c2540445aad08816382c0dc208d2516d90d89.tar.gz u-boot-401c2540445aad08816382c0dc208d2516d90d89.tar.xz u-boot-401c2540445aad08816382c0dc208d2516d90d89.zip | |
Merge branch 'master' of git://git.denx.de/u-boot-usb
- Second half of the USB Gadget DM conversion
Diffstat (limited to 'include/linux')
| -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 |
3 files changed, 27 insertions, 1 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h new file mode 100644 index 0000000000..4a54ae0509 --- /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 1f3cd63b8f..cc6f7cb39e 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 30c464ce39..a49a66f2f8 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 |
