Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa538645 authored by Daniel Vetter's avatar Daniel Vetter
Browse files

drm: Used DRM_LEGACY for all legacy functions



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.

Reviewed-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Reviewed-by: default avatarFrank Binns <frank.binns@imgtec.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470251470-30830-2-git-send-email-daniel.vetter@ffwll.ch
parent 3cbf6a5d
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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.
+11 −11
Original line number Diff line number Diff line
@@ -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)
+12 −12
Original line number Diff line number Diff line
@@ -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);
+2 −4
Original line number Diff line number Diff line
@@ -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;
Loading