From patchwork Wed Jan 22 14:41:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13947391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECECFC0218C for ; Wed, 22 Jan 2025 14:41:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 66F2010E716; Wed, 22 Jan 2025 14:41:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="WQ88OaMt"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57BBC10E704; Wed, 22 Jan 2025 14:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737556906; x=1769092906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rWYl9o5mm8UNIWhQMZc2/vOLUXsBfEDE9VfAJiUlIQk=; b=WQ88OaMtrlMYvU7WEmw6su0i++ICrjjX+Ivae1QBnSSIWmtO3kehefnc 2NDbGkww1gER2jlZsc4x/rHxbk5bCT5x5wctntJJ8rhm5kO+iEdeoGFD5 GIcuQl+38mf7PEyhb4g3Tr5ej74jEcG9DQBzM881XbwmAPcXTgjM9C8CE /p9guCT5kFzE3LAuv1igOm+b/C14QgF0vIv80buC6u+GQA85/qREzXwhn oXeMhyNTnJPe9AwoyfzohUP7gKMUvfrm7fN0XScNOh/IR+/aslOzBNkBQ wqkx+tqvkJp2i1jpbtHdQDr/J/ZHqn/bdTZVIsLp2UmiK90BKkuS50jLH Q==; X-CSE-ConnectionGUID: xWFNS0aaQ9WCrtKROn15bQ== X-CSE-MsgGUID: vri/Ykt8Qw6CRjtlMu6FqA== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="60484654" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="60484654" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 06:41:46 -0800 X-CSE-ConnectionGUID: i420t5HoTNmI41giacccsA== X-CSE-MsgGUID: 9M8kAXPsTJ+pBV3HvudNdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="107087720" Received: from lfiedoro-mobl.ger.corp.intel.com (HELO localhost) ([10.245.246.30]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 06:41:44 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, simona.vetter@ffwll.ch, jani.nikula@intel.com, Thomas Zimmermann Subject: [PATCH 1/2] drm/client: include types.h to make drm_client_event.h self-contained Date: Wed, 22 Jan 2025 16:41:33 +0200 Message-Id: <6c69cb005cc3a2b968b6c9675d0ba03173f6c574.1737556766.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_client_event.h uses bool without types.h, include it. Fixes: bf17766f1083 ("drm/client: Move suspend/resume into DRM client callbacks") Cc: Thomas Zimmermann Signed-off-by: Jani Nikula --- include/drm/drm_client_event.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/drm/drm_client_event.h b/include/drm/drm_client_event.h index 99863554b055..1d544d3a3228 100644 --- a/include/drm/drm_client_event.h +++ b/include/drm/drm_client_event.h @@ -3,6 +3,8 @@ #ifndef _DRM_CLIENT_EVENT_H_ #define _DRM_CLIENT_EVENT_H_ +#include + struct drm_device; #if defined(CONFIG_DRM_CLIENT) From patchwork Wed Jan 22 14:41:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13947392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92599C0218C for ; Wed, 22 Jan 2025 14:41:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BBB710E704; Wed, 22 Jan 2025 14:41:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="KSAU5Z5u"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5FF7A10E6FD; Wed, 22 Jan 2025 14:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737556913; x=1769092913; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0iar7pUFEZgeKylxKvolv6U3bmWrB9z8DhfqoUMpX14=; b=KSAU5Z5u73J+hXleQsdYRig0hbmulWQ89xdYp0p0D7fIT/G4hVYRWeqh g4uDqmFUBnZVuHvyTzpKArTWcNDEsBr+uXqmKEByss/JcLNYpspT+kJz3 q2OOheoW/yJ2uU3+IP09oCrYWnHj4dz8FFLlZc0L7/MxDDeIC2zhvqBEE z9dQOT0eZvTh5fYej6uryI9H5I1dg8nFpirkBbfucBvbfqyTlpRxgoZWt DCZxt2Sj5W3J9SYJcjDo+Xg3o65oVYZJkMoqEebn96WauXP581oW/FPgX GFcyQcG7NB05P9JJS5XmDrjcUHOTf1hEGDNNfEd68Xy1KOEnswMuPCdnE g==; X-CSE-ConnectionGUID: rdqsj3krQIm7RpM/LSsqmg== X-CSE-MsgGUID: j0jjeKx9TKq/eWTrGDXYwA== X-IronPort-AV: E=McAfee;i="6700,10204,11323"; a="60484665" X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="60484665" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 06:41:53 -0800 X-CSE-ConnectionGUID: LmQM6WqZRPKHw6eI//MxMg== X-CSE-MsgGUID: k6m4AZAOSAajoMR956q0sA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,225,1732608000"; d="scan'208";a="107087753" Received: from lfiedoro-mobl.ger.corp.intel.com (HELO localhost) ([10.245.246.30]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2025 06:41:49 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, simona.vetter@ffwll.ch, jani.nikula@intel.com, Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Masahiro Yamada Subject: [PATCH 2/2] drm: ensure drm headers are self-contained and pass kernel-doc Date: Wed, 22 Jan 2025 16:41:34 +0200 Message-Id: X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Ensure drm headers build, are self-contained, have header guards, and have no kernel-doc warnings, when CONFIG_DRM_HEADER_TEST=y. The mechanism follows similar patters used in i915, xe, and usr/include. To cover include/drm, we need to recurse there using the top level Kbuild and the new include/Kbuild files. v4: check for CONFIG_WERROR in addition to CONFIG_DRM_WERROR v3: adapt to upstream build changes v2: make DRM_HEADER_TEST depend on DRM Suggested-by: Daniel Vetter Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Masahiro Yamada Acked-by: Thomas Zimmermann Signed-off-by: Jani Nikula --- Kbuild | 1 + drivers/gpu/drm/Kconfig | 11 +++++++++++ drivers/gpu/drm/Makefile | 18 ++++++++++++++++++ include/Kbuild | 1 + include/drm/Makefile | 18 ++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 include/Kbuild create mode 100644 include/drm/Makefile diff --git a/Kbuild b/Kbuild index 464b34a08f51..f327ca86990c 100644 --- a/Kbuild +++ b/Kbuild @@ -97,3 +97,4 @@ obj-$(CONFIG_SAMPLES) += samples/ obj-$(CONFIG_NET) += net/ obj-y += virt/ obj-y += $(ARCH_DRIVERS) +obj-$(CONFIG_DRM_HEADER_TEST) += include/ diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index fbef3f471bd0..f9b3ebf63fa9 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -494,6 +494,17 @@ config DRM_WERROR If in doubt, say N. +config DRM_HEADER_TEST + bool "Ensure DRM headers are self-contained and pass kernel-doc" + depends on DRM && EXPERT + default n + help + Ensure the DRM subsystem headers both under drivers/gpu/drm and + include/drm compile, are self-contained, have header guards, and have + no kernel-doc warnings. + + If in doubt, say N. + endif # Separate option because drm_panel_orientation_quirks.c is shared with fbdev diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 85af94bb907d..42901f877bf2 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -222,3 +222,21 @@ obj-y += solomon/ obj-$(CONFIG_DRM_SPRD) += sprd/ obj-$(CONFIG_DRM_LOONGSON) += loongson/ obj-$(CONFIG_DRM_POWERVR) += imagination/ + +# Ensure drm headers are self-contained and pass kernel-doc +hdrtest-files := \ + $(shell cd $(src) && find . -maxdepth 1 -name 'drm_*.h') \ + $(shell cd $(src) && find display lib -name '*.h') + +always-$(CONFIG_DRM_HEADER_TEST) += \ + $(patsubst %.h,%.hdrtest, $(hdrtest-files)) + +# Include the header twice to detect missing include guard. +quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) + cmd_hdrtest = \ + $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ + $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ + touch $@ + +$(obj)/%.hdrtest: $(src)/%.h FORCE + $(call if_changed_dep,hdrtest) diff --git a/include/Kbuild b/include/Kbuild new file mode 100644 index 000000000000..5e76a599e2dd --- /dev/null +++ b/include/Kbuild @@ -0,0 +1 @@ +obj-$(CONFIG_DRM_HEADER_TEST) += drm/ diff --git a/include/drm/Makefile b/include/drm/Makefile new file mode 100644 index 000000000000..a7bd15d2803e --- /dev/null +++ b/include/drm/Makefile @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Ensure drm headers are self-contained and pass kernel-doc +hdrtest-files := \ + $(shell cd $(src) && find * -name '*.h' 2>/dev/null) + +always-$(CONFIG_DRM_HEADER_TEST) += \ + $(patsubst %.h,%.hdrtest, $(hdrtest-files)) + +# Include the header twice to detect missing include guard. +quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@) + cmd_hdrtest = \ + $(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \ + $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \ + touch $@ + +$(obj)/%.hdrtest: $(src)/%.h FORCE + $(call if_changed_dep,hdrtest)