From patchwork Sun Jun 19 12:31:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Krause X-Patchwork-Id: 9186121 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 BDBD3601C0 for ; Sun, 19 Jun 2016 12:32:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD15125E13 for ; Sun, 19 Jun 2016 12:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A14CC2821F; Sun, 19 Jun 2016 12:32:27 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1633025E13 for ; Sun, 19 Jun 2016 12:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751786AbcFSMb7 (ORCPT ); Sun, 19 Jun 2016 08:31:59 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35964 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751744AbcFSMb5 (ORCPT ); Sun, 19 Jun 2016 08:31:57 -0400 Received: by mail-wm0-f67.google.com with SMTP id c82so4915740wme.3 for ; Sun, 19 Jun 2016 05:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3QRSets1aK2trG3B2LIf3P6iclTRtSmeMKVnOQyMZZc=; b=Q+HQ0G5X6ll2L/yEcnRhkAh/lGHRAD4TcigUdVwG6zJ6ryfu2gxoxvs47BZ+0iGvDB n1YYeqoGYN5ceeVYJodE2qtphrUVYVAcZKp43kD/4ihCtjFetZf9wGKXukxi9v4gd8uS wwHh+SxMI+UhDhKwk9mInVVaZDZ2dBR3kVsrtlqZ5ZsRafRt49ZI4geiucrBow4vUmEB N7Gnyf68vqPydhnrdvvqPdhH3eY8ZXTH2dIlKrJewxpsfKYOmYM44aRocSriTxPiTwGA pkao8gZ7HPnTlXC5whytH9MCGGmtN1bRlpufUq6N0/rmwQjDy0Tc+Ja9SpqIJOf3kJWG DYKw== 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=3QRSets1aK2trG3B2LIf3P6iclTRtSmeMKVnOQyMZZc=; b=OPQ/eeBh/3CdwujSW0wSL26gAsNc1s2mbIraUdnhI7CkHy/vioBrzRxrPrNYOUWZus qe6GxR8VZkBdplNSBg27J2Jlj4t2zTh8hKWimPhdm9yi9qC+jWLO/wQjbrLJDZsRjo2d k2XCwUjVpOypRMX0+y2JEMOH2fJWWvliMCfSWlYRY0pyVRLZfoVIwfD3QME2gWk0Y+YP ufcugy/T5omB9Bbi/PdkeQd/+Kx1U0vtV1rMdaMBK/qEJRebuzTn+reRbfDmpVmYu16W tloutN1/ZFkes+O/tQH1UgFBZM6/FhD9lXMkbBbvsTtuOseUrZNUPdDA5I0D5p1CBYNk dHNA== X-Gm-Message-State: ALyK8tJWywg8AQtEIs7Tt83mAOOQoZFiZhhKYocFT19aVAXa6B2DZDRpZaC36tt1oTyg5w== X-Received: by 10.194.23.7 with SMTP id i7mr11006203wjf.57.1466339515677; Sun, 19 Jun 2016 05:31:55 -0700 (PDT) Received: from jig.fritz.box ([84.179.22.43]) by smtp.gmail.com with ESMTPSA id g3sm58348678wjb.47.2016.06.19.05.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2016 05:31:55 -0700 (PDT) From: Mathias Krause To: Sumit Semwal Cc: Brad Spengler , PaX Team , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Mathias Krause , Daniel Vetter Subject: [PATCH 3/3] dma-buf: remove dma_buf_debugfs_create_file() Date: Sun, 19 Jun 2016 14:31:31 +0200 Message-Id: <1466339491-12639-4-git-send-email-minipli@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1466339491-12639-1-git-send-email-minipli@googlemail.com> References: <1466339491-12639-1-git-send-email-minipli@googlemail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is only a single user of dma_buf_debugfs_create_file() and that one got the function pointer cast wrong. With that one fixed, there is no need to have a wrapper for debugfs_create_file(), just call it directly. With no users left, we can remove dma_buf_debugfs_create_file(). While at it, simplify the error handling in dma_buf_init_debugfs() slightly. Signed-off-by: Mathias Krause Cc: Sumit Semwal Cc: Daniel Vetter Reviewed-by: Daniel Vetter --- drivers/dma-buf/dma-buf.c | 29 +++++++++-------------------- include/linux/dma-buf.h | 2 -- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index f03e51561199..20ce0687b111 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -895,22 +895,22 @@ static struct dentry *dma_buf_debugfs_dir; static int dma_buf_init_debugfs(void) { + struct dentry *d; int err = 0; - dma_buf_debugfs_dir = debugfs_create_dir("dma_buf", NULL); + d = debugfs_create_dir("dma_buf", NULL); + if (IS_ERR(d)) + return PTR_ERR(d); - if (IS_ERR(dma_buf_debugfs_dir)) { - err = PTR_ERR(dma_buf_debugfs_dir); - dma_buf_debugfs_dir = NULL; - return err; - } + dma_buf_debugfs_dir = d; - err = dma_buf_debugfs_create_file("bufinfo", NULL); - - if (err) { + d = debugfs_create_file("bufinfo", S_IRUGO, dma_buf_debugfs_dir, + NULL, &dma_buf_debug_fops); + if (IS_ERR(d)) { pr_debug("dma_buf: debugfs: failed to create node bufinfo\n"); debugfs_remove_recursive(dma_buf_debugfs_dir); dma_buf_debugfs_dir = NULL; + err = PTR_ERR(d); } return err; @@ -921,17 +921,6 @@ static void dma_buf_uninit_debugfs(void) if (dma_buf_debugfs_dir) debugfs_remove_recursive(dma_buf_debugfs_dir); } - -int dma_buf_debugfs_create_file(const char *name, - int (*write)(struct seq_file *)) -{ - struct dentry *d; - - d = debugfs_create_file(name, S_IRUGO, dma_buf_debugfs_dir, - write, &dma_buf_debug_fops); - - return PTR_ERR_OR_ZERO(d); -} #else static inline int dma_buf_init_debugfs(void) { diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 4551c6f2a6c4..e0b0741ae671 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -242,6 +242,4 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); -int dma_buf_debugfs_create_file(const char *name, - int (*write)(struct seq_file *)); #endif /* __DMA_BUF_H__ */