Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2701001iob; Fri, 6 May 2022 08:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/jNw2DOuVe05hCfO0tW7pxHS5AN6UrVF3k6lfyFA+YOZzQ+XEJbhAWpFgsPpa/qGygQ5o X-Received: by 2002:a05:6a00:1411:b0:4fd:e594:fac0 with SMTP id l17-20020a056a00141100b004fde594fac0mr4107436pfu.79.1651851380027; Fri, 06 May 2022 08:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651851380; cv=none; d=google.com; s=arc-20160816; b=x6d1FTLw16s62I2aO67GX9cMbAB12J6sIVhgg2JXYIlDQquyyhiRvqPZEag529AHId Qb2cOJKiUCPtFFdd4zX0XMKaq4YV9QdBVd1bcBsIivFHmJLZCjvvZhC1NbV58xG9+rC5 DPUbDgzqrd0+CRr7BDD69aIx0e53CbWGE0fSgvGLezXwLvEIsIa1CUSE7sAWxTYdqRo9 69WhW7ZS2fb/DCI5mYLCBL5V+kDledh8PJCgj8JriJfYuRWkfqfCAt3lnOY2yUmSfnnX UtyHsmtDpiektRN5xxj6vhF+gMU+1bG/sZkoAvNXWB7vTocXLxpEomQ8ttVPCS8KE/Uq 2xRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=rcxyA3134NCuVr95OWaYMkj8iPMc5rNfiopB8bULWOw=; b=P3DU92ogFdje87Tsu+jdXVBOrvoPE0D4SixrLwKy65v2uL/ldgCO9MD+UcUMiyNjth Ouk6ISP5zxAvTXWBYpCxPSpK/Gb73/RiMxXdVpT2WCewo0igvcUfSi94Sc3AQqMw8Fhz +RmN8C79Jfm3RmJtp+UluR7pDP0H5tm7VVjxzICBzOy4ha6IEN6138iMOM3YxQs0Sk1q dFoDtYZtETDoz5wSiX7aEUQMCS3kPxMPzjbEha1bANX4X5b0NtbZQiJdtW4mCAKW8izY pPLjHlDwJLtQ+dpeGs7xC1zXwjCDlSVFknp8tYmmI87stE/jtTZHVuoyRCM1BAJ4p/EQ w5UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=H1cwutUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a170902cec100b00154c1348e40si2964492plg.497.2022.05.06.08.36.01; Fri, 06 May 2022 08:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=H1cwutUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348632AbiEEIb6 (ORCPT + 99 others); Thu, 5 May 2022 04:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348747AbiEEIb4 (ORCPT ); Thu, 5 May 2022 04:31:56 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 016AD344EF for ; Thu, 5 May 2022 01:28:18 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id l18so7294362ejc.7 for ; Thu, 05 May 2022 01:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=rcxyA3134NCuVr95OWaYMkj8iPMc5rNfiopB8bULWOw=; b=H1cwutUCyWdowQDRRqKBECZ7cUTOSHNa+ipMPT5VMGhPA86WXJuB5lxhlMCbnu6Re8 tEdUZkDoo/WZ3T4mQ46BAEVx9J6ODM730zFY8ahwLrF9ZgI48vQJuq9SDDDZjPsVzTT8 Q1VXEIfaCOTxBGLQofxq6O5fpbN0S929CEFOs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=rcxyA3134NCuVr95OWaYMkj8iPMc5rNfiopB8bULWOw=; b=XEL1Wg8ZBsZfMcePFar+qeT2Ea7Y5QKr8MG2tZ5Vb4WkpQWNVPI+wc7tl3dWvH+Uns XEYZVuOdOgzzICvYkKg4rrim8p9QVoEdZGGXLbA+R32eqEYYS3qsv7lkuIFFZEqTD7SJ ivgaSuEWcngmyWgzBKxk6RdAAkvqRpDXFjPdezTwhLR61oHmYvvR4c1WekeCMX1xhQqd 44DkpZ6cbXtRJBGczTG6LYQkd12W2RKfBKgH55cutenMaIMdMD2MWHTleJN3/edTBUqV wJ6cKVaJlKfE3ltzfLZQ9Lriz0dUZG6rqJ300+ZZJM1h14QG0wfXxxz/5LXcvJY81Ujz jLGA== X-Gm-Message-State: AOAM532MSUv+OfL8f7MJNTrE64MJDkr3EkN33cFoUNdZCMLgmpbTGa+s dODdd0rqiSJA3GKELMAQPsFqTw== X-Received: by 2002:a17:907:72c4:b0:6f4:ad52:b9fd with SMTP id du4-20020a17090772c400b006f4ad52b9fdmr9179057ejc.128.1651739296611; Thu, 05 May 2022 01:28:16 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id y15-20020a170906070f00b006f3ef214e3asm462604ejb.160.2022.05.05.01.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 01:28:15 -0700 (PDT) Date: Thu, 5 May 2022 10:28:14 +0200 From: Daniel Vetter To: Jeffrey Hugo Cc: Jani Nikula , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, 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 Message-ID: Mail-Followup-To: Jeffrey Hugo , Jani Nikula , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <1651262112-29664-1-git-send-email-quic_jhugo@quicinc.com> <87y1zkq6vg.fsf@intel.com> <6dde7bb4-8931-ccdb-2677-930a1c6d6dab@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6dde7bb4-8931-ccdb-2677-930a1c6d6dab@quicinc.com> X-Operating-System: Linux phenom 5.10.0-8-amd64 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Wed, May 04, 2022 at 07:58:38AM -0600, Jeffrey Hugo wrote: > On 5/4/2022 3:38 AM, Daniel Vetter wrote: > > On Mon, May 02, 2022 at 06:41:39PM +0300, Jani Nikula wrote: > > > 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. > > > > Yeah we abuse macros in a bunch of places to untangle header dependencies, > > so then going back and pulling in all the headers back in feels a bit > > silly and defeats the point. > > Fair enough. I'll consider this NAK'd > > I've been pondering alternate solutions, but haven't come up with any. I > guess, for now, the status quo will remain. I think a standalone header for gem fops or so might be an option. We also have some macro iirc for standard stuff in drm_driver (or at least had in the past, maybe that's cleaned up now better). That would allow drivers to include this monster header that pulls in a lot of things in the one place they define their file ops, and nowhere else. I think that would cover everything we'd want to achieve? But would be a bit of churn to roll out everywhere. -Daniel > > > > > iow, I concur. > > -Daniel > > > > > > > > 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 > > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch