From mboxrd@z Thu Jan 1 00:00:00 1970 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 C1721C433F5 for ; Fri, 25 Feb 2022 21:35:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E059F10EA3E; Fri, 25 Feb 2022 21:35:51 +0000 (UTC) Received: from mx1.smtp.larsendata.com (mx1.smtp.larsendata.com [91.221.196.215]) by gabe.freedesktop.org (Postfix) with ESMTPS id A94A510EA07 for ; Fri, 25 Feb 2022 21:35:49 +0000 (UTC) Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx1.smtp.larsendata.com (Halon) with ESMTPS id e5c00027-9682-11ec-9faa-0050568c148b; Fri, 25 Feb 2022 21:35:48 +0000 (UTC) Received: from ravnborg.org (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 90DCF194B1C; Fri, 25 Feb 2022 22:35:50 +0100 (CET) Date: Fri, 25 Feb 2022 22:35:42 +0100 X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: Rob Clark Subject: Re: [Freedreno] [PATCH 1/3] drm: Extend DEFINE_DRM_GEM_FOPS() for optional fops Message-ID: References: <20220225202614.225197-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: , Cc: Rob Clark , Tvrtko Ursulin , David Airlie , linux-arm-msm , open list , dri-devel , Thomas Zimmermann , freedreno Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Rob, > > > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h > > > index 35e7f44c2a75..987e78b18244 100644 > > > --- a/include/drm/drm_gem.h > > > +++ b/include/drm/drm_gem.h > > > @@ -327,7 +327,7 @@ struct drm_gem_object { > > > * non-static version of this you're probably doing it wrong and will break the > > > * THIS_MODULE reference by accident. > > > */ > > > -#define DEFINE_DRM_GEM_FOPS(name) \ > > > +#define DEFINE_DRM_GEM_FOPS(name, ...) \ > > > static const struct file_operations name = {\ > > > .owner = THIS_MODULE,\ > > > .open = drm_open,\ > > > @@ -338,6 +338,7 @@ struct drm_gem_object { > > > .read = drm_read,\ > > > .llseek = noop_llseek,\ > > > .mmap = drm_gem_mmap,\ > > > + ##__VA_ARGS__\ > > > } > > > > Would it not be less convoluted to make the macro only provide > > the initializers? So you'd get something like: > > > > static const struct file_operations foo = { > > DRM_GEM_FOPS, > > .my_stuff = whatever, > > }; > > > > Hmm, I like my color of the bikeshed, but I guess it is a matter of opinion ;-) Or less surprise. Most similar macros provides initializers only. Try "git grep DRM_.*OPS | grep define" in include/drm and take a look at the hits. Sam