Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2010456iob; Thu, 5 May 2022 13:12:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRuPjOWuYhKf0KzrHVorvcFYllVuXIOZi6zu5XGquDwJTs6+1QkPkMKVmo0v0zh4aAZ54p X-Received: by 2002:a17:906:6a29:b0:6f4:3389:9094 with SMTP id qw41-20020a1709066a2900b006f433899094mr24269848ejc.323.1651781545015; Thu, 05 May 2022 13:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651781545; cv=none; d=google.com; s=arc-20160816; b=ysGuMGEAJgnwLsat8z+cn7eh/X73a5ZssU9wYCxyxXdgSIVMK7BAfuKNhFJnzI0Hpc z0A4sM7+kf3hnUEojBkXndXYMWciqfMlOKn01JjmcdaXAn2TyUZj7/KPJ2FQGaCzcbwL 43jNuZZ3vfD6wvD3gd19WKzXd8RACblNZPKYYfEZPdK1Rsr5t7RxtltYjVFTQIYyHhOe i7TnlOenwjmkHS4cxHZcGuQ6sDWpDMI9k4924SrBVq98eUw0yi9C5QPdMd9VI4TOdaWY 0ltyHgbTLOJGx3GvxV9aSVt+8hvK18HNrl69jps0Y5K3QCJqqrJePM33JiyqHuVhCvTe NX4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=11770cKS+9CS+QLXwuNHlJ4PVZqEaAPkwZKE6duj5KU=; b=jesnkAyFrrYgrIqRI7KxOo0rHRjCkoxG1WBkc8uESU0hQuUQlADkDaXJCcCZwvRVWm orX41BjM58gC0DluVdBXBD4wPIPaaFCydgme9JVBLr2yN8SPQoNPCM0ArQSs426f3fKG t0E1wgqsoffXWM+6WZaCN3720yKxTnFHHotuRp0jUEmgkBeokSMBPLuqD5ydAtUhLoTV /x7mivBGmkpLeJaSMZ0uSqaqacmXwl4GchddXVlaLFRFEIKiyKI44RbgQCxs2RGuEypo HQrQhUL1qbFDLOISD6Gvy2NhgyI1WKWrPs572ZsSz30qFovjrK8OEjordldVvTxQgOtK dgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=kn60oK6P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a170906305500b006e0f9bb2596si2986036ejd.925.2022.05.05.13.12.01; Thu, 05 May 2022 13:12:25 -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=@quicinc.com header.s=qcdkim header.b=kn60oK6P; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348243AbiEDOCS (ORCPT + 99 others); Wed, 4 May 2022 10:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237763AbiEDOCQ (ORCPT ); Wed, 4 May 2022 10:02:16 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03890275F3 for ; Wed, 4 May 2022 06:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1651672721; x=1683208721; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=11770cKS+9CS+QLXwuNHlJ4PVZqEaAPkwZKE6duj5KU=; b=kn60oK6Piy9cF8Npdqal5RMc40FvKwDyrhgHzFCeWS7Ka3csaJ2BoK3G PZe5ci1ZX74lacVnRvvV1ncHxkr2mIVrm7MEZ+4EilItW3dZMoQMNS4Zx qbOHW7hh1YdsdONbAj/orNZMM1tRswkFp2oxYdLiE2WBYS/tavjIP1GQu 8=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 04 May 2022 06:58:40 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2022 06:58:40 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 4 May 2022 06:58:40 -0700 Received: from [10.226.59.182] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 4 May 2022 06:58:39 -0700 Message-ID: <6dde7bb4-8931-ccdb-2677-930a1c6d6dab@quicinc.com> Date: Wed, 4 May 2022 07:58:38 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] drm: drm_gem.h: Add explicit includes for DEFINE_DRM_GEM_FOPS Content-Language: en-US To: Jani Nikula , , , , , , References: <1651262112-29664-1-git-send-email-quic_jhugo@quicinc.com> <87y1zkq6vg.fsf@intel.com> From: Jeffrey Hugo In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 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. > > 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 >