Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp240662iob; Mon, 2 May 2022 18:13:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8mPxYWkWgW94rvWsNeBNjVUuv8X7pmf4zm8keXcA8o6AaeNek4VaP9j5X8oKIod6iyLj+ X-Received: by 2002:a65:6b92:0:b0:39c:c97b:1b57 with SMTP id d18-20020a656b92000000b0039cc97b1b57mr12124561pgw.517.1651540394520; Mon, 02 May 2022 18:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540394; cv=none; d=google.com; s=arc-20160816; b=Lgmfybgkp6AJnULC7NEtkLQRj8lcVhWGo6yJ+OSkMhM/ccBZezBPzCsJH4sGfure/g zmn6ycYMKaB1eeTPPc+nGSLso6oqGguszIrSo8Gv7XcKVztjzRc8JkSYw5S/ar452AZG Attkp4JZqlUVtjqUA1wZtNWtMoGReFMaQOjcLOOLok/xVDpw3PTywvG6m5wt43jRy4Cz ZdQvoDofb2349Q+MHqo0MXqOpoL5WhOCeLW7eJB23cJdOdbsSI83VsCtqc9+ji4y0FFT EXxfXh3+vMp1u9E1+hpTk5yLFD3gbZhqe1GMMKCghwbLSBp9Y3dwHYrRHlMvacgQL0U/ VC7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=uXGPYBCJ+2nvaeyWjxxKb3AGBPpaB4j/HZ9aEJoM2vc=; b=gnFYCWTgsmlrnaYXEkOFB/kSpezFGRGKGqChwvOEEBpgtQ+2fQvVWL6+fQbTDFDgek cnBh59RElzOQRhfRW8dCyuQlmZkK4DSq9Ln6WYhDbT6YQRJPqQyFeJxS02pR49m/Nk+i 7kj/hm48gBAlIt3J46w35qnZpCC0QbVT62K1VnChzEn4X/uciyURaHf+0yPp4uyxRz8M O3d/bV0yePpO74w+Y7/DspZvj4jNJjI68POZrKRp3b4Iha44ZHCl6dz/ZY314oBYg7uF XyhBJMqlEoDQ4D7EHugRGL7nQjeOjOuwMcMk+Ue3ucWSCzJOTzDNMCdz4wC0I2v09kFi 2t5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Wrls+B1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h70-20020a638349000000b003c219413b58si4193334pge.598.2022.05.02.18.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Wrls+B1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98D975DD36; Mon, 2 May 2022 17:54:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385966AbiEBPpQ (ORCPT + 99 others); Mon, 2 May 2022 11:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385938AbiEBPpO (ORCPT ); Mon, 2 May 2022 11:45:14 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5D75D6 for ; Mon, 2 May 2022 08:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651506105; x=1683042105; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=9Es5XqFtpVE3LdYUHq79mdDv756yQwrZat3r/qgRHNc=; b=Wrls+B1BczEur3+ydRAQU3ZdMHzLc0KHTZBL0qbI4zxNur7RJMz1EzfF jRouvnsPiUXygcpteYB0mD35BSE/ax7Awg3XbFaJ9cUsYuF8y8pH+AUQm er6PWJNaEMa9s2idw2a1Y7XWU0EL9VzIF73hqd9LOQ7ELMSOZ536AiIu3 jsQ9Nd6o92CHMK96YOpPalcOXhiyJLoCh/erCVqcZlPvaX2T9vSBe6cjJ JILqk6dTR+Wx+9vkoBR4vWa+if4wS1ZBLQ3wXAJPJ+XKGjebImOvFcE8j r0aRJBD7Zn/mQ+q2xM1C6JJHXJslkl+fFt5lwlAOvlW7/LcS3EteXa79F Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10335"; a="247150718" X-IronPort-AV: E=Sophos;i="5.91,192,1647327600"; d="scan'208";a="247150718" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 08:41:45 -0700 X-IronPort-AV: E=Sophos;i="5.91,192,1647327600"; d="scan'208";a="583756662" Received: from wagoleb-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.155.30]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2022 08:41:42 -0700 From: Jani Nikula To: Jeffrey Hugo , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch Cc: Jeffrey Hugo , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm: drm_gem.h: Add explicit includes for DEFINE_DRM_GEM_FOPS In-Reply-To: <1651262112-29664-1-git-send-email-quic_jhugo@quicinc.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1651262112-29664-1-git-send-email-quic_jhugo@quicinc.com> Date: Mon, 02 May 2022 18:41:39 +0300 Message-ID: <87y1zkq6vg.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Apr 2022, Jeffrey Hugo wrote: > DEFINE_DRM_GEM_FOPS() references drm functions from other headers. For > example drm_open() is defined in drm_file.h and drm_ioctl() is defined > in drm_ioctl.h. Since drm_gem.h doesn't include these headers, it > relies on an implicit include from the .c file to have included these > required headers before DEFINE_DRM_GEM_FOPS() gets used. Relying on > these implicit includes can cause build failures for new code that > doesn't know about these requirements, and can lead to future problems > if the headers ever get restructured as there will be a need to update > every downstream file that includes drm_gem.h. > > Lets fix this explicitly including the required headers in drm_gem.h so > that code that includes drm_gem.h does not need to worry about these > implicit dependencies. In the general case, I tend to agree, but in this specific instance I think I'd err on the side of fewer includes. I think the more likely outcome here is accumulating implicit dependencies on symbols from drm_file.h and drm_ioctl.h by including drm_gem.h only! I do think headers need to be self-contained, and we actually enforce this in i915 (see HDRTEST in drivers/gpu/drm/i915/Makefile), but not to the point of macro expansions. BR, Jani. > > Signed-off-by: Jeffrey Hugo > --- > include/drm/drm_gem.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h > index 9d7c61a..1cbe3d8 100644 > --- a/include/drm/drm_gem.h > +++ b/include/drm/drm_gem.h > @@ -37,6 +37,8 @@ > #include > #include > > +#include > +#include > #include > > struct iosys_map; -- Jani Nikula, Intel Open Source Graphics Center