From patchwork Fri Jun 1 11:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10443027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92A74602BD for ; Fri, 1 Jun 2018 11:22:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84B6128A54 for ; Fri, 1 Jun 2018 11:22:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78C5928B04; Fri, 1 Jun 2018 11:22:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CB7B928A54 for ; Fri, 1 Jun 2018 11:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5lzb6gH1ePn4o+avj9tgu2iGobFnU9go9Eej6ZjHzkM=; b=hI9S/Ne47+Q1RVMF8zEKIrx6Bo oT94AeaAcPt6dyckeGmB1Xme9qZFkDIwwIrApwi1DR8/43+AOtFqwxiO7kz2sDMsa1k4fJTeWiLqS qEYXbbYnQRck4d85MLHT1MMFbIQm6yCK16nLCJMi970979q6sF5TLdbAA8W5iQQChVzUfpHmFsTk1 pOLOT6lFXZNEgH+5A6xwfsiHlHhENpSixLtGeCLhhFFAQJ2KkwI/NTOi/Lg0WUfUHfD5bd1gUyXzv z7xYUL5k02bVKjg8cFftOOZu3dOXLQlzIY3hp4oRDeFd+iAM7wY14+rviQdHkUmy8N33kbSDhfjFA t7+DvAUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fOi8J-0004FL-BP; Fri, 01 Jun 2018 11:22:11 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fOi80-0003fs-WF; Fri, 01 Jun 2018 11:21:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1WiwOttuezEaRKXZfKIeJMdZGNd0cG97T+1VUwivFgU=; b=fdiqBjaRD2QOpQUsHRNFqaGpl u+e++Fn0CBYnudizgnbKUrKrhgKxEv7Z498/Uk3kV6CzYG5Pwq5wr8VxIS+faJmlVE6YAEx+lqVnZ ngWHLoPaKWik1uC1qb28ckfClvAZIwFS7eyYL0mOIWDsvqlT0JiNZB2cW3bXIMd6shnO1sSRfwcVv 127o4/1YP1fCfkP4U0sPKz6JlBy9pP/+WGvh7rk4muZ7oeOq1mqUq+xD8uyrs/X9yO+3rWvoJip2N DntsVEiOXDDnIjJXLnGiwsWmZkpiPY26TOldL1P+IrteyYB0P1rTMGNVhRR6yH6wPA9ViTerjHMzt LdV3zMaqQ==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fOhxJ-0005US-P6; Fri, 01 Jun 2018 11:10:52 +0000 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D350F208AE; Fri, 1 Jun 2018 11:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527851438; bh=eMHLzqlEjbuqC73nTAeORCOEG71ppN2RgrYR4lSNzfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGCaB1PFdY2q4K0/5SEv10NY6IrLV2a30dhZwaYUAOuMW2hNoEOoL6Dl6QumGsiTr 2pdNvu1IPPACr+fr7ba2l+80uFovcAPebIUYY3awOkuupffGNoxTyJZLVJyHJW+qyU CJqT4q8nSQMRNOk283lMJvfQkxFX4y57LYhaRG6U= From: Greg Kroah-Hartman To: devel@driverdev.osuosl.org Subject: [PATCH 2/6] staging: vc04_services: remove odd vchiq_debugfs_top() wrapper Date: Fri, 1 Jun 2018 13:10:00 +0200 Message-Id: <20180601111004.1670-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180601111004.1670-1-gregkh@linuxfoundation.org> References: <20180601111004.1670-1-gregkh@linuxfoundation.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180601_121050_325368_A6EB11E0 X-CRM114-Status: GOOD ( 18.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Kees Cook , Arnd Bergmann , Greg Kroah-Hartman , Keerthi Reddy , linux-rpi-kernel@lists.infradead.org, Dan Carpenter , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP vchiq_debugfs_top() is only a wrapper around a pointer to a dentry, so just use the dentry directly instead, making it a static variable instead of part of a static structure. This also removes the pointless BUG_ON() when checking that dentry as no one should ever care if debugfs is working or not, and the kernel should really not panic over something as trivial as that. Suggested-by: Eric Anholt Cc: Stefan Wahren Cc: Kees Cook Cc: Dan Carpenter Cc: Arnd Bergmann Cc: Keerthi Reddy Cc: linux-rpi-kernel@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Greg Kroah-Hartman --- .../interface/vchiq_arm/vchiq_debugfs.c | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c index 103fec955e2c..8b46256a97fc 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c @@ -53,9 +53,6 @@ /* Top-level debug info */ struct vchiq_debugfs_info { - /* Global 'vchiq' debugfs entry used by all instances */ - struct dentry *vchiq_cfg_dir; - /* one entry per client process */ struct dentry *clients; @@ -65,6 +62,9 @@ struct vchiq_debugfs_info { static struct vchiq_debugfs_info debugfs_info; +/* Global 'vchiq' debugfs entry used by all instances */ +struct dentry *vchiq_dbg_dir; + /* Log category debugfs entries */ struct vchiq_debugfs_log_entry { const char *name; @@ -82,7 +82,6 @@ static struct vchiq_debugfs_log_entry vchiq_debugfs_log_entries[] = { static int n_log_entries = ARRAY_SIZE(vchiq_debugfs_log_entries); static struct dentry *vchiq_clients_top(void); -static struct dentry *vchiq_debugfs_top(void); static int debugfs_log_show(struct seq_file *f, void *offset) { @@ -163,7 +162,7 @@ static void vchiq_debugfs_create_log_entries(struct dentry *top) struct dentry *dir; size_t i; - dir = debugfs_create_dir("log", vchiq_debugfs_top()); + dir = debugfs_create_dir("log", vchiq_dbg_dir); debugfs_info.log_categories = dir; for (i = 0; i < n_log_entries; i++) { @@ -286,17 +285,16 @@ void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance) void vchiq_debugfs_init(void) { - debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL); - debugfs_info.clients = debugfs_create_dir("clients", - vchiq_debugfs_top()); + vchiq_dbg_dir = debugfs_create_dir("vchiq", NULL); + debugfs_info.clients = debugfs_create_dir("clients", vchiq_dbg_dir); - vchiq_debugfs_create_log_entries(vchiq_debugfs_top()); + vchiq_debugfs_create_log_entries(vchiq_dbg_dir); } /* remove all the debugfs entries */ void vchiq_debugfs_deinit(void) { - debugfs_remove_recursive(vchiq_debugfs_top()); + debugfs_remove_recursive(vchiq_dbg_dir); } static struct dentry *vchiq_clients_top(void) @@ -304,12 +302,6 @@ static struct dentry *vchiq_clients_top(void) return debugfs_info.clients; } -static struct dentry *vchiq_debugfs_top(void) -{ - BUG_ON(debugfs_info.vchiq_cfg_dir == NULL); - return debugfs_info.vchiq_cfg_dir; -} - #else /* CONFIG_DEBUG_FS */ void vchiq_debugfs_init(void)