netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3 v3] ipv6: convert the uses of ADBG and remove the superfluous parentheses
@ 2013-08-14  3:36 Ding Tianhong
  2013-08-14  3:44 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Tianhong @ 2013-08-14  3:36 UTC (permalink / raw)
  To: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, Joe Perches, Netdev

Just follow the Joe Perches's opinion, it is a better way to fix the
style errors.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 net/ipv6/addrconf.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 7b55464..734724c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -99,9 +99,9 @@
 #define ACONF_DEBUG 2
 
 #if ACONF_DEBUG >= 3
-#define ADBG(x) printk x
+#define ADBG(fmt, ...) printk(fmt, ##__VA_ARGS__)
 #else
-#define ADBG(x)
+#define ADBG(fmt, ...) do {} while (0)
 #endif
 
 #define	INFINITY_LIFE_TIME	0xFFFFFFFF
@@ -369,9 +369,9 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
 	dev_hold(dev);
 
 	if (snmp6_alloc_dev(ndev) < 0) {
-		ADBG((KERN_WARNING
+		ADBG(KERN_WARNING
 			"%s: cannot allocate memory for statistics; dev=%s.\n",
-			__func__, dev->name));
+			__func__, dev->name);
 		neigh_parms_release(&nd_tbl, ndev->nd_parms);
 		dev_put(dev);
 		kfree(ndev);
@@ -379,9 +379,9 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
 	}
 
 	if (snmp6_register_dev(ndev) < 0) {
-		ADBG((KERN_WARNING
+		ADBG(KERN_WARNING
 			"%s: cannot create /proc/net/dev_snmp6/%s\n",
-			__func__, dev->name));
+			__func__, dev->name);
 		neigh_parms_release(&nd_tbl, ndev->nd_parms);
 		ndev->dead = 1;
 		in6_dev_finish_destroy(ndev);
@@ -844,7 +844,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
 
 	/* Ignore adding duplicate addresses on an interface */
 	if (ipv6_chk_same_addr(dev_net(idev->dev), addr, idev->dev)) {
-		ADBG(("ipv6_add_addr: already assigned\n"));
+		ADBG("ipv6_add_addr: already assigned\n");
 		err = -EEXIST;
 		goto out;
 	}
@@ -852,7 +852,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
 	ifa = kzalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC);
 
 	if (ifa == NULL) {
-		ADBG(("ipv6_add_addr: malloc failed\n"));
+		ADBG("ipv6_add_addr: malloc failed\n");
 		err = -ENOBUFS;
 		goto out;
 	}
@@ -2070,7 +2070,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
 	pinfo = (struct prefix_info *) opt;
 
 	if (len < sizeof(struct prefix_info)) {
-		ADBG(("addrconf: prefix option too short\n"));
+		ADBG("addrconf: prefix option too short\n");
 		return;
 	}
 
@@ -3650,8 +3650,8 @@ restart:
 	if (time_before(next_sched, jiffies + ADDRCONF_TIMER_FUZZ_MAX))
 		next_sched = jiffies + ADDRCONF_TIMER_FUZZ_MAX;
 
-	ADBG((KERN_DEBUG "now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n",
-	      now, next, next_sec, next_sched));
+	ADBG(KERN_DEBUG "now = %lu, schedule = %lu, rounded schedule = %lu => %lu\n",
+	      now, next, next_sec, next_sched);
 
 	addr_chk_timer.expires = next_sched;
 	add_timer(&addr_chk_timer);
-- 
1.8.2.1

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

* Re: [PATCH 2/3 v3] ipv6: convert the uses of ADBG and remove the superfluous parentheses
  2013-08-14  3:36 [PATCH 2/3 v3] ipv6: convert the uses of ADBG and remove the superfluous parentheses Ding Tianhong
@ 2013-08-14  3:44 ` Joe Perches
  2013-08-14  3:47   ` Ding Tianhong
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2013-08-14  3:44 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, Netdev

On Wed, 2013-08-14 at 11:36 +0800, Ding Tianhong wrote:
> Just follow the Joe Perches's opinion, it is a better way to fix the
> style errors.

[]

> Signed-off-by: Joe Perches <joe@perches.com>

Nope, not signed by me.  I sent you a suggestion.
Please don't add Signed-off-by: signatures for others.
Maybe you might use Suggested-by:

> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>

> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c

> @@ -99,9 +99,9 @@
>  #define ACONF_DEBUG 2
>  
>  #if ACONF_DEBUG >= 3
> -#define ADBG(x) printk x
> +#define ADBG(fmt, ...) printk(fmt, ##__VA_ARGS__)
>  #else
> -#define ADBG(x)
> +#define ADBG(fmt, ...) do {} while (0)

btw:  The macro I suggested will always verify format
and arguments.  This will not.

#define ADBG(fmt, ...) do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)

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

* Re: [PATCH 2/3 v3] ipv6: convert the uses of ADBG and remove the superfluous parentheses
  2013-08-14  3:44 ` Joe Perches
@ 2013-08-14  3:47   ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2013-08-14  3:47 UTC (permalink / raw)
  To: Joe Perches
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy, Netdev

On 2013/8/14 11:44, Joe Perches wrote:
> On Wed, 2013-08-14 at 11:36 +0800, Ding Tianhong wrote:
>> Just follow the Joe Perches's opinion, it is a better way to fix the
>> style errors.
> 
> []
> 
>> Signed-off-by: Joe Perches <joe@perches.com>
> 
> Nope, not signed by me.  I sent you a suggestion.
> Please don't add Signed-off-by: signatures for others.
> Maybe you might use Suggested-by:
> 
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> 
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> 
>> @@ -99,9 +99,9 @@
>>  #define ACONF_DEBUG 2
>>  
>>  #if ACONF_DEBUG >= 3
>> -#define ADBG(x) printk x
>> +#define ADBG(fmt, ...) printk(fmt, ##__VA_ARGS__)
>>  #else
>> -#define ADBG(x)
>> +#define ADBG(fmt, ...) do {} while (0)
> 
> btw:  The macro I suggested will always verify format
> and arguments.  This will not.
> 
> #define ADBG(fmt, ...) do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
> 
> 

yes, I got your opinion , but I think it's more simple and clear, maybe not align  :)

> 
> .
> 

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

end of thread, other threads:[~2013-08-14  3:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14  3:36 [PATCH 2/3 v3] ipv6: convert the uses of ADBG and remove the superfluous parentheses Ding Tianhong
2013-08-14  3:44 ` Joe Perches
2013-08-14  3:47   ` Ding Tianhong

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