[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YhlLrujgN2Ovv5JW@ravnborg.org>
Date: Fri, 25 Feb 2022 22:35:42 +0100
From: Sam Ravnborg <sam@...nborg.org>
To: Rob Clark <robdclark@...il.com>
Cc: Ville Syrjälä
<ville.syrjala@...ux.intel.com>,
Rob Clark <robdclark@...omium.org>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
David Airlie <airlied@...ux.ie>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
freedreno <freedreno@...ts.freedesktop.org>
Subject: Re: [Freedreno] [PATCH 1/3] drm: Extend DEFINE_DRM_GEM_FOPS() for
optional fops
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
Powered by blists - more mailing lists