aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/connector')
-rw-r--r--drivers/connector/cn_proc.c11
-rw-r--r--drivers/connector/cn_queue.c5
-rw-r--r--drivers/connector/connector.c17
3 files changed, 15 insertions, 18 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 3ece69231343..5c9f67f98d10 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/connector.h> 29#include <linux/connector.h>
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31#include <asm/unaligned.h>
31 32
32#include <linux/cn_proc.h> 33#include <linux/cn_proc.h>
33 34
@@ -60,7 +61,7 @@ void proc_fork_connector(struct task_struct *task)
60 ev = (struct proc_event*)msg->data; 61 ev = (struct proc_event*)msg->data;
61 get_seq(&msg->seq, &ev->cpu); 62 get_seq(&msg->seq, &ev->cpu);
62 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 63 ktime_get_ts(&ts); /* get high res monotonic timestamp */
63 ev->timestamp_ns = timespec_to_ns(&ts); 64 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
64 ev->what = PROC_EVENT_FORK; 65 ev->what = PROC_EVENT_FORK;
65 ev->event_data.fork.parent_pid = task->real_parent->pid; 66 ev->event_data.fork.parent_pid = task->real_parent->pid;
66 ev->event_data.fork.parent_tgid = task->real_parent->tgid; 67 ev->event_data.fork.parent_tgid = task->real_parent->tgid;
@@ -88,7 +89,7 @@ void proc_exec_connector(struct task_struct *task)
88 ev = (struct proc_event*)msg->data; 89 ev = (struct proc_event*)msg->data;
89 get_seq(&msg->seq, &ev->cpu); 90 get_seq(&msg->seq, &ev->cpu);
90 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 91 ktime_get_ts(&ts); /* get high res monotonic timestamp */
91 ev->timestamp_ns = timespec_to_ns(&ts); 92 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
92 ev->what = PROC_EVENT_EXEC; 93 ev->what = PROC_EVENT_EXEC;
93 ev->event_data.exec.process_pid = task->pid; 94 ev->event_data.exec.process_pid = task->pid;
94 ev->event_data.exec.process_tgid = task->tgid; 95 ev->event_data.exec.process_tgid = task->tgid;
@@ -124,7 +125,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
124 return; 125 return;
125 get_seq(&msg->seq, &ev->cpu); 126 get_seq(&msg->seq, &ev->cpu);
126 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 127 ktime_get_ts(&ts); /* get high res monotonic timestamp */
127 ev->timestamp_ns = timespec_to_ns(&ts); 128 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
128 129
129 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 130 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
130 msg->ack = 0; /* not used */ 131 msg->ack = 0; /* not used */
@@ -146,7 +147,7 @@ void proc_exit_connector(struct task_struct *task)
146 ev = (struct proc_event*)msg->data; 147 ev = (struct proc_event*)msg->data;
147 get_seq(&msg->seq, &ev->cpu); 148 get_seq(&msg->seq, &ev->cpu);
148 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 149 ktime_get_ts(&ts); /* get high res monotonic timestamp */
149 ev->timestamp_ns = timespec_to_ns(&ts); 150 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
150 ev->what = PROC_EVENT_EXIT; 151 ev->what = PROC_EVENT_EXIT;
151 ev->event_data.exit.process_pid = task->pid; 152 ev->event_data.exit.process_pid = task->pid;
152 ev->event_data.exit.process_tgid = task->tgid; 153 ev->event_data.exit.process_tgid = task->tgid;
@@ -181,7 +182,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
181 ev = (struct proc_event*)msg->data; 182 ev = (struct proc_event*)msg->data;
182 msg->seq = rcvd_seq; 183 msg->seq = rcvd_seq;
183 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 184 ktime_get_ts(&ts); /* get high res monotonic timestamp */
184 ev->timestamp_ns = timespec_to_ns(&ts); 185 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
185 ev->cpu = -1; 186 ev->cpu = -1;
186 ev->what = PROC_EVENT_NONE; 187 ev->what = PROC_EVENT_NONE;
187 ev->event_data.ack.err = err; 188 ev->event_data.ack.err = err;
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index b418b16e910e..296f51002b55 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -34,7 +34,7 @@
34void cn_queue_wrapper(struct work_struct *work) 34void cn_queue_wrapper(struct work_struct *work)
35{ 35{
36 struct cn_callback_entry *cbq = 36 struct cn_callback_entry *cbq =
37 container_of(work, struct cn_callback_entry, work.work); 37 container_of(work, struct cn_callback_entry, work);
38 struct cn_callback_data *d = &cbq->data; 38 struct cn_callback_data *d = &cbq->data;
39 39
40 d->callback(d->callback_priv); 40 d->callback(d->callback_priv);
@@ -59,13 +59,12 @@ static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struc
59 memcpy(&cbq->id.id, id, sizeof(struct cb_id)); 59 memcpy(&cbq->id.id, id, sizeof(struct cb_id));
60 cbq->data.callback = callback; 60 cbq->data.callback = callback;
61 61
62 INIT_DELAYED_WORK(&cbq->work, &cn_queue_wrapper); 62 INIT_WORK(&cbq->work, &cn_queue_wrapper);
63 return cbq; 63 return cbq;
64} 64}
65 65
66static void cn_queue_free_callback(struct cn_callback_entry *cbq) 66static void cn_queue_free_callback(struct cn_callback_entry *cbq)
67{ 67{
68 cancel_delayed_work(&cbq->work);
69 flush_workqueue(cbq->pdev->cn_queue); 68 flush_workqueue(cbq->pdev->cn_queue);
70 69
71 kfree(cbq); 70 kfree(cbq);
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 5e7cd45d10ee..a44db75bc25b 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -135,17 +135,15 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
135 spin_lock_bh(&dev->cbdev->queue_lock); 135 spin_lock_bh(&dev->cbdev->queue_lock);
136 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { 136 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
137 if (cn_cb_equal(&__cbq->id.id, &msg->id)) { 137 if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
138 if (likely(!test_bit(WORK_STRUCT_PENDING, 138 if (likely(!work_pending(&__cbq->work) &&
139 &__cbq->work.work.management) &&
140 __cbq->data.ddata == NULL)) { 139 __cbq->data.ddata == NULL)) {
141 __cbq->data.callback_priv = msg; 140 __cbq->data.callback_priv = msg;
142 141
143 __cbq->data.ddata = data; 142 __cbq->data.ddata = data;
144 __cbq->data.destruct_data = destruct_data; 143 __cbq->data.destruct_data = destruct_data;
145 144
146 if (queue_delayed_work( 145 if (queue_work(dev->cbdev->cn_queue,
147 dev->cbdev->cn_queue, 146 &__cbq->work))
148 &__cbq->work, 0))
149 err = 0; 147 err = 0;
150 } else { 148 } else {
151 struct cn_callback_data *d; 149 struct cn_callback_data *d;
@@ -159,12 +157,11 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
159 d->destruct_data = destruct_data; 157 d->destruct_data = destruct_data;
160 d->free = __cbq; 158 d->free = __cbq;
161 159
162 INIT_DELAYED_WORK(&__cbq->work, 160 INIT_WORK(&__cbq->work,
163 &cn_queue_wrapper); 161 &cn_queue_wrapper);
164 162
165 if (queue_delayed_work( 163 if (queue_work(dev->cbdev->cn_queue,
166 dev->cbdev->cn_queue, 164 &__cbq->work))
167 &__cbq->work, 0))
168 err = 0; 165 err = 0;
169 else { 166 else {
170 kfree(__cbq); 167 kfree(__cbq);