[PATCH v2 6/6] drm: Separate DRIVER_MODESET and DRIVER_LEGACY

Daniel Vetter daniel at ffwll.ch
Tue Jul 12 11:06:00 UTC 2016


On Fri, Jun 24, 2016 at 06:15:20PM +0100, Frank Binns wrote:
> Support non-legacy drivers without mode-setting functionality by using
> the new DRIVER_LEGACY feature to separate out legacy code, rather than
> relying on DRIVER_MODESET not being advertised.
> 
> Signed-off-by: Thierry Reding <treding at nvidia.com>
> 
> v2:
> - Rebase
> - Change a few more places to check against DRIVER_LEGACY
> - Move a core check
> 
> Signed-off-by: Frank Binns <frank.binns at imgtec.com>

There's no reason at all to have both DRIVER_LEGACY and DRIVER_MODESET,
since DRIVER_MODESET really only means "not a legacy horror show". There's
0 harm at all in registering a render-only driver as DRIVER_MODESET.

The upshot of a 1:1 replacement is then that you can do it using
coccinelle, which makes it a lot easier to review.
-Daniel

> ---
>  drivers/gpu/drm/drm_bufs.c    | 22 +++++++++++-----------
>  drivers/gpu/drm/drm_context.c | 24 ++++++++++++------------
>  drivers/gpu/drm/drm_dma.c     |  4 ++--
>  drivers/gpu/drm/drm_fops.c    | 10 ++++++----
>  drivers/gpu/drm/drm_ioctl.c   |  4 ++--
>  drivers/gpu/drm/drm_irq.c     | 14 +++++++-------
>  drivers/gpu/drm/drm_lock.c    |  4 ++--
>  drivers/gpu/drm/drm_pci.c     | 10 +++++-----
>  drivers/gpu/drm/drm_scatter.c |  6 +++---
>  9 files changed, 50 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index c3a12cd..3219151 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 192a5f9..3c4000f 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 ea48180..c7dd17f 100644
> --- a/drivers/gpu/drm/drm_dma.c
> +++ b/drivers/gpu/drm/drm_dma.c
> @@ -50,7 +50,7 @@ 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;
>  	}
>  
> @@ -81,7 +81,7 @@ 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;
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 323c238..fee5b0c 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -91,8 +91,8 @@ static int drm_setup(struct drm_device * dev)
>  {
>  	int ret;
>  
> -	if (dev->driver->firstopen &&
> -	    !drm_core_check_feature(dev, DRIVER_MODESET)) {
> +	if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
> +	    dev->driver->firstopen) {
>  		ret = dev->driver->firstopen(dev);
>  		if (ret != 0)
>  			return ret;
> @@ -307,6 +307,9 @@ static void drm_events_release(struct drm_file *file_priv)
>   */
>  static void drm_legacy_dev_reinit(struct drm_device *dev)
>  {
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> +		return;
> +
>  	if (dev->irq_enabled)
>  		drm_irq_uninstall(dev);
>  
> @@ -346,8 +349,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))
> -		drm_legacy_dev_reinit(dev);
> +	drm_legacy_dev_reinit(dev);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 1f84ff5..b2175bf 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -717,9 +717,9 @@ long drm_ioctl(struct file *filp,
>  		memset(kdata, 0, usize);
>  	}
>  
> -	/* Enforce sane locking for kms driver ioctls. Core ioctls are
> +	/* Enforce sane locking for non-legacy 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 8ca3d2b..dce3c57 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -336,7 +336,7 @@ void drm_vblank_cleanup(struct drm_device *dev)
>  		struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
>  
>  		WARN_ON(vblank->enabled &&
> -			drm_core_check_feature(dev, DRIVER_MODESET));
> +			!drm_core_check_feature(dev, DRIVER_LEGACY));
>  
>  		del_timer_sync(&vblank->disable_timer);
>  	}
> @@ -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 {
> @@ -544,7 +544,7 @@ int drm_irq_uninstall(struct drm_device *dev)
>  			if (!vblank->enabled)
>  				continue;
>  
> -			WARN_ON(drm_core_check_feature(dev, DRIVER_MODESET));
> +			WARN_ON(!drm_core_check_feature(dev, DRIVER_LEGACY));
>  
>  			vblank_disable_and_save(dev, i);
>  			wake_up(&vblank->queue);
> @@ -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 support on pci devices. */
>  	if (WARN_ON(!dev->pdev))
> @@ -1522,7 +1522,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 48ac0eb..c901f3c 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 b2f8f10..0fc8cec 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. */
> @@ -248,7 +248,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
>  	dev->hose = pdev->sysdata;
>  #endif
>  
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> +	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
>  		pci_set_drvdata(pdev, dev);
>  
>  	drm_pci_agp_init(dev);
> @@ -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 4f0f3b3..efee0de 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))
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list