diff mbox

[1/3] drm: extra printk() wrapper macros

Message ID 1468260090-2756-1-git-send-email-david.s.gordon@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Gordon July 11, 2016, 6:01 p.m. UTC
We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
provides several other useful intermediate levels such as NOTICE and
WARNING. So this patch fills out the set by providing both regular and
once-only macros for each of the levels INFO, NOTICE, and WARNING, using
a common underlying macro that does all the token-pasting.

DRM_ERROR is unchanged, as it's not just a printk wrapper.

Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
---
 include/drm/drmP.h | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

Comments

Tvrtko Ursulin July 12, 2016, 9:06 a.m. UTC | #1
On 11/07/16 19:01, Dave Gordon wrote:
> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
> provides several other useful intermediate levels such as NOTICE and
> WARNING. So this patch fills out the set by providing both regular and
> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
> a common underlying macro that does all the token-pasting.
>
> DRM_ERROR is unchanged, as it's not just a printk wrapper.
>
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
> ---
>   include/drm/drmP.h | 26 ++++++++++++++++++++------
>   1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index cf918e3e..82648b1 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>   /** \name Macros to make printk easier */
>   /*@{*/
>
> +#define	_DRM_PRINTK(once, level, fmt, ...)				\
> +	do {								\
> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> +			     ##__VA_ARGS__);				\
> +	} while (0)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)

To me DRM_NOTICE would be better to keep consistent with kernel naming 
for the equivalent log level.

> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
> +#define DRM_NOTE_ONCE(fmt, ...)					\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
>   /**
>    * Error output.
>    *
> @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
>   		drm_err(fmt, ##__VA_ARGS__);				\
>   })
>
> -#define DRM_INFO(fmt, ...)				\
> -	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)				\
> -	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
>   /**
>    * Debug output.
>    *
>

Otherwise acked by me.

Regards,

Tvrtko
Eric Engestrom July 12, 2016, 11:06 a.m. UTC | #2
On Mon, Jul 11, 2016 at 07:01:27PM +0100, Dave Gordon wrote:
> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
> provides several other useful intermediate levels such as NOTICE and
> WARNING. So this patch fills out the set by providing both regular and
> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
> a common underlying macro that does all the token-pasting.
> 
> DRM_ERROR is unchanged, as it's not just a printk wrapper.
> 
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
> ---
>  include/drm/drmP.h | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index cf918e3e..82648b1 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>  /** \name Macros to make printk easier */
>  /*@{*/
>  
> +#define	_DRM_PRINTK(once, level, fmt, ...)				\

Tab after `#define`?

> +	do {								\
> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> +			     ##__VA_ARGS__);				\
> +	} while (0)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)

Missing ## here; should be: ##__VA_ARGS__
The rest looks good.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>

> +#define DRM_NOTE_ONCE(fmt, ...)					\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
>  /**
>   * Error output.
>   *
> @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
>  		drm_err(fmt, ##__VA_ARGS__);				\
>  })
>  
> -#define DRM_INFO(fmt, ...)				\
> -	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)				\
> -	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
>  /**
>   * Debug output.
>   *
> -- 
> 1.9.1
Dave Gordon July 12, 2016, 1:28 p.m. UTC | #3
On 12/07/16 10:06, Tvrtko Ursulin wrote:
>
> On 11/07/16 19:01, Dave Gordon wrote:
>> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
>> provides several other useful intermediate levels such as NOTICE and
>> WARNING. So this patch fills out the set by providing both regular and
>> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
>> a common underlying macro that does all the token-pasting.
>>
>> DRM_ERROR is unchanged, as it's not just a printk wrapper.
>>
>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>> ---
>>   include/drm/drmP.h | 26 ++++++++++++++++++++------
>>   1 file changed, 20 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
>> index cf918e3e..82648b1 100644
>> --- a/include/drm/drmP.h
>> +++ b/include/drm/drmP.h
>> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>>   /** \name Macros to make printk easier */
>>   /*@{*/
>>
>> +#define    _DRM_PRINTK(once, level, fmt, ...)                \
>> +    do {                                \
>> +        printk##once(KERN_##level "[" DRM_NAME "] " fmt,    \
>> +                 ##__VA_ARGS__);                \
>> +    } while (0)
>> +
>> +#define DRM_INFO(fmt, ...)                        \
>> +    _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
>> +#define DRM_NOTE(fmt, ...)                        \
>> +    _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
>
> To me DRM_NOTICE would be better to keep consistent with kernel naming
> for the equivalent log level.

