* [PATCH 1/6] backports: copy linux/overflow.h
@ 2018-09-06 6:57 Felix Fietkau
2018-09-06 6:57 ` [PATCH 2/6] backport-include: backport kvmalloc and kvmalloc_array Felix Fietkau
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Overflow macros are useful for further backports
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
copy-list | 1 +
1 file changed, 1 insertion(+)
diff --git a/copy-list b/copy-list
index 5c64b6d4..21ca8070 100644
--- a/copy-list
+++ b/copy-list
@@ -19,6 +19,7 @@ include/linux/fixp-arith.h
# This just defines some macros, simply take it
include/linux/bitfield.h
include/linux/average.h
+include/linux/overflow.h
# crypto_memneq
crypto/memneq.c -> compat/memneq.c
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/6] backport-include: backport kvmalloc and kvmalloc_array
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
@ 2018-09-06 6:57 ` Felix Fietkau
2018-09-06 6:57 ` [PATCH 3/6] patches: remove lib-bucket_locks.patch Felix Fietkau
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
backport/backport-include/linux/mm.h | 35 ++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index 3234b37d..6ee5c7d8 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -3,6 +3,9 @@
#include_next <linux/mm.h>
#include <linux/page_ref.h>
#include <linux/sched.h>
+#include <linux/overflow.h>
+#include <linux/vmalloc.h>
+#include <linux/slab.h>
#ifndef VM_NODUMP
/*
@@ -123,4 +126,36 @@ static inline bool page_is_pfmemalloc(struct page *page)
}
#endif /* < 4.2 */
+#if LINUX_VERSION_IS_LESS(4,12,0)
+#define kvmalloc LINUX_BACKPORT(kvmalloc)
+static inline void *kvmalloc(size_t size, gfp_t flags)
+{
+ gfp_t kmalloc_flags = flags;
+ void *ret;
+
+ if ((flags & GFP_KERNEL) != GFP_KERNEL)
+ return kmalloc(size, flags);
+
+ if (size > PAGE_SIZE)
+ kmalloc_flags |= __GFP_NOWARN | __GFP_NORETRY;
+
+ ret = kmalloc(size, flags);
+ if (ret || size < PAGE_SIZE)
+ return ret;
+
+ return vmalloc(size);
+}
+
+#define kvmalloc_array LINUX_BACKPORT(kvmalloc_array)
+static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
+{
+ size_t bytes;
+
+ if (unlikely(check_mul_overflow(n, size, &bytes)))
+ return NULL;
+
+ return kvmalloc(bytes, flags);
+}
+#endif
+
#endif /* __BACKPORT_MM_H */
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/6] patches: remove lib-bucket_locks.patch
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
2018-09-06 6:57 ` [PATCH 2/6] backport-include: backport kvmalloc and kvmalloc_array Felix Fietkau
@ 2018-09-06 6:57 ` Felix Fietkau
2018-09-06 6:57 ` [PATCH 4/6] backport-include: backport ktime_get_boottime_seconds Felix Fietkau
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Obsoleted by kvmalloc/kvmalloc_array backport
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
patches/lib-bucket_locks.patch | 29 -----------------------------
1 file changed, 29 deletions(-)
delete mode 100644 patches/lib-bucket_locks.patch
diff --git a/patches/lib-bucket_locks.patch b/patches/lib-bucket_locks.patch
deleted file mode 100644
index 15eeda11..00000000
--- a/patches/lib-bucket_locks.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/compat/lib-bucket_locks.c b/compat/lib-bucket_locks.c
-index 266a97c5708b..405b52ca5708 100644
---- a/compat/lib-bucket_locks.c
-+++ b/compat/lib-bucket_locks.c
-@@ -30,10 +30,24 @@ int alloc_bucket_spinlocks(spinlock_t **
- }
-
- if (sizeof(spinlock_t) != 0) {
-+#if LINUX_VERSION_IS_LESS(4,12,0)
-+#ifdef CONFIG_NUMA
-+ if (size * sizeof(spinlock_t) > PAGE_SIZE &&
-+ gfp == GFP_KERNEL)
-+ tlocks = vmalloc(size * sizeof(spinlock_t));
-+#endif
-+ if (gfp != GFP_KERNEL)
-+ gfp |= __GFP_NOWARN | __GFP_NORETRY;
-+
-+ if (!tlocks)
-+ tlocks = kmalloc_array(size, sizeof(spinlock_t),
-+ gfp);
-+#else
- if (gfpflags_allow_blocking(gfp))
- tlocks = kvmalloc(size * sizeof(spinlock_t), gfp);
- else
- tlocks = kmalloc_array(size, sizeof(spinlock_t), gfp);
-+#endif
- if (!tlocks)
- return -ENOMEM;
- for (i = 0; i < size; i++)
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/6] backport-include: backport ktime_get_boottime_seconds
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
2018-09-06 6:57 ` [PATCH 2/6] backport-include: backport kvmalloc and kvmalloc_array Felix Fietkau
2018-09-06 6:57 ` [PATCH 3/6] patches: remove lib-bucket_locks.patch Felix Fietkau
@ 2018-09-06 6:57 ` Felix Fietkau
2018-09-06 6:57 ` [PATCH 5/6] backport: copy net/rsi_91x.h Felix Fietkau
2018-09-06 6:57 ` [PATCH 6/6] backport: add firmware_request_nowarn and firmware_request_cache Felix Fietkau
4 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
backport/backport-include/linux/timekeeping.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h
index 30f9b7a9..56c3deec 100644
--- a/backport/backport-include/linux/timekeeping.h
+++ b/backport/backport-include/linux/timekeeping.h
@@ -24,6 +24,13 @@ static inline u64 ktime_get_boot_ns(void)
}
#endif /* < 3.17 */
+#if LINUX_VERSION_IS_LESS(4,18,0)
+static inline time64_t ktime_get_boottime_seconds(void)
+{
+ return ktime_divns(ktime_get_boottime(), NSEC_PER_SEC);
+}
+#endif /* < 4.18 */
+
#if LINUX_VERSION_IS_LESS(3,19,0)
static inline time64_t ktime_get_seconds(void)
{
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/6] backport: copy net/rsi_91x.h
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
` (2 preceding siblings ...)
2018-09-06 6:57 ` [PATCH 4/6] backport-include: backport ktime_get_boottime_seconds Felix Fietkau
@ 2018-09-06 6:57 ` Felix Fietkau
2018-09-06 6:57 ` [PATCH 6/6] backport: add firmware_request_nowarn and firmware_request_cache Felix Fietkau
4 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
copy-list | 1 +
1 file changed, 1 insertion(+)
diff --git a/copy-list b/copy-list
index 21ca8070..f9f9396c 100644
--- a/copy-list
+++ b/copy-list
@@ -49,6 +49,7 @@ include/linux/spi/libertas_spi.h
include/linux/platform_data/brcmfmac.h
include/linux/platform_data/net-cw1200.h
include/uapi/linux/nl80211.h
+include/net/rsi_91x.h
include/net/cfg80211.h
include/net/cfg80211-wext.h
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6/6] backport: add firmware_request_nowarn and firmware_request_cache
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
` (3 preceding siblings ...)
2018-09-06 6:57 ` [PATCH 5/6] backport: copy net/rsi_91x.h Felix Fietkau
@ 2018-09-06 6:57 ` Felix Fietkau
4 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2018-09-06 6:57 UTC (permalink / raw)
To: backports; +Cc: john
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
backport/backport-include/linux/firmware.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/backport/backport-include/linux/firmware.h b/backport/backport-include/linux/firmware.h
index 186eec3e..b5bc16be 100644
--- a/backport/backport-include/linux/firmware.h
+++ b/backport/backport-include/linux/firmware.h
@@ -5,5 +5,16 @@
#if LINUX_VERSION_IS_LESS(3,14,0)
#define request_firmware_direct(fw, name, device) request_firmware(fw, name, device)
#endif
+#if LINUX_VERSION_IS_LESS(4,18,0)
+#define firmware_request_nowarn(fw, name, device) request_firmware(fw, name, device)
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,17,0)
+#define firmware_request_cache LINUX_BACKPORT(firmware_request_cache)
+static inline int firmware_request_cache(struct device *device, const char *name)
+{
+ return 0;
+}
+#endif
#endif /* __BACKPORT_LINUX_FIRMWARE_H */
--
2.17.0
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-06 11:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06 6:57 [PATCH 1/6] backports: copy linux/overflow.h Felix Fietkau
2018-09-06 6:57 ` [PATCH 2/6] backport-include: backport kvmalloc and kvmalloc_array Felix Fietkau
2018-09-06 6:57 ` [PATCH 3/6] patches: remove lib-bucket_locks.patch Felix Fietkau
2018-09-06 6:57 ` [PATCH 4/6] backport-include: backport ktime_get_boottime_seconds Felix Fietkau
2018-09-06 6:57 ` [PATCH 5/6] backport: copy net/rsi_91x.h Felix Fietkau
2018-09-06 6:57 ` [PATCH 6/6] backport: add firmware_request_nowarn and firmware_request_cache Felix Fietkau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).