netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] compat-wireless: Fix ath9k debug log issue.
       [not found] ` <1296473865-18529-1-git-send-email-senthilkumar-DlyHzToyqoxBDgjK7y7TUQ@public.gmane.org>
@ 2011-01-31 18:58   ` Joe Perches
  2011-02-01 13:33     ` Senthil Balasubramanian
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2011-01-31 18:58 UTC (permalink / raw)
  To: Senthil Balasubramanian
  Cc: luis.rodriguez-DlyHzToyqoxBDgjK7y7TUQ,
	mcgrof-Re5JQEeQqe8AvxtiuMwx3w,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA

On Mon, 2011-01-31 at 17:07 +0530, Senthil Balasubramanian wrote:
> 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

> +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);
> + 

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/1] compat-wireless: Fix ath9k debug log issue.
  2011-01-31 18:58   ` [PATCH 1/1] compat-wireless: Fix ath9k debug log issue Joe Perches
@ 2011-02-01 13:33     ` Senthil Balasubramanian
  0 siblings, 0 replies; 2+ messages in thread
From: Senthil Balasubramanian @ 2011-02-01 13:33 UTC (permalink / raw)
  To: Joe Perches
  Cc: Senthilkumar Balasubramanian, Luis Rodriguez,
	mcgrof-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Feb 01, 2011 at 12:28:16AM +0530, Joe Perches wrote:
> On Mon, 2011-01-31 at 17:07 +0530, Senthil Balasubramanian wrote:
> > 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.
> 
> 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.
> 
> 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.

> 
> #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
> 
> > +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);
> > + 
> 
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-02-01 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1296473865-18529-1-git-send-email-senthilkumar@atheros.com>
     [not found] ` <1296473865-18529-1-git-send-email-senthilkumar-DlyHzToyqoxBDgjK7y7TUQ@public.gmane.org>
2011-01-31 18:58   ` [PATCH 1/1] compat-wireless: Fix ath9k debug log issue Joe Perches
2011-02-01 13:33     ` Senthil Balasubramanian

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