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 C4C94C433F5 for ; Fri, 25 Feb 2022 20:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236626AbiBYUhS (ORCPT ); Fri, 25 Feb 2022 15:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbiBYUhS (ORCPT ); Fri, 25 Feb 2022 15:37:18 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF92D203BFE; Fri, 25 Feb 2022 12:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645821405; x=1677357405; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=Um3Ri3Z5tNczvjbg/Kqd4t82aFPTJQvoXqKHvporKMY=; b=STw3OsbvzxKtGZBf1w7CWCu1ztwIvRrQk9Qb9578FlyQzWF2Da1HA2Fl 7/1ZRyfNlopZyUQ9AnGeZfuOCHR3Q6MxaSC4wUej2pcyRj/KHCr0rgVH2 6APviUzWsRST/HGQYbR9qheijiInUq12aCm8kSyNL8IHHoaLxd7iJTZfd hH1NSnLma6+dkrG4VhIlrAHdoCtrdg5hvEbZWbqseABqxr+z7B0nLO3dt txmVPpWDBk0KZo99fXkCJZTZd3gngNEfMCDAaZ4nTpemJY9FzJAHipjfL kJA7qUEdak65tGykaeRt/SEWSvWy6DmRV5Tspr6XVWaNf0lLqnBJRW42Z w==; X-IronPort-AV: E=McAfee;i="6200,9189,10269"; a="252771373" X-IronPort-AV: E=Sophos;i="5.90,137,1643702400"; d="scan'208";a="252771373" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 12:36:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,137,1643702400"; d="scan'208";a="638353417" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by fmsmga002.fm.intel.com with SMTP; 25 Feb 2022 12:36:41 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 25 Feb 2022 22:36:41 +0200 Date: Fri, 25 Feb 2022 22:36:41 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , Tvrtko Ursulin , David Airlie , linux-arm-msm@vger.kernel.org, open list , Thomas Zimmermann , freedreno@lists.freedesktop.org Subject: Re: [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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220225202614.225197-1-robdclark@gmail.com> X-Patchwork-Hint: comment Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, Feb 25, 2022 at 12:26:12PM -0800, Rob Clark wrote: > From: Rob Clark > > Extend the helper macro so we don't have to throw it away if driver adds > support for optional fops, like show_fdinfo(). > > Signed-off-by: Rob Clark > --- > include/drm/drm_gem.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > 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, }; > > void drm_gem_object_release(struct drm_gem_object *obj); > -- > 2.35.1 -- Ville Syrjälä Intel