Maybe, but then we'd probably want DRM_WARNING() as well, and the names 
get cumbersome, especially when you want to tag "_ONCE" on the end as 
well. I liked the consistency of {INFO,NOTE,WARN} all being four letters ;)

Any comments from dri-devel on INFO/NOTE/WARN vs INFO/NOTICE/WARNING?
Or any other suggestions?

.Dave.

>> +#define DRM_WARN(fmt, ...)                        \
>> +    _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
>> +
>> +#define DRM_INFO_ONCE(fmt, ...)                        \
>> +    _DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
>> +#define DRM_NOTE_ONCE(fmt, ...)                    \
>> +    _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
>> +#define DRM_WARN_ONCE(fmt, ...)                        \
>> +    _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
>> +
>>   /**
>>    * Error output.
>>    *
>> @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
>>           drm_err(fmt, ##__VA_ARGS__);                \
>>   })
>>
>> -#define DRM_INFO(fmt, ...)                \
>> -    printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>> -
>> -#define DRM_INFO_ONCE(fmt, ...)                \
>> -    printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>> -
>>   /**
>>    * Debug output.
>>    *
>>
>
> Otherwise acked by me.
>
> Regards,
> Tvrtko
Tvrtko Ursulin July 12, 2016, 1:51 p.m. UTC | #4
On 12/07/16 14:28, Dave Gordon wrote:
> On 12/07/16 10:06, Tvrtko Ursulin wrote:
>>
>> On 11/07/16 19:01, Dave Gordon wrote:
>>> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
>>> provides several other useful intermediate levels such as NOTICE and
>>> WARNING. So this patch fills out the set by providing both regular and
>>> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
>>> a common underlying macro that does all the token-pasting.
>>>
>>> DRM_ERROR is unchanged, as it's not just a printk wrapper.
>>>
>>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>>> ---
>>>   include/drm/drmP.h | 26 ++++++++++++++++++++------
>>>   1 file changed, 20 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
>>> index cf918e3e..82648b1 100644
>>> --- a/include/drm/drmP.h
>>> +++ b/include/drm/drmP.h
>>> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>>>   /** \name Macros to make printk easier */
>>>   /*@{*/
>>>
>>> +#define    _DRM_PRINTK(once, level, fmt, ...)                \
>>> +    do {                                \
>>> +        printk##once(KERN_##level "[" DRM_NAME "] " fmt,    \
>>> +                 ##__VA_ARGS__);                \
>>> +    } while (0)
>>> +
>>> +#define DRM_INFO(fmt, ...)                        \
>>> +    _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
>>> +#define DRM_NOTE(fmt, ...)                        \
>>> +    _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
>>
>> To me DRM_NOTICE would be better to keep consistent with kernel naming
>> for the equivalent log level.
>
> Maybe, but then we'd probably want DRM_WARNING() as well, and the names
> get cumbersome, especially when you want to tag "_ONCE" on the end as
> well. I liked the consistency of {INFO,NOTE,WARN} all being four letters ;)
>
> Any comments from dri-devel on INFO/NOTE/WARN vs INFO/NOTICE/WARNING?
> Or any other suggestions?

Luckily kernel offers us precedent to avoid the DRM_WARNING verbosity 
and establish the only exception where log level symbolic name does not 
match the printk helper name. :)

#define pr_emerg(fmt, ...) \
         printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_alert(fmt, ...) \
         printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_crit(fmt, ...) \
         printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err(fmt, ...) \
         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning(fmt, ...) \
         printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warn pr_warning
#define pr_notice(fmt, ...) \
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)

And short form is indeed more popular:

