All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: connector: fixed coding style issues
@ 2012-07-14 20:26 Valentin Ilie
  2012-07-14 20:33 ` Joe Perches
  2012-07-14 23:08 ` [PATCH V2] " Valentin Ilie
  0 siblings, 2 replies; 7+ messages in thread
From: Valentin Ilie @ 2012-07-14 20:26 UTC (permalink / raw)
  To: zbr; +Cc: netdev, Valentin Ilie

Fixed checkpatch warnings.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
---
 drivers/connector/cn_proc.c   |   30 +++++++++++++++---------------
 drivers/connector/cn_queue.c  |    6 +++---
 drivers/connector/connector.c |    2 +-
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 77e1e6c..a76801c 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 };
 static inline void get_seq(__u32 *ts, int *cpu)
 {
 	preempt_disable();
-	*ts = __this_cpu_inc_return(proc_event_counts) -1;
+	*ts = __this_cpu_inc_return(proc_event_counts) - 1;
 	*cpu = smp_processor_id();
 	preempt_enable();
 }
@@ -62,8 +62,8 @@ void proc_fork_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -93,8 +93,8 @@ void proc_exec_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	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)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	ev->what = which_id;
 	ev->event_data.id.process_pid = task->pid;
 	ev->event_data.id.process_tgid = task->tgid;
@@ -134,7 +134,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
 		ev->event_data.id.e.egid = cred->egid;
 	} else {
 		rcu_read_unlock();
-	     	return;
+		return;
 	}
 	rcu_read_unlock();
 	get_seq(&msg->seq, &ev->cpu);
@@ -241,8 +241,8 @@ void proc_exit_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	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)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	msg->seq = rcvd_seq;
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -303,7 +303,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
 	if (msg->len != sizeof(*mc_op))
 		return;
 
