Skip to contentSkip to conversation

compat-wireless: Fix ath9k debug log issue.

PATCH In review Senthil Balasubramanian 3 participants 3 messages Jan 31, 2011 – Feb 1, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat-wireless: Fix ath9k debug log issue.

ath9k debug logs are not shown as we are using recursive vsnprintf which are supported in kernel 2.6.36 and above. use vprintk for older kernels.

This patch has fixed the issue.

---
 patches/37-vsnprintk.patch |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
 create mode 100644 patches/37-vsnprintk.patch
patches/37-vsnprintk.patch new file +28 -0
new file mode 100644
index 0000000..93d1a00
@@ -0,0 +1,28 @@
+diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
+index c325202..e3e60d4 100644
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -60,16 +60,23 @@ EXPORT_SYMBOL(ath_rxbuf_alloc);
+ int ath_printk(const char *level, struct ath_common *common,
+ 	       const char *fmt, ...)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	struct va_format vaf;
++#endif
+ 	va_list args;
+ 	int rtn;
+ 
+ 	va_start(args, fmt);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	vaf.fmt = fmt;
+ 	vaf.va = &args;
+ 
+ 	rtn = printk("%sath: %pV", level, &vaf);
++#else
++	printk("%sath: ", level);
++	rtn = vprintk(fmt, args);
++#endif
+ 
+ 	va_end(args);
+ 
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · Senthil Balasubramanian

ath9k debug logs are not shown as we are using recursive vsnprintf which are supported in kernel 2.6.36 and above. use vprintk for older kernels.

#ifdefs spread around the tree for this sort of
change are not very nice.

Perhaps wireless-compat should not be an impediment to mainline progress and these sorts of changes should be minimized.

If this is really necessary for backward compatibility, I think the %pV could just be removed.

If not, because this style would be used in several places, perhaps another macro could be used to hide the use of %pV.

Maybe something like:

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
#define PRINTK_VA_LIST(level, prefix, fmt, __va_list) \
({ \
struct va_format vaf; \
\
vaf.fmt = fmt; \

 	vaf.va = &__va_list;				\
							\
	printk("%s" prefix "%pV", level, &vaf);		\
})
#else
#define PRINTK_VA_LIST(level, prefix, fmt, __va_list)	\
({							\
	printk("%s" prefix, level);			\
	vprintk(fmt, __va_list);			\
})

#endif

Quoted 18 lines
patches/37-vsnprintk.patch new file +18 -0
+diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
+index c325202..e3e60d4 100644
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -60,16 +60,23 @@ EXPORT_SYMBOL(ath_rxbuf_alloc);
+ int ath_printk(const char *level, struct ath_common *common,
+ 	       const char *fmt, ...)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	struct va_format vaf;
++#endif
+ 	va_list args;
+ 	int rtn;
+ 
+ 	va_start(args, fmt);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	vaf.fmt = fmt;

patches/37-vsnprintk.patch line 28

Quoted 10 lines
patches/37-vsnprintk.patch new file +10 -0
+ 	vaf.va = &args;
+ 
+ 	rtn = printk("%sath: %pV", level, &vaf);
++#else
++	printk("%sath: ", level);
++	rtn = vprintk(fmt, args);
++#endif
+ 
+ 	va_end(args);
+ 

So this would become something like:

int ath_printk(const char *level, struct ath_common *common,

	       const char *fmt, ...)
{
	va_list args;
	int rtn;

	va_start(args, fmt);

	rtn = PRINTK_VA_LIST(level, "ath: ", fmt, args);

	va_end(args);

	return rtn;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 7 lines · Joe Perches
Quoted 3 lines · Senthil Balasubramanian

ath9k debug logs are not shown as we are using recursive vsnprintf which are supported in kernel 2.6.36 and above. use vprintk for older kernels.

#ifdefs spread around the tree for this sort of change are not very nice.

#if LINUX_VERSION is unavoidable in compat wireless and compat is actually meant for that.

Quoted 7 lines

Perhaps wireless-compat should not be an impediment to mainline progress and these sorts of changes should be minimized.

If this is really necessary for backward compatibility, I think the %pV could just be removed.

May be this can be done if we are really worried about the no.of patches in compat folder.

Quoted 6 lines

If not, because this style would be used in several places, perhaps another macro could be used to hide the use of %pV.

Maybe something like:

you mean use this in wireless-testing ??. We should not add if kernel version checks in wireless-testing code and I don't prefer that either.

Quoted 51 lines

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
#define PRINTK_VA_LIST(level, prefix, fmt, __va_list) \
({ \

(quoted diff) +0 -0
 	struct va_format vaf;				\
 							\
 	vaf.fmt = fmt;					\
 	vaf.va = &__va_list;				\
							\
	printk("%s" prefix "%pV", level, &vaf);		\
})
#else
#define PRINTK_VA_LIST(level, prefix, fmt, __va_list)	\
({							\
	printk("%s" prefix, level);			\
	vprintk(fmt, __va_list);			\
})

#endif

Quoted 18 lines
patches/37-vsnprintk.patch new file +18 -0
+diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
+index c325202..e3e60d4 100644
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -60,16 +60,23 @@ EXPORT_SYMBOL(ath_rxbuf_alloc);
+ int ath_printk(const char *level, struct ath_common *common,
+ 	       const char *fmt, ...)
+ {
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	struct va_format vaf;
++#endif
+ 	va_list args;
+ 	int rtn;
+ 
+ 	va_start(args, fmt);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+ 	vaf.fmt = fmt;

patches/37-vsnprintk.patch line 28

Quoted 10 lines
patches/37-vsnprintk.patch new file +10 -0
+ 	vaf.va = &args;
+ 
+ 	rtn = printk("%sath: %pV", level, &vaf);
++#else
++	printk("%sath: ", level);
++	rtn = vprintk(fmt, args);
++#endif
+ 
+ 	va_end(args);
+ 

So this would become something like:

int ath_printk(const char *level, struct ath_common *common,

Quoted 15 lines
	       const char *fmt, ...)
{
	va_list args;
	int rtn;

	va_start(args, fmt);

	rtn = PRINTK_VA_LIST(level, "ath: ", fmt, args);

	va_end(args);

	return rtn;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html