diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-07-16 17:04:40 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 13:18:07 -0400 |
commit | 9e93f21b4309572c646bd8141a4853be5c031523 (patch) | |
tree | c90ff5bf99d92a78308fd4b3ac7b54acaaccedcc | |
parent | f2dec1eae8029bb056a3c1b2d3373681fa8e3e7a (diff) |
connector: Use ktime_get_ns()
Replace the ever recurring:
ts = ktime_get_ts();
ns = timespec_to_ns(&ts);
with
ns = ktime_get_ns();
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r-- | drivers/connector/cn_proc.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index ccdd4c7e748b..15d06fcf0b50 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -69,7 +69,6 @@ void proc_fork_connector(struct task_struct *task) | |||
69 | struct cn_msg *msg; | 69 | struct cn_msg *msg; |
70 | struct proc_event *ev; | 70 | struct proc_event *ev; |
71 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 71 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
72 | struct timespec ts; | ||
73 | struct task_struct *parent; | 72 | struct task_struct *parent; |
74 | 73 | ||
75 | if (atomic_read(&proc_event_num_listeners) < 1) | 74 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -79,8 +78,7 @@ void proc_fork_connector(struct task_struct *task) | |||
79 | ev = (struct proc_event *)msg->data; | 78 | ev = (struct proc_event *)msg->data; |
80 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 79 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
81 | get_seq(&msg->seq, &ev->cpu); | 80 | get_seq(&msg->seq, &ev->cpu); |
82 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 81 | ev->timestamp_ns = ktime_get_ns(); |
83 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
84 | ev->what = PROC_EVENT_FORK; | 82 | ev->what = PROC_EVENT_FORK; |
85 | rcu_read_lock(); | 83 | rcu_read_lock(); |
86 | parent = rcu_dereference(task->real_parent); | 84 | parent = rcu_dereference(task->real_parent); |
@@ -102,7 +100,6 @@ void proc_exec_connector(struct task_struct *task) | |||
102 | { | 100 | { |
103 | struct cn_msg *msg; | 101 | struct cn_msg *msg; |
104 | struct proc_event *ev; | 102 | struct proc_event *ev; |
105 | struct timespec ts; | ||
106 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 103 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
107 | 104 | ||
108 | if (atomic_read(&proc_event_num_listeners) < 1) | 105 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -112,8 +109,7 @@ void proc_exec_connector(struct task_struct *task) | |||
112 | ev = (struct proc_event *)msg->data; | 109 | ev = (struct proc_event *)msg->data; |
113 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 110 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
114 | get_seq(&msg->seq, &ev->cpu); | 111 | get_seq(&msg->seq, &ev->cpu); |
115 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 112 | ev->timestamp_ns = ktime_get_ns(); |
116 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
117 | ev->what = PROC_EVENT_EXEC; | 113 | ev->what = PROC_EVENT_EXEC; |
118 | ev->event_data.exec.process_pid = task->pid; | 114 | ev->event_data.exec.process_pid = task->pid; |
119 | ev->event_data.exec.process_tgid = task->tgid; | 115 | ev->event_data.exec.process_tgid = task->tgid; |
@@ -130,7 +126,6 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
130 | struct cn_msg *msg; | 126 | struct cn_msg *msg; |
131 | struct proc_event *ev; | 127 | struct proc_event *ev; |
132 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 128 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
133 | struct timespec ts; | ||
134 | const struct cred *cred; | 129 | const struct cred *cred; |
135 | 130 | ||
136 | if (atomic_read(&proc_event_num_listeners) < 1) | 131 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -156,8 +151,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
156 | } | 151 | } |
157 | rcu_read_unlock(); | 152 | rcu_read_unlock(); |
158 | get_seq(&msg->seq, &ev->cpu); | 153 | get_seq(&msg->seq, &ev->cpu); |
159 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 154 | ev->timestamp_ns = ktime_get_ns(); |
160 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
161 | 155 | ||
162 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 156 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
163 | msg->ack = 0; /* not used */ | 157 | msg->ack = 0; /* not used */ |
@@ -170,7 +164,6 @@ void proc_sid_connector(struct task_struct *task) | |||
170 | { | 164 | { |
171 | struct cn_msg *msg; | 165 | struct cn_msg *msg; |
172 | struct proc_event *ev; | 166 | struct proc_event *ev; |
173 | struct timespec ts; | ||
174 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 167 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
175 | 168 | ||
176 | if (atomic_read(&proc_event_num_listeners) < 1) | 169 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -180,8 +173,7 @@ void proc_sid_connector(struct task_struct *task) | |||
180 | ev = (struct proc_event *)msg->data; | 173 | ev = (struct proc_event *)msg->data; |
181 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 174 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
182 | get_seq(&msg->seq, &ev->cpu); | 175 | get_seq(&msg->seq, &ev->cpu); |
183 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 176 | ev->timestamp_ns = ktime_get_ns(); |
184 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
185 | ev->what = PROC_EVENT_SID; | 177 | ev->what = PROC_EVENT_SID; |
186 | ev->event_data.sid.process_pid = task->pid; | 178 | ev->event_data.sid.process_pid = task->pid; |
187 | ev->event_data.sid.process_tgid = task->tgid; | 179 | ev->event_data.sid.process_tgid = task->tgid; |
@@ -197,7 +189,6 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
197 | { | 189 | { |
198 | struct cn_msg *msg; | 190 | struct cn_msg *msg; |
199 | struct proc_event *ev; | 191 | struct proc_event *ev; |
200 | struct timespec ts; | ||
201 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 192 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
202 | 193 | ||
203 | if (atomic_read(&proc_event_num_listeners) < 1) | 194 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -207,8 +198,7 @@ void proc_ptrace_connector(struct task_struct *task, int ptrace_id) | |||
207 | ev = (struct proc_event *)msg->data; | 198 | ev = (struct proc_event *)msg->data; |
208 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 199 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
209 | get_seq(&msg->seq, &ev->cpu); | 200 | get_seq(&msg->seq, &ev->cpu); |
210 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 201 | ev->timestamp_ns = ktime_get_ns(); |
211 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
212 | ev->what = PROC_EVENT_PTRACE; | 202 | ev->what = PROC_EVENT_PTRACE; |
213 | ev->event_data.ptrace.process_pid = task->pid; | 203 | ev->event_data.ptrace.process_pid = task->pid; |
214 | ev->event_data.ptrace.process_tgid = task->tgid; | 204 | ev->event_data.ptrace.process_tgid = task->tgid; |
@@ -232,7 +222,6 @@ void proc_comm_connector(struct task_struct *task) | |||
232 | { | 222 | { |
233 | struct cn_msg *msg; | 223 | struct cn_msg *msg; |
234 | struct proc_event *ev; | 224 | struct proc_event *ev; |
235 | struct timespec ts; | ||
236 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 225 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
237 | 226 | ||
238 | if (atomic_read(&proc_event_num_listeners) < 1) | 227 | if (atomic_read(&proc_event_num_listeners) < 1) |
@@ -242,8 +231,7 @@ void proc_comm_connector(struct task_struct *task) | |||
242 | ev = (struct proc_event *)msg->data; | 231 | ev = (struct proc_event *)msg->data; |
243 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 232 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
244 | get_seq(&msg->seq, &ev->cpu); | 233 | get_seq(&msg->seq, &ev->cpu); |
245 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 234 | ev->timestamp_ns = ktime_get_ns(); |
246 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
247 | ev->what = PROC_EVENT_COMM; | 235 | ev->what = PROC_EVENT_COMM; |
248 | ev->event_data.comm.process_pid = task->pid; | 236 | ev->event_data.comm.process_pid = task->pid; |
249 | ev->event_data.comm.process_tgid = task->tgid; | 237 | ev->event_data.comm.process_tgid = task->tgid; |
@@ -261,7 +249,6 @@ void proc_coredump_connector(struct task_struct *task) | |||
261 | struct cn_msg *msg; | 249 | struct cn_msg *msg; |
262 | struct proc_event *ev; | 250 | struct proc_event *ev; |
263 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 251 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
264 | struct timespec ts; | ||
265 | 252 | ||
266 | if (atomic_read(&proc_event_num_listeners) < 1) | 253 | if (atomic_read(&proc_event_num_listeners) < 1) |
267 | return; | 254 | return; |
@@ -270,8 +257,7 @@ void proc_coredump_connector(struct task_struct *task) | |||
270 | ev = (struct proc_event *)msg->data; | 257 | ev = (struct proc_event *)msg->data; |
271 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 258 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
272 | get_seq(&msg->seq, &ev->cpu); | 259 | get_seq(&msg->seq, &ev->cpu); |
273 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 260 | ev->timestamp_ns = ktime_get_ns(); |
274 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
275 | ev->what = PROC_EVENT_COREDUMP; | 261 | ev->what = PROC_EVENT_COREDUMP; |
276 | ev->event_data.coredump.process_pid = task->pid; | 262 | ev->event_data.coredump.process_pid = task->pid; |
277 | ev->event_data.coredump.process_tgid = task->tgid; | 263 | ev->event_data.coredump.process_tgid = task->tgid; |
@@ -288,7 +274,6 @@ void proc_exit_connector(struct task_struct *task) | |||
288 | struct cn_msg *msg; | 274 | struct cn_msg *msg; |
289 | struct proc_event *ev; | 275 | struct proc_event *ev; |
290 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 276 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
291 | struct timespec ts; | ||
292 | 277 | ||
293 | if (atomic_read(&proc_event_num_listeners) < 1) | 278 | if (atomic_read(&proc_event_num_listeners) < 1) |
294 | return; | 279 | return; |
@@ -297,8 +282,7 @@ void proc_exit_connector(struct task_struct *task) | |||
297 | ev = (struct proc_event *)msg->data; | 282 | ev = (struct proc_event *)msg->data; |
298 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 283 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
299 | get_seq(&msg->seq, &ev->cpu); | 284 | get_seq(&msg->seq, &ev->cpu); |
300 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 285 | ev->timestamp_ns = ktime_get_ns(); |
301 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
302 | ev->what = PROC_EVENT_EXIT; | 286 | ev->what = PROC_EVENT_EXIT; |
303 | ev->event_data.exit.process_pid = task->pid; | 287 | ev->event_data.exit.process_pid = task->pid; |
304 | ev->event_data.exit.process_tgid = task->tgid; | 288 | ev->event_data.exit.process_tgid = task->tgid; |
@@ -325,7 +309,6 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
325 | struct cn_msg *msg; | 309 | struct cn_msg *msg; |
326 | struct proc_event *ev; | 310 | struct proc_event *ev; |
327 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); | 311 | __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); |
328 | struct timespec ts; | ||
329 | 312 | ||
330 | if (atomic_read(&proc_event_num_listeners) < 1) | 313 | if (atomic_read(&proc_event_num_listeners) < 1) |
331 | return; | 314 | return; |
@@ -334,8 +317,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
334 | ev = (struct proc_event *)msg->data; | 317 | ev = (struct proc_event *)msg->data; |
335 | memset(&ev->event_data, 0, sizeof(ev->event_data)); | 318 | memset(&ev->event_data, 0, sizeof(ev->event_data)); |
336 | msg->seq = rcvd_seq; | 319 | msg->seq = rcvd_seq; |
337 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 320 | ev->timestamp_ns = ktime_get_ns(); |
338 | ev->timestamp_ns = timespec_to_ns(&ts); | ||
339 | ev->cpu = -1; | 321 | ev->cpu = -1; |
340 | ev->what = PROC_EVENT_NONE; | 322 | ev->what = PROC_EVENT_NONE; |
341 | ev->event_data.ack.err = err; | 323 | ev->event_data.ack.err = err; |