~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_print.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/drm/drm_print.h (Version linux-6.11-rc3) and /include/drm/drm_print.h (Version linux-6.9.12)


  1 /*                                                  1 /*
  2  * Copyright (C) 2016 Red Hat                       2  * Copyright (C) 2016 Red Hat
  3  *                                                  3  *
  4  * Permission is hereby granted, free of charg      4  * Permission is hereby granted, free of charge, to any person obtaining a
  5  * copy of this software and associated docume      5  * copy of this software and associated documentation files (the "Software"),
  6  * to deal in the Software without restriction      6  * to deal in the Software without restriction, including without limitation
  7  * the rights to use, copy, modify, merge, pub      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8  * and/or sell copies of the Software, and to       8  * and/or sell copies of the Software, and to permit persons to whom the
  9  * Software is furnished to do so, subject to       9  * Software is furnished to do so, subject to the following conditions:
 10  *                                                 10  *
 11  * The above copyright notice and this permiss     11  * The above copyright notice and this permission notice shall be included in
 12  * all copies or substantial portions of the S     12  * all copies or substantial portions of the Software.
 13  *                                                 13  *
 14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W     14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE W     15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINF     16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIA     17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CO     18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19  * ARISING FROM, OUT OF OR IN CONNECTION WITH      19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20  * OTHER DEALINGS IN THE SOFTWARE.                 20  * OTHER DEALINGS IN THE SOFTWARE.
 21  *                                                 21  *
 22  * Authors:                                        22  * Authors:
 23  * Rob Clark <robdclark@gmail.com>                 23  * Rob Clark <robdclark@gmail.com>
 24  */                                                24  */
 25                                                    25 
 26 #ifndef DRM_PRINT_H_                               26 #ifndef DRM_PRINT_H_
 27 #define DRM_PRINT_H_                               27 #define DRM_PRINT_H_
 28                                                    28 
 29 #include <linux/compiler.h>                        29 #include <linux/compiler.h>
 30 #include <linux/printk.h>                          30 #include <linux/printk.h>
                                                   >>  31 #include <linux/seq_file.h>
 31 #include <linux/device.h>                          32 #include <linux/device.h>
                                                   >>  33 #include <linux/debugfs.h>
 32 #include <linux/dynamic_debug.h>                   34 #include <linux/dynamic_debug.h>
 33                                                    35 
 34 #include <drm/drm.h>                               36 #include <drm/drm.h>
 35                                                    37 
 36 struct debugfs_regset32;                       << 
 37 struct drm_device;                                 38 struct drm_device;
 38 struct seq_file;                               << 
 39                                                    39 
 40 /* Do *not* use outside of drm_print.[ch]! */      40 /* Do *not* use outside of drm_print.[ch]! */
 41 extern unsigned long __drm_debug;                  41 extern unsigned long __drm_debug;
 42                                                    42 
 43 /**                                                43 /**
 44  * DOC: print                                      44  * DOC: print
 45  *                                                 45  *
 46  * A simple wrapper for dev_printk(), seq_prin     46  * A simple wrapper for dev_printk(), seq_printf(), etc.  Allows same
 47  * debug code to be used for both debugfs and      47  * debug code to be used for both debugfs and printk logging.
 48  *                                                 48  *
 49  * For example::                                   49  * For example::
 50  *                                                 50  *
 51  *     void log_some_info(struct drm_printer *     51  *     void log_some_info(struct drm_printer *p)
 52  *     {                                           52  *     {
 53  *             drm_printf(p, "foo=%d\n", foo);     53  *             drm_printf(p, "foo=%d\n", foo);
 54  *             drm_printf(p, "bar=%d\n", bar);     54  *             drm_printf(p, "bar=%d\n", bar);
 55  *     }                                           55  *     }
 56  *                                                 56  *
 57  *     #ifdef CONFIG_DEBUG_FS                      57  *     #ifdef CONFIG_DEBUG_FS
 58  *     void debugfs_show(struct seq_file *f)       58  *     void debugfs_show(struct seq_file *f)
 59  *     {                                           59  *     {
 60  *             struct drm_printer p = drm_seq_     60  *             struct drm_printer p = drm_seq_file_printer(f);
 61  *             log_some_info(&p);                  61  *             log_some_info(&p);
 62  *     }                                           62  *     }
 63  *     #endif                                      63  *     #endif
 64  *                                                 64  *
 65  *     void some_other_function(...)               65  *     void some_other_function(...)
 66  *     {                                           66  *     {
 67  *             struct drm_printer p = drm_info     67  *             struct drm_printer p = drm_info_printer(drm->dev);
 68  *             log_some_info(&p);                  68  *             log_some_info(&p);
 69  *     }                                           69  *     }
 70  */                                                70  */
 71                                                    71 
 72 /**                                                72 /**
 73  * enum drm_debug_category - The DRM debug cat     73  * enum drm_debug_category - The DRM debug categories
 74  *                                                 74  *
 75  * Each of the DRM debug logging macros use a      75  * Each of the DRM debug logging macros use a specific category, and the logging
 76  * is filtered by the drm.debug module paramet     76  * is filtered by the drm.debug module parameter. This enum specifies the values
 77  * for the interface.                              77  * for the interface.
 78  *                                                 78  *
 79  * Each DRM_DEBUG_<CATEGORY> macro logs to DRM     79  * Each DRM_DEBUG_<CATEGORY> macro logs to DRM_UT_<CATEGORY> category, except
 80  * DRM_DEBUG() logs to DRM_UT_CORE.                80  * DRM_DEBUG() logs to DRM_UT_CORE.
 81  *                                                 81  *
 82  * Enabling verbose debug messages is done thr     82  * Enabling verbose debug messages is done through the drm.debug parameter, each
 83  * category being enabled by a bit:                83  * category being enabled by a bit:
 84  *                                                 84  *
 85  *  - drm.debug=0x1 will enable CORE messages      85  *  - drm.debug=0x1 will enable CORE messages
 86  *  - drm.debug=0x2 will enable DRIVER message     86  *  - drm.debug=0x2 will enable DRIVER messages
 87  *  - drm.debug=0x3 will enable CORE and DRIVE     87  *  - drm.debug=0x3 will enable CORE and DRIVER messages
 88  *  - ...                                          88  *  - ...
 89  *  - drm.debug=0x1ff will enable all messages     89  *  - drm.debug=0x1ff will enable all messages
 90  *                                                 90  *
 91  * An interesting feature is that it's possibl     91  * An interesting feature is that it's possible to enable verbose logging at
 92  * run-time by echoing the debug value in its      92  * run-time by echoing the debug value in its sysfs node::
 93  *                                                 93  *
 94  *   # echo 0xf > /sys/module/drm/parameters/d     94  *   # echo 0xf > /sys/module/drm/parameters/debug
 95  *                                                 95  *
 96  */                                                96  */
 97 enum drm_debug_category {                          97 enum drm_debug_category {
 98         /* These names must match those in DYN     98         /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */
 99         /**                                        99         /**
100          * @DRM_UT_CORE: Used in the generic d    100          * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c,
101          * drm_memory.c, ...                      101          * drm_memory.c, ...
102          */                                       102          */
103         DRM_UT_CORE,                              103         DRM_UT_CORE,
104         /**                                       104         /**
105          * @DRM_UT_DRIVER: Used in the vendor     105          * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915,
106          * radeon, ... macro.                     106          * radeon, ... macro.
107          */                                       107          */
108         DRM_UT_DRIVER,                            108         DRM_UT_DRIVER,
109         /**                                       109         /**
110          * @DRM_UT_KMS: Used in the modesettin    110          * @DRM_UT_KMS: Used in the modesetting code.
111          */                                       111          */
112         DRM_UT_KMS,                               112         DRM_UT_KMS,
113         /**                                       113         /**
114          * @DRM_UT_PRIME: Used in the prime co    114          * @DRM_UT_PRIME: Used in the prime code.
115          */                                       115          */
116         DRM_UT_PRIME,                             116         DRM_UT_PRIME,
117         /**                                       117         /**
118          * @DRM_UT_ATOMIC: Used in the atomic     118          * @DRM_UT_ATOMIC: Used in the atomic code.
119          */                                       119          */
120         DRM_UT_ATOMIC,                            120         DRM_UT_ATOMIC,
121         /**                                       121         /**
122          * @DRM_UT_VBL: Used for verbose debug    122          * @DRM_UT_VBL: Used for verbose debug message in the vblank code.
123          */                                       123          */
124         DRM_UT_VBL,                               124         DRM_UT_VBL,
125         /**                                       125         /**
126          * @DRM_UT_STATE: Used for verbose ato    126          * @DRM_UT_STATE: Used for verbose atomic state debugging.
127          */                                       127          */
128         DRM_UT_STATE,                             128         DRM_UT_STATE,
129         /**                                       129         /**
130          * @DRM_UT_LEASE: Used in the lease co    130          * @DRM_UT_LEASE: Used in the lease code.
131          */                                       131          */
132         DRM_UT_LEASE,                             132         DRM_UT_LEASE,
133         /**                                       133         /**
134          * @DRM_UT_DP: Used in the DP code.       134          * @DRM_UT_DP: Used in the DP code.
135          */                                       135          */
136         DRM_UT_DP,                                136         DRM_UT_DP,
137         /**                                       137         /**
138          * @DRM_UT_DRMRES: Used in the drm man    138          * @DRM_UT_DRMRES: Used in the drm managed resources code.
139          */                                       139          */
140         DRM_UT_DRMRES                             140         DRM_UT_DRMRES
141 };                                                141 };
142                                                   142 
143 static inline bool drm_debug_enabled_raw(enum     143 static inline bool drm_debug_enabled_raw(enum drm_debug_category category)
144 {                                                 144 {
145         return unlikely(__drm_debug & BIT(cate    145         return unlikely(__drm_debug & BIT(category));
146 }                                                 146 }
147                                                   147 
148 #define drm_debug_enabled_instrumented(categor    148 #define drm_debug_enabled_instrumented(category)                        \
149         ({                                        149         ({                                                              \
150                 pr_debug("todo: is this freque    150                 pr_debug("todo: is this frequent enough to optimize ?\n"); \
151                 drm_debug_enabled_raw(category    151                 drm_debug_enabled_raw(category);                        \
152         })                                        152         })
153                                                   153 
154 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)         154 #if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
155 /*                                                155 /*
156  * the drm.debug API uses dyndbg, so each drm_    156  * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets
157  * a descriptor, and only enabled callsites ar    157  * a descriptor, and only enabled callsites are reachable.  They use
158  * the private macro to avoid re-testing the e    158  * the private macro to avoid re-testing the enable-bit.
159  */                                               159  */
160 #define __drm_debug_enabled(category)   true      160 #define __drm_debug_enabled(category)   true
161 #define drm_debug_enabled(category)     drm_de    161 #define drm_debug_enabled(category)     drm_debug_enabled_instrumented(category)
162 #else                                             162 #else
163 #define __drm_debug_enabled(category)   drm_de    163 #define __drm_debug_enabled(category)   drm_debug_enabled_raw(category)
164 #define drm_debug_enabled(category)     drm_de    164 #define drm_debug_enabled(category)     drm_debug_enabled_raw(category)
165 #endif                                            165 #endif
166                                                   166 
167 /**                                               167 /**
168  * struct drm_printer - drm output "stream"       168  * struct drm_printer - drm output "stream"
169  *                                                169  *
170  * Do not use struct members directly.  Use dr    170  * Do not use struct members directly.  Use drm_printer_seq_file(),
171  * drm_printer_info(), etc to initialize.  And    171  * drm_printer_info(), etc to initialize.  And drm_printf() for output.
172  */                                               172  */
173 struct drm_printer {                              173 struct drm_printer {
174         /* private: */                            174         /* private: */
175         void (*printfn)(struct drm_printer *p,    175         void (*printfn)(struct drm_printer *p, struct va_format *vaf);
176         void (*puts)(struct drm_printer *p, co    176         void (*puts)(struct drm_printer *p, const char *str);
177         void *arg;                                177         void *arg;
178         const void *origin;                    << 
179         const char *prefix;                       178         const char *prefix;
180         enum drm_debug_category category;         179         enum drm_debug_category category;
181 };                                                180 };
182                                                   181 
183 void __drm_printfn_coredump(struct drm_printer    182 void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf);
184 void __drm_puts_coredump(struct drm_printer *p    183 void __drm_puts_coredump(struct drm_printer *p, const char *str);
185 void __drm_printfn_seq_file(struct drm_printer    184 void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
186 void __drm_puts_seq_file(struct drm_printer *p    185 void __drm_puts_seq_file(struct drm_printer *p, const char *str);
187 void __drm_printfn_info(struct drm_printer *p,    186 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
188 void __drm_printfn_dbg(struct drm_printer *p,     187 void __drm_printfn_dbg(struct drm_printer *p, struct va_format *vaf);
189 void __drm_printfn_err(struct drm_printer *p,     188 void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf);
190                                                   189 
191 __printf(2, 3)                                    190 __printf(2, 3)
192 void drm_printf(struct drm_printer *p, const c    191 void drm_printf(struct drm_printer *p, const char *f, ...);
193 void drm_puts(struct drm_printer *p, const cha    192 void drm_puts(struct drm_printer *p, const char *str);
194 void drm_print_regset32(struct drm_printer *p,    193 void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
195 void drm_print_bits(struct drm_printer *p, uns    194 void drm_print_bits(struct drm_printer *p, unsigned long value,
196                     const char * const bits[],    195                     const char * const bits[], unsigned int nbits);
197                                                   196 
198 __printf(2, 0)                                    197 __printf(2, 0)
199 /**                                               198 /**
200  * drm_vprintf - print to a &drm_printer strea    199  * drm_vprintf - print to a &drm_printer stream
201  * @p: the &drm_printer                           200  * @p: the &drm_printer
202  * @fmt: format string                            201  * @fmt: format string
203  * @va: the va_list                               202  * @va: the va_list
204  */                                               203  */
205 static inline void                                204 static inline void
206 drm_vprintf(struct drm_printer *p, const char     205 drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
207 {                                                 206 {
208         struct va_format vaf = { .fmt = fmt, .    207         struct va_format vaf = { .fmt = fmt, .va = va };
209                                                   208 
210         p->printfn(p, &vaf);                      209         p->printfn(p, &vaf);
211 }                                                 210 }
212                                                   211 
213 /**                                               212 /**
214  * drm_printf_indent - Print to a &drm_printer    213  * drm_printf_indent - Print to a &drm_printer stream with indentation
215  * @printer: DRM printer                          214  * @printer: DRM printer
216  * @indent: Tab indentation level (max 5)         215  * @indent: Tab indentation level (max 5)
217  * @fmt: Format string                            216  * @fmt: Format string
218  */                                               217  */
219 #define drm_printf_indent(printer, indent, fmt    218 #define drm_printf_indent(printer, indent, fmt, ...) \
220         drm_printf((printer), "%.*s" fmt, (ind    219         drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", ##__VA_ARGS__)
221                                                   220 
222 /**                                               221 /**
223  * struct drm_print_iterator - local struct us    222  * struct drm_print_iterator - local struct used with drm_printer_coredump
224  * @data: Pointer to the devcoredump output bu    223  * @data: Pointer to the devcoredump output buffer
225  * @start: The offset within the buffer to sta    224  * @start: The offset within the buffer to start writing
226  * @remain: The number of bytes to write for t    225  * @remain: The number of bytes to write for this iteration
227  */                                               226  */
228 struct drm_print_iterator {                       227 struct drm_print_iterator {
229         void *data;                               228         void *data;
230         ssize_t start;                            229         ssize_t start;
231         ssize_t remain;                           230         ssize_t remain;
232         /* private: */                            231         /* private: */
233         ssize_t offset;                           232         ssize_t offset;
234 };                                                233 };
235                                                   234 
236 /**                                               235 /**
237  * drm_coredump_printer - construct a &drm_pri    236  * drm_coredump_printer - construct a &drm_printer that can output to a buffer
238  * from the read function for devcoredump         237  * from the read function for devcoredump
239  * @iter: A pointer to a struct drm_print_iter    238  * @iter: A pointer to a struct drm_print_iterator for the read instance
240  *                                                239  *
241  * This wrapper extends drm_printf() to work w    240  * This wrapper extends drm_printf() to work with a dev_coredumpm() callback
242  * function. The passed in drm_print_iterator     241  * function. The passed in drm_print_iterator struct contains the buffer
243  * pointer, size and offset as passed in from     242  * pointer, size and offset as passed in from devcoredump.
244  *                                                243  *
245  * For example::                                  244  * For example::
246  *                                                245  *
247  *      void coredump_read(char *buffer, loff_    246  *      void coredump_read(char *buffer, loff_t offset, size_t count,
248  *              void *data, size_t datalen)       247  *              void *data, size_t datalen)
249  *      {                                         248  *      {
250  *              struct drm_print_iterator iter    249  *              struct drm_print_iterator iter;
251  *              struct drm_printer p;             250  *              struct drm_printer p;
252  *                                                251  *
253  *              iter.data = buffer;               252  *              iter.data = buffer;
254  *              iter.start = offset;              253  *              iter.start = offset;
255  *              iter.remain = count;              254  *              iter.remain = count;
256  *                                                255  *
257  *              p = drm_coredump_printer(&iter    256  *              p = drm_coredump_printer(&iter);
258  *                                                257  *
259  *              drm_printf(p, "foo=%d\n", foo)    258  *              drm_printf(p, "foo=%d\n", foo);
260  *      }                                         259  *      }
261  *                                                260  *
262  *      void makecoredump(...)                    261  *      void makecoredump(...)
263  *      {                                         262  *      {
264  *              ...                               263  *              ...
265  *              dev_coredumpm(dev, THIS_MODULE    264  *              dev_coredumpm(dev, THIS_MODULE, data, 0, GFP_KERNEL,
266  *                      coredump_read, ...)       265  *                      coredump_read, ...)
267  *      }                                         266  *      }
268  *                                                267  *
269  * RETURNS:                                       268  * RETURNS:
270  * The &drm_printer object                        269  * The &drm_printer object
271  */                                               270  */
272 static inline struct drm_printer                  271 static inline struct drm_printer
273 drm_coredump_printer(struct drm_print_iterator    272 drm_coredump_printer(struct drm_print_iterator *iter)
274 {                                                 273 {
275         struct drm_printer p = {                  274         struct drm_printer p = {
276                 .printfn = __drm_printfn_cored    275                 .printfn = __drm_printfn_coredump,
277                 .puts = __drm_puts_coredump,      276                 .puts = __drm_puts_coredump,
278                 .arg = iter,                      277                 .arg = iter,
279         };                                        278         };
280                                                   279 
281         /* Set the internal offset of the iter    280         /* Set the internal offset of the iterator to zero */
282         iter->offset = 0;                         281         iter->offset = 0;
283                                                   282 
284         return p;                                 283         return p;
285 }                                                 284 }
286                                                   285 
287 /**                                               286 /**
288  * drm_seq_file_printer - construct a &drm_pri    287  * drm_seq_file_printer - construct a &drm_printer that outputs to &seq_file
289  * @f:  the &struct seq_file to output to         288  * @f:  the &struct seq_file to output to
290  *                                                289  *
291  * RETURNS:                                       290  * RETURNS:
292  * The &drm_printer object                        291  * The &drm_printer object
293  */                                               292  */
294 static inline struct drm_printer drm_seq_file_    293 static inline struct drm_printer drm_seq_file_printer(struct seq_file *f)
295 {                                                 294 {
296         struct drm_printer p = {                  295         struct drm_printer p = {
297                 .printfn = __drm_printfn_seq_f    296                 .printfn = __drm_printfn_seq_file,
298                 .puts = __drm_puts_seq_file,      297                 .puts = __drm_puts_seq_file,
299                 .arg = f,                         298                 .arg = f,
300         };                                        299         };
301         return p;                                 300         return p;
302 }                                                 301 }
303                                                   302 
304 /**                                               303 /**
305  * drm_info_printer - construct a &drm_printer    304  * drm_info_printer - construct a &drm_printer that outputs to dev_printk()
306  * @dev: the &struct device pointer               305  * @dev: the &struct device pointer
307  *                                                306  *
308  * RETURNS:                                       307  * RETURNS:
309  * The &drm_printer object                        308  * The &drm_printer object
310  */                                               309  */
311 static inline struct drm_printer drm_info_prin    310 static inline struct drm_printer drm_info_printer(struct device *dev)
312 {                                                 311 {
313         struct drm_printer p = {                  312         struct drm_printer p = {
314                 .printfn = __drm_printfn_info,    313                 .printfn = __drm_printfn_info,
315                 .arg = dev,                       314                 .arg = dev,
316         };                                        315         };
317         return p;                                 316         return p;
318 }                                                 317 }
319                                                   318 
320 /**                                               319 /**
321  * drm_dbg_printer - construct a &drm_printer     320  * drm_dbg_printer - construct a &drm_printer for drm device specific output
322  * @drm: the &struct drm_device pointer, or NU    321  * @drm: the &struct drm_device pointer, or NULL
323  * @category: the debug category to use           322  * @category: the debug category to use
324  * @prefix: debug output prefix, or NULL for n    323  * @prefix: debug output prefix, or NULL for no prefix
325  *                                                324  *
326  * RETURNS:                                       325  * RETURNS:
327  * The &drm_printer object                        326  * The &drm_printer object
328  */                                               327  */
329 static inline struct drm_printer drm_dbg_print    328 static inline struct drm_printer drm_dbg_printer(struct drm_device *drm,
330                                                   329                                                  enum drm_debug_category category,
331                                                   330                                                  const char *prefix)
332 {                                                 331 {
333         struct drm_printer p = {                  332         struct drm_printer p = {
334                 .printfn = __drm_printfn_dbg,     333                 .printfn = __drm_printfn_dbg,
335                 .arg = drm,                       334                 .arg = drm,
336                 .origin = (const void *)_THIS_ << 
337                 .prefix = prefix,                 335                 .prefix = prefix,
338                 .category = category,             336                 .category = category,
339         };                                        337         };
340         return p;                                 338         return p;
341 }                                                 339 }
342                                                   340 
343 /**                                               341 /**
344  * drm_err_printer - construct a &drm_printer     342  * drm_err_printer - construct a &drm_printer that outputs to drm_err()
345  * @drm: the &struct drm_device pointer           343  * @drm: the &struct drm_device pointer
346  * @prefix: debug output prefix, or NULL for n    344  * @prefix: debug output prefix, or NULL for no prefix
347  *                                                345  *
348  * RETURNS:                                       346  * RETURNS:
349  * The &drm_printer object                        347  * The &drm_printer object
350  */                                               348  */
351 static inline struct drm_printer drm_err_print    349 static inline struct drm_printer drm_err_printer(struct drm_device *drm,
352                                                   350                                                  const char *prefix)
353 {                                                 351 {
354         struct drm_printer p = {                  352         struct drm_printer p = {
355                 .printfn = __drm_printfn_err,     353                 .printfn = __drm_printfn_err,
356                 .arg = drm,                       354                 .arg = drm,
357                 .prefix = prefix                  355                 .prefix = prefix
358         };                                        356         };
359         return p;                                 357         return p;
360 }                                                 358 }
361                                                   359 
362 /*                                                360 /*
363  * struct device based logging                    361  * struct device based logging
364  *                                                362  *
365  * Prefer drm_device based logging over device    363  * Prefer drm_device based logging over device or printk based logging.
366  */                                               364  */
367                                                   365 
368 __printf(3, 4)                                    366 __printf(3, 4)
369 void drm_dev_printk(const struct device *dev,     367 void drm_dev_printk(const struct device *dev, const char *level,
370                     const char *format, ...);     368                     const char *format, ...);
371 struct _ddebug;                                   369 struct _ddebug;
372 __printf(4, 5)                                    370 __printf(4, 5)
373 void __drm_dev_dbg(struct _ddebug *desc, const    371 void __drm_dev_dbg(struct _ddebug *desc, const struct device *dev,
374                    enum drm_debug_category cat    372                    enum drm_debug_category category, const char *format, ...);
375                                                   373 
376 /**                                               374 /**
377  * DRM_DEV_ERROR() - Error output.                375  * DRM_DEV_ERROR() - Error output.
378  *                                                376  *
379  * NOTE: this is deprecated in favor of drm_er    377  * NOTE: this is deprecated in favor of drm_err() or dev_err().
380  *                                                378  *
381  * @dev: device pointer                           379  * @dev: device pointer
382  * @fmt: printf() like format string.             380  * @fmt: printf() like format string.
383  */                                               381  */
384 #define DRM_DEV_ERROR(dev, fmt, ...)              382 #define DRM_DEV_ERROR(dev, fmt, ...)                                    \
385         drm_dev_printk(dev, KERN_ERR, "*ERROR*    383         drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
386                                                   384 
387 /**                                               385 /**
388  * DRM_DEV_ERROR_RATELIMITED() - Rate limited     386  * DRM_DEV_ERROR_RATELIMITED() - Rate limited error output.
389  *                                                387  *
390  * NOTE: this is deprecated in favor of drm_er    388  * NOTE: this is deprecated in favor of drm_err_ratelimited() or
391  * dev_err_ratelimited().                         389  * dev_err_ratelimited().
392  *                                                390  *
393  * @dev: device pointer                           391  * @dev: device pointer
394  * @fmt: printf() like format string.             392  * @fmt: printf() like format string.
395  *                                                393  *
396  * Like DRM_ERROR() but won't flood the log.      394  * Like DRM_ERROR() but won't flood the log.
397  */                                               395  */
398 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ..    396 #define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)                        \
399 ({                                                397 ({                                                                      \
400         static DEFINE_RATELIMIT_STATE(_rs,        398         static DEFINE_RATELIMIT_STATE(_rs,                              \
401                                       DEFAULT_    399                                       DEFAULT_RATELIMIT_INTERVAL,       \
402                                       DEFAULT_    400                                       DEFAULT_RATELIMIT_BURST);         \
403                                                   401                                                                         \
404         if (__ratelimit(&_rs))                    402         if (__ratelimit(&_rs))                                          \
405                 DRM_DEV_ERROR(dev, fmt, ##__VA    403                 DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);                 \
406 })                                                404 })
407                                                   405 
408 /* NOTE: this is deprecated in favor of drm_in    406 /* NOTE: this is deprecated in favor of drm_info() or dev_info(). */
409 #define DRM_DEV_INFO(dev, fmt, ...)               407 #define DRM_DEV_INFO(dev, fmt, ...)                             \
410         drm_dev_printk(dev, KERN_INFO, fmt, ##    408         drm_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
411                                                   409 
412 /* NOTE: this is deprecated in favor of drm_in    410 /* NOTE: this is deprecated in favor of drm_info_once() or dev_info_once(). */
413 #define DRM_DEV_INFO_ONCE(dev, fmt, ...)          411 #define DRM_DEV_INFO_ONCE(dev, fmt, ...)                                \
414 ({                                                412 ({                                                                      \
415         static bool __print_once __read_mostly    413         static bool __print_once __read_mostly;                         \
416         if (!__print_once) {                      414         if (!__print_once) {                                            \
417                 __print_once = true;              415                 __print_once = true;                                    \
418                 DRM_DEV_INFO(dev, fmt, ##__VA_    416                 DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);                  \
419         }                                         417         }                                                               \
420 })                                                418 })
421                                                   419 
422 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)        420 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
423 #define drm_dev_dbg(dev, cat, fmt, ...)           421 #define drm_dev_dbg(dev, cat, fmt, ...)                         \
424         __drm_dev_dbg(NULL, dev, cat, fmt, ##_    422         __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__)
425 #else                                             423 #else
426 #define drm_dev_dbg(dev, cat, fmt, ...)           424 #define drm_dev_dbg(dev, cat, fmt, ...)                         \
427         _dynamic_func_call_cls(cat, fmt, __drm    425         _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg,         \
428                                dev, cat, fmt,     426                                dev, cat, fmt, ##__VA_ARGS__)
429 #endif                                            427 #endif
430                                                   428 
431 /**                                               429 /**
432  * DRM_DEV_DEBUG() - Debug output for generic     430  * DRM_DEV_DEBUG() - Debug output for generic drm code
433  *                                                431  *
434  * NOTE: this is deprecated in favor of drm_db    432  * NOTE: this is deprecated in favor of drm_dbg_core().
435  *                                                433  *
436  * @dev: device pointer                           434  * @dev: device pointer
437  * @fmt: printf() like format string.             435  * @fmt: printf() like format string.
438  */                                               436  */
439 #define DRM_DEV_DEBUG(dev, fmt, ...)              437 #define DRM_DEV_DEBUG(dev, fmt, ...)                                    \
440         drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##_    438         drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
441 /**                                               439 /**
442  * DRM_DEV_DEBUG_DRIVER() - Debug output for v    440  * DRM_DEV_DEBUG_DRIVER() - Debug output for vendor specific part of the driver
443  *                                                441  *
444  * NOTE: this is deprecated in favor of drm_db    442  * NOTE: this is deprecated in favor of drm_dbg() or dev_dbg().
445  *                                                443  *
446  * @dev: device pointer                           444  * @dev: device pointer
447  * @fmt: printf() like format string.             445  * @fmt: printf() like format string.
448  */                                               446  */
449 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)       447 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)                             \
450         drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, #    448         drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
451 /**                                               449 /**
452  * DRM_DEV_DEBUG_KMS() - Debug output for mode    450  * DRM_DEV_DEBUG_KMS() - Debug output for modesetting code
453  *                                                451  *
454  * NOTE: this is deprecated in favor of drm_db    452  * NOTE: this is deprecated in favor of drm_dbg_kms().
455  *                                                453  *
456  * @dev: device pointer                           454  * @dev: device pointer
457  * @fmt: printf() like format string.             455  * @fmt: printf() like format string.
458  */                                               456  */
459 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)          457 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)                                \
460         drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__    458         drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
461                                                   459 
462 /*                                                460 /*
463  * struct drm_device based logging                461  * struct drm_device based logging
464  *                                                462  *
465  * Prefer drm_device based logging over device    463  * Prefer drm_device based logging over device or prink based logging.
466  */                                               464  */
467                                                   465 
468 /* Helper for struct drm_device based logging.    466 /* Helper for struct drm_device based logging. */
469 #define __drm_printk(drm, level, type, fmt, ..    467 #define __drm_printk(drm, level, type, fmt, ...)                        \
470         dev_##level##type((drm) ? (drm)->dev :    468         dev_##level##type((drm) ? (drm)->dev : NULL, "[drm] " fmt, ##__VA_ARGS__)
471                                                   469 
472                                                   470 
473 #define drm_info(drm, fmt, ...)                   471 #define drm_info(drm, fmt, ...)                                 \
474         __drm_printk((drm), info,, fmt, ##__VA    472         __drm_printk((drm), info,, fmt, ##__VA_ARGS__)
475                                                   473 
476 #define drm_notice(drm, fmt, ...)                 474 #define drm_notice(drm, fmt, ...)                               \
477         __drm_printk((drm), notice,, fmt, ##__    475         __drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
478                                                   476 
479 #define drm_warn(drm, fmt, ...)                   477 #define drm_warn(drm, fmt, ...)                                 \
480         __drm_printk((drm), warn,, fmt, ##__VA    478         __drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
481                                                   479 
482 #define drm_err(drm, fmt, ...)                    480 #define drm_err(drm, fmt, ...)                                  \
483         __drm_printk((drm), err,, "*ERROR* " f    481         __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
484                                                   482 
485                                                   483 
486 #define drm_info_once(drm, fmt, ...)              484 #define drm_info_once(drm, fmt, ...)                            \
487         __drm_printk((drm), info, _once, fmt,     485         __drm_printk((drm), info, _once, fmt, ##__VA_ARGS__)
488                                                   486 
489 #define drm_notice_once(drm, fmt, ...)            487 #define drm_notice_once(drm, fmt, ...)                          \
490         __drm_printk((drm), notice, _once, fmt    488         __drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__)
491                                                   489 
492 #define drm_warn_once(drm, fmt, ...)              490 #define drm_warn_once(drm, fmt, ...)                            \
493         __drm_printk((drm), warn, _once, fmt,     491         __drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__)
494                                                   492 
495 #define drm_err_once(drm, fmt, ...)               493 #define drm_err_once(drm, fmt, ...)                             \
496         __drm_printk((drm), err, _once, "*ERRO    494         __drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
497                                                   495 
498                                                   496 
499 #define drm_err_ratelimited(drm, fmt, ...)        497 #define drm_err_ratelimited(drm, fmt, ...)                              \
500         __drm_printk((drm), err, _ratelimited,    498         __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
501                                                   499 
502                                                   500 
503 #define drm_dbg_core(drm, fmt, ...)               501 #define drm_dbg_core(drm, fmt, ...)                                     \
504         drm_dev_dbg((drm) ? (drm)->dev : NULL,    502         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_CORE, fmt, ##__VA_ARGS__)
505 #define drm_dbg_driver(drm, fmt, ...)             503 #define drm_dbg_driver(drm, fmt, ...)                                           \
506         drm_dev_dbg((drm) ? (drm)->dev : NULL,    504         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
507 #define drm_dbg_kms(drm, fmt, ...)                505 #define drm_dbg_kms(drm, fmt, ...)                                      \
508         drm_dev_dbg((drm) ? (drm)->dev : NULL,    506         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__)
509 #define drm_dbg_prime(drm, fmt, ...)              507 #define drm_dbg_prime(drm, fmt, ...)                                    \
510         drm_dev_dbg((drm) ? (drm)->dev : NULL,    508         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
511 #define drm_dbg_atomic(drm, fmt, ...)             509 #define drm_dbg_atomic(drm, fmt, ...)                                   \
512         drm_dev_dbg((drm) ? (drm)->dev : NULL,    510         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
513 #define drm_dbg_vbl(drm, fmt, ...)                511 #define drm_dbg_vbl(drm, fmt, ...)                                      \
514         drm_dev_dbg((drm) ? (drm)->dev : NULL,    512         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_VBL, fmt, ##__VA_ARGS__)
515 #define drm_dbg_state(drm, fmt, ...)              513 #define drm_dbg_state(drm, fmt, ...)                                    \
516         drm_dev_dbg((drm) ? (drm)->dev : NULL,    514         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_STATE, fmt, ##__VA_ARGS__)
517 #define drm_dbg_lease(drm, fmt, ...)              515 #define drm_dbg_lease(drm, fmt, ...)                                    \
518         drm_dev_dbg((drm) ? (drm)->dev : NULL,    516         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
519 #define drm_dbg_dp(drm, fmt, ...)                 517 #define drm_dbg_dp(drm, fmt, ...)                                       \
520         drm_dev_dbg((drm) ? (drm)->dev : NULL,    518         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DP, fmt, ##__VA_ARGS__)
521 #define drm_dbg_drmres(drm, fmt, ...)             519 #define drm_dbg_drmres(drm, fmt, ...)                                   \
522         drm_dev_dbg((drm) ? (drm)->dev : NULL,    520         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRMRES, fmt, ##__VA_ARGS__)
523                                                   521 
524 #define drm_dbg(drm, fmt, ...)  drm_dbg_driver    522 #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
525                                                   523 
526 /*                                                524 /*
527  * printk based logging                           525  * printk based logging
528  *                                                526  *
529  * Prefer drm_device based logging over device    527  * Prefer drm_device based logging over device or prink based logging.
530  */                                               528  */
531                                                   529 
                                                   >> 530 __printf(3, 4)
                                                   >> 531 void ___drm_dbg(struct _ddebug *desc, enum drm_debug_category category, const char *format, ...);
532 __printf(1, 2)                                    532 __printf(1, 2)
533 void __drm_err(const char *format, ...);          533 void __drm_err(const char *format, ...);
534                                                   534 
535 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)        535 #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
536 #define __drm_dbg(cat, fmt, ...)        __drm_ !! 536 #define __drm_dbg(cat, fmt, ...)                ___drm_dbg(NULL, cat, fmt, ##__VA_ARGS__)
537 #else                                             537 #else
538 #define __drm_dbg(cat, fmt, ...)                  538 #define __drm_dbg(cat, fmt, ...)                                        \
539         _dynamic_func_call_cls(cat, fmt, __drm !! 539         _dynamic_func_call_cls(cat, fmt, ___drm_dbg,                    \
540                                NULL, cat, fmt, !! 540                                cat, fmt, ##__VA_ARGS__)
541 #endif                                            541 #endif
542                                                   542 
543 /* Macros to make printk easier */                543 /* Macros to make printk easier */
544                                                   544 
545 #define _DRM_PRINTK(once, level, fmt, ...)        545 #define _DRM_PRINTK(once, level, fmt, ...)                              \
546         printk##once(KERN_##level "[" DRM_NAME    546         printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
547                                                   547 
548 /* NOTE: this is deprecated in favor of pr_inf    548 /* NOTE: this is deprecated in favor of pr_info(). */
549 #define DRM_INFO(fmt, ...)                        549 #define DRM_INFO(fmt, ...)                                              \
550         _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__    550         _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
551 /* NOTE: this is deprecated in favor of pr_not    551 /* NOTE: this is deprecated in favor of pr_notice(). */
552 #define DRM_NOTE(fmt, ...)                        552 #define DRM_NOTE(fmt, ...)                                              \
553         _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS    553         _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
554 /* NOTE: this is deprecated in favor of pr_war    554 /* NOTE: this is deprecated in favor of pr_warn(). */
555 #define DRM_WARN(fmt, ...)                        555 #define DRM_WARN(fmt, ...)                                              \
556         _DRM_PRINTK(, WARNING, fmt, ##__VA_ARG    556         _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
557                                                   557 
558 /* NOTE: this is deprecated in favor of pr_inf    558 /* NOTE: this is deprecated in favor of pr_info_once(). */
559 #define DRM_INFO_ONCE(fmt, ...)                   559 #define DRM_INFO_ONCE(fmt, ...)                                         \
560         _DRM_PRINTK(_once, INFO, fmt, ##__VA_A    560         _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
561 /* NOTE: this is deprecated in favor of pr_not    561 /* NOTE: this is deprecated in favor of pr_notice_once(). */
562 #define DRM_NOTE_ONCE(fmt, ...)                   562 #define DRM_NOTE_ONCE(fmt, ...)                                         \
563         _DRM_PRINTK(_once, NOTICE, fmt, ##__VA    563         _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
564 /* NOTE: this is deprecated in favor of pr_war    564 /* NOTE: this is deprecated in favor of pr_warn_once(). */
565 #define DRM_WARN_ONCE(fmt, ...)                   565 #define DRM_WARN_ONCE(fmt, ...)                                         \
566         _DRM_PRINTK(_once, WARNING, fmt, ##__V    566         _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
567                                                   567 
568 /* NOTE: this is deprecated in favor of pr_err    568 /* NOTE: this is deprecated in favor of pr_err(). */
569 #define DRM_ERROR(fmt, ...)                       569 #define DRM_ERROR(fmt, ...)                                             \
570         __drm_err(fmt, ##__VA_ARGS__)             570         __drm_err(fmt, ##__VA_ARGS__)
571                                                   571 
572 /* NOTE: this is deprecated in favor of pr_err    572 /* NOTE: this is deprecated in favor of pr_err_ratelimited(). */
573 #define DRM_ERROR_RATELIMITED(fmt, ...)           573 #define DRM_ERROR_RATELIMITED(fmt, ...)                                 \
574         DRM_DEV_ERROR_RATELIMITED(NULL, fmt, #    574         DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
575                                                   575 
576 /* NOTE: this is deprecated in favor of drm_db    576 /* NOTE: this is deprecated in favor of drm_dbg_core(NULL, ...). */
577 #define DRM_DEBUG(fmt, ...)                       577 #define DRM_DEBUG(fmt, ...)                                             \
578         __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARG    578         __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
579                                                   579 
580 /* NOTE: this is deprecated in favor of drm_db    580 /* NOTE: this is deprecated in favor of drm_dbg(NULL, ...). */
581 #define DRM_DEBUG_DRIVER(fmt, ...)                581 #define DRM_DEBUG_DRIVER(fmt, ...)                                      \
582         __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_A    582         __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
583                                                   583 
584 /* NOTE: this is deprecated in favor of drm_db    584 /* NOTE: this is deprecated in favor of drm_dbg_kms(NULL, ...). */
585 #define DRM_DEBUG_KMS(fmt, ...)                   585 #define DRM_DEBUG_KMS(fmt, ...)                                         \
586         __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS    586         __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
587                                                   587 
588 /* NOTE: this is deprecated in favor of drm_db    588 /* NOTE: this is deprecated in favor of drm_dbg_prime(NULL, ...). */
589 #define DRM_DEBUG_PRIME(fmt, ...)                 589 #define DRM_DEBUG_PRIME(fmt, ...)                                       \
590         __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_AR    590         __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
591                                                   591 
592 /* NOTE: this is deprecated in favor of drm_db    592 /* NOTE: this is deprecated in favor of drm_dbg_atomic(NULL, ...). */
593 #define DRM_DEBUG_ATOMIC(fmt, ...)                593 #define DRM_DEBUG_ATOMIC(fmt, ...)                                      \
594         __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_A    594         __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
595                                                   595 
596 /* NOTE: this is deprecated in favor of drm_db    596 /* NOTE: this is deprecated in favor of drm_dbg_vbl(NULL, ...). */
597 #define DRM_DEBUG_VBL(fmt, ...)                   597 #define DRM_DEBUG_VBL(fmt, ...)                                         \
598         __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS    598         __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
599                                                   599 
600 /* NOTE: this is deprecated in favor of drm_db    600 /* NOTE: this is deprecated in favor of drm_dbg_lease(NULL, ...). */
601 #define DRM_DEBUG_LEASE(fmt, ...)                 601 #define DRM_DEBUG_LEASE(fmt, ...)                                       \
602         __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_AR    602         __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
603                                                   603 
604 /* NOTE: this is deprecated in favor of drm_db    604 /* NOTE: this is deprecated in favor of drm_dbg_dp(NULL, ...). */
605 #define DRM_DEBUG_DP(fmt, ...)                    605 #define DRM_DEBUG_DP(fmt, ...)                                          \
606         __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS    606         __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
607                                                   607 
608 #define __DRM_DEFINE_DBG_RATELIMITED(category,    608 #define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)                                   \
609 ({                                                609 ({                                                                                              \
610         static DEFINE_RATELIMIT_STATE(rs_, DEF    610         static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
611         const struct drm_device *drm_ = (drm);    611         const struct drm_device *drm_ = (drm);                                                  \
612                                                   612                                                                                                 \
613         if (drm_debug_enabled(DRM_UT_ ## categ    613         if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))                        \
614                 drm_dev_printk(drm_ ? drm_->de    614                 drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);       \
615 })                                                615 })
616                                                   616 
617 #define drm_dbg_ratelimited(drm, fmt, ...) \      617 #define drm_dbg_ratelimited(drm, fmt, ...) \
618         __DRM_DEFINE_DBG_RATELIMITED(DRIVER, d    618         __DRM_DEFINE_DBG_RATELIMITED(DRIVER, drm, fmt, ## __VA_ARGS__)
619                                                   619 
620 #define drm_dbg_kms_ratelimited(drm, fmt, ...)    620 #define drm_dbg_kms_ratelimited(drm, fmt, ...) \
621         __DRM_DEFINE_DBG_RATELIMITED(KMS, drm,    621         __DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__)
622                                                   622 
623 /*                                                623 /*
624  * struct drm_device based WARNs                  624  * struct drm_device based WARNs
625  *                                                625  *
626  * drm_WARN*() acts like WARN*(), but with the    626  * drm_WARN*() acts like WARN*(), but with the key difference of
627  * using device specific information so that w    627  * using device specific information so that we know from which device
628  * warning is originating from.                   628  * warning is originating from.
629  *                                                629  *
630  * Prefer drm_device based drm_WARN* over regu    630  * Prefer drm_device based drm_WARN* over regular WARN*
631  */                                               631  */
632                                                   632 
633 /* Helper for struct drm_device based WARNs */    633 /* Helper for struct drm_device based WARNs */
634 #define drm_WARN(drm, condition, format, arg..    634 #define drm_WARN(drm, condition, format, arg...)                        \
635         WARN(condition, "%s %s: [drm] " format !! 635         WARN(condition, "%s %s: " format,                               \
636                         dev_driver_string((drm    636                         dev_driver_string((drm)->dev),                  \
637                         dev_name((drm)->dev),     637                         dev_name((drm)->dev), ## arg)
638                                                   638 
639 #define drm_WARN_ONCE(drm, condition, format,     639 #define drm_WARN_ONCE(drm, condition, format, arg...)                   \
640         WARN_ONCE(condition, "%s %s: [drm] " f !! 640         WARN_ONCE(condition, "%s %s: " format,                          \
641                         dev_driver_string((drm    641                         dev_driver_string((drm)->dev),                  \
642                         dev_name((drm)->dev),     642                         dev_name((drm)->dev), ## arg)
643                                                   643 
644 #define drm_WARN_ON(drm, x)                       644 #define drm_WARN_ON(drm, x)                                             \
645         drm_WARN((drm), (x), "%s",                645         drm_WARN((drm), (x), "%s",                                      \
646                  "drm_WARN_ON(" __stringify(x)    646                  "drm_WARN_ON(" __stringify(x) ")")
647                                                   647 
648 #define drm_WARN_ON_ONCE(drm, x)                  648 #define drm_WARN_ON_ONCE(drm, x)                                        \
649         drm_WARN_ONCE((drm), (x), "%s",           649         drm_WARN_ONCE((drm), (x), "%s",                                 \
650                       "drm_WARN_ON_ONCE(" __st    650                       "drm_WARN_ON_ONCE(" __stringify(x) ")")
651                                                   651 
652 #endif /* DRM_PRINT_H_ */                         652 #endif /* DRM_PRINT_H_ */
653                                                   653 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php