mac80211: fix compile error on PowerPC (PPC_85xx)
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Oct 2017 14:16:32 +0000 (16:16 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 1 Oct 2017 14:41:19 +0000 (16:41 +0200)
Including linux/interrupt.h in linux/hrtimer.h causes this error message
on PowerPC builds on x86, ARM and MIPS it works:

  CC [M]  /backports-4.14-rc2-1/compat/main.o
In file included from /backports-4.14-rc2-1/backport-include/linux/printk.h:5:0,
                 from ./include/linux/kernel.h:13,
                 from /backports-4.14-rc2-1/backport-include/linux/kernel.h:3,
                 from ./include/linux/list.h:8,
                 from /backports-4.14-rc2-1/backport-include/linux/list.h:3,
                 from ./include/linux/module.h:9,
                 from /backports-4.14-rc2-1/backport-include/linux/module.h:3,
                 from /backports-4.14-rc2-1/compat/main.c:1:
./include/linux/ratelimit.h: In function 'ratelimit_state_exit':
./include/linux/ratelimit.h:62:11: error: dereferencing pointer to incomplete type 'struct task_struct'
    current->comm, rs->missed);
           ^
./include/linux/printk.h:279:37: note: in definition of macro 'pr_warning'
  printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                     ^
./include/linux/ratelimit.h:61:3: note: in expansion of macro 'pr_warn'
   pr_warn("%s: %d output lines suppressed due to ratelimiting\n",
   ^

The backport of the hrtimer_start() functions needs the
linux/interrupt.h because some parts are defined there. Fix this by
moving the hrtimer_start() backport to the linux/interrupt.h backport
header file.

Fixes: a8f63a0717f5: ("mac80211: update to backports-4.14-rc2")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/mac80211/patches/006-header-fix-compile-error-on-PowerPC-PPC_85xx.patch [new file with mode: 0644]

diff --git a/package/kernel/mac80211/patches/006-header-fix-compile-error-on-PowerPC-PPC_85xx.patch b/package/kernel/mac80211/patches/006-header-fix-compile-error-on-PowerPC-PPC_85xx.patch
new file mode 100644 (file)
index 0000000..fa35c4b
--- /dev/null
@@ -0,0 +1,81 @@
+From f192535ab136905d87bc75a4e848b66f0aef315e Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 1 Oct 2017 16:05:24 +0200
+Subject: header: fix compile error on PowerPC (PPC_85xx)
+
+Including linux/interrupt.h in linux/hrtimer.h causes this error message
+on PowerPC builds on x86, ARM and MIPS it works:
+
+  CC [M]  /backports-4.14-rc2-1/compat/main.o
+In file included from /backports-4.14-rc2-1/backport-include/linux/printk.h:5:0,
+                 from ./include/linux/kernel.h:13,
+                 from /backports-4.14-rc2-1/backport-include/linux/kernel.h:3,
+                 from ./include/linux/list.h:8,
+                 from /backports-4.14-rc2-1/backport-include/linux/list.h:3,
+                 from ./include/linux/module.h:9,
+                 from /backports-4.14-rc2-1/backport-include/linux/module.h:3,
+                 from /backports-4.14-rc2-1/compat/main.c:1:
+./include/linux/ratelimit.h: In function 'ratelimit_state_exit':
+./include/linux/ratelimit.h:62:11: error: dereferencing pointer to incomplete type 'struct task_struct'
+    current->comm, rs->missed);
+           ^
+./include/linux/printk.h:279:37: note: in definition of macro 'pr_warning'
+  printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+                                     ^
+./include/linux/ratelimit.h:61:3: note: in expansion of macro 'pr_warn'
+   pr_warn("%s: %d output lines suppressed due to ratelimiting\n",
+   ^
+
+The backport of the hrtimer_start() functions needs the
+linux/interrupt.h because some parts are defined there. Fix this by
+moving the hrtimer_start() backport to the linux/interrupt.h backport
+header file.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ backport-include/linux/hrtimer.h   | 17 -----------------
+ backport-include/linux/interrupt.h | 17 ++++++++++++++++-
+ 2 files changed, 16 insertions(+), 18 deletions(-)
+ delete mode 100644 backport-include/linux/hrtimer.h
+
+--- a/backport-include/linux/hrtimer.h
++++ /dev/null
+@@ -1,17 +0,0 @@
+-#ifndef _BP_HRTIMER_H
+-#define _BP_HRTIMER_H
+-#include <linux/version.h>
+-#include_next <linux/hrtimer.h>
+-#include <linux/interrupt.h>
+-
+-#if LINUX_VERSION_IS_LESS(4,10,0)
+-static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
+-                                        const enum hrtimer_mode mode)
+-{
+-      ktime_t _time = { .tv64 = time };
+-      hrtimer_start(timer, _time, mode);
+-}
+-#define hrtimer_start LINUX_BACKPORT(hrtimer_start)
+-#endif
+-
+-#endif /* _BP_HRTIMER_H */
+--- a/backport-include/linux/interrupt.h
++++ b/backport-include/linux/interrupt.h
+@@ -1,2 +1,17 @@
+-#include <linux/hrtimer.h>
++#ifndef _BP_LINUX_INTERRUPT_H
++#define _BP_LINUX_INTERRUPT_H
++#include <linux/version.h>
+ #include_next <linux/interrupt.h>
++#include <linux/ktime.h>
++
++#if LINUX_VERSION_IS_LESS(4,10,0)
++static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
++                                        const enum hrtimer_mode mode)
++{
++      ktime_t _time = { .tv64 = time };
++      hrtimer_start(timer, _time, mode);
++}
++#define hrtimer_start LINUX_BACKPORT(hrtimer_start)
++#endif
++
++#endif /* _BP_LINUX_INTERRUPT_H */