mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drivers-core: make structured logging play nice with dynamic-debug
commit c4e00daaa9 changed __dev_printk
in a way that broke dynamic-debug's ability to control the dynamic
prefix of dev_dbg(dev,..), but not dev_dbg(NULL,..) or pr_debug(..),
which is why it wasnt noticed sooner.
When dev==NULL, __dev_printk() just calls printk(), which just works.
But otherwise, it assumed that level was always a string like "<L>"
and just plucked out the 'L', ignoring the rest.  However,
dynamic_emit_prefix() adds "[tid] module:func:line:" to the string,
those additions all got lost.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Cc: stable <stable@vger.kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
			
			
This commit is contained in:
		
							parent
							
								
									0d7614f09c
								
							
						
					
					
						commit
						af7f2158fd
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1865,6 +1865,7 @@ int __dev_printk(const char *level, const struct device *dev,
 | 
			
		|||
		 struct va_format *vaf)
 | 
			
		||||
{
 | 
			
		||||
	char dict[128];
 | 
			
		||||
	const char *level_extra = "";
 | 
			
		||||
	size_t dictlen = 0;
 | 
			
		||||
	const char *subsys;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1911,10 +1912,14 @@ int __dev_printk(const char *level, const struct device *dev,
 | 
			
		|||
				    "DEVICE=+%s:%s", subsys, dev_name(dev));
 | 
			
		||||
	}
 | 
			
		||||
skip:
 | 
			
		||||
	if (level[3])
 | 
			
		||||
		level_extra = &level[3]; /* skip past "<L>" */
 | 
			
		||||
 | 
			
		||||
	return printk_emit(0, level[1] - '0',
 | 
			
		||||
			   dictlen ? dict : NULL, dictlen,
 | 
			
		||||
			   "%s %s: %pV",
 | 
			
		||||
			   dev_driver_string(dev), dev_name(dev), vaf);
 | 
			
		||||
			   "%s %s: %s%pV",
 | 
			
		||||
			   dev_driver_string(dev), dev_name(dev),
 | 
			
		||||
			   level_extra, vaf);
 | 
			
		||||
}
 | 
			
		||||
EXPORT_SYMBOL(__dev_printk);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue