Blame view

include/usb/lin_gadget_compat.h 804 Bytes
38517a782   Lukasz Majewski   usb:gadget:s5p US...
1
2
3
4
5
6
  /*
   * Copyright (c) 2011 Samsung Electronics
   * Lukasz Majewski <l.majewski@samsung.com>
   *
   * This is a Linux kernel compatibility layer for USB Gadget
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
7
   * SPDX-License-Identifier:	GPL-2.0+
38517a782   Lukasz Majewski   usb:gadget:s5p US...
8
9
10
11
   */
  
  #ifndef __LIN_COMPAT_H__
  #define __LIN_COMPAT_H__
ed3986ca3   Masahiro Yamada   bitops: collect B...
12
  #include <linux/bitops.h>
6777a3cf7   Mike Frysinger   lin_gadget: use c...
13
  #include <linux/compat.h>
38517a782   Lukasz Majewski   usb:gadget:s5p US...
14
  /* common */
7010f5b94   Lukasz Majewski   usb:gadget:compos...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  #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);
  	}
  }
38517a782   Lukasz Majewski   usb:gadget:s5p US...
30
31
32
33
  #define dma_cache_maint(addr, size, mode) cache_flush()
  void cache_flush(void);
  
  #endif /* __LIN_COMPAT_H__ */