netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] llc: "foo* bar" should be "foo *bar"
@ 2013-12-20  3:14 Chen Weilong
  2013-12-20  3:15 ` [PATCH 2/2] llc: fix checkpatch errors with space Chen Weilong
  2013-12-27 18:06 ` [PATCH 1/2] llc: "foo* bar" should be "foo *bar" David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Weilong @ 2013-12-20  3:14 UTC (permalink / raw)
  To: acme, davem; +Cc: netdev

From: Weilong Chen <chenweilong@huawei.com>


Signed-off-by: Weilong Chen <chenweilong@huawei.com>
---
 net/llc/llc_conn.c | 4 ++--
 net/llc/llc_core.c | 2 +-
 net/llc/llc_sap.c  | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index cd87241..42dc2e4 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -753,7 +753,7 @@ void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk)
  *
  *	Sends received pdus to the connection state machine.
  */
-static int llc_conn_rcv(struct sock* sk, struct sk_buff *skb)
+static int llc_conn_rcv(struct sock *sk, struct sk_buff *skb)
 {
 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
 
@@ -891,7 +891,7 @@ out_kfree_skb:
  *
  *     Initializes a socket with default llc values.
  */
-static void llc_sk_init(struct sock* sk)
+static void llc_sk_init(struct sock *sk)
 {
 	struct llc_sock *llc = llc_sk(sk);
 
diff --git a/net/llc/llc_core.c b/net/llc/llc_core.c
index 2bb0ddf..e251c04 100644
--- a/net/llc/llc_core.c
+++ b/net/llc/llc_core.c
@@ -48,7 +48,7 @@ static struct llc_sap *llc_sap_alloc(void)
 
 static struct llc_sap *__llc_sap_find(unsigned char sap_value)
 {
-	struct llc_sap* sap;
+	struct llc_sap *sap;
 
 	list_for_each_entry(sap, &llc_sap_list, node)
 		if (sap->laddr.lsap == sap_value)
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index e585069..06033f6 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -66,7 +66,7 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev,
 	return skb;
 }
 
-void llc_save_primitive(struct sock *sk, struct sk_buff* skb, u8 prim)
+void llc_save_primitive(struct sock *sk, struct sk_buff *skb, u8 prim)
 {
 	struct sockaddr_llc *addr;
 
@@ -114,7 +114,7 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb)
  *	failure.
  */
 static struct llc_sap_state_trans *llc_find_sap_trans(struct llc_sap *sap,
-						      struct sk_buff* skb)
+						      struct sk_buff *skb)
 {
 	int i = 0;
 	struct llc_sap_state_trans *rc = NULL;
-- 
1.7.12

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

* [PATCH 2/2] llc: fix checkpatch errors with space
  2013-12-20  3:14 [PATCH 1/2] llc: "foo* bar" should be "foo *bar" Chen Weilong
@ 2013-12-20  3:15 ` Chen Weilong
  2013-12-20  3:48   ` Joe Perches
  2013-12-27 18:06 ` [PATCH 1/2] llc: "foo* bar" should be "foo *bar" David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Chen Weilong @ 2013-12-20  3:15 UTC (permalink / raw)
  To: acme, davem; +Cc: netdev

From: Weilong Chen <chenweilong@huawei.com>


Signed-off-by: Weilong Chen <chenweilong@huawei.com>
---
 net/llc/af_llc.c   | 2 +-
 net/llc/llc_c_ac.c | 2 +-
 net/llc/llc_pdu.c  | 2 +-
 net/llc/llc_proc.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 7b01b9f..0335407 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -980,7 +980,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
 		rc = -ENOTCONN;
 		if (sk->sk_state != TCP_ESTABLISHED)
 			goto out;
-		if(llc->dev)
+		if (llc->dev)
 			sllc.sllc_arphrd = llc->dev->type;
 		sllc.sllc_sap = llc->daddr.lsap;
 		memcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index ea225bd..91dba83 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -1024,7 +1024,7 @@ int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct sk_buff *skb)
 				if (llc->npta > 0)
 					llc->npta = llc->npta - 1;
 			} else
-				llc->dec_cntr -=1;
+				llc->dec_cntr -= 1;
 		}
 	} else
 		llc->connect_step = 0 ;
diff --git a/net/llc/llc_pdu.c b/net/llc/llc_pdu.c
index 2e6cb79..dea9b43 100644
--- a/net/llc/llc_pdu.c
+++ b/net/llc/llc_pdu.c
@@ -231,7 +231,7 @@ void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
 
 	frmr_info = (struct llc_frmr_info *)&pdu->ctrl_2;
 	ctrl = (u8 *)&prev_pdu->ctrl_1;
-	FRMR_INFO_SET_REJ_CNTRL(frmr_info,ctrl);
+	FRMR_INFO_SET_REJ_CNTRL(frmr_info, ctrl);
 	FRMR_INFO_SET_Vs(frmr_info, vs);
 	FRMR_INFO_SET_Vr(frmr_info, vr);
 	prev_pf = llc_pdu_get_pf_bit(prev_pdu);
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 1a3c7e0..abf28eb 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -142,7 +142,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
 	if (llc->dev)
 		llc_ui_format_mac(seq, llc->dev->dev_addr);
 	else {
-		u8 addr[6] = {0,0,0,0,0,0};
+		u8 addr[6] = {0, 0, 0, 0, 0, 0};
 		llc_ui_format_mac(seq, addr);
 	}
 	seq_printf(seq, "@%02X ", llc->sap->laddr.lsap);
-- 
1.7.12

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

* Re: [PATCH 2/2] llc: fix checkpatch errors with space
  2013-12-20  3:15 ` [PATCH 2/2] llc: fix checkpatch errors with space Chen Weilong
@ 2013-12-20  3:48   ` Joe Perches
  2013-12-20  4:52     ` chenweilong
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2013-12-20  3:48 UTC (permalink / raw)
  To: Chen Weilong; +Cc: acme, davem, netdev

On Fri, 2013-12-20 at 11:15 +0800, Chen Weilong wrote:
> From: Weilong Chen <chenweilong@huawei.com>
[]
> diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
> index 1a3c7e0..abf28eb 100644
> --- a/net/llc/llc_proc.c
> +++ b/net/llc/llc_proc.c
> @@ -142,7 +142,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
>  	if (llc->dev)
>  		llc_ui_format_mac(seq, llc->dev->dev_addr);
>  	else {
> -		u8 addr[6] = {0,0,0,0,0,0};
> +		u8 addr[6] = {0, 0, 0, 0, 0, 0};
>  		llc_ui_format_mac(seq, addr);

No need to constantly reinitialize addr and the
static function llc_ui_format_mac is pretty useless.

Perhaps this instead?

Consolidate multiple seq_printfs to a single call.
Remove unnecessary llc_ui_format_mac and use %pM directly.

---
 net/llc/llc_proc.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 1a3c7e0..f264038 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -26,11 +26,6 @@
 #include <net/llc_c_st.h>
 #include <net/llc_conn.h>
 
-static void llc_ui_format_mac(struct seq_file *seq, u8 *addr)
-{
-	seq_printf(seq, "%pM", addr);
-}
-
 static struct sock *llc_get_sk_idx(loff_t pos)
 {
 	struct llc_sap *sap;
@@ -125,6 +120,7 @@ static void llc_seq_stop(struct seq_file *seq, void *v)
 
 static int llc_seq_socket_show(struct seq_file *seq, void *v)
 {
+	static const u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 	struct sock* sk;
 	struct llc_sock *llc;
 
@@ -137,17 +133,11 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
 	llc = llc_sk(sk);
 
 	/* FIXME: check if the address is multicast */
-	seq_printf(seq, "%2X  %2X ", sk->sk_type, 0);
-
-	if (llc->dev)
-		llc_ui_format_mac(seq, llc->dev->dev_addr);
-	else {
-		u8 addr[6] = {0,0,0,0,0,0};
-		llc_ui_format_mac(seq, addr);
-	}
-	seq_printf(seq, "@%02X ", llc->sap->laddr.lsap);
-	llc_ui_format_mac(seq, llc->daddr.mac);
-	seq_printf(seq, "@%02X %8d %8d %2d %3u %4d\n", llc->daddr.lsap,
+	seq_printf(seq, "%2X  %2X %pM@%02X %pM@%02X %8d %8d %2d %3u %4d\n",
+		   sk->sk_type, 0,
+		   llc->dev ? llc->dev->dev_addr : null_addr,
+		   llc->sap->laddr.lsap,
+		   llc->daddr.mac, llc->daddr.lsap,
 		   sk_wmem_alloc_get(sk),
 		   sk_rmem_alloc_get(sk) - llc->copied_seq,
 		   sk->sk_state,

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

* Re: [PATCH 2/2] llc: fix checkpatch errors with space
  2013-12-20  3:48   ` Joe Perches
@ 2013-12-20  4:52     ` chenweilong
  0 siblings, 0 replies; 5+ messages in thread
From: chenweilong @ 2013-12-20  4:52 UTC (permalink / raw)
  To: Joe Perches; +Cc: acme, davem, netdev

On 2013/12/20 11:48, Joe Perches wrote:
> On Fri, 2013-12-20 at 11:15 +0800, Chen Weilong wrote:
>> From: Weilong Chen <chenweilong@huawei.com>
> []
>> diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
>> index 1a3c7e0..abf28eb 100644
>> --- a/net/llc/llc_proc.c
>> +++ b/net/llc/llc_proc.c
>> @@ -142,7 +142,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
>>  	if (llc->dev)
>>  		llc_ui_format_mac(seq, llc->dev->dev_addr);
>>  	else {
>> -		u8 addr[6] = {0,0,0,0,0,0};
>> +		u8 addr[6] = {0, 0, 0, 0, 0, 0};
>>  		llc_ui_format_mac(seq, addr);
> 
> No need to constantly reinitialize addr and the
> static function llc_ui_format_mac is pretty useless.
> 
> Perhaps this instead?
> 
> Consolidate multiple seq_printfs to a single call.
> Remove unnecessary llc_ui_format_mac and use %pM directly.
> 
> ---
>  net/llc/llc_proc.c | 22 ++++++----------------
>  1 file changed, 6 insertions(+), 16 deletions(-)
> 
> diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
> index 1a3c7e0..f264038 100644
> --- a/net/llc/llc_proc.c
> +++ b/net/llc/llc_proc.c
> @@ -26,11 +26,6 @@
>  #include <net/llc_c_st.h>
>  #include <net/llc_conn.h>
>  
> -static void llc_ui_format_mac(struct seq_file *seq, u8 *addr)
> -{
> -	seq_printf(seq, "%pM", addr);
> -}
> -
>  static struct sock *llc_get_sk_idx(loff_t pos)
>  {
>  	struct llc_sap *sap;
> @@ -125,6 +120,7 @@ static void llc_seq_stop(struct seq_file *seq, void *v)
>  
>  static int llc_seq_socket_show(struct seq_file *seq, void *v)
>  {
> +	static const u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
>  	struct sock* sk;
>  	struct llc_sock *llc;
>  
> @@ -137,17 +133,11 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
>  	llc = llc_sk(sk);
>  
>  	/* FIXME: check if the address is multicast */
> -	seq_printf(seq, "%2X  %2X ", sk->sk_type, 0);
> -
> -	if (llc->dev)
> -		llc_ui_format_mac(seq, llc->dev->dev_addr);
> -	else {
> -		u8 addr[6] = {0,0,0,0,0,0};
> -		llc_ui_format_mac(seq, addr);
> -	}
> -	seq_printf(seq, "@%02X ", llc->sap->laddr.lsap);
> -	llc_ui_format_mac(seq, llc->daddr.mac);
> -	seq_printf(seq, "@%02X %8d %8d %2d %3u %4d\n", llc->daddr.lsap,
> +	seq_printf(seq, "%2X  %2X %pM@%02X %pM@%02X %8d %8d %2d %3u %4d\n",
> +		   sk->sk_type, 0,
> +		   llc->dev ? llc->dev->dev_addr : null_addr,
> +		   llc->sap->laddr.lsap,
> +		   llc->daddr.mac, llc->daddr.lsap,
>  		   sk_wmem_alloc_get(sk),
>  		   sk_rmem_alloc_get(sk) - llc->copied_seq,
>  		   sk->sk_state,
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
That's very good.
Thanks!

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

* Re: [PATCH 1/2] llc: "foo* bar" should be "foo *bar"
  2013-12-20  3:14 [PATCH 1/2] llc: "foo* bar" should be "foo *bar" Chen Weilong
  2013-12-20  3:15 ` [PATCH 2/2] llc: fix checkpatch errors with space Chen Weilong
@ 2013-12-27 18:06 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2013-12-27 18:06 UTC (permalink / raw)
  To: chenweilong; +Cc: acme, netdev

From: Chen Weilong <chenweilong@huawei.com>
Date: Fri, 20 Dec 2013 11:14:59 +0800

> From: Weilong Chen <chenweilong@huawei.com>
> 
> Signed-off-by: Weilong Chen <chenweilong@huawei.com>

Applied.

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

end of thread, other threads:[~2013-12-27 18:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20  3:14 [PATCH 1/2] llc: "foo* bar" should be "foo *bar" Chen Weilong
2013-12-20  3:15 ` [PATCH 2/2] llc: fix checkpatch errors with space Chen Weilong
2013-12-20  3:48   ` Joe Perches
2013-12-20  4:52     ` chenweilong
2013-12-27 18:06 ` [PATCH 1/2] llc: "foo* bar" should be "foo *bar" David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).