-	mc_op = (enum proc_cn_mcast_op*)msg->data;
+	mc_op = (enum proc_cn_mcast_op *)msg->data;
 	switch (*mc_op) {
 	case PROC_CN_MCAST_LISTEN:
 		atomic_inc(&proc_event_num_listeners);
@@ -328,8 +328,8 @@ static int __init cn_proc_init(void)
 	int err;
 
 	if ((err = cn_add_callback(&cn_proc_event_id, "cn_proc",
-	 			   &cn_proc_mcast_ctl))) {
-		printk(KERN_WARNING "cn_proc failed to register\n");
+					&cn_proc_mcast_ctl))) {
+		pr_warn("cn_proc failed to register\n");
 		return err;
 	}
 	return 0;
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index c42c9d5..cd3bd7d 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -1,5 +1,5 @@
 /*
- * 	cn_queue.c
+ *	cn_queue.c
  *
  * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
  * All rights reserved.
@@ -40,7 +40,7 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
 
 	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
 	if (!cbq) {
-		printk(KERN_ERR "Failed to create new callback queue.\n");
+		pr_err("Failed to create new callback queue.\n");
 		return NULL;
 	}
 
@@ -149,7 +149,7 @@ void cn_queue_free_dev(struct cn_queue_dev *dev)
 	spin_unlock_bh(&dev->queue_lock);
 
 	while (atomic_read(&dev->refcnt)) {
-		printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
+		pr_info("Waiting for %s to become free: refcnt=%d.\n",
 		       dev->name, atomic_read(&dev->refcnt));
 		msleep(1000);
 	}
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index dde6a0f..36e89ae 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -1,5 +1,5 @@
 /*
- * 	connector.c
+ *	connector.c
  *
  * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
  * All rights reserved.
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: connector: fixed coding style issues
  2012-07-14 20:26 [PATCH] drivers: connector: fixed coding style issues Valentin Ilie
@ 2012-07-14 20:33 ` Joe Perches
  2012-07-14 21:51   ` Valentin Ilie
  2012-07-17  6:24   ` David Miller
  2012-07-14 23:08 ` [PATCH V2] " Valentin Ilie
  1 sibling, 2 replies; 7+ messages in thread
From: Joe Perches @ 2012-07-14 20:33 UTC (permalink / raw)
  To: Valentin Ilie; +Cc: zbr, netdev

On Sat, 2012-07-14 at 23:26 +0300, Valentin Ilie wrote:
> Fixed checkpatch warnings.
[]
> diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
[]
> @@ -328,8 +328,8 @@ static int __init cn_proc_init(void)
>  	int err;
>  
>  	if ((err = cn_add_callback(&cn_proc_event_id, "cn_proc",
> -	 			   &cn_proc_mcast_ctl))) {
> -		printk(KERN_WARNING "cn_proc failed to register\n");
> +					&cn_proc_mcast_ctl))) {
> +		pr_warn("cn_proc failed to register\n");

I don't believe the first part of this change is a checkpatch
message.  I think it would be better written by hoisting the
function outside the if like:

	err = cn_add_callback(&cn_proc_event_id, "cn_proc", &cn_proc_mcast_ctl)
	if (err) {
		pr_warn("cn_proc failed to register\n");
		return err;
	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: connector: fixed coding style issues
  2012-07-14 20:33 ` Joe Perches
@ 2012-07-14 21:51   ` Valentin Ilie
  2012-07-14 21:56     ` Joe Perches
  2012-07-17  6:24   ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Valentin Ilie @ 2012-07-14 21:51 UTC (permalink / raw)
  To: Joe Perches; +Cc: zbr, netdev

On 14 July 2012 23:33, Joe Perches <joe@perches.com> wrote:
> I think it would be better written by hoisting the
> function outside the if like [..]

OK.

Should I submit the whole patch again (with that change) or just
another small patch that does just that?

-- 
Valentin Ilie

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: connector: fixed coding style issues
  2012-07-14 21:51   ` Valentin Ilie
@ 2012-07-14 21:56     ` Joe Perches
  0 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2012-07-14 21:56 UTC (permalink / raw)
  To: Valentin Ilie; +Cc: zbr, netdev

On Sun, 2012-07-15 at 00:51 +0300, Valentin Ilie wrote:
> On 14 July 2012 23:33, Joe Perches <joe@perches.com> wrote:
> > I think it would be better written by hoisting the
> > function outside the if like [..]
> 
> OK.
> 
> Should I submit the whole patch again (with that change) or just
> another small patch that does just that?

It's generally better to reply to the original patch
with [PATCH V2] with the entire patch content updated.

btw: there's a missing a semicolon in what I posted.

Also add a changelog after the --- so the new patch
email looks like:

Subject: [PATCH V2] drivers: connectors: etc

Patch description...

Signed-off-by: etc
---
v2: Updated to do whatever

actual patch...

cheers, Joe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V2] drivers: connector: fixed coding style issues
  2012-07-14 20:26 [PATCH] drivers: connector: fixed coding style issues Valentin Ilie
  2012-07-14 20:33 ` Joe Perches
@ 2012-07-14 23:08 ` Valentin Ilie
  1 sibling, 0 replies; 7+ messages in thread
From: Valentin Ilie @ 2012-07-14 23:08 UTC (permalink / raw)
  To: zbr; +Cc: netdev, Valentin Ilie

V2: Replaced assignment in if statement.
Fixed coding style issues.

Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com>
---
 drivers/connector/cn_proc.c   |   36 ++++++++++++++++++------------------
 drivers/connector/cn_queue.c  |   12 +++++++-----
 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 77e1e6c..3e92b7d 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 };
 static inline void get_seq(__u32 *ts, int *cpu)
 {
 	preempt_disable();
-	*ts = __this_cpu_inc_return(proc_event_counts) -1;
+	*ts = __this_cpu_inc_return(proc_event_counts) - 1;
 	*cpu = smp_processor_id();
 	preempt_enable();
 }
@@ -62,8 +62,8 @@ void proc_fork_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -93,8 +93,8 @@ void proc_exec_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	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)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	ev->what = which_id;
 	ev->event_data.id.process_pid = task->pid;
 	ev->event_data.id.process_tgid = task->tgid;
@@ -134,7 +134,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
 		ev->event_data.id.e.egid = cred->egid;
 	} else {
 		rcu_read_unlock();
-	     	return;
+		return;
 	}
 	rcu_read_unlock();
 	get_seq(&msg->seq, &ev->cpu);
@@ -241,8 +241,8 @@ void proc_exit_connector(struct task_struct *task)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	get_seq(&msg->seq, &ev->cpu);
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	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)
 	if (atomic_read(&proc_event_num_listeners) < 1)
 		return;
 
-	msg = (struct cn_msg*)buffer;
-	ev = (struct proc_event*)msg->data;
+	msg = (struct cn_msg *)buffer;
+	ev = (struct proc_event *)msg->data;
 	msg->seq = rcvd_seq;
 	ktime_get_ts(&ts); /* get high res monotonic timestamp */
 	put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
@@ -303,7 +303,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
 	if (msg->len != sizeof(*mc_op))
 		return;
 
-	mc_op = (enum proc_cn_mcast_op*)msg->data;
+	mc_op = (enum proc_cn_mcast_op *)msg->data;
 	switch (*mc_op) {
 	case PROC_CN_MCAST_LISTEN:
 		atomic_inc(&proc_event_num_listeners);
@@ -325,11 +325,11 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
  */
 static int __init cn_proc_init(void)
 {
-	int err;
-
-	if ((err = cn_add_callback(&cn_proc_event_id, "cn_proc",
-	 			   &cn_proc_mcast_ctl))) {
-		printk(KERN_WARNING "cn_proc failed to register\n");
+	int err = cn_add_callback(&cn_proc_event_id,
+				  "cn_proc",
+				  &cn_proc_mcast_ctl);
+	if (err) {
+		pr_warn("cn_proc failed to register\n");
 		return err;
 	}
 	return 0;
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index c42c9d5..1f8bf05 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -1,5 +1,5 @@
 /*
- * 	cn_queue.c
+ *	cn_queue.c
  *
  * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
  * All rights reserved.
@@ -34,13 +34,14 @@
 static struct cn_callback_entry *
 cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
 			      struct cb_id *id,
-			      void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
+			      void (*callback)(struct cn_msg *,
+					       struct netlink_skb_parms *))
 {
 	struct cn_callback_entry *cbq;
 
 	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
 	if (!cbq) {
-		printk(KERN_ERR "Failed to create new callback queue.\n");
+		pr_err("Failed to create new callback queue.\n");
 		return NULL;
 	}
 
@@ -71,7 +72,8 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2)
 
 int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
 			  struct cb_id *id,
-			  void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
+			  void (*callback)(struct cn_msg *,
+					   struct netlink_skb_parms *))
 {
 	struct cn_callback_entry *cbq, *__cbq;
 	int found = 0;
@@ -149,7 +151,7 @@ void cn_queue_free_dev(struct cn_queue_dev *dev)
 	spin_unlock_bh(&dev->queue_lock);
 
 	while (atomic_read(&dev->refcnt)) {
-		printk(KERN_INFO "Waiting for %s to become free: refcnt=%d.\n",
+		pr_info("Waiting for %s to become free: refcnt=%d.\n",
 		       dev->name, atomic_read(&dev->refcnt));
 		msleep(1000);
 	}
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index dde6a0f..32174f0 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -1,5 +1,5 @@
 /*
- * 	connector.c
+ *	connector.c
  *
  * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
  * All rights reserved.
@@ -185,7 +185,8 @@ static void cn_rx_skb(struct sk_buff *__skb)
  * May sleep.
  */
 int cn_add_callback(struct cb_id *id, const char *name,
-		    void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
+		    void (*callback)(struct cn_msg *,
+				     struct netlink_skb_parms *))
 {
 	int err;
 	struct cn_dev *dev = &cdev;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: connector: fixed coding style issues
  2012-07-14 20:33 ` Joe Perches
  2012-07-14 21:51   ` Valentin Ilie
@ 2012-07-17  6:24   ` David Miller
  2012-07-17  7:26     ` Evgeniy Polyakov
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2012-07-17  6:24 UTC (permalink / raw)
  To: joe; +Cc: valentin.ilie, zbr, netdev


I applied v2 of this patch, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drivers: connector: fixed coding style issues
  2012-07-17  6:24   ` David Miller
@ 2012-07-17  7:26     ` Evgeniy Polyakov
  0 siblings, 0 replies; 7+ messages in thread
From: Evgeniy Polyakov @ 2012-07-17  7:26 UTC (permalink / raw)
  To: David Miller; +Cc: joe, valentin.ilie, netdev

On Mon, Jul 16, 2012 at 11:24:41PM -0700, David Miller (davem@davemloft.net) wrote:
> 
> I applied v2 of this patch, thanks.

Thanks, everyone!

-- 
	Evgeniy Polyakov

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-17  7:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-14 20:26 [PATCH] drivers: connector: fixed coding style issues Valentin Ilie
2012-07-14 20:33 ` Joe Perches
2012-07-14 21:51   ` Valentin Ilie
2012-07-14 21:56     ` Joe Perches
2012-07-17  6:24   ` David Miller
2012-07-17  7:26     ` Evgeniy Polyakov
2012-07-14 23:08 ` [PATCH V2] " Valentin Ilie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.