linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IPv6: simplify & condense a few declarations & statements
@ 2013-04-17 17:20 Nathaniel Yazdani
  2013-04-17 17:28 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Nathaniel Yazdani @ 2013-04-17 17:20 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber
  Cc: netdev, linux-kernel, Nathaniel Yazdani


This patch combines several statements/declarations into more concise forms and removes a 
couple of unnecessary local variables within a few functions, mostly inline.

Signed-off-by: Nathaniel Yazdani <n1ght.4nd.d4y@gmail.com>
---
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 192dd1a..3f7dcdb 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -111,10 +111,7 @@ static inline void fib6_walker_unlink(struct fib6_walker_t *w)
 }
 static __inline__ u32 fib6_new_sernum(void)
 {
-	u32 n = ++rt_sernum;
-	if ((__s32)n <= 0)
-		rt_sernum = n = 1;
-	return n;
+	return (__s32)++rt_sernum <= 0 ? rt_sernum = 1 : rt_sernum;
 }
 
 /*
@@ -149,11 +146,7 @@ static __inline__ __be32 addr_bit_set(const void *token, int fn_bit)
 
 static __inline__ struct fib6_node * node_alloc(void)
 {
-	struct fib6_node *fn;
-
-	fn = kmem_cache_zalloc(fib6_node_kmem, GFP_ATOMIC);
-
-	return fn;
+	return kmem_cache_zalloc(fib6_node_kmem, GFP_ATOMIC);
 }
 
 static __inline__ void node_free(struct fib6_node * fn)
@@ -190,9 +183,8 @@ static void fib6_link_table(struct net *net, struct fib6_table *tb)
 
 static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
 {
-	struct fib6_table *table;
+	struct fib6_table *table = kzalloc(sizeof(struct fib6_table), GFP_ATOMIC);
 
-	table = kzalloc(sizeof(*table), GFP_ATOMIC);
 	if (table) {
 		table->tb6_id = id;
 		table->tb6_root.leaf = net->ipv6.ip6_null_entry;



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

* Re: [PATCH] IPv6: simplify & condense a few declarations & statements
  2013-04-17 17:20 [PATCH] IPv6: simplify & condense a few declarations & statements Nathaniel Yazdani
@ 2013-04-17 17:28 ` David Miller
  2013-04-17 18:02   ` Nathaniel Yazdani
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2013-04-17 17:28 UTC (permalink / raw)
  To: n1ght.4nd.d4y; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel

From: Nathaniel Yazdani <n1ght.4nd.d4y@gmail.com>
Date: Wed, 17 Apr 2013 10:20:22 -0700

> This patch combines several statements/declarations into more concise forms and removes a 
> couple of unnecessary local variables within a few functions, mostly inline.

Please make commit messages with 80 column long lines maximum.

> @@ -111,10 +111,7 @@ static inline void fib6_walker_unlink(struct fib6_walker_t *w)
>  }
>  static __inline__ u32 fib6_new_sernum(void)
>  {
> -	u32 n = ++rt_sernum;
> -	if ((__s32)n <= 0)
> -		rt_sernum = n = 1;
> -	return n;
> +	return (__s32)++rt_sernum <= 0 ? rt_sernum = 1 : rt_sernum;

Like your commit message, I find this unreadable, and definitely not
an improvement.

I'm not applying this even with the long lines in the commit message
fixes, sorry.


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

* Re: [PATCH] IPv6: simplify & condense a few declarations & statements
  2013-04-17 17:28 ` David Miller
@ 2013-04-17 18:02   ` Nathaniel Yazdani
  0 siblings, 0 replies; 3+ messages in thread
From: Nathaniel Yazdani @ 2013-04-17 18:02 UTC (permalink / raw)
  To: David Miller; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel

>I'm not applying this even with the long lines in the commit message
>fixes, sorry.

Okay, well thank you for your time nonetheless.



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

end of thread, other threads:[~2013-04-17 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-17 17:20 [PATCH] IPv6: simplify & condense a few declarations & statements Nathaniel Yazdani
2013-04-17 17:28 ` David Miller
2013-04-17 18:02   ` Nathaniel Yazdani

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).