From patchwork Thu Aug 8 13:41:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2841166 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3D679F271 for ; Thu, 8 Aug 2013 13:57:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9DA3204BB for ; Thu, 8 Aug 2013 13:57:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9DBED204B5 for ; Thu, 8 Aug 2013 13:57:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5883E6744 for ; Thu, 8 Aug 2013 06:57:25 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f179.google.com (mail-ea0-f179.google.com [209.85.215.179]) by gabe.freedesktop.org (Postfix) with ESMTP id C0D26E68B5 for ; Thu, 8 Aug 2013 06:41:43 -0700 (PDT) Received: by mail-ea0-f179.google.com with SMTP id b10so1441274eae.24 for ; Thu, 08 Aug 2013 06:41:43 -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=uQOHd3hUU/+fR96E0J/ahvIPRwbYhiQerJayi6w0oQE=; b=XaNEG6hQHJJJIONtNCA+v+SneyMx+7cTo6b/B9rOyyJCmiLbC28aYnoea9/03HCxQr sEJxTXfIq5xzABkbeTa0NjqtUPKu3bJTZgrOlZxXlLpjWSA9jkjAk6ET2Lwm2QbVaOi2 vCZ64Q3Pibe9BVMBk65sow1iEIP84hxuPnWGo= 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=uQOHd3hUU/+fR96E0J/ahvIPRwbYhiQerJayi6w0oQE=; b=OiM00RAwAncvte7nH9Y+pRuwEFwDzkLqCI/XM4z+grWKbONSCfGREOJ22kkiTjMLLe jjPXxqActglNCGJAbSORS0wDE0NArrHE3R45CPe5AZDKjBylKnXWVFdMGBXMq+/PVpqg 5yZ65g8dOWnpI6zMxs7fVubLzGV+UXBUB6r0YjPOTw96YL8ZMEa+GnejqNoF9V9su177 ZbGrXPIrTRTdTH97BQtEWvbvcBrlNKhqro9xFK+nxHo8TN7jSEBlJeczl6GxECYvrApc lYJAPreAzwZzcBp9mttBb20F3++rpOPmNeUUAo5J40AEK6qTbfYooEXQ0VQdKuU5AiCZ eIBg== X-Gm-Message-State: ALoCoQlUokNsf7ZPHSctk2/uyo5IK0GZpbN7UFj5IZTRoYwuHSVmd2Lo/ZZk8GH2UMPmLjkQ7H6T X-Received: by 10.14.193.198 with SMTP id k46mr8328471een.128.1375969303003; Thu, 08 Aug 2013 06:41:43 -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.41.41 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 Aug 2013 06:41:42 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 07/25] drm: hide legacy sg cleanup better from common code Date: Thu, 8 Aug 2013 15:41:17 +0200 Message-Id: <1375969295-18929-8-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 I've decided that some clear markers for what's legacy dri1/non-gem code is useful. I've opted to use the drm_legacy prefix and then hide all the checks in that function for better readability in the common code. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 6 +----- drivers/gpu/drm/drm_scatter.c | 10 +++++++++- include/drm/drmP.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index dddd799..743b24d 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -197,11 +197,7 @@ int drm_lastclose(struct drm_device * dev) drm_agp_clear(dev); - if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && - !drm_core_check_feature(dev, DRIVER_MODESET)) { - drm_sg_cleanup(dev->sg); - dev->sg = NULL; - } + drm_legacy_sg_cleanup(dev); /* Clear vma list (only built for debugging) */ list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) { diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c index a4a076f..dd8a648 100644 --- a/drivers/gpu/drm/drm_scatter.c +++ b/drivers/gpu/drm/drm_scatter.c @@ -46,7 +46,7 @@ static inline void *drm_vmalloc_dma(unsigned long size) #endif } -void drm_sg_cleanup(struct drm_sg_mem * entry) +static void drm_sg_cleanup(struct drm_sg_mem * entry) { struct page *page; int i; @@ -64,6 +64,14 @@ void drm_sg_cleanup(struct drm_sg_mem * entry) kfree(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_sg_cleanup(dev->sg); + dev->sg = NULL; + } +} #ifdef _LP64 # define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1))) #else diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 7495fb2..bc38f99 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1567,7 +1567,7 @@ extern int drm_vma_info(struct seq_file *m, void *data); #endif /* Scatter Gather Support (drm_scatter.h) */ -extern void drm_sg_cleanup(struct drm_sg_mem * entry); +extern void drm_legacy_sg_cleanup(struct drm_device *dev); extern int drm_sg_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_sg_free(struct drm_device *dev, void *data,