From patchwork Mon Nov 23 09:33:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 7679051 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F22CE9FCA2 for ; Mon, 23 Nov 2015 09:33:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 371B42062C for ; Mon, 23 Nov 2015 09:33:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 53E3720445 for ; Mon, 23 Nov 2015 09:33:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1082372103; Mon, 23 Nov 2015 01:33:46 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id C303D720EA for ; Mon, 23 Nov 2015 01:33:43 -0800 (PST) Received: by wmuu63 with SMTP id u63so45639480wmu.0 for ; Mon, 23 Nov 2015 01:33:42 -0800 (PST) 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=rTc4uKw0822ELsmZgZPSKrxRwpnBW6xYDMVkjX7Ne3c=; b=IbAbTiwYj7PX9NjjPT7RMfCRreawWmIbzkpx9AAXa4zcM6Q/qWnKbHvnb7tZCC2hvb VQlrCkajkPL2V1j7ygGQ+rtamYlYY0s6UENUIYtH5zvmQ7Qa5z18sNtLEyzDpxpF1ZL0 tOy6zk/1dKCCMPIdfSnofjcskLsTSheJKURgk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rTc4uKw0822ELsmZgZPSKrxRwpnBW6xYDMVkjX7Ne3c=; b=LVzUBdmpmAPx9wO658hienGU5/Bs2uIfp2bp8pyk67dmJOEokvnCDFkSlc1QclFigE CvbPj9ouPnRuHPv4Serhj33xdwchSck/xihpEU1/MSn5a721sPEHpYl6Ba6kaq/obpcc RpKHjoRapwMt9yTPA+tDShMNBcD+Jy6M0gABwVzIoM0hnF5gpRsQPtmJ2wH1aoko1D9l 9Xs5ZwR/J8SJjsS0HvBalA7AG5HYJMxiuVzWJ/nON/QXEgIZ8qRaHS41gLnZNpuXYRTd CSxPxnYv6EBZMUxFfJVPWB0iJ0tMgkt/aYNu2aD0TH6Bf+Ri37738DR7M1g57pKwfvX4 3rKw== X-Gm-Message-State: ALoCoQkjoNvIQhTT1Dn417IXDxdbYi2Neg7Wdn/sFEuOKzPgVmCgCcasII9hgcGspLja3jZxjtmH X-Received: by 10.194.240.67 with SMTP id vy3mr29344367wjc.168.1448271222580; Mon, 23 Nov 2015 01:33:42 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id pn6sm12332758wjb.15.2015.11.23.01.33.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 01:33:42 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Mon, 23 Nov 2015 10:33:03 +0100 Message-Id: <1448271183-20523-31-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1448271183-20523-1-git-send-email-daniel.vetter@ffwll.ch> References: <1448271183-20523-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Intel Graphics Development Subject: [Intel-gfx] [PATCH] v2: Also add a DRIVER_* check like for all other maps functions to really short-circuit the code. And give drm_legacy_rmmap used by the dev unregister code the same treatment. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 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 --- drivers/gpu/drm/drm_bufs.c | 14 ++++++++++---- include/drm/drm_legacy.h | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index de18b8b78a26..5a51633da033 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -542,15 +542,17 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) } EXPORT_SYMBOL(drm_legacy_rmmap_locked); -int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map) +void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map) { - int ret; + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && + drm_core_check_feature(dev, DRIVER_MODESET)) + return; mutex_lock(&dev->struct_mutex); - ret = drm_legacy_rmmap_locked(dev, map); + drm_legacy_rmmap_locked(dev, map); mutex_unlock(&dev->struct_mutex); - return ret; + return; } EXPORT_SYMBOL(drm_legacy_rmmap); @@ -558,6 +560,10 @@ 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_KMS_LEGACY_CONTEXT) && + drm_core_check_feature(dev, DRIVER_MODESET)) + return; + mutex_lock(&dev->struct_mutex); list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) { if (r_list->master == master) { diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h index 24504b0eafea..a5ef2c7e40f8 100644 --- a/include/drm/drm_legacy.h +++ b/include/drm/drm_legacy.h @@ -154,7 +154,7 @@ struct drm_map_list { int drm_legacy_addmap(struct drm_device *d, resource_size_t offset, unsigned int size, enum drm_map_type type, enum drm_map_flags flags, struct drm_local_map **map_p); -int drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map); +void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map); int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map); void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master);