summaryrefslogtreecommitdiff
path: root/backport-include/asm-generic
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2018-09-14 10:41:12 +0200
committerDominik Sliwa <dominik.sliwa@toradex.com>2018-09-14 10:41:12 +0200
commit6142e8731c3e5b9c9f96d9af83052b9787604b39 (patch)
tree45b17840142b10874bf8974a74152eb3f9021e82 /backport-include/asm-generic
initial commit
Generated againts 4.18 kernel source with git backports 0795d050c62e04c7c4fd7fcb554756e6adb4ec64 Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport-include/asm-generic')
-rw-r--r--backport-include/asm-generic/bug.h39
-rw-r--r--backport-include/asm-generic/pci-dma-compat.h17
2 files changed, 56 insertions, 0 deletions
diff --git a/backport-include/asm-generic/bug.h b/backport-include/asm-generic/bug.h
new file mode 100644
index 0000000..4e9e05f
--- /dev/null
+++ b/backport-include/asm-generic/bug.h
@@ -0,0 +1,39 @@
+#ifndef __BACKPORT_ASM_GENERIC_BUG_H
+#define __BACKPORT_ASM_GENERIC_BUG_H
+#include_next <asm-generic/bug.h>
+
+#ifndef __WARN
+#define __WARN(foo) dump_stack()
+#endif
+
+#ifndef WARN_ONCE
+#define WARN_ONCE(condition, format...) ({ \
+ static int __warned; \
+ int __ret_warn_once = !!(condition); \
+ \
+ if (unlikely(__ret_warn_once)) \
+ if (WARN(!__warned, format)) \
+ __warned = 1; \
+ unlikely(__ret_warn_once); \
+})
+#endif
+
+#ifndef __WARN_printf
+/*
+ * To port this properly we'd have to port warn_slowpath_null(),
+ * which I'm lazy to do so just do a regular print for now. If you
+ * want to port this read kernel/panic.c
+ */
+#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
+#endif
+
+#ifndef WARN
+#define WARN(condition, format...) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ __WARN_printf(format); \
+ unlikely(__ret_warn_on); \
+})
+#endif
+
+#endif /* __BACKPORT_ASM_GENERIC_BUG_H */
diff --git a/backport-include/asm-generic/pci-dma-compat.h b/backport-include/asm-generic/pci-dma-compat.h
new file mode 100644
index 0000000..1b1433e
--- /dev/null
+++ b/backport-include/asm-generic/pci-dma-compat.h
@@ -0,0 +1,17 @@
+#ifndef __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H
+#define __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H
+#include_next <asm-generic/pci-dma-compat.h>
+
+#if LINUX_VERSION_IS_LESS(3,17,0)
+#define pci_zalloc_consistent LINUX_BACKPORT(pci_zalloc_consistent)
+static inline void *pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
+ dma_addr_t *dma_handle)
+{
+ void *ret = pci_alloc_consistent(hwdev, size, dma_handle);
+ if (ret)
+ memset(ret, 0, size);
+ return ret;
+}
+#endif
+
+#endif /* __BACKPORT_ASM_GENERIC_PCI_DMA_COMPAT_H */