Commit 916fa097997a5e1b70768ce944de28e038d4bebf
Committed by
Marek Vasut
1 parent
bb00a015d6
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
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>
Showing 14 changed files with 28 additions and 46 deletions Side-by-side Diff
- drivers/usb/dwc3/gadget.c
- drivers/usb/dwc3/ti_usb_phy.c
- drivers/usb/eth/r8152.c
- drivers/usb/gadget/at91_udc.c
- drivers/usb/gadget/atmel_usba_udc.c
- drivers/usb/gadget/dwc2_udc_otg.c
- drivers/usb/gadget/dwc2_udc_otg_phy.c
- drivers/usb/gadget/dwc2_udc_otg_priv.h
- drivers/usb/gadget/f_mass_storage.c
- drivers/usb/gadget/pxa25x_udc.c
- include/linux/bitmap.h
- include/linux/types.h
- include/linux/usb/composite.h
- include/usb/lin_gadget_compat.h
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/ti_usb_phy.c
drivers/usb/eth/r8152.c
drivers/usb/gadget/at91_udc.c
drivers/usb/gadget/atmel_usba_udc.c
drivers/usb/gadget/dwc2_udc_otg.c
drivers/usb/gadget/dwc2_udc_otg_phy.c
drivers/usb/gadget/dwc2_udc_otg_priv.h
drivers/usb/gadget/f_mass_storage.c
... | ... | @@ -256,7 +256,7 @@ |
256 | 256 | #include <linux/usb/gadget.h> |
257 | 257 | #include <linux/usb/gadget.h> |
258 | 258 | #include <linux/usb/composite.h> |
259 | -#include <usb/lin_gadget_compat.h> | |
259 | +#include <linux/bitmap.h> | |
260 | 260 | #include <g_dnl.h> |
261 | 261 | |
262 | 262 | /*------------------------------------------------------------------------*/ |
drivers/usb/gadget/pxa25x_udc.c
include/linux/bitmap.h
1 | +// SPDX-License-Identifier: GPL-2.0+ | |
2 | +#ifndef __LINUX_BITMAP_H | |
3 | +#define __LINUX_BITMAP_H | |
4 | + | |
5 | +#include <asm/types.h> | |
6 | +#include <linux/types.h> | |
7 | +#include <linux/bitops.h> | |
8 | + | |
9 | +#define small_const_nbits(nbits) \ | |
10 | + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) | |
11 | + | |
12 | +static inline void bitmap_zero(unsigned long *dst, int nbits) | |
13 | +{ | |
14 | + if (small_const_nbits(nbits)) { | |
15 | + *dst = 0UL; | |
16 | + } else { | |
17 | + int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); | |
18 | + | |
19 | + memset(dst, 0, len); | |
20 | + } | |
21 | +} | |
22 | + | |
23 | +#endif /* __LINUX_BITMAP_H */ |
include/linux/types.h
include/linux/usb/composite.h
include/usb/lin_gadget_compat.h
1 | -/* SPDX-License-Identifier: GPL-2.0+ */ | |
2 | -/* | |
3 | - * Copyright (c) 2011 Samsung Electronics | |
4 | - * Lukasz Majewski <l.majewski@samsung.com> | |
5 | - * | |
6 | - * This is a Linux kernel compatibility layer for USB Gadget | |
7 | - */ | |
8 | - | |
9 | -#ifndef __LIN_COMPAT_H__ | |
10 | -#define __LIN_COMPAT_H__ | |
11 | - | |
12 | -#include <linux/bitops.h> | |
13 | -#include <linux/compat.h> | |
14 | - | |
15 | -/* common */ | |
16 | -#define DECLARE_BITMAP(name, bits) \ | |
17 | - unsigned long name[BITS_TO_LONGS(bits)] | |
18 | - | |
19 | -#define small_const_nbits(nbits) \ | |
20 | - (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) | |
21 | - | |
22 | -static inline void bitmap_zero(unsigned long *dst, int nbits) | |
23 | -{ | |
24 | - if (small_const_nbits(nbits)) | |
25 | - *dst = 0UL; | |
26 | - else { | |
27 | - int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); | |
28 | - memset(dst, 0, len); | |
29 | - } | |
30 | -} | |
31 | - | |
32 | -#define dma_cache_maint(addr, size, mode) cache_flush() | |
33 | -void cache_flush(void); | |
34 | - | |
35 | -#endif /* __LIN_COMPAT_H__ */ |