$ grep pr_warn\( drivers/ -r | wc -l
1935
$ grep pr_warning\( drivers/ -r | wc -l
141

Regards,

Tvrtko
Daniel Vetter July 12, 2016, 2:25 p.m. UTC | #5
On Mon, Jul 11, 2016 at 07:01:27PM +0100, Dave Gordon wrote:
> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
> provides several other useful intermediate levels such as NOTICE and
> WARNING. So this patch fills out the set by providing both regular and
> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
> a common underlying macro that does all the token-pasting.
> 
> DRM_ERROR is unchanged, as it's not just a printk wrapper.
> 
> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>

I'm not sure what exactly the brave new drm debug model should look like
(probably some form of pimped dynamic debug printk, to be able to be
backwards compatible with the gazillion of blog posts recommending to
capture dmesg with drm.debug=0xe). But extending these is probably not
what we want ...
-Daniel

> ---
>  include/drm/drmP.h | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index cf918e3e..82648b1 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>  /** \name Macros to make printk easier */
>  /*@{*/
>  
> +#define	_DRM_PRINTK(once, level, fmt, ...)				\
> +	do {								\
> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> +			     ##__VA_ARGS__);				\
> +	} while (0)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
> +#define DRM_NOTE_ONCE(fmt, ...)					\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
>  /**
>   * Error output.
>   *
> @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
>  		drm_err(fmt, ##__VA_ARGS__);				\
>  })
>  
> -#define DRM_INFO(fmt, ...)				\
> -	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)				\
> -	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
>  /**
>   * Debug output.
>   *
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Gordon July 12, 2016, 2:53 p.m. UTC | #6
On 12/07/16 15:25, Daniel Vetter wrote:
> On Mon, Jul 11, 2016 at 07:01:27PM +0100, Dave Gordon wrote:
>> We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
>> provides several other useful intermediate levels such as NOTICE and
>> WARNING. So this patch fills out the set by providing both regular and
>> once-only macros for each of the levels INFO, NOTICE, and WARNING, using
>> a common underlying macro that does all the token-pasting.
>>
>> DRM_ERROR is unchanged, as it's not just a printk wrapper.
>>
>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>
> I'm not sure what exactly the brave new drm debug model should look like
> (probably some form of pimped dynamic debug printk, to be able to be
> backwards compatible with the gazillion of blog posts recommending to
> capture dmesg with drm.debug=0xe). But extending these is probably not
> what we want ...
> -Daniel

These are not debug of any sort, these message are intended to be seen 
by the user (or administrator), and these macros allow us to emit the 
messages at the most appropriate kernel message level.

.Dave.

>> ---
>>   include/drm/drmP.h | 26 ++++++++++++++++++++------
>>   1 file changed, 20 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
>> index cf918e3e..82648b1 100644
>> --- a/include/drm/drmP.h
>> +++ b/include/drm/drmP.h
>> @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
>>   /** \name Macros to make printk easier */
>>   /*@{*/
>>
>> +#define	_DRM_PRINTK(once, level, fmt, ...)				\
>> +	do {								\
>> +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
>> +			     ##__VA_ARGS__);				\
>> +	} while (0)
>> +
>> +#define DRM_INFO(fmt, ...)						\
>> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
>> +#define DRM_NOTE(fmt, ...)						\
>> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
>> +#define DRM_WARN(fmt, ...)						\
>> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
>> +
>> +#define DRM_INFO_ONCE(fmt, ...)						\
>> +	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
>> +#define DRM_NOTE_ONCE(fmt, ...)					\
>> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
>> +#define DRM_WARN_ONCE(fmt, ...)						\
>> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
>> +
>>   /**
>>    * Error output.
>>    *
>> @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
>>   		drm_err(fmt, ##__VA_ARGS__);				\
>>   })
>>
>> -#define DRM_INFO(fmt, ...)				\
>> -	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>> -
>> -#define DRM_INFO_ONCE(fmt, ...)				\
>> -	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
>> -
>>   /**
>>    * Debug output.
>>    *
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
Daniel Vetter July 12, 2016, 2:59 p.m. UTC | #7
On Tue, Jul 12, 2016 at 03:53:55PM +0100, Dave Gordon wrote:
> On 12/07/16 15:25, Daniel Vetter wrote:
> > On Mon, Jul 11, 2016 at 07:01:27PM +0100, Dave Gordon wrote:
> > > We had only DRM_INFO() and DRM_ERROR(), whereas the underlying printk()
> > > provides several other useful intermediate levels such as NOTICE and
> > > WARNING. So this patch fills out the set by providing both regular and
> > > once-only macros for each of the levels INFO, NOTICE, and WARNING, using
> > > a common underlying macro that does all the token-pasting.
> > > 
> > > DRM_ERROR is unchanged, as it's not just a printk wrapper.
> > > 
> > > Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
> > 
> > I'm not sure what exactly the brave new drm debug model should look like
> > (probably some form of pimped dynamic debug printk, to be able to be
> > backwards compatible with the gazillion of blog posts recommending to
> > capture dmesg with drm.debug=0xe). But extending these is probably not
> > what we want ...
> > -Daniel
> 
> These are not debug of any sort, these message are intended to be seen by
> the user (or administrator), and these macros allow us to emit the messages
> at the most appropriate kernel message level.

Hm ok, I guess we can extend them for that.
-Daniel

> 
> .Dave.
> 
> > > ---
> > >   include/drm/drmP.h | 26 ++++++++++++++++++++------
> > >   1 file changed, 20 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > > index cf918e3e..82648b1 100644
> > > --- a/include/drm/drmP.h
> > > +++ b/include/drm/drmP.h
> > > @@ -162,6 +162,26 @@ void drm_err(const char *format, ...);
> > >   /** \name Macros to make printk easier */
> > >   /*@{*/
> > > 
> > > +#define	_DRM_PRINTK(once, level, fmt, ...)				\
> > > +	do {								\
> > > +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > > +			     ##__VA_ARGS__);				\
> > > +	} while (0)
> > > +
> > > +#define DRM_INFO(fmt, ...)						\
> > > +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> > > +#define DRM_NOTE(fmt, ...)						\
> > > +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> > > +#define DRM_WARN(fmt, ...)						\
> > > +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> > > +
> > > +#define DRM_INFO_ONCE(fmt, ...)						\
> > > +	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
> > > +#define DRM_NOTE_ONCE(fmt, ...)					\
> > > +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> > > +#define DRM_WARN_ONCE(fmt, ...)						\
> > > +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> > > +
> > >   /**
> > >    * Error output.
> > >    *
> > > @@ -187,12 +207,6 @@ void drm_err(const char *format, ...);
> > >   		drm_err(fmt, ##__VA_ARGS__);				\
> > >   })
> > > 
> > > -#define DRM_INFO(fmt, ...)				\
> > > -	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> > > -
> > > -#define DRM_INFO_ONCE(fmt, ...)				\
> > > -	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> > > -
> > >   /**
> > >    * Debug output.
> > >    *
> > > --
> > > 1.9.1
> > > 
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
>
diff mbox

Patch

diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index cf918e3e..82648b1 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -162,6 +162,26 @@  void drm_err(const char *format, ...);
 /** \name Macros to make printk easier */
 /*@{*/
 
+#define	_DRM_PRINTK(once, level, fmt, ...)				\
+	do {								\
+		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
+			     ##__VA_ARGS__);				\
+	} while (0)
+
+#define DRM_INFO(fmt, ...)						\
+	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
+#define DRM_NOTE(fmt, ...)						\
+	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN(fmt, ...)						\
+	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
+
+#define DRM_INFO_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, INFO, fmt, __VA_ARGS__)
+#define DRM_NOTE_ONCE(fmt, ...)					\
+	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
+#define DRM_WARN_ONCE(fmt, ...)						\
+	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
+
 /**
  * Error output.
  *
@@ -187,12 +207,6 @@  void drm_err(const char *format, ...);
 		drm_err(fmt, ##__VA_ARGS__);				\
 })
 
-#define DRM_INFO(fmt, ...)				\
-	printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
-
-#define DRM_INFO_ONCE(fmt, ...)				\
-	printk_once(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
-
 /**
  * Debug output.
  *