From: Daniel Vetter <daniel@ffwll.ch>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: "Daniel Vetter" <daniel@ffwll.ch>,
"David Airlie" <airlied@linux.ie>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <maxime.ripard@bootlin.com>,
"Sean Paul" <sean@poorly.run>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Rob Clark" <robdclark@gmail.com>,
"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
"Eric Anholt" <eric@anholt.net>
Subject: Re: [PATCH v1 3/7] drm: move drm_can_sleep() to drm_util.h
Date: Thu, 27 Dec 2018 13:14:41 +0100 [thread overview]
Message-ID: <20181227121441.GF9058@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <20181226210353.13993-3-sam@ravnborg.org>
On Wed, Dec 26, 2018 at 10:03:49PM +0100, Sam Ravnborg wrote:
> 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.
>
> 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>
> ---
> drivers/gpu/drm/amd/amdgpu/atom.c | 2 ++
> drivers/gpu/drm/ast/ast_fb.c | 1 +
> drivers/gpu/drm/cirrus/cirrus_fbdev.c | 1 +
> drivers/gpu/drm/drm_flip_work.c | 1 +
> drivers/gpu/drm/mgag200/mgag200_fb.c | 1 +
> drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 1 +
> drivers/gpu/drm/omapdrm/omap_fbdev.c | 1 +
> drivers/gpu/drm/qxl/qxl_cmd.c | 2 ++
> drivers/gpu/drm/radeon/atom.c | 2 ++
> drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 1 +
> drivers/gpu/drm/vc4/vc4_drv.h | 1 +
> include/drm/drmP.h | 8 --------
> include/drm/drm_util.h | 13 +++++++++++++
> 13 files changed, 27 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
> index e9934de1b9cf..dd30f4e61a8c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c
> @@ -27,6 +27,8 @@
> #include <linux/slab.h>
> #include <asm/unaligned.h>
>
> +#include <drm/drm_util.h>
> +
> #define ATOM_DEBUG
>
> #include "atom.h"
> diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
> index de26df0c6044..fb56fe848e81 100644
> --- a/drivers/gpu/drm/ast/ast_fb.c
> +++ b/drivers/gpu/drm/ast/ast_fb.c
> @@ -38,6 +38,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_crtc.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_fb_helper.h>
> #include <drm/drm_crtc_helper.h>
> #include "ast_drv.h"
> diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> index 68ab1821e15b..1544fa55d1ff 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
> @@ -10,6 +10,7 @@
> */
> #include <linux/module.h>
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_fb_helper.h>
> #include <drm/drm_crtc_helper.h>
>
> diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
> index 12dea16f22a8..3da3bf5af405 100644
> --- a/drivers/gpu/drm/drm_flip_work.c
> +++ b/drivers/gpu/drm/drm_flip_work.c
> @@ -22,6 +22,7 @@
> */
>
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_flip_work.h>
>
> /**
> diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
> index 30726c9fe28c..6893934b26c0 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_fb.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
> @@ -12,6 +12,7 @@
> */
> #include <linux/module.h>
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_fb_helper.h>
> #include <drm/drm_crtc_helper.h>
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> index 96c2b828dba4..fa2d1d8995ee 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> @@ -16,6 +16,7 @@
> * this program. If not, see <http://www.gnu.org/licenses/>.
> */
>
> +#include <drm/drm_util.h>
>
> #include "mdp5_kms.h"
> #include "mdp5_smp.h"
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index aee99194499f..851c59f07eb1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -16,6 +16,7 @@
> */
>
> #include <drm/drm_crtc.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_fb_helper.h>
>
> #include "omap_drv.h"
> diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
> index 208af9f37914..d17676824377 100644
> --- a/drivers/gpu/drm/qxl/qxl_cmd.c
> +++ b/drivers/gpu/drm/qxl/qxl_cmd.c
> @@ -25,6 +25,8 @@
>
> /* QXL cmd/ring handling */
>
> +#include <drm/drm_util.h>
> +
> #include "qxl_drv.h"
> #include "qxl_object.h"
>
> diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
> index e55cbeee7a53..ac98ad561870 100644
> --- a/drivers/gpu/drm/radeon/atom.c
> +++ b/drivers/gpu/drm/radeon/atom.c
> @@ -27,6 +27,8 @@
> #include <linux/slab.h>
> #include <asm/unaligned.h>
>
> +#include <drm/drm_util.h>
> +
> #define ATOM_DEBUG
>
> #include "atom.h"
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> index 222a1fa41d7c..7e3257e8fd56 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> @@ -24,6 +24,7 @@
> * Alex Deucher
> */
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_crtc_helper.h>
> #include <drm/radeon_drm.h>
> #include "radeon.h"
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index bd6ef1f31822..79c6bcc4f509 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -9,6 +9,7 @@
> #include <linux/mm_types.h>
> #include <linux/reservation.h>
> #include <drm/drmP.h>
> +#include <drm/drm_util.h>
> #include <drm/drm_encoder.h>
> #include <drm/drm_gem_cma_helper.h>
> #include <drm/drm_atomic.h>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2ba786820052..a77c9ee43b68 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -95,12 +95,4 @@ struct dma_buf_attachment;
> struct pci_dev;
> 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;
> -}
> -
> #endif
> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 88abdca89baa..e3200980d3f3 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -26,7 +26,20 @@
> #ifndef _DRM_UTIL_H_
> #define _DRM_UTIL_H_
>
> +#include <linux/irqflags.h>
> +#include <linux/preempt.h>
> +#include <linux/kgdb.h>
> +#include <linux/smp.h>
> +
> /* helper for handling conditionals in various for_each macros */
> #define for_each_if(condition) if (!(condition)) {} else
>
> +/* returns true if currently okay to sleep */
Kerneldoc would be nice for this, specifically a huge warning that this
shouldn't be used (it doesn't work everywhere) and a FIXME that all users
should be removed. We might even want to include this as a todo item in
gpu/todo.rst
-Daniel
> +static inline bool drm_can_sleep(void)
> +{
> + if (in_atomic() || in_dbg_master() || irqs_disabled())
> + return false;
> + return true;
> +}
> +
> #endif
> --
> 2.12.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2018-12-27 12:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 21:02 [PATCH v1 0/7] drm: minimize drmP.h dependencies Sam Ravnborg
2018-12-26 21:03 ` [PATCH v1 1/7] drm: move DRM_IF_VERSION to drm_internal.h Sam Ravnborg
2018-12-27 12:09 ` Daniel Vetter
2018-12-26 21:03 ` [PATCH v1 2/7] drm: move DRM_SWITCH_POWER defines to drm_device.h Sam Ravnborg
2018-12-27 12:12 ` Daniel Vetter
2018-12-27 22:17 ` Sam Ravnborg
2018-12-26 21:03 ` [PATCH v1 3/7] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
2018-12-27 12:14 ` Daniel Vetter [this message]
2018-12-26 21:03 ` [PATCH v1 4/7] drm: remove include of drmP.h from bridge/dw_hdmi.h Sam Ravnborg
2018-12-27 10:02 ` Laurent Pinchart
2018-12-26 21:03 ` [PATCH v1 5/7] drm: remove include of drmP.h from drm_encoder_slave.h Sam Ravnborg
2018-12-26 21:03 ` [PATCH v1 6/7] drm: remove include of drmP.h from drm_modeset_helper.h Sam Ravnborg
2018-12-27 10:04 ` Laurent Pinchart
2018-12-26 21:03 ` [PATCH v1 7/7] drm: remove include of drmP.h from drm_gem_cma_helper.h Sam Ravnborg
2018-12-27 16:28 ` David Lechner
2018-12-27 22:22 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181227121441.GF9058@dvetter-linux.ger.corp.intel.com \
--to=daniel@ffwll.ch \
--cc=David1.Zhou@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=robdclark@gmail.com \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--cc=tomi.valkeinen@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox