![]() |
|
|||
0001 /* 0002 * Internal Header for the Direct Rendering Manager 0003 * 0004 * Copyright 2018 Intel Corporation 0005 * 0006 * Permission is hereby granted, free of charge, to any person obtaining a 0007 * copy of this software and associated documentation files (the "Software"), 0008 * to deal in the Software without restriction, including without limitation 0009 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0010 * and/or sell copies of the Software, and to permit persons to whom the 0011 * Software is furnished to do so, subject to the following conditions: 0012 * 0013 * The above copyright notice and this permission notice (including the next 0014 * paragraph) shall be included in all copies or substantial portions of the 0015 * Software. 0016 * 0017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0018 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0020 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 0021 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0022 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0023 * OTHER DEALINGS IN THE SOFTWARE. 0024 */ 0025 0026 #ifndef _DRM_UTIL_H_ 0027 #define _DRM_UTIL_H_ 0028 0029 /** 0030 * DOC: drm utils 0031 * 0032 * Macros and inline functions that does not naturally belong in other places 0033 */ 0034 0035 #include <linux/interrupt.h> 0036 #include <linux/kgdb.h> 0037 #include <linux/preempt.h> 0038 #include <linux/smp.h> 0039 0040 /* 0041 * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall 0042 * only be visible for drmselftests. 0043 */ 0044 #if defined(CONFIG_DRM_EXPORT_FOR_TESTS) 0045 #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x) 0046 #else 0047 #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) 0048 #endif 0049 0050 /** 0051 * for_each_if - helper for handling conditionals in various for_each macros 0052 * @condition: The condition to check 0053 * 0054 * Typical use:: 0055 * 0056 * #define for_each_foo_bar(x, y) \' 0057 * list_for_each_entry(x, y->list, head) \' 0058 * for_each_if(x->something == SOMETHING) 0059 * 0060 * The for_each_if() macro makes the use of for_each_foo_bar() less error 0061 * prone. 0062 */ 0063 #define for_each_if(condition) if (!(condition)) {} else 0064 0065 /** 0066 * drm_can_sleep - returns true if currently okay to sleep 0067 * 0068 * This function shall not be used in new code. 0069 * The check for running in atomic context may not work - see linux/preempt.h. 0070 * 0071 * FIXME: All users of drm_can_sleep should be removed (see todo.rst) 0072 * 0073 * Returns: 0074 * False if kgdb is active, we are in atomic context or irqs are disabled. 0075 */ 0076 static inline bool drm_can_sleep(void) 0077 { 0078 if (in_atomic() || in_dbg_master() || irqs_disabled()) 0079 return false; 0080 return true; 0081 } 0082 0083 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |