diff options
author | Valentin Ilie <valentin.ilie@gmail.com> | 2012-07-14 09:08:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-17 02:23:52 -0400 |
commit | f3c48ecce56df6168be07377bf32bba88314b14c (patch) | |
tree | ad84e4042379267670977d0c652d5af224d13f85 /drivers/connector | |
parent | ad8c94532acbd64e7ada25ce188befb6ef6b2027 (diff) |
drivers: connector: fixed coding style issues
V2: Replaced assignment in if statement.
Fixed coding style issues.
Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/connector')
-rw-r--r-- | drivers/connector/cn_proc.c | 36 | ||||
-rw-r--r-- | drivers/connector/cn_queue.c | 12 | ||||
-rw-r--r-- | drivers/connector/connector.c | 5 |
3 files changed, 28 insertions, 25 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 77e1e6cd66ce..3e92b7d3fcd2 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -46,7 +46,7 @@ static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; | |||
46 | static inline void get_seq(__u32 *ts, int *cpu) | 46 | static inline void get_seq(__u32 *ts, int *cpu) |
47 | { | 47 | { |
48 | preempt_disable(); | 48 | preempt_disable(); |
49 | *ts = __this_cpu_inc_return(proc_event_counts) -1; | 49 | *ts = __this_cpu_inc_return(proc_event_counts) - 1; |
50 | *cpu = smp_processor_id(); | 50 | *cpu = smp_processor_id(); |
51 | preempt_enable(); | 51 | preempt_enable(); |
52 | } | 52 | } |
@@ -62,8 +62,8 @@ void proc_fork_connector(struct task_struct *task) | |||
62 | if (atomic_read(&proc_event_num_listeners) < 1) | 62 | if (atomic_read(&proc_event_num_listeners) < 1) |
63 | return; | 63 | return; |
64 | 64 | ||
65 | msg = (struct cn_msg*)buffer; | 65 | msg = (struct cn_msg *)buffer; |
66 | ev = (struct proc_event*)msg->data; | 66 | ev = (struct proc_event *)msg->data; |
67 | get_seq(&msg->seq, &ev->cpu); | 67 | get_seq(&msg->seq, &ev->cpu); |
68 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 68 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
69 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 69 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -93,8 +93,8 @@ void proc_exec_connector(struct task_struct *task) | |||
93 | if (atomic_read(&proc_event_num_listeners) < 1) | 93 | if (atomic_read(&proc_event_num_listeners) < 1) |
94 | return; | 94 | return; |
95 | 95 | ||
96 | msg = (struct cn_msg*)buffer; | 96 | msg = (struct cn_msg *)buffer; |
97 | ev = (struct proc_event*)msg->data; | 97 | ev = (struct proc_event *)msg->data; |
98 | get_seq(&msg->seq, &ev->cpu); | 98 | get_seq(&msg->seq, &ev->cpu); |
99 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 99 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
100 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 100 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -119,8 +119,8 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
119 | if (atomic_read(&proc_event_num_listeners) < 1) | 119 | if (atomic_read(&proc_event_num_listeners) < 1) |
120 | return; | 120 | return; |
121 | 121 | ||
122 | msg = (struct cn_msg*)buffer; | 122 | msg = (struct cn_msg *)buffer; |
123 | ev = (struct proc_event*)msg->data; | 123 | ev = (struct proc_event *)msg->data; |
124 | ev->what = which_id; | 124 | ev->what = which_id; |
125 | ev->event_data.id.process_pid = task->pid; | 125 | ev->event_data.id.process_pid = task->pid; |
126 | ev->event_data.id.process_tgid = task->tgid; | 126 | ev->event_data.id.process_tgid = task->tgid; |
@@ -134,7 +134,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
134 | ev->event_data.id.e.egid = cred->egid; | 134 | ev->event_data.id.e.egid = cred->egid; |
135 | } else { | 135 | } else { |
136 | rcu_read_unlock(); | 136 | rcu_read_unlock(); |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | rcu_read_unlock(); | 139 | rcu_read_unlock(); |
140 | get_seq(&msg->seq, &ev->cpu); | 140 | get_seq(&msg->seq, &ev->cpu); |
@@ -241,8 +241,8 @@ void proc_exit_connector(struct task_struct *task) | |||
241 | if (atomic_read(&proc_event_num_listeners) < 1) | 241 | if (atomic_read(&proc_event_num_listeners) < 1) |
242 | return; | 242 | return; |
243 | 243 | ||
244 | msg = (struct cn_msg*)buffer; | 244 | msg = (struct cn_msg *)buffer; |
245 | ev = (struct proc_event*)msg->data; | 245 | ev = (struct proc_event *)msg->data; |
246 | get_seq(&msg->seq, &ev->cpu); | 246 | get_seq(&msg->seq, &ev->cpu); |
247 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 247 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
248 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 248 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -276,8 +276,8 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
276 | if (atomic_read(&proc_event_num_listeners) < 1) | 276 | if (atomic_read(&proc_event_num_listeners) < 1) |
277 | return; | 277 | return; |
278 | 278 | ||
279 | msg = (struct cn_msg*)buffer; | 279 | msg = (struct cn_msg *)buffer; |
280 | ev = (struct proc_event*)msg->data; | 280 | ev = (struct proc_event *)msg->data; |
281 | msg->seq = rcvd_seq; | 281 | msg->seq = rcvd_seq; |
282 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ | 282 | ktime_get_ts(&ts); /* get high res monotonic timestamp */ |
283 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); | 283 | put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); |
@@ -303,7 +303,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, | |||
303 | if (msg->len != sizeof(*mc_op)) | 303 | if (msg->len != sizeof(*mc_op)) |
304 | return; | 304 | return; |
305 | 305 | ||
306 | mc_op = (enum proc_cn_mcast_op*)msg->data; | 306 | mc_op = (enum proc_cn_mcast_op *)msg->data; |
307 | switch (*mc_op) { | 307 | switch (*mc_op) { |
308 | case PROC_CN_MCAST_LISTEN: | 308 | case PROC_CN_MCAST_LISTEN: |
309 | atomic_inc(&proc_event_num_listeners); | 309 | atomic_inc(&proc_event_num_listeners); |
@@ -325,11 +325,11 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, | |||
325 | */ | 325 | */ |
326 | static int __init cn_proc_init(void) | 326 | static int __init cn_proc_init(void) |
327 | { | 327 | { |
328 | int err; | 328 | int err = cn_add_callback(&cn_proc_event_id, |
329 | 329 | "cn_proc", | |
330 | if ((err = cn_add_callback(&cn_proc_event_id, "cn_proc", | 330 | &cn_proc_mcast_ctl); |
331 | &cn_proc_mcast_ctl))) { | 331 | if (err) { |
332 | printk(KERN_WARNING "cn_proc failed to register\n"); | 332 | pr_warn("cn_proc failed to register\n"); |
333 | return err; | 333 | return err; |
334 | } | 334 | } |
335 | return 0; | 335 | return 0; |
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c index c42c9d517790..1f8bf054d11c 100644 --- a/drivers/connector/cn_queue.c +++ b/drivers/connector/cn_queue.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * cn_queue.c | 2 | * cn_queue.c |
3 | * | 3 | * |
4 | * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> | 4 | * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> |
5 | * All rights reserved. | 5 | * All rights reserved. |
@@ -34,13 +34,14 @@ | |||
34 | static struct cn_callback_entry * | 34 | static struct cn_callback_entry * |
35 | cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, | 35 | cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name, |
36 | struct cb_id *id, | 36 | struct cb_id *id, |
37 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) | 37 | void (*callback)(struct cn_msg *, |
38 | struct netlink_skb_parms *)) | ||
38 | { | 39 | { |
39 | struct cn_callback_entry *cbq; | 40 | struct cn_callback_entry *cbq; |
40 | 41 | ||
41 | cbq = kzalloc(sizeof(*cbq), GFP_KERNEL); | 42 | cbq = kzalloc(sizeof(*cbq), GFP_KERNEL); |
42 | if (!cbq) { | 43 | if (!cbq) { |
43 | printk(KERN_ERR "Failed to create new callback queue.\n"); | 44 | pr_err("Failed to create new callback queue.\n"); |
44 | return NULL; | 45 | return NULL; |
45 | } | 46 | } |
46 | 47 | ||
@@ -71,7 +72,8 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2) | |||
71 | 72 | ||
72 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, | 73 | int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, |
73 | struct cb_id *id, | 74 | struct cb_id *id, |
74 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) | 75 | void (*callback)(struct cn_msg *, |
76 | struct netlink_skb_parms *)) | ||
75 | { | 77 | { |
76 | struct cn_callback_entry *cbq, *__cbq; | 78 | struct cn_callback_entry *cbq, *__cbq; |
77 | int found = 0; | 79 | int found = 0; |
@@ -149,7 +151,7 @@ void cn_queue_free_dev(struct cn_queue_dev *dev) | |||
149 | spin_unlock_bh(&dev->queue_lock); | 151 | spin_unlock_bh(&dev->queue_lock); |
150 | 152 | ||
151 | while (atomic_read(&dev->refcnt)) { | 153 | while (atomic_read(&dev->refcnt)) { |
152 | printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n", | 154 | pr_info("Waiting for %s to become free: refcnt=%d.\n", |
153 | dev->name, atomic_read(&dev->refcnt)); | 155 | dev->name, atomic_read(&dev->refcnt)); |
154 | msleep(1000); | 156 | msleep(1000); |
155 | } | 157 | } |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 116cf8d02834..82fa4f0f91d6 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * connector.c | 2 | * connector.c |
3 | * | 3 | * |
4 | * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> | 4 | * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> |
5 | * All rights reserved. | 5 | * All rights reserved. |
@@ -185,7 +185,8 @@ static void cn_rx_skb(struct sk_buff *__skb) | |||
185 | * May sleep. | 185 | * May sleep. |
186 | */ | 186 | */ |
187 | int cn_add_callback(struct cb_id *id, const char *name, | 187 | int cn_add_callback(struct cb_id *id, const char *name, |
188 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) | 188 | void (*callback)(struct cn_msg *, |
189 | struct netlink_skb_parms *)) | ||
189 | { | 190 | { |
190 | int err; | 191 | int err; |
191 | struct cn_dev *dev = &cdev; | 192 | struct cn_dev *dev = &cdev; |