Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 145ce502 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

net/sctp: Use pr_fmt and pr_<level>



Change SCTP_DEBUG_PRINTK and SCTP_DEBUG_PRINTK_IPADDR to
use do { print } while (0) guards.
Add SCTP_DEBUG_PRINTK_CONT to fix errors in log when
lines were continued.
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Add a missing newline in "Failed bind hash alloc"

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dee06e47
Loading
Loading
Loading
Loading
+30 −18
Original line number Diff line number Diff line
@@ -275,24 +275,35 @@ struct sctp_mib {
/* Print debugging messages.  */
#if SCTP_DEBUG
extern int sctp_debug_flag;
#define SCTP_DEBUG_PRINTK(whatever...) \
	((void) (sctp_debug_flag && printk(KERN_DEBUG whatever)))
#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \
#define SCTP_DEBUG_PRINTK(fmt, args...)			\
do {							\
	if (sctp_debug_flag)				\
		printk(KERN_DEBUG pr_fmt(fmt), ##args);	\
} while (0)
#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)		\
do {							\
	if (sctp_debug_flag)				\
		pr_cont(fmt, ##args);			\
} while (0)
#define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail,			\
				 args_lead, saddr, args_trail...)	\
do {									\
	if (sctp_debug_flag) {						\
		if (saddr->sa.sa_family == AF_INET6) {			\
			printk(KERN_DEBUG				\
			       lead "%pI6" trail, \
			       leadparm, \
			       pr_fmt(fmt_lead "%pI6" fmt_trail),	\
			       args_lead,				\
			       &saddr->v6.sin6_addr,			\
			       otherparms); \
			       args_trail);				\
		} else {						\
			printk(KERN_DEBUG				\
			       lead "%pI4" trail, \
			       leadparm, \
			       pr_fmt(fmt_lead "%pI4" fmt_trail),	\
			       args_lead,				\
			       &saddr->v4.sin_addr.s_addr,		\
			       otherparms); \
			       args_trail);				\
		}							\
	}
	}								\
} while (0)
#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }

@@ -306,6 +317,7 @@ extern int sctp_debug_flag;
#else	/* SCTP_DEBUG */

#define SCTP_DEBUG_PRINTK(whatever...)
#define SCTP_DEBUG_PRINTK_CONT(fmt, args...)
#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
#define SCTP_ENABLE_DEBUG
#define SCTP_DISABLE_DEBUG
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@
 * be incorporated into the next SCTP release.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/poll.h>
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@
 * be incorporated into the next SCTP release.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/net.h>
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@
 * be incorporated into the next SCTP release.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
#include <linux/interrupt.h>
+3 −1
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@
 * be incorporated into the next SCTP release.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
@@ -336,7 +338,7 @@ static void sctp_v6_get_saddr(struct sctp_sock *sk,
		memcpy(saddr, baddr, sizeof(union sctp_addr));
		SCTP_DEBUG_PRINTK("saddr: %pI6\n", &saddr->v6.sin6_addr);
	} else {
		printk(KERN_ERR "%s: asoc:%p Could not find a valid source "
		pr_err("%s: asoc:%p Could not find a valid source "
		       "address for the dest:%pI6\n",
		       __func__, asoc, &daddr->v6.sin6_addr);
	}
Loading