Marc Andre Tanner wrote:
> Thanks, so if I understood it correctly this should be used like this:
> 
> #define PRINTK_FILTER(fmt) (                                                  
> \
>       (((const char *)(fmt))[0] != '<' && CONFIG_PRINTK_VERBOSITY >= 4) ||    
> \
>       (((const char *)(fmt))[0] == '<' &&                                     
> \
>        ((const char *)(fmt))[1] <= *__stringify(CONFIG_PRINTK_VERBOSITY))     
> \
> )
> 
> #define printk(fmt, ...) ({                                                   
> \
>       if (__builtin_constant_p(PRINTK_FILTER(fmt)) && PRINTK_FILTER(fmt))     
> \
>               printk((fmt), ##__VA_ARGS__);                                   
> \
> })
> 
> The sizeof check wouldn't be necessary. Is this correct?

Looks good, except that I think kernel style is to use "do {...} while
(0)" rather than "({ ... })"

-- Jamie
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to