mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
drm: move drm_can_sleep() to drm_util.h
Move drm_can_sleep() out of drmP.h to allow users to get rid of the drmP.h include. There was no header file that was a good match for this helper function. So add this to drm_util with the relevant includes. Add include of drm_util.h to all users. v2: - Update comments to use kernel-doc style (Daniel) - Add FIXME to drm_can_sleep and add note that this function should not be used in new code (Daniel) v3: - Fix kernel-doc syntax (Daniel) - Plug drm_util.h into drm-internels.rst (Daniel) Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Sean Paul <sean@poorly.run> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: "David (ChunMing) Zhou" <David1.Zhou@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20190112193251.20450-2-sam@ravnborg.org
This commit is contained in:
parent
f5d5ef72cf
commit
e9eafcb589
@ -233,6 +233,15 @@ Printer
|
|||||||
.. kernel-doc:: drivers/gpu/drm/drm_print.c
|
.. kernel-doc:: drivers/gpu/drm/drm_print.c
|
||||||
:export:
|
:export:
|
||||||
|
|
||||||
|
Utilities
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. kernel-doc:: include/drm/drm_util.h
|
||||||
|
:doc: drm utils
|
||||||
|
|
||||||
|
.. kernel-doc:: include/drm/drm_util.h
|
||||||
|
:internal:
|
||||||
|
|
||||||
|
|
||||||
Legacy Support Code
|
Legacy Support Code
|
||||||
===================
|
===================
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
|
#include <drm/drm_util.h>
|
||||||
|
|
||||||
#define ATOM_DEBUG
|
#define ATOM_DEBUG
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
@ -39,7 +39,9 @@
|
|||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
#include <drm/drm_crtc.h>
|
#include <drm/drm_crtc.h>
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
|
|
||||||
#include "ast_drv.h"
|
#include "ast_drv.h"
|
||||||
|
|
||||||
static void ast_dirty_update(struct ast_fbdev *afbdev,
|
static void ast_dirty_update(struct ast_fbdev *afbdev,
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_flip_work.h>
|
#include <drm/drm_flip_work.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <drm/drm_util.h>
|
||||||
|
|
||||||
#include "mdp5_kms.h"
|
#include "mdp5_kms.h"
|
||||||
#include "mdp5_smp.h"
|
#include "mdp5_smp.h"
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <drm/drm_crtc.h>
|
#include <drm/drm_crtc.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
|
|
||||||
#include "omap_drv.h"
|
#include "omap_drv.h"
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
/* QXL cmd/ring handling */
|
/* QXL cmd/ring handling */
|
||||||
|
|
||||||
|
#include <drm/drm_util.h>
|
||||||
|
|
||||||
#include "qxl_drv.h"
|
#include "qxl_drv.h"
|
||||||
#include "qxl_object.h"
|
#include "qxl_object.h"
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/unaligned.h>
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
|
#include <drm/drm_util.h>
|
||||||
|
|
||||||
#define ATOM_DEBUG
|
#define ATOM_DEBUG
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* Alex Deucher
|
* Alex Deucher
|
||||||
*/
|
*/
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
#include <drm/radeon_drm.h>
|
#include <drm/radeon_drm.h>
|
||||||
#include "radeon.h"
|
#include "radeon.h"
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <linux/mm_types.h>
|
#include <linux/mm_types.h>
|
||||||
#include <linux/reservation.h>
|
#include <linux/reservation.h>
|
||||||
#include <drm/drmP.h>
|
#include <drm/drmP.h>
|
||||||
|
#include <drm/drm_util.h>
|
||||||
#include <drm/drm_encoder.h>
|
#include <drm/drm_encoder.h>
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_atomic.h>
|
#include <drm/drm_atomic.h>
|
||||||
|
@ -94,14 +94,6 @@ struct dma_buf_attachment;
|
|||||||
struct pci_dev;
|
struct pci_dev;
|
||||||
struct pci_controller;
|
struct pci_controller;
|
||||||
|
|
||||||
/* returns true if currently okay to sleep */
|
|
||||||
static inline bool drm_can_sleep(void)
|
|
||||||
{
|
|
||||||
if (in_atomic() || in_dbg_master() || irqs_disabled())
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
|
#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
|
||||||
#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
|
#define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
|
||||||
#else
|
#else
|
||||||
|
@ -26,7 +26,48 @@
|
|||||||
#ifndef _DRM_UTIL_H_
|
#ifndef _DRM_UTIL_H_
|
||||||
#define _DRM_UTIL_H_
|
#define _DRM_UTIL_H_
|
||||||
|
|
||||||
/* helper for handling conditionals in various for_each macros */
|
/**
|
||||||
|
* DOC: drm utils
|
||||||
|
*
|
||||||
|
* Macros and inline functions that does not naturally belong in other places
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/irqflags.h>
|
||||||
|
#include <linux/preempt.h>
|
||||||
|
#include <linux/kgdb.h>
|
||||||
|
#include <linux/smp.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for_each_if - helper for handling conditionals in various for_each macros
|
||||||
|
* @condition: The condition to check
|
||||||
|
*
|
||||||
|
* Typical use::
|
||||||
|
*
|
||||||
|
* #define for_each_foo_bar(x, y) \'
|
||||||
|
* list_for_each_entry(x, y->list, head) \'
|
||||||
|
* for_each_if(x->something == SOMETHING)
|
||||||
|
*
|
||||||
|
* The for_each_if() macro makes the use of for_each_foo_bar() less error
|
||||||
|
* prone.
|
||||||
|
*/
|
||||||
#define for_each_if(condition) if (!(condition)) {} else
|
#define for_each_if(condition) if (!(condition)) {} else
|
||||||
|
|
||||||
|
/**
|
||||||
|
* drm_can_sleep - returns true if currently okay to sleep
|
||||||
|
*
|
||||||
|
* This function shall not be used in new code.
|
||||||
|
* The check for running in atomic context may not work - see linux/preempt.h.
|
||||||
|
*
|
||||||
|
* FIXME: All users of drm_can_sleep should be removed (see todo.rst)
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* True if kgdb is active or we are in an atomic context or irqs are disabled
|
||||||
|
*/
|
||||||
|
static inline bool drm_can_sleep(void)
|
||||||
|
{
|
||||||
|
if (in_atomic() || in_dbg_master() || irqs_disabled())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user