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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05B63C433EF for ; Fri, 25 Feb 2022 21:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234087AbiBYVgY (ORCPT ); Fri, 25 Feb 2022 16:36:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbiBYVgX (ORCPT ); Fri, 25 Feb 2022 16:36:23 -0500 Received: from mx1.smtp.larsendata.com (mx1.smtp.larsendata.com [91.221.196.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC9C81BE0C5 for ; Fri, 25 Feb 2022 13:35:49 -0800 (PST) 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 Cc: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Rob Clark , Tvrtko Ursulin , David Airlie , linux-arm-msm , open list , dri-devel , Thomas Zimmermann , freedreno 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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