From patchwork Wed Dec 11 10:34:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3323861 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 0A63A9F37A for ; Wed, 11 Dec 2013 10:35:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA5CF20726 for ; Wed, 11 Dec 2013 10:35:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BEE37206C3 for ; Wed, 11 Dec 2013 10:35:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A420610577C; Wed, 11 Dec 2013 02:35:20 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B3FF1FB4A9 for ; Wed, 11 Dec 2013 02:34:51 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c41so2784974eek.8 for ; Wed, 11 Dec 2013 02:34:51 -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=RllAdt6d3pAslCOYn25PjWIEnB5c+JTL4Jq4fzTD52c=; b=Xjmo22Lis5ixg4UPq7NS/o5OdYtV5CPUIAR20Mtd2Z/JjgKtdqJakKx5HiDOatWpF9 BAtrUqVbNJ9/Tm6gEFdULEi7j+dsrkGpwIW/9JGkoap3Ux79dS7LADeKDJ5JDcZIpC/1 tYQZfYvA62LtycLollA79s/rsnA6FLx6rurz0= 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=RllAdt6d3pAslCOYn25PjWIEnB5c+JTL4Jq4fzTD52c=; b=UM5tLGfBpTG2NmBrttwTciODQgeIjUU4eO/wUW+SrJPRt2zkRSANH+/aVHssswwdZA t1ZNsYo4p9wd/KznIU6DRdSqhQRlBRnP0Xo9ep3uGhJVYFhndSAknZRdJL+bxyKf5qe4 SqrydTg2HgMpOyyzPsJRGcDuYBd949kfsK2uia4gkkivnRqPwL+t/i8xklPHq8SpeQl8 1HfjGzB4O3WNYkDi4iss/d99sX/XzWCKdmy1EqR/cU6I92MWzIZJYv+l00NEzvufqZ+b OUbofmL0SdgCBY194QlRIuHGQ1QdkpiTNK8T7LOxQpnttyGEFalu/M6OaV7nK54RHyyI nq8A== X-Gm-Message-State: ALoCoQmlYScy95imHhxPnf42KeuclqQv/Dqa/plJEwMKHPRJgbvEApSAR0XPs9WPbOSRVM2iXaP0 X-Received: by 10.15.95.72 with SMTP id bc48mr886037eeb.49.1386758091115; Wed, 11 Dec 2013 02:34:51 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPSA id b41sm51932269eef.16.2013.12.11.02.34.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Dec 2013 02:34:50 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 16/50] drm: inline drm_agp_destroy Date: Wed, 11 Dec 2013 11:34:37 +0100 Message-Id: <1386758111-3446-17-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386758111-3446-1-git-send-email-daniel.vetter@ffwll.ch> References: <1386758111-3446-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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 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 Wrapping a kfree is pointless. v2: Add a comment to the kerneldoc for drm_agp_init to explain where the kfree happens as requested by David. Note that for modeset drivers agp cleanup is fairly complicated anyway: The drm_agp_clear is a noop and drivers must call drm_agp_release on their own. Which they all seem to do properly. Cc: David Herrmann Reviewed-by: David Herrmann Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_agpsupport.c | 18 +++--------------- drivers/gpu/drm/drm_pci.c | 2 +- include/drm/drm_agpsupport.h | 5 ----- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 084a674e4b56..1f544af43617 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -393,6 +393,9 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data, * Gets the drm_agp_t structure which is made available by the agpgart module * via the inter_module_* functions. Creates and initializes a drm_agp_head * structure. + * + * Note that final cleanup of the kmalloced structure is directly done in + * drm_pci_agp_destroy. */ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { @@ -460,21 +463,6 @@ void drm_agp_clear(struct drm_device *dev) } /** - * drm_agp_destroy - Destroy AGP head - * @dev: DRM device - * - * Destroy resources that were previously allocated via drm_agp_initp. Caller - * must ensure to clean up all AGP resources before calling this. See - * drm_agp_clear(). - * - * Call this to destroy AGP heads allocated via drm_agp_init(). - */ -void drm_agp_destroy(struct drm_agp_head *agp) -{ - kfree(agp); -} - -/** * Binds a collection of pages into AGP memory at the given offset, returning * the AGP memory structure containing them. * diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 2211c4d70c2d..f710e3d9d847 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -281,7 +281,7 @@ static void drm_pci_agp_destroy(struct drm_device *dev) if (dev->agp) { arch_phys_wc_del(dev->agp->agp_mtrr); drm_agp_clear(dev); - drm_agp_destroy(dev->agp); + kfree(dev->agp); dev->agp = NULL; } } diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h index a12b0e011e44..56a861b2ceaa 100644 --- a/include/drm/drm_agpsupport.h +++ b/include/drm/drm_agpsupport.h @@ -20,7 +20,6 @@ DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, uint32_t type); struct drm_agp_head *drm_agp_init(struct drm_device *dev); -void drm_agp_destroy(struct drm_agp_head *agp); void drm_agp_clear(struct drm_device *dev); int drm_agp_acquire(struct drm_device *dev); int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, @@ -76,10 +75,6 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) return NULL; } -static inline void drm_agp_destroy(struct drm_agp_head *agp) -{ -} - static inline void drm_agp_clear(struct drm_device *dev) { }