Commit 916fa097997a5e1b70768ce944de28e038d4bebf

Authored by Lukasz Majewski
Committed by Marek Vasut
1 parent bb00a015d6

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
... ... @@ -16,7 +16,6 @@
16 16 #include <common.h>
17 17 #include <malloc.h>
18 18 #include <asm/dma-mapping.h>
19   -#include <usb/lin_gadget_compat.h>
20 19 #include <linux/bug.h>
21 20 #include <linux/list.h>
22 21  
drivers/usb/dwc3/ti_usb_phy.c
... ... @@ -19,7 +19,6 @@
19 19 #include <common.h>
20 20 #include <malloc.h>
21 21 #include <ti-usb-phy-uboot.h>
22   -#include <usb/lin_gadget_compat.h>
23 22 #include <linux/ioport.h>
24 23 #include <asm/io.h>
25 24 #include <asm/arch/sys_proto.h>
drivers/usb/eth/r8152.c
... ... @@ -10,7 +10,6 @@
10 10 #include <malloc.h>
11 11 #include <memalign.h>
12 12 #include <usb.h>
13   -#include <usb/lin_gadget_compat.h>
14 13 #include <linux/mii.h>
15 14 #include <linux/bitops.h>
16 15 #include "usb_ether.h"
drivers/usb/gadget/at91_udc.c
... ... @@ -24,7 +24,6 @@
24 24 #include <linux/usb/gadget.h>
25 25 #include <linux/usb/at91_udc.h>
26 26 #include <malloc.h>
27   -#include <usb/lin_gadget_compat.h>
28 27  
29 28 #include "at91_udc.h"
30 29  
drivers/usb/gadget/atmel_usba_udc.c
... ... @@ -16,7 +16,6 @@
16 16 #include <linux/usb/gadget.h>
17 17 #include <linux/usb/atmel_usba_udc.h>
18 18 #include <malloc.h>
19   -#include <usb/lin_gadget_compat.h>
20 19  
21 20 #include "atmel_usba_udc.h"
22 21  
drivers/usb/gadget/dwc2_udc_otg.c
... ... @@ -33,7 +33,6 @@
33 33  
34 34 #include "dwc2_udc_otg_regs.h"
35 35 #include "dwc2_udc_otg_priv.h"
36   -#include <usb/lin_gadget_compat.h>
37 36  
38 37 /***********************************************************/
39 38  
drivers/usb/gadget/dwc2_udc_otg_phy.c
... ... @@ -33,7 +33,6 @@
33 33  
34 34 #include "dwc2_udc_otg_regs.h"
35 35 #include "dwc2_udc_otg_priv.h"
36   -#include <usb/lin_gadget_compat.h>
37 36  
38 37 #include <usb/dwc2_udc.h>
39 38  
drivers/usb/gadget/dwc2_udc_otg_priv.h
... ... @@ -12,7 +12,6 @@
12 12 #include <linux/usb/ch9.h>
13 13 #include <linux/usb/gadget.h>
14 14 #include <linux/list.h>
15   -#include <usb/lin_gadget_compat.h>
16 15 #include <usb/dwc2_udc.h>
17 16  
18 17 /*-------------------------------------------------------------------------*/
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
... ... @@ -29,7 +29,6 @@
29 29  
30 30 #include <linux/usb/ch9.h>
31 31 #include <linux/usb/gadget.h>
32   -#include <usb/lin_gadget_compat.h>
33 32 #include <asm/arch/pxa-regs.h>
34 33  
35 34 #include "pxa25x_udc.h"
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
... ... @@ -158,5 +158,8 @@
158 158 char f_fpack[6];
159 159 };
160 160  
  161 +#define DECLARE_BITMAP(name, bits) \
  162 + unsigned long name[BITS_TO_LONGS(bits)]
  163 +
161 164 #endif /* _LINUX_TYPES_H */
include/linux/usb/composite.h
... ... @@ -24,7 +24,7 @@
24 24 #include <common.h>
25 25 #include <linux/usb/ch9.h>
26 26 #include <linux/usb/gadget.h>
27   -#include <usb/lin_gadget_compat.h>
  27 +#include <linux/bitmap.h>
28 28  
29 29 /*
30 30 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
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__ */