mac80211: fix compile error on PowerPC (PPC_85xx)
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 006-header-fix-compile-error-on-PowerPC-PPC_85xx.patch
1 From f192535ab136905d87bc75a4e848b66f0aef315e Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 1 Oct 2017 16:05:24 +0200
4 Subject: header: fix compile error on PowerPC (PPC_85xx)
5
6 Including linux/interrupt.h in linux/hrtimer.h causes this error message
7 on PowerPC builds on x86, ARM and MIPS it works:
8
9   CC [M]  /backports-4.14-rc2-1/compat/main.o
10 In file included from /backports-4.14-rc2-1/backport-include/linux/printk.h:5:0,
11                  from ./include/linux/kernel.h:13,
12                  from /backports-4.14-rc2-1/backport-include/linux/kernel.h:3,
13                  from ./include/linux/list.h:8,
14                  from /backports-4.14-rc2-1/backport-include/linux/list.h:3,
15                  from ./include/linux/module.h:9,
16                  from /backports-4.14-rc2-1/backport-include/linux/module.h:3,
17                  from /backports-4.14-rc2-1/compat/main.c:1:
18 ./include/linux/ratelimit.h: In function 'ratelimit_state_exit':
19 ./include/linux/ratelimit.h:62:11: error: dereferencing pointer to incomplete type 'struct task_struct'
20     current->comm, rs->missed);
21            ^
22 ./include/linux/printk.h:279:37: note: in definition of macro 'pr_warning'
23   printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
24                                      ^
25 ./include/linux/ratelimit.h:61:3: note: in expansion of macro 'pr_warn'
26    pr_warn("%s: %d output lines suppressed due to ratelimiting\n",
27    ^
28
29 The backport of the hrtimer_start() functions needs the
30 linux/interrupt.h because some parts are defined there. Fix this by
31 moving the hrtimer_start() backport to the linux/interrupt.h backport
32 header file.
33
34 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
35 ---
36  backport-include/linux/hrtimer.h   | 17 -----------------
37  backport-include/linux/interrupt.h | 17 ++++++++++++++++-
38  2 files changed, 16 insertions(+), 18 deletions(-)
39  delete mode 100644 backport-include/linux/hrtimer.h
40
41 --- a/backport-include/linux/hrtimer.h
42 +++ /dev/null
43 @@ -1,17 +0,0 @@
44 -#ifndef _BP_HRTIMER_H
45 -#define _BP_HRTIMER_H
46 -#include <linux/version.h>
47 -#include_next <linux/hrtimer.h>
48 -#include <linux/interrupt.h>
49 -
50 -#if LINUX_VERSION_IS_LESS(4,10,0)
51 -static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
52 -                                         const enum hrtimer_mode mode)
53 -{
54 -       ktime_t _time = { .tv64 = time };
55 -       hrtimer_start(timer, _time, mode);
56 -}
57 -#define hrtimer_start LINUX_BACKPORT(hrtimer_start)
58 -#endif
59 -
60 -#endif /* _BP_HRTIMER_H */
61 --- a/backport-include/linux/interrupt.h
62 +++ b/backport-include/linux/interrupt.h
63 @@ -1,2 +1,17 @@
64 -#include <linux/hrtimer.h>
65 +#ifndef _BP_LINUX_INTERRUPT_H
66 +#define _BP_LINUX_INTERRUPT_H
67 +#include <linux/version.h>
68  #include_next <linux/interrupt.h>
69 +#include <linux/ktime.h>
70 +
71 +#if LINUX_VERSION_IS_LESS(4,10,0)
72 +static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
73 +                                         const enum hrtimer_mode mode)
74 +{
75 +       ktime_t _time = { .tv64 = time };
76 +       hrtimer_start(timer, _time, mode);
77 +}
78 +#define hrtimer_start LINUX_BACKPORT(hrtimer_start)
79 +#endif
80 +
81 +#endif /* _BP_LINUX_INTERRUPT_H */