From patchwork Sun Jul 7 19:02:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 2824618 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 9ADA69F9DE for ; Sun, 7 Jul 2013 19:08:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A823120122 for ; Sun, 7 Jul 2013 19:08:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A5BA420121 for ; Sun, 7 Jul 2013 19:08:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95C41E60EE for ; Sun, 7 Jul 2013 12:08:48 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (unknown [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id D5797E60D3 for ; Sun, 7 Jul 2013 12:02:31 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=87.106.93.118; Received: from fireflyinternet.com (unverified [87.106.93.118]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 129474429-1500050 for ; Sun, 07 Jul 2013 20:02:30 +0100 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.73.22; Received: from arrandale.alporthouse.com (unverified [78.156.73.22]) by fireflyinternet.com (Firefly Internet (M2)) with ESMTP id 9693295-1500048 for multiple; Sun, 07 Jul 2013 20:02:33 +0100 From: Chris Wilson To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] drm: Clean up debugfs upon shutdown Date: Sun, 7 Jul 2013 20:02:18 +0100 Message-Id: <1373223745-9095-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.8.3.2 X-Originating-IP: 78.156.73.22 Cc: Dave Airlie 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Driver authors are a forgetful breed, and having to manually clean up all inodes from debugfs during module unload is tedious and rarely encountered by users; leftover inodes fester. But behold, the drm core already tracks all inodes created under the DRI debugfs minor so that we can do all the teardown ourselves. Signed-off-by: Chris Wilson Cc: Dave Airlie Reviewed-by: Rob Clark --- drivers/gpu/drm/drm_debugfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index a05087c..b855fd7 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -229,7 +229,16 @@ int drm_debugfs_cleanup(struct drm_minor *minor) if (dev->driver->debugfs_cleanup) dev->driver->debugfs_cleanup(minor); - drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor); + while (!list_empty(&minor->debugfs_list)) { + struct drm_info_node *node = + list_first_entry(&minor->debugfs_list, + struct drm_info_node, + list); + + debugfs_remove(node->dent); + list_del(&node->list); + kfree(node); + } debugfs_remove(minor->debugfs_root); minor->debugfs_root = NULL;