Re: [PATCH 3/9] drm/i915: Wrap drm_gem_object_lookup in i915_gem_object_lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 20, 2016 at 02:38:19PM +0300, Joonas Lahtinen wrote:
> On ke, 2016-07-20 at 09:59 +0100, Chris Wilson wrote:
> > For symmetry with a forthcoming i915_gem_object_get() and
> > i915_gem_object_pu().
> > 
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h        | 20 +++++++++++-
> >  drivers/gpu/drm/i915/i915_gem.c        | 58 +++++++++++++++++-----------------
> >  drivers/gpu/drm/i915/i915_gem_tiling.c |  8 ++---
> >  drivers/gpu/drm/i915/intel_display.c   |  4 +--
> >  drivers/gpu/drm/i915/intel_overlay.c   |  5 ++-
> >  5 files changed, 56 insertions(+), 39 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 2131e7f1e57a..47f244f9c64e 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2286,7 +2286,25 @@ struct drm_i915_gem_object {
> >  		} userptr;
> >  	};
> >  };
> > -#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
> > +
> > +static inline struct drm_i915_gem_object *
> > +to_intel_bo(struct drm_gem_object *gem)
> > +{
> > +	/* Assert that to_intel_bo(NULL) == NULL */
> > +	BUILD_BUG_ON(offsetof(struct drm_i915_gem_object, base));
> > +
> > +	return container_of(gem, struct drm_i915_gem_object, base);
> > +}
> > +
> > +static inline struct drm_i915_gem_object *
> > +i915_gem_object_lookup(struct drm_file *file, u32 handle)
> > +{
> > +	return to_intel_bo(drm_gem_object_lookup(file, handle));
> > +}
> > +
> > +__deprecated
> > +extern struct drm_gem_object *
> 
> _deprecated seems to be placed just before the function name elsewhere,
> for easier spotting, I guess. So lets stick to it.

I was trying to make this look exactly like the extern it was
deprecating, so I settled on putting it on the line before. I wanted it
tight against the previous function, so that I had

static inline
new_function()
{
)
__deprecates
extern old_function()

But it is not the verb and checkpatch moans about the lack of newline.
 
> Also I'm little wary about doing this deprecate another function when
> we introduce a new one, especially header level, but I guess there is
> no scenario when somebody would like to include i915_drv.h and use
> drm_gem_object_lookup...

Exactly. That would be bad and needs to be caught.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux