usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
PATCH 1/1 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 removing 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 as relevant bit operations have been mored out earlier from this file.
---
drivers/usb/dwc3/gadget.c | 1 - drivers/usb/dwc3/ti_usb_phy.c | 1 - drivers/usb/eth/r8152.c | 1 - drivers/usb/gadget/at91_udc.c | 1 - drivers/usb/gadget/atmel_usba_udc.c | 1 - drivers/usb/gadget/dwc2_udc_otg.c | 1 - drivers/usb/gadget/dwc2_udc_otg_phy.c | 1 - drivers/usb/gadget/dwc2_udc_otg_priv.h | 1 - drivers/usb/gadget/f_mass_storage.c | 2 +- drivers/usb/gadget/pxa25x_udc.c | 1 - include/linux/bitmap.h | 23 ++++++++++++++++++++++ include/linux/types.h | 3 +++ include/linux/usb/composite.h | 2 +- include/usb/lin_gadget_compat.h | 35 ---------------------------------- 14 files changed, 28 insertions(+), 46 deletions(-) create mode 100644 include/linux/bitmap.h delete mode 100644 include/usb/lin_gadget_compat.h
drivers/usb/dwc3/gadget.c +0 -1
@@ -16,7 +16,6 @@#include <common.h> #include <malloc.h> #include <asm/dma-mapping.h> -#include <usb/lin_gadget_compat.h> #include <linux/bug.h> #include <linux/list.h>
drivers/usb/dwc3/ti_usb_phy.c +0 -1
@@ -19,7 +19,6 @@#include <common.h> #include <malloc.h> #include <ti-usb-phy-uboot.h> -#include <usb/lin_gadget_compat.h> #include <linux/ioport.h> #include <asm/io.h> #include <asm/arch/sys_proto.h>
drivers/usb/eth/r8152.c +0 -1
@@ -10,7 +10,6 @@#include <malloc.h> #include <memalign.h> #include <usb.h> -#include <usb/lin_gadget_compat.h> #include <linux/mii.h> #include <linux/bitops.h> #include "usb_ether.h"
drivers/usb/gadget/at91_udc.c +0 -1
@@ -24,7 +24,6 @@#include <linux/usb/gadget.h> #include <linux/usb/at91_udc.h> #include <malloc.h> -#include <usb/lin_gadget_compat.h> #include "at91_udc.h"
drivers/usb/gadget/atmel_usba_udc.c +0 -1
@@ -16,7 +16,6 @@#include <linux/usb/gadget.h> #include <linux/usb/atmel_usba_udc.h> #include <malloc.h> -#include <usb/lin_gadget_compat.h> #include "atmel_usba_udc.h"
drivers/usb/gadget/dwc2_udc_otg.c +0 -1
@@ -33,7 +33,6 @@#include "dwc2_udc_otg_regs.h" #include "dwc2_udc_otg_priv.h" -#include <usb/lin_gadget_compat.h> /***********************************************************/
drivers/usb/gadget/dwc2_udc_otg_phy.c +0 -1
@@ -33,7 +33,6 @@#include "dwc2_udc_otg_regs.h" #include "dwc2_udc_otg_priv.h" -#include <usb/lin_gadget_compat.h> #include <usb/dwc2_udc.h>
drivers/usb/gadget/dwc2_udc_otg_priv.h +0 -1
@@ -12,7 +12,6 @@#include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/list.h> -#include <usb/lin_gadget_compat.h> #include <usb/dwc2_udc.h> /*-------------------------------------------------------------------------*/
drivers/usb/gadget/f_mass_storage.c +1 -1
@@ -256,7 +256,7 @@#include <linux/usb/gadget.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> -#include <usb/lin_gadget_compat.h> +#include <linux/bitmap.h> #include <g_dnl.h> /*------------------------------------------------------------------------*/
drivers/usb/gadget/pxa25x_udc.c +0 -1
@@ -29,7 +29,6 @@#include <linux/usb/ch9.h> #include <linux/usb/gadget.h> -#include <usb/lin_gadget_compat.h> #include <asm/arch/pxa-regs.h> #include "pxa25x_udc.h"
include/linux/bitmap.h new file +23 -0
@@ -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 */
include/linux/types.h +3 -0
@@ -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 */
include/linux/usb/composite.h +1 -1
@@ -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
include/usb/lin_gadget_compat.h deleted +0 -35
@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* Copyright (c) 2011 Samsung Electronics -* Lukasz Majewski <[email protected]> -* -* 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__ */
Signature · 1 line
2.11.0
PATCH 1/1 usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
Quoted 7 lines · Lukasz Majewski
The BITMAP related operations can now be moved to
./include/linux/bitmap.hfile to mimic the Linux kernel directory tree.This change also allows removing the
lin_gadget_compat.hheader file (which is a legacy code only for composite U-boot layer).
It was also possible to remove #includes from several USB gadget drivers as relevant bit operations have been mored out earlier from this file.
s/mored/moved
Otherwise looks good to me:
--
Stefan
Quoted 244 lines
Signed-off-by Lukasz Majewski <[email protected]>---
drivers/usb/dwc3/gadget.c | 1 - drivers/usb/dwc3/ti_usb_phy.c | 1 - drivers/usb/eth/r8152.c | 1 - drivers/usb/gadget/at91_udc.c | 1 - drivers/usb/gadget/atmel_usba_udc.c | 1 - drivers/usb/gadget/dwc2_udc_otg.c | 1 - drivers/usb/gadget/dwc2_udc_otg_phy.c | 1 - drivers/usb/gadget/dwc2_udc_otg_priv.h | 1 - drivers/usb/gadget/f_mass_storage.c | 2 +- drivers/usb/gadget/pxa25x_udc.c | 1 - include/linux/bitmap.h | 23 ++++++++++++++++++++++ include/linux/types.h | 3 +++ include/linux/usb/composite.h | 2 +- include/usb/lin_gadget_compat.h | 35 ---------------------------------- 14 files changed, 28 insertions(+), 46 deletions(-) create mode 100644 include/linux/bitmap.h delete mode 100644 include/usb/lin_gadget_compat.hdrivers/usb/dwc3/gadget.c +0
-1@@ -16,7 +16,6 @@#include <common.h> #include <malloc.h> #include <asm/dma-mapping.h> -#include <usb/lin_gadget_compat.h> #include <linux/bug.h> #include <linux/list.h> drivers/usb/dwc3/ti_usb_phy.c +0
-1@@ -19,7 +19,6 @@#include <common.h> #include <malloc.h> #include <ti-usb-phy-uboot.h> -#include <usb/lin_gadget_compat.h> #include <linux/ioport.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> drivers/usb/eth/r8152.c +0
-1@@ -10,7 +10,6 @@#include <malloc.h> #include <memalign.h> #include <usb.h> -#include <usb/lin_gadget_compat.h> #include <linux/mii.h> #include <linux/bitops.h> #include "usb_ether.h" drivers/usb/gadget/at91_udc.c +0
-1@@ -24,7 +24,6 @@#include <linux/usb/gadget.h> #include <linux/usb/at91_udc.h> #include <malloc.h> -#include <usb/lin_gadget_compat.h> #include "at91_udc.h" drivers/usb/gadget/atmel_usba_udc.c +0
-1@@ -16,7 +16,6 @@#include <linux/usb/gadget.h> #include <linux/usb/atmel_usba_udc.h> #include <malloc.h> -#include <usb/lin_gadget_compat.h> #include "atmel_usba_udc.h" drivers/usb/gadget/dwc2_udc_otg.c +0
-1@@ -33,7 +33,6 @@#include "dwc2_udc_otg_regs.h" #include "dwc2_udc_otg_priv.h" -#include <usb/lin_gadget_compat.h> /***********************************************************/ drivers/usb/gadget/dwc2_udc_otg_phy.c +0
-1@@ -33,7 +33,6 @@#include "dwc2_udc_otg_regs.h" #include "dwc2_udc_otg_priv.h" -#include <usb/lin_gadget_compat.h> #include <usb/dwc2_udc.h> drivers/usb/gadget/dwc2_udc_otg_priv.h +0
-1@@ -12,7 +12,6 @@#include <linux/usb/ch9.h> #include <linux/usb/gadget.h> #include <linux/list.h> -#include <usb/lin_gadget_compat.h> #include <usb/dwc2_udc.h> /*-------------------------------------------------------------------------*/ drivers/usb/gadget/f_mass_storage.c +1
-1@@ -256,7 +256,7 @@#include <linux/usb/gadget.h> #include <linux/usb/gadget.h> #include <linux/usb/composite.h> -#include <usb/lin_gadget_compat.h> +#include <linux/bitmap.h> #include <g_dnl.h> /*------------------------------------------------------------------------*/ drivers/usb/gadget/pxa25x_udc.c +0
-1@@ -29,7 +29,6 @@#include <linux/usb/ch9.h> #include <linux/usb/gadget.h> -#include <usb/lin_gadget_compat.h> #include <asm/arch/pxa-regs.h> #include "pxa25x_udc.h" include/linux/bitmap.h new file +23
-0@@ -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 */ include/linux/types.h +3
-0@@ -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 */ include/linux/usb/composite.h +1
-1@@ -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 include/usb/lin_gadget_compat.h deleted +0
-35@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* -* Copyright (c) 2011 Samsung Electronics -* Lukasz Majewski <[email protected]> -* -* 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__ */