From patchwork Thu Aug 8 13:41:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2841238 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 948C9BF546 for ; Thu, 8 Aug 2013 14:20:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A176E20122 for ; Thu, 8 Aug 2013 14:20:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E4546201C0 for ; Thu, 8 Aug 2013 14:20:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CB4DE67F0 for ; Thu, 8 Aug 2013 07:20:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FE1AE6801 for ; Thu, 8 Aug 2013 06:42:04 -0700 (PDT) Received: by mail-ee0-f53.google.com with SMTP id b15so1532281eek.26 for ; Thu, 08 Aug 2013 06:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a+hOvKgEIekldZ6E69ZDVfNq0p+Hn431gsg6QrldDuc=; b=Up4wAAZANBxYOjwb95IzFVvnuDcy3Xww2zWwUSOVbUxuCWHehmu5ZdqSqvZdK+soQo RIR5PtptJz1IhhOarLljDDNER1asJgd3BDeD7V/eBImFGV4XehWSFeuvcyk/UCXDBiGU GQWmKOg46hwk6Scv1kJydsAw1PFw4Po/O+bx0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a+hOvKgEIekldZ6E69ZDVfNq0p+Hn431gsg6QrldDuc=; b=YP0wv9+bogBeDgGIVt9Pwm91fyyceUT2v8YCQKxieetbuyjYESuPFX42+yYMa8tctq wV+0IBTcPG67GTOpb+wNl4NXPvzUDnywxHENrUGJneyR4YgU4YaldITzDX5SS4cBJWN1 OGk8EW5c9vQkfuTOM9tCZdUDsUcHK5Iap6itKLsUY19HAnajgg3gFKJq0y+xJTmZ2m1C iG9K1qKpDDFdLWcgWTvwAkH4VoIn4hOthq1V7wInViKB4xb/IFc/rSENZR+Yx7VG4CTR T7dNxnACjnK2HcaXEXK0qQUGN8ZS4/InjzeWSGyU89YX2HDoQaYTAfC9UkPN3fS+7MWa Hd1g== X-Gm-Message-State: ALoCoQmzYbEgtCXN6YVXk8a+STSq+XSZgfGUPau/pKXVRdOpQZGx1mFQXhLzsAN2HNllqfNe+KDA X-Received: by 10.14.251.10 with SMTP id a10mr8345898ees.76.1375969324248; Thu, 08 Aug 2013 06:42:04 -0700 (PDT) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id bn13sm19282226eeb.11.2013.08.08.06.42.02 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Aug 2013 06:42:03 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 19/25] drm: remove the dma_ioctl special-case Date: Thu, 8 Aug 2013 15:41:29 +0200 Message-Id: <1375969295-18929-20-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1375969295-18929-1-git-send-email-daniel.vetter@ffwll.ch> References: <1375969295-18929-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We might as well have a real ioctl function which checks for the callbacks. This seems to be a remnant from back in the days when each drm driver had their own complete ioctl table, with no shared core drm table at all. To make really sure no mis-guided user in a kms driver pops up again explicitly check for that in the new ioctl implementation. v2: Drop the unused variable I've accidentally left in the code, spotted by David Herrmann. Cc: David Herrmann Signed-off-by: Daniel Vetter Reviewed-by: David Herrmann --- drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++ drivers/gpu/drm/drm_drv.c | 6 +----- include/drm/drmP.h | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index f63133b..471e051d 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1455,6 +1455,18 @@ int drm_mapbufs(struct drm_device *dev, void *data, return retcode; } +int drm_dma_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + + if (dev->driver->dma_ioctl) + return dev->driver->dma_ioctl(dev, data, file_priv); + else + return -EINVAL; +} + struct drm_local_map *drm_getsarea(struct drm_device *dev) { struct drm_map_list *entry; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 5b949a7..83078cd 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -106,8 +106,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ - DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), @@ -395,9 +394,6 @@ long drm_ioctl(struct file *filp, /* Do not trust userspace, use our own definition */ func = ioctl->func; - /* is there a local override? */ - if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) - func = dev->driver->dma_ioctl; if (!func) { DRM_DEBUG("no function\n"); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 5b9462d..2a2a5b7 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1366,6 +1366,8 @@ extern int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_dma_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); /* DMA support (drm_dma.h) */ extern int drm_legacy_dma_setup(struct drm_device *dev);