MMC: DWMMC: Correct the CLKDIV register value
[kernel/u-boot.git] / include / usb / lin_gadget_compat.h
index 8287b9d..a25e9d9 100644 (file)
@@ -4,20 +4,7 @@
  *
  * This is a Linux kernel compatibility layer for USB Gadget
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef __LIN_COMPAT_H__
 
 #define ENOTSUPP       524     /* Operation is not supported */
 
+#define BITS_PER_BYTE                          8
+#define BITS_TO_LONGS(nr) \
+       DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#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);