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