linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Alexey Brodkin <abrodkin@synopsys.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Chen Feng <puck.chen@hisilicon.com>,
	Christian Konig <christian.koenig@amd.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	David Zhou <David1.Zhou@amd.com>, Eric Anholt <eric@anholt.net>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Philippe Cornu <philippe.cornu@st.com>,
	Rob Clark <robdclark@gmail.com>,
	Rongrong Zou <zourongrong@gmail.com>, Sean Paul <sean@poorly.run>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Vincent Abriou <vincent.abriou@st.com>,
	Xinliang Liu <z.liuxinliang@hisilicon.com>,
	Xinwei Kong <kong.kongxinwei@hisilicon.com>,
	Yannick Fertre <yannick.fertre@st.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 1/8] drm: move drm_can_sleep() to drm_util.h
Date: Fri, 18 Jan 2019 17:15:33 +0200	[thread overview]
Message-ID: <20190118151533.GD5275@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190112193251.20450-2-sam@ravnborg.org>

Hi Sam,

Thank you for the patch.

On Sat, Jan 12, 2019 at 08:32:44PM +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.
> 
> 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>
> ---
>  Documentation/gpu/drm-internals.rst             |  9 ++++++
>  drivers/gpu/drm/amd/amdgpu/atom.c               |  2 ++
>  drivers/gpu/drm/ast/ast_fb.c                    |  2 ++
>  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                          | 43 ++++++++++++++++++++++++-
>  14 files changed, 66 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/gpu/drm-internals.rst b/Documentation/gpu/drm-internals.rst
> index 9090fabf3f7a..2caf21effd28 100644
> --- a/Documentation/gpu/drm-internals.rst
> +++ b/Documentation/gpu/drm-internals.rst
> @@ -233,6 +233,15 @@ Printer
>  .. kernel-doc:: drivers/gpu/drm/drm_print.c
>     :export:
>  
> +Utilities
> +---------
> +
> +.. kernel-doc:: include/drm/drm_util.h
> +   :doc: drm utils
> +
> +.. kernel-doc:: include/drm/drm_util.h
> +   :internal:

Why do we need it twice ?

> +
>  
>  Legacy Support Code
>  ===================

[snip]

> 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>

Please keep headers alphabetically sorted, here and everywhere else in
this patch. This helps locating and avoiding duplicated headers.

>  #include "omap_drv.h"

[snip]

> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 88abdca89baa..f776a55e5508 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -26,7 +26,48 @@
>  #ifndef _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

s/does/do/

> + */
> +
> +#include <linux/irqflags.h>
> +#include <linux/preempt.h>
> +#include <linux/kgdb.h>
> +#include <linux/smp.h>

Four headers needed to use three functions, impressive :-)

Alphabetical sorted here too please (and actually everywhere in this
patch series :-)).

> +/**
> + * 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
>  
> +/**
> + * 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

Did you mean False ?

With these fixed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + */
> +static inline bool drm_can_sleep(void)
> +{
> +	if (in_atomic() || in_dbg_master() || irqs_disabled())
> +		return false;
> +	return true;
> +}
> +
>  #endif

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-01-18 15:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12 19:32 [PATCH v4 0/8] drm: minimize drmP.h dependencies Sam Ravnborg
2019-01-12 19:32 ` [PATCH v4 1/8] drm: move drm_can_sleep() to drm_util.h Sam Ravnborg
2019-01-18 15:15   ` Laurent Pinchart [this message]
2019-01-12 19:32 ` [PATCH v4 2/8] drm: move EXPORT_SYMBOL_FOR_TESTS_ONLY " Sam Ravnborg
2019-01-18 15:21   ` Laurent Pinchart
2019-01-12 19:32 ` [PATCH v4 3/8] drm/stm: prepare for drmP.h removal from drm_modeset_helper.h Sam Ravnborg
2019-01-14  9:59   ` Benjamin Gaignard
2019-01-12 19:32 ` [PATCH v4 4/8] drm/hisilicon/kirin: " Sam Ravnborg
2019-01-12 19:32 ` [PATCH v4 5/8] drm/arcpgu: " Sam Ravnborg
2019-01-14 13:48   ` Alexey Brodkin
2019-01-12 19:32 ` [PATCH v4 6/8] drm/bridge: cdns: " Sam Ravnborg
2019-01-12 19:32 ` [PATCH v4 7/8] drmi/rcar-du: " Sam Ravnborg
2019-01-18 15:24   ` Laurent Pinchart
2019-01-12 19:32 ` [PATCH v4 8/8] drm: remove drmP.h " Sam Ravnborg
2019-01-14 10:03   ` Daniel Vetter
2019-01-18 15:25   ` Laurent Pinchart

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=20190118151533.GD5275@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=David1.Zhou@amd.com \
    --cc=a.hajda@samsung.com \
    --cc=abrodkin@synopsys.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=philippe.cornu@st.com \
    --cc=puck.chen@hisilicon.com \
    --cc=robdclark@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --cc=tomi.valkeinen@ti.com \
    --cc=vincent.abriou@st.com \
    --cc=yannick.fertre@st.com \
    --cc=z.liuxinliang@hisilicon.com \
    --cc=zourongrong@gmail.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;
as well as URLs for NNTP newsgroup(s).