All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Peter Antoine <peter.antoine@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Ben Skeggs <bskeggs@redhat.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET
Date: Thu, 14 Apr 2016 12:06:03 +0200	[thread overview]
Message-ID: <20160414100603.GL2510@phenom.ffwll.local> (raw)
In-Reply-To: <CACvgo51TM18dONKfWL3wDH98D9GooMjzkyHsLq8pw0v6nRWdAQ@mail.gmail.com>

On Wed, Mar 30, 2016 at 11:39:01AM +0100, Emil Velikov wrote:
> On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Like in
> >
> > commit 0e975980d435d58df2d430d688b8c18778b42218
> > Author: Peter Antoine <peter.antoine@intel.com>
> > Date:   Tue Jun 23 08:18:49 2015 +0100
> >
> >     drm: Turn off Legacy Context Functions
> >
> > we need to again make an exception for nouveau, but everyone else
> > really doesn't need this.
> >
> > Cc: Peter Antoine <peter.antoine@intel.com>
> > Cc: Ben Skeggs <bskeggs@redhat.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> > index d92db7007f62..e8a12a4fd400 100644
> > --- a/drivers/gpu/drm/drm_bufs.c
> > +++ b/drivers/gpu/drm/drm_bufs.c
> > @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
> >         if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
> >                 return -EPERM;
> >
> > +       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> > +           drm_core_check_feature(dev, DRIVER_MODESET))
> > +               return -EINVAL;
> > +
> Wondering if making this the first check in the function won't be
> better ? We have a handful of places which preemptively check
> DRIVER_MODESET prior to calling drm_legacy functions and similarly
> some (last time I've looked) drm_legacy functions check for
> DRIVER_MODESET. Perhaps we can move all the checking into the
> drm_legacy API alone ?

This is an ioctl handler, so there's not really any caller we can move
this to. In general I'm split, and I just put checks like these wherever
it makes sense, pulling them out into callers if there's an entire pile of
them who all want the same checks.

In the end I don't think it matters, as long as we dutifully combine
drm_legacy_* with such checks, so that it's _really_ all dead code for
modern drives.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-04-14 10:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30  9:45 [PATCH 00/10] Another shot at cruft removal Daniel Vetter
2016-03-30  9:45 ` [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP Daniel Vetter
2016-03-30 10:48   ` Emil Velikov
2016-03-30 11:00   ` [Intel-gfx] " kbuild test robot
2016-03-30 11:07   ` [PATCH] " Daniel Vetter
2016-03-30 11:19     ` [Intel-gfx] " kbuild test robot
2016-03-30 11:24   ` Daniel Vetter
2016-03-30 12:53     ` Emil Velikov
2016-03-30 15:21       ` Daniel Vetter
2016-03-30  9:45 ` [PATCH 02/10] drm: Use dev->name as fallback for dev->unique Daniel Vetter
2016-03-30 10:43   ` Emil Velikov
2016-04-26 11:12     ` Daniel Vetter
2016-03-30  9:45 ` [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE Daniel Vetter
2016-04-26 11:24   ` Daniel Vetter
2016-03-30  9:45 ` [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files Daniel Vetter
2016-03-30 13:49   ` Alex Deucher
2016-03-30 15:30     ` Daniel Vetter
2016-03-30  9:45 ` [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix Daniel Vetter
2016-03-30 10:09   ` kbuild test robot
2016-03-30 12:59     ` [Intel-gfx] " Thierry Reding
2016-03-30  9:45 ` [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit Daniel Vetter
2016-03-30 13:01   ` Thierry Reding
2016-03-30  9:45 ` [PATCH 07/10] drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix Daniel Vetter
2016-03-30  9:45 ` [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET Daniel Vetter
2016-03-30 10:39   ` Emil Velikov
2016-04-14 10:06     ` Daniel Vetter [this message]
2016-04-14 13:57       ` Emil Velikov
2016-03-30  9:45 ` [PATCH 09/10] drm: Push struct_mutex into ->master_destroy Daniel Vetter
2016-03-30  9:45 ` [PATCH 10/10] drm: Hide master MAP cleanup in drm_bufs.c Daniel Vetter
2016-03-30 16:13 ` ✗ Fi.CI.BAT: failure for Another shot at cruft removal Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160414100603.GL2510@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=peter.antoine@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.