[alsa-devel] [PATCH 1/2] ALSA: convert "snd_printk(KERN_INFO" to "pr_info("

Takashi Iwai tiwai at suse.de
Wed Jun 5 08:16:03 CEST 2013


At Tue, 04 Jun 2013 23:07:51 -0700,
Joe Perches wrote:
> 
> On Wed, 2013-06-05 at 07:52 +0200, Takashi Iwai wrote:
> > At Tue, 4 Jun 2013 13:20:40 -0400 (EDT),
> 
> > > --- usb-3.10.orig/sound/isa/opti9xx/miro.c
> []
> > > -			snd_printk(KERN_INFO "unknown miro aci id\n");
> > > +			pr_info("unknown miro aci id\n");
> []
> > need proper prefix, and should be rather pr_warning().
> 
> pr_warn should be preferred over pr_warning

Oh, then shouldn't we define them in other way round?

--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -214,9 +214,9 @@ extern void dump_stack(void) __cold;
 	printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_err(fmt, ...) \
 	printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warning(fmt, ...) \
+#define pr_warn(fmt, ...) \
 	printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warn pr_warning
+#define pr_warning pr_warn
 #define pr_notice(fmt, ...) \
 	printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \


> and most everything should have a
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> added.  Another option would be to add
> ccflags-y += -D "pr_fmt(fmt)=KBUILD_MODNAME \": \" fmt" 
> to the top level sound makefile.

Right, these would work well.
With this addition, we can go rather to remove superfluous prefix from
pr_*().


> Some eon son I'll actually submit this
> https://lkml.org/lkml/2012/3/27/247
> and most all of the #define pr_fmt(...
> will be unncessary.
> 
> > > --- usb-3.10.orig/sound/pci/emu10k1/emu10k1x.c
> []
> > >  #if 0
> > > -	snd_printk(KERN_INFO "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
> > > +	pr_info("IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
> > >  		   epcm->substream->ops->pointer(epcm->substream),
> > >  		   snd_pcm_lib_period_bytes(epcm->substream),
> > >  		   snd_pcm_lib_buffer_bytes(epcm->substream));
> > 
> > Should be pr_debug().
> 
> Or the block deleted

Yes, another obvious option :)


thanks,

Takashi


More information about the Alsa-devel mailing list