[PATCH 2/2] drm: Used DRM_LEGACY for all legacy functions

Frank Binns frank.binns at imgtec.com
Thu Aug 4 07:37:49 UTC 2016


On 03/08/16 20:11, Daniel Vetter wrote:
> Except for nouveau, only legacy drivers need this really. And nouveau
> is already marked up with DRIVER_KMS_LEGACY_CONTEXT as the special
> case.
>
> I've tried to be careful to leave everything related to modeset still
> using the DRIVER_MODESET flag. Otherwise it's a direct replacement of
> !DRIVER_MODESET with DRIVER_LEGACY checks. Also helps readability
> since fewer negative checks overall.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

I don't think this goes far enough. For example, the documentation
for the 'firstopen' callback says that it's called for legacy UMS drivers
but it does a check based on DRIVER_MODESET. There are also some
places in drm_pci.c that should be changed as well.

Anyway, this is progress so:
Reviewed-by: Frank Binns <frank.binns at imgtec.com>

> ---
>   drivers/gpu/drm/drm_agpsupport.c |  6 ++----
>   drivers/gpu/drm/drm_auth.c       |  2 +-
>   drivers/gpu/drm/drm_bufs.c       | 22 +++++++++++-----------
>   drivers/gpu/drm/drm_context.c    | 24 ++++++++++++------------
>   drivers/gpu/drm/drm_dma.c        |  6 ++----
>   drivers/gpu/drm/drm_fops.c       |  6 +++---
>   drivers/gpu/drm/drm_ioctl.c      |  4 ++--
>   drivers/gpu/drm/drm_irq.c        | 10 +++++-----
>   drivers/gpu/drm/drm_lock.c       |  4 ++--
>   drivers/gpu/drm/drm_pci.c        |  8 ++++----
>   drivers/gpu/drm/drm_scatter.c    |  6 +++---
>   11 files changed, 47 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
> index 605bd243fb36..d621c8a4cf00 100644
> --- a/drivers/gpu/drm/drm_agpsupport.c
> +++ b/drivers/gpu/drm/drm_agpsupport.c
> @@ -430,9 +430,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
>    * intact so it can still be used. It is safe to call this if AGP is disabled or
>    * was already removed.
>    *
> - * If DRIVER_MODESET is active, nothing is done to protect the modesetting
> - * resources from getting destroyed. Drivers are responsible of cleaning them up
> - * during device shutdown.
> + * Cleanup is only done for drivers who have DRIVER_LEGACY set.
>    */
>   void drm_legacy_agp_clear(struct drm_device *dev)
>   {
> @@ -440,7 +438,7 @@ void drm_legacy_agp_clear(struct drm_device *dev)
>   
>   	if (!dev->agp)
>   		return;
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 4153e8a193af..6b143514a566 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -251,7 +251,7 @@ void drm_master_release(struct drm_file *file_priv)
>   	if (!drm_is_current_master(file_priv))
>   		goto out;
>   
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY)) {
>   		/*
>   		 * Since the master is disappearing, so is the
>   		 * possibility to lock.
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index c3a12cd8bd0d..32191513e82d 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -397,7 +397,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
>   		return -EPERM;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	err = drm_addmap_core(dev, map->offset, map->size, map->type,
> @@ -443,7 +443,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
>   	int i;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	idx = map->offset;
> @@ -545,7 +545,7 @@ EXPORT_SYMBOL(drm_legacy_rmmap_locked);
>   void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
>   {
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -558,7 +558,7 @@ void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master)
>   {
>   	struct drm_map_list *r_list, *list_temp;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -595,7 +595,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
>   	int ret;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -1220,7 +1220,7 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data,
>   	struct drm_buf_desc *request = data;
>   	int ret;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> @@ -1266,7 +1266,7 @@ int drm_legacy_infobufs(struct drm_device *dev, void *data,
>   	int i;
>   	int count;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> @@ -1347,7 +1347,7 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
>   	int order;
>   	struct drm_buf_entry *entry;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> @@ -1395,7 +1395,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
>   	int idx;
>   	struct drm_buf *buf;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> @@ -1450,7 +1450,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,
>   	struct drm_buf_map *request = data;
>   	int i;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> @@ -1530,7 +1530,7 @@ int drm_legacy_mapbufs(struct drm_device *dev, void *data,
>   int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
>   		  struct drm_file *file_priv)
>   {
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (dev->driver->dma_ioctl)
> diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
> index 192a5f9eeb74..3c4000facb36 100644
> --- a/drivers/gpu/drm/drm_context.c
> +++ b/drivers/gpu/drm/drm_context.c
> @@ -54,7 +54,7 @@ struct drm_ctx_list {
>   void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
>   {
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -92,7 +92,7 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
>   void drm_legacy_ctxbitmap_init(struct drm_device * dev)
>   {
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	idr_init(&dev->ctx_idr);
> @@ -109,7 +109,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
>   void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
>   {
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -131,7 +131,7 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
>   	struct drm_ctx_list *pos, *tmp;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
>   
>   	mutex_lock(&dev->ctxlist_mutex);
> @@ -177,7 +177,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data,
>   	struct drm_map_list *_entry;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -225,7 +225,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
>   	struct drm_map_list *r_list = NULL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	mutex_lock(&dev->struct_mutex);
> @@ -329,7 +329,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
>   	int i;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (res->count >= DRM_RESERVED_CONTEXTS) {
> @@ -363,7 +363,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
>   	struct drm_ctx *ctx = data;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	ctx->handle = drm_legacy_ctxbitmap_next(dev);
> @@ -410,7 +410,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
>   	struct drm_ctx *ctx = data;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	/* This is 0, because we don't handle any context flags */
> @@ -436,7 +436,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
>   	struct drm_ctx *ctx = data;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	DRM_DEBUG("%d\n", ctx->handle);
> @@ -460,7 +460,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
>   	struct drm_ctx *ctx = data;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	DRM_DEBUG("%d\n", ctx->handle);
> @@ -486,7 +486,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
>   	struct drm_ctx *ctx = data;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
> -	    drm_core_check_feature(dev, DRIVER_MODESET))
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	DRM_DEBUG("%d\n", ctx->handle);
> diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
> index ea481800ef56..3f83e2ca80ad 100644
> --- a/drivers/gpu/drm/drm_dma.c
> +++ b/drivers/gpu/drm/drm_dma.c
> @@ -50,9 +50,8 @@ int drm_legacy_dma_setup(struct drm_device *dev)
>   	int i;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
> -	    drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return 0;
> -	}
>   
>   	dev->buf_use = 0;
>   	atomic_set(&dev->buf_alloc, 0);
> @@ -81,9 +80,8 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
>   	int i, j;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
> -	    drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	    !drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return;
> -	}
>   
>   	if (!dma)
>   		return;
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 323c238fcac7..036cd275c53e 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -92,7 +92,7 @@ static int drm_setup(struct drm_device * dev)
>   	int ret;
>   
>   	if (dev->driver->firstopen &&
> -	    !drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	    drm_core_check_feature(dev, DRIVER_LEGACY)) {
>   		ret = dev->driver->firstopen(dev);
>   		if (ret != 0)
>   			return ret;
> @@ -346,7 +346,7 @@ void drm_lastclose(struct drm_device * dev)
>   		dev->driver->lastclose(dev);
>   	DRM_DEBUG("driver lastclose completed\n");
>   
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   		drm_legacy_dev_reinit(dev);
>   }
>   
> @@ -389,7 +389,7 @@ int drm_release(struct inode *inode, struct file *filp)
>   		  (long)old_encode_dev(file_priv->minor->kdev->devt),
>   		  dev->open_count);
>   
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   		drm_legacy_lock_release(dev, filp);
>   
>   	if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 5085fd90f74d..0663a92922a8 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -714,9 +714,9 @@ long drm_ioctl(struct file *filp,
>   	if (ksize > in_size)
>   		memset(kdata + in_size, 0, ksize - in_size);
>   
> -	/* Enforce sane locking for kms driver ioctls. Core ioctls are
> +	/* Enforce sane locking for modern driver ioctls. Core ioctls are
>   	 * too messy still. */
> -	if ((drm_core_check_feature(dev, DRIVER_MODESET) && is_driver_ioctl) ||
> +	if ((!drm_core_check_feature(dev, DRIVER_LEGACY) && is_driver_ioctl) ||
>   	    (ioctl->flags & DRM_UNLOCKED))
>   		retcode = func(dev, kdata, file_priv);
>   	else {
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index a33465d8e133..d6d022b7c29b 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -482,7 +482,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
>   		return ret;
>   	}
>   
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   		vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL);
>   
>   	/* After installing handler */
> @@ -491,7 +491,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
>   
>   	if (ret < 0) {
>   		dev->irq_enabled = false;
> -		if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +		if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   			vga_client_register(dev->pdev, NULL, NULL, NULL);
>   		free_irq(irq, dev);
>   	} else {
> @@ -557,7 +557,7 @@ int drm_irq_uninstall(struct drm_device *dev)
>   
>   	DRM_DEBUG("irq=%d\n", dev->irq);
>   
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   		vga_client_register(dev->pdev, NULL, NULL, NULL);
>   
>   	if (dev->driver->irq_uninstall)
> @@ -592,7 +592,7 @@ int drm_control(struct drm_device *dev, void *data,
>   
>   	if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
>   		return 0;
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return 0;
>   	/* UMS was only ever supported on pci devices. */
>   	if (WARN_ON(!dev->pdev))
> @@ -1488,7 +1488,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
>   		return 0;
>   
>   	/* KMS drivers handle this internally */
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return 0;
>   
>   	pipe = modeset->crtc;
> diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
> index 48ac0ebbd663..c901f3c5b269 100644
> --- a/drivers/gpu/drm/drm_lock.c
> +++ b/drivers/gpu/drm/drm_lock.c
> @@ -163,7 +163,7 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
>   	struct drm_master *master = file_priv->master;
>   	int ret = 0;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	++file_priv->lock_count;
> @@ -252,7 +252,7 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
>   	struct drm_lock *lock = data;
>   	struct drm_master *master = file_priv->master;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (lock->context == DRM_KERNEL_CONTEXT) {
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index b2f8f1062d5f..d86362fc8ac6 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -175,7 +175,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
>   {
>   	struct drm_irq_busid *p = data;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	/* UMS was only ever support on PCI devices. */
> @@ -263,7 +263,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
>   
>   	/* No locking needed since shadow-attach is single-threaded since it may
>   	 * only be called from the per-driver module init hook. */
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY))
>   		list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
>   
>   	return 0;
> @@ -299,7 +299,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
>   
>   	DRM_DEBUG("\n");
>   
> -	if (driver->driver_features & DRIVER_MODESET)
> +	if (!(driver->driver_features & DRIVER_LEGACY))
>   		return pci_register_driver(pdriver);
>   
>   	/* If not using KMS, fall back to stealth mode manual scanning. */
> @@ -421,7 +421,7 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
>   	struct drm_device *dev, *tmp;
>   	DRM_DEBUG("\n");
>   
> -	if (driver->driver_features & DRIVER_MODESET) {
> +	if (!(driver->driver_features & DRIVER_LEGACY)) {
>   		pci_unregister_driver(pdriver);
>   	} else {
>   		list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
> diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
> index bf70431073f6..275bca44f38c 100644
> --- a/drivers/gpu/drm/drm_scatter.c
> +++ b/drivers/gpu/drm/drm_scatter.c
> @@ -68,7 +68,7 @@ static void drm_sg_cleanup(struct drm_sg_mem * entry)
>   void drm_legacy_sg_cleanup(struct drm_device *dev)
>   {
>   	if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg &&
> -	    !drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	    drm_core_check_feature(dev, DRIVER_LEGACY)) {
>   		drm_sg_cleanup(dev->sg);
>   		dev->sg = NULL;
>   	}
> @@ -88,7 +88,7 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
>   
>   	DRM_DEBUG("\n");
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_SG))
> @@ -201,7 +201,7 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
>   	struct drm_scatter_gather *request = data;
>   	struct drm_sg_mem *entry;
>   
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>   		return -EINVAL;
>   
>   	if (!drm_core_check_feature(dev, DRIVER_SG))



More information about the dri-devel mailing list