Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3248484imu; Fri, 18 Jan 2019 07:17:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN6xKjSbcicqG4ymmB8cktmrW/jro7UBQqm8IVL6dSSF7opX4vf/S3ffMuMhfBwYIzN7xSOQ X-Received: by 2002:a62:1992:: with SMTP id 140mr19775202pfz.33.1547824629659; Fri, 18 Jan 2019 07:17:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547824629; cv=none; d=google.com; s=arc-20160816; b=w6+DWU7EsZoOrS680i9m0vjtCXybpa3KRK53BI+/+wOcOEQgr8rpAg0smuTL0hF7/0 0XvgVhNZ8mVd3Y9zd8tsBhfo4Iwg6dNLyHN6RTAP6bRyybyf1JxV8j6GvwjiD1Thk/u3 RdaGX+NvBCB5c0O8VnG0hDrW2IA5AqBca4nuwEHW0ORNanpDFDYvZ0hP1aqDe/fWuZle /jffbdPBapwvu64RcbBQ8WupQkegIOnx+hP61MqZim6lZBsqX9oLyCpJalPerLxN+5Rv TcUm4iizMJPdIdfwNuxGpZ+kD30gtms7CXMrlNiW5JH39UKPfq6F2vFjC34Hi6SN8Q0g SKTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=P9rdUioupS7RJU7m3EPO9GTOzOrfjMscb/5+IAWyk1k=; b=jqoh2aXcW7uIO7DeolNzvkg9JurgeXsAIVVcgORgOFdx5yHZIFUUAswvQ97Td49xiK dPi1bIOZTWKNz922q24QaedqmxuVKu4fqMskeAQ70X1lG8V1/dz+4YgkvRtkIePD878U tbxLchSIxJwZb0gJcRnm4MnshKFfpiuShTEJ3KxhXf+oP7b/EgZwGz3YBcoTJibZq937 2F7mgDxyULdTU+qPST847e7SbjnA+moHG8zI5NsWiIcuVDYZpBMj83FfWgEnwA4tBc8d OnAWqesP0Z7z0B/2KOQciVb/s/xeLTB2j4otnFwyfaWM4p0sNWhnXlMPvbsiMa1GRP8q BdFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=gxloH0iE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f35si4935367pgf.449.2019.01.18.07.16.51; Fri, 18 Jan 2019 07:17:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=gxloH0iE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbfARPPi (ORCPT + 99 others); Fri, 18 Jan 2019 10:15:38 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:52896 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727460AbfARPPh (ORCPT ); Fri, 18 Jan 2019 10:15:37 -0500 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B805B53E; Fri, 18 Jan 2019 16:15:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547824533; bh=C0W348bHwbiqEUMJ82+wbFBJahb50TTSfJ1Ql9D1Wd4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gxloH0iEQpA+LoY3WqiCqu6Jd/xYQRCpuDVoI4PWzEWg6a17mbpZEniadjqNH4E93 AQVWoeMBcazK9ywLIfzjBoBBR3bmeFmn1AAy8CnERwUsVz4LKadIWyAA9i3C+dTTbK cXU0K6cWnjJzRoN0hf4lnXDMFwLyH4KysIKC2VeQ= Date: Fri, 18 Jan 2019 17:15:33 +0200 From: Laurent Pinchart To: Sam Ravnborg Cc: Alex Deucher , Alexey Brodkin , Andrzej Hajda , Benjamin Gaignard , Chen Feng , Christian Konig , Daniel Vetter , David Airlie , David Zhou , Eric Anholt , Gerd Hoffmann , Kieran Bingham , Maarten Lankhorst , Maxime Ripard , Philippe Cornu , Rob Clark , Rongrong Zou , Sean Paul , Tomi Valkeinen , Vincent Abriou , Xinliang Liu , Xinwei Kong , Yannick Fertre , 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 Message-ID: <20190118151533.GD5275@pendragon.ideasonboard.com> References: <20190112193251.20450-1-sam@ravnborg.org> <20190112193251.20450-2-sam@ravnborg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190112193251.20450-2-sam@ravnborg.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Sean Paul > Cc: David Airlie > Cc: Daniel Vetter > Cc: Alex Deucher > Cc: "Christian König" > Cc: "David (ChunMing) Zhou" > Cc: Gerd Hoffmann > Cc: Rob Clark > Cc: Tomi Valkeinen > Cc: Eric Anholt > --- > 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 > +#include > #include 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 > +#include > +#include > +#include 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 > + */ > +static inline bool drm_can_sleep(void) > +{ > + if (in_atomic() || in_dbg_master() || irqs_disabled()) > + return false; > + return true; > +} > + > #endif -- Regards, Laurent Pinchart