[octeon] add a more basic generic profile
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.30 / 973-ocf_2.6.27_fix.patch
1 --- a/crypto/ocf/random.c
2 +++ b/crypto/ocf/random.c
3 @@ -49,6 +49,7 @@
4 #include <linux/unistd.h>
5 #include <linux/poll.h>
6 #include <linux/random.h>
7 +#include <linux/kthread.h>
8 #include <cryptodev.h>
9
10 #ifdef CONFIG_OCF_FIPS
11 @@ -81,7 +82,7 @@ struct random_op {
12
13 static int random_proc(void *arg);
14
15 -static pid_t randomproc = (pid_t) -1;
16 +static struct task_struct *random_task;
17 static spinlock_t random_lock;
18
19 /*
20 @@ -141,13 +142,18 @@ crypto_rregister(
21 spin_lock_irqsave(&random_lock, flags);
22 list_add_tail(&rops->random_list, &random_ops);
23 if (!started) {
24 - randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES);
25 - if (randomproc < 0) {
26 - ret = randomproc;
27 + struct task_struct *t;
28 +
29 + t = kthread_create(random_proc, NULL, "ocf-random");
30 + if (IS_ERR(t)) {
31 + ret = PTR_ERR(t);
32 printk("crypto: crypto_rregister cannot start random thread; "
33 "error %d", ret);
34 - } else
35 + } else {
36 + random_task = t;
37 + wake_up_process(t);
38 started = 1;
39 + }
40 }
41 spin_unlock_irqrestore(&random_lock, flags);
42
43 @@ -172,7 +178,7 @@ crypto_runregister_all(u_int32_t driveri
44
45 spin_lock_irqsave(&random_lock, flags);
46 if (list_empty(&random_ops) && started)
47 - kill_proc(randomproc, SIGKILL, 1);
48 + send_sig(SIGKILL, random_task, 1);
49 spin_unlock_irqrestore(&random_lock, flags);
50 return(0);
51 }
52 @@ -308,7 +314,7 @@ random_proc(void *arg)
53
54 bad_alloc:
55 spin_lock_irq(&random_lock);
56 - randomproc = (pid_t) -1;
57 + random_task = NULL;
58 started = 0;
59 spin_unlock_irq(&random_lock);
60
61 --- a/crypto/ocf/crypto.c
62 +++ b/crypto/ocf/crypto.c
63 @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD: src/sys/opencrypto/c
64 #include <linux/sched.h>
65 #include <linux/spinlock.h>
66 #include <linux/version.h>
67 +#include <linux/kthread.h>
68 #include <cryptodev.h>
69
70 /*
71 @@ -255,10 +256,10 @@ module_param(crypto_devallowsoft, int, 0
72 MODULE_PARM_DESC(crypto_devallowsoft,
73 "Enable/disable use of software crypto support");
74
75 -static pid_t cryptoproc = (pid_t) -1;
76 +static struct task_struct *crypto_task;
77 static struct completion cryptoproc_exited;
78 static DECLARE_WAIT_QUEUE_HEAD(cryptoproc_wait);
79 -static pid_t cryptoretproc = (pid_t) -1;
80 +static struct task_struct *cryptoret_task;
81 static struct completion cryptoretproc_exited;
82 static DECLARE_WAIT_QUEUE_HEAD(cryptoretproc_wait);
83
84 @@ -1401,7 +1402,7 @@ crypto_proc(void *arg)
85 wait_event_interruptible(cryptoproc_wait,
86 !(list_empty(&crp_q) || crypto_all_qblocked) ||
87 !(list_empty(&crp_kq) || crypto_all_kqblocked) ||
88 - cryptoproc == (pid_t) -1);
89 + crypto_task == NULL);
90 crp_sleep = 0;
91 if (signal_pending (current)) {
92 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
93 @@ -1414,7 +1415,7 @@ crypto_proc(void *arg)
94 }
95 CRYPTO_Q_LOCK();
96 dprintk("%s - awake\n", __FUNCTION__);
97 - if (cryptoproc == (pid_t) -1)
98 + if (crypto_task == NULL)
99 break;
100 cryptostats.cs_intrs++;
101 }
102 @@ -1470,7 +1471,7 @@ crypto_ret_proc(void *arg)
103 dprintk("%s - sleeping\n", __FUNCTION__);
104 CRYPTO_RETQ_UNLOCK();
105 wait_event_interruptible(cryptoretproc_wait,
106 - cryptoretproc == (pid_t) -1 ||
107 + cryptoret_task == NULL ||
108 !list_empty(&crp_ret_q) ||
109 !list_empty(&crp_ret_kq));
110 if (signal_pending (current)) {
111 @@ -1484,7 +1485,7 @@ crypto_ret_proc(void *arg)
112 }
113 CRYPTO_RETQ_LOCK();
114 dprintk("%s - awake\n", __FUNCTION__);
115 - if (cryptoretproc == (pid_t) -1) {
116 + if (cryptoret_task == NULL) {
117 dprintk("%s - EXITING!\n", __FUNCTION__);
118 break;
119 }
120 @@ -1597,6 +1598,7 @@ DB_SHOW_COMMAND(kcrypto, db_show_kcrypto
121 static int
122 crypto_init(void)
123 {
124 + struct task_struct *t;
125 int error;
126
127 dprintk("%s(0x%x)\n", __FUNCTION__, (int) crypto_init);
128 @@ -1643,23 +1645,27 @@ crypto_init(void)
129 init_completion(&cryptoproc_exited);
130 init_completion(&cryptoretproc_exited);
131
132 - cryptoproc = 0; /* to avoid race condition where proc runs first */
133 - cryptoproc = kernel_thread(crypto_proc, NULL, CLONE_FS|CLONE_FILES);
134 - if (cryptoproc < 0) {
135 - error = cryptoproc;
136 + crypto_task = NULL; /* to avoid race condition where proc runs first */
137 + t = kthread_create(crypto_proc, NULL, "ocf-crypto");
138 + if (IS_ERR(t)) {
139 + error = PTR_ERR(t);
140 printk("crypto: crypto_init cannot start crypto thread; error %d",
141 error);
142 goto bad;
143 }
144 + wake_up_process(t);
145 + crypto_task = t;
146
147 - cryptoretproc = 0; /* to avoid race condition where proc runs first */
148 - cryptoretproc = kernel_thread(crypto_ret_proc, NULL, CLONE_FS|CLONE_FILES);
149 - if (cryptoretproc < 0) {
150 - error = cryptoretproc;
151 + cryptoret_task = NULL; /* to avoid race condition where proc runs first */
152 + t = kthread_create(crypto_ret_proc, NULL, "ocf-cryptoret");
153 + if (IS_ERR(t)) {
154 + error = PTR_ERR(t);
155 printk("crypto: crypto_init cannot start cryptoret thread; error %d",
156 error);
157 goto bad;
158 }
159 + wake_up_process(t);
160 + cryptoret_task = t;
161
162 return 0;
163 bad:
164 @@ -1671,7 +1677,7 @@ bad:
165 static void
166 crypto_exit(void)
167 {
168 - pid_t p;
169 + struct task_struct *t;
170 unsigned long d_flags;
171
172 dprintk("%s()\n", __FUNCTION__);
173 @@ -1681,18 +1687,18 @@ crypto_exit(void)
174 */
175
176 CRYPTO_DRIVER_LOCK();
177 - p = cryptoproc;
178 - cryptoproc = (pid_t) -1;
179 - kill_proc(p, SIGTERM, 1);
180 + t = crypto_task;
181 + crypto_task = NULL;
182 + send_sig(SIGTERM, t, 1);
183 wake_up_interruptible(&cryptoproc_wait);
184 CRYPTO_DRIVER_UNLOCK();
185
186 wait_for_completion(&cryptoproc_exited);
187
188 CRYPTO_DRIVER_LOCK();
189 - p = cryptoretproc;
190 - cryptoretproc = (pid_t) -1;
191 - kill_proc(p, SIGTERM, 1);
192 + t = cryptoret_task;
193 + cryptoret_task = NULL;
194 + send_sig(SIGTERM, t, 1);
195 wake_up_interruptible(&cryptoretproc_wait);
196 CRYPTO_DRIVER_UNLOCK();
197
This page took 0.046594 seconds and 5 git commands to generate.