mac80211: update to wireless-testing 2017-01-31
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 005-revert-devcoredump.patch
1 --- a/compat/Makefile
2 +++ b/compat/Makefile
3 @@ -35,8 +35,6 @@ compat-$(CPTCFG_KERNEL_4_6) += backport-
4
5 compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o
6 compat-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += crypto-skcipher.o
7 -skcipher-objs += crypto-skcipher.o
8 -obj-$(CPTCFG_BPAUTO_CRYPTO_SKCIPHER) += skcipher.o
9 compat-$(CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP) += drivers-base-devcoredump.o
10 compat-$(CPTCFG_BPAUTO_RHASHTABLE) += lib-rhashtable.o
11 cordic-objs += lib-cordic.o
12 --- a/compat/drivers-base-devcoredump.c
13 +++ b/compat/drivers-base-devcoredump.c
14 @@ -31,6 +31,7 @@
15 #include <linux/slab.h>
16 #include <linux/fs.h>
17 #include <linux/workqueue.h>
18 +#include "backports.h"
19
20 static struct class devcd_class;
21
22 @@ -40,6 +41,10 @@ static bool devcd_disabled;
23 /* if data isn't read by userspace after 5 minutes then delete it */
24 #define DEVCD_TIMEOUT (HZ * 60 * 5)
25
26 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
27 +static struct bin_attribute devcd_attr_data;
28 +#endif
29 +
30 struct devcd_entry {
31 struct device devcd_dev;
32 void *data;
33 @@ -69,8 +74,7 @@ static void devcd_dev_release(struct dev
34 * a struct device to know when it goes away?
35 */
36 if (devcd->failing_dev->kobj.sd)
37 - sysfs_delete_link(&devcd->failing_dev->kobj, &dev->kobj,
38 - "devcoredump");
39 + sysfs_remove_link(&devcd->failing_dev->kobj, "devcoredump");
40
41 put_device(devcd->failing_dev);
42 kfree(devcd);
43 @@ -82,6 +86,9 @@ static void devcd_del(struct work_struct
44
45 devcd = container_of(wk, struct devcd_entry, del_wk.work);
46
47 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
48 + device_remove_bin_file(&devcd->devcd_dev, &devcd_attr_data);
49 +#endif
50 device_del(&devcd->devcd_dev);
51 put_device(&devcd->devcd_dev);
52 }
53 @@ -115,6 +122,7 @@ static struct bin_attribute devcd_attr_d
54 .write = devcd_data_write,
55 };
56
57 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
58 static struct bin_attribute *devcd_dev_bin_attrs[] = {
59 &devcd_attr_data, NULL,
60 };
61 @@ -126,6 +134,7 @@ static const struct attribute_group devc
62 static const struct attribute_group *devcd_dev_groups[] = {
63 &devcd_dev_group, NULL,
64 };
65 +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) */
66
67 static int devcd_free(struct device *dev, void *data)
68 {
69 @@ -160,18 +169,11 @@ static ssize_t disabled_store(struct cla
70
71 return count;
72 }
73 -static CLASS_ATTR_RW(disabled);
74
75 -static struct attribute *devcd_class_attrs[] = {
76 - &class_attr_disabled.attr,
77 - NULL,
78 +static struct class_attribute devcd_class_attrs[] = {
79 + __ATTR_RW(disabled),
80 + __ATTR_NULL
81 };
82 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
83 -ATTRIBUTE_GROUPS(devcd_class);
84 -#else
85 -#define BP_ATTR_GRP_STRUCT device_attribute
86 -ATTRIBUTE_GROUPS_BACKPORT(devcd_class);
87 -#endif
88
89 static struct class devcd_class = {
90 .name = "devcoredump",
91 @@ -179,10 +181,8 @@ static struct class devcd_class = {
92 .dev_release = devcd_dev_release,
93 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
94 .dev_groups = devcd_dev_groups,
95 -#else
96 - .dev_attrs = devcd_class_dev_attrs,
97 #endif
98 - .class_groups = devcd_class_groups,
99 + .class_attrs = devcd_class_attrs,
100 };
101
102 static ssize_t devcd_readv(char *buffer, loff_t offset, size_t count,
103 @@ -325,6 +325,11 @@ void dev_coredumpm(struct device *dev, s
104 if (device_add(&devcd->devcd_dev))
105 goto put_device;
106
107 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
108 + if (device_create_bin_file(&devcd->devcd_dev, &devcd_attr_data))
109 + goto put_device;
110 +#endif
111 +
112 if (sysfs_create_link(&devcd->devcd_dev.kobj, &dev->kobj,
113 "failing_device"))
114 /* nothing - symlink will be missing */;
115 @@ -367,16 +372,13 @@ void dev_coredumpsg(struct device *dev,
116 }
117 EXPORT_SYMBOL_GPL(dev_coredumpsg);
118
119 -static int __init devcoredump_init(void)
120 +int __init devcoredump_init(void)
121 {
122 - init_devcd_class_attrs();
123 return class_register(&devcd_class);
124 }
125 -__initcall(devcoredump_init);
126
127 -static void __exit devcoredump_exit(void)
128 +void __exit devcoredump_exit(void)
129 {
130 class_for_each_device(&devcd_class, NULL, NULL, devcd_free);
131 class_unregister(&devcd_class);
132 }
133 -__exitcall(devcoredump_exit);
134 --- a/include/linux/backport-devcoredump.h
135 +++ b/include/linux/backport-devcoredump.h
136 @@ -66,7 +66,7 @@ static inline void _devcd_free_sgtable(s
137 }
138
139
140 -#ifdef CONFIG_DEV_COREDUMP
141 +#ifdef CPTCFG_BPAUTO_WANT_DEV_COREDUMP
142 void dev_coredumpv(struct device *dev, void *data, size_t datalen,
143 gfp_t gfp);
144
145 @@ -100,6 +100,6 @@ static inline void dev_coredumpsg(struct
146 {
147 _devcd_free_sgtable(table);
148 }
149 -#endif /* CONFIG_DEV_COREDUMP */
150 +#endif /* CPTCFG_BPAUTO_WANT_DEV_COREDUMP */
151
152 #endif /* __DEVCOREDUMP_H */