From patchwork Thu Oct 18 19:58:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10647989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37D7D112B for ; Thu, 18 Oct 2018 19:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29C6B28E6D for ; Thu, 18 Oct 2018 19:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DE8328E85; Thu, 18 Oct 2018 19:58:56 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 84BCE28E6D for ; Thu, 18 Oct 2018 19:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727126AbeJSEB3 (ORCPT ); Fri, 19 Oct 2018 00:01:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33506 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725139AbeJSEB3 (ORCPT ); Fri, 19 Oct 2018 00:01:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0C0186132B; Thu, 18 Oct 2018 19:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539892733; bh=OvK4gz57oCeFDkRgtF7VU0zMwHD/i4flB82jk56CPYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EonCz96C5s7gE0u7I6WLYfmRWFda22JiHkrQOl/+HJLjnH8fGsfOnw/i7gSB3P54s nsp5kWs9UOH0ZHoTGeKgtyA5zQURiFVSUKHmy1wgpW7OmPqJR9mmFUbCEg5D/NUE4U vda8nq9ngzmfNnMum7FRY692dtZ6eo8zn/o/g8P4= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7980960913; Thu, 18 Oct 2018 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539892729; bh=OvK4gz57oCeFDkRgtF7VU0zMwHD/i4flB82jk56CPYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hsYVyufGVzApCOqRFS25PWQM2JQTRzGyCs8nlIGNSAY/ZOT9Q4kyGJeeHCxoClk3H TGuPUXYvSBY9va99OwvluF6ysvkumgueQ7V5kfDVTDho3ld6lfnlesIPxWHKwSmQaA OvsfVLqEJm3Qjfu94SW1CpflyyWz+i986J1ok0r8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7980960913 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, seanpaul@chromium.org, abhinavk@codeaurora.org Subject: [PATCH 02/11] drm/msm/dpu: Use DEFINE_SHOW_ATTRIBUTE Date: Thu, 18 Oct 2018 13:58:27 -0600 Message-Id: <20181018195836.15885-3-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181018195836.15885-1-jcrouse@codeaurora.org> References: <20181018195836.15885-1-jcrouse@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the standard DEFINE_SHOW_ATTRIBUTE macro for seq_file based debugfs files instead of custom macros and hand-coded functions. Signed-off-by: Jordan Crouse Reviewed-by: Bruce Wang --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 14 +------- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 31 +++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 34 +++----------------- 3 files changed, 10 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index 879c13fe74e0..7607aac9449c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -299,18 +299,6 @@ static void dpu_disable_all_irqs(struct dpu_kms *dpu_kms) } #ifdef CONFIG_DEBUG_FS -#define DEFINE_DPU_DEBUGFS_SEQ_FOPS(__prefix) \ -static int __prefix ## _open(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, __prefix ## _show, inode->i_private); \ -} \ -static const struct file_operations __prefix ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __prefix ## _open, \ - .release = single_release, \ - .read = seq_read, \ - .llseek = seq_lseek, \ -} static int dpu_debugfs_core_irq_show(struct seq_file *s, void *v) { @@ -341,7 +329,7 @@ static int dpu_debugfs_core_irq_show(struct seq_file *s, void *v) return 0; } -DEFINE_DPU_DEBUGFS_SEQ_FOPS(dpu_debugfs_core_irq); +DEFINE_SHOW_ATTRIBUTE(dpu_debugfs_core_irq); int dpu_debugfs_core_irq_init(struct dpu_kms *dpu_kms, struct dentry *parent) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index ae63590ad2d3..fb923c0c4171 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1232,7 +1232,7 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) } #ifdef CONFIG_DEBUG_FS -static int _dpu_debugfs_status_show(struct seq_file *s, void *data) +static int dpu_crtc_debugfs_status_show(struct seq_file *s, void *data) { struct dpu_crtc *dpu_crtc; struct dpu_plane_state *pstate = NULL; @@ -1351,23 +1351,7 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) return 0; } -static int _dpu_debugfs_status_open(struct inode *inode, struct file *file) -{ - return single_open(file, _dpu_debugfs_status_show, inode->i_private); -} - -#define DEFINE_DPU_DEBUGFS_SEQ_FOPS(__prefix) \ -static int __prefix ## _open(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, __prefix ## _show, inode->i_private); \ -} \ -static const struct file_operations __prefix ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __prefix ## _open, \ - .release = single_release, \ - .read = seq_read, \ - .llseek = seq_lseek, \ -} +DEFINE_SHOW_ATTRIBUTE(dpu_crtc_debugfs_status); static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) { @@ -1391,20 +1375,13 @@ static int dpu_crtc_debugfs_state_show(struct seq_file *s, void *v) return 0; } -DEFINE_DPU_DEBUGFS_SEQ_FOPS(dpu_crtc_debugfs_state); +DEFINE_SHOW_ATTRIBUTE(dpu_crtc_debugfs_state); static int _dpu_crtc_init_debugfs(struct drm_crtc *crtc) { struct dpu_crtc *dpu_crtc; struct dpu_kms *dpu_kms; - static const struct file_operations debugfs_status_fops = { - .open = _dpu_debugfs_status_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - }; - if (!crtc) return -EINVAL; dpu_crtc = to_dpu_crtc(crtc); @@ -1419,7 +1396,7 @@ static int _dpu_crtc_init_debugfs(struct drm_crtc *crtc) /* don't error check these */ debugfs_create_file("status", 0400, dpu_crtc->debugfs_root, - dpu_crtc, &debugfs_status_fops); + dpu_crtc, &dpu_crtc_debugfs_status_fops); debugfs_create_file("state", 0600, dpu_crtc->debugfs_root, &dpu_crtc->base, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index fd5bad16338d..7e3ba128cbaf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -113,30 +113,17 @@ static int _dpu_danger_signal_status(struct seq_file *s, return 0; } -#define DEFINE_DPU_DEBUGFS_SEQ_FOPS(__prefix) \ -static int __prefix ## _open(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, __prefix ## _show, inode->i_private); \ -} \ -static const struct file_operations __prefix ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __prefix ## _open, \ - .release = single_release, \ - .read = seq_read, \ - .llseek = seq_lseek, \ -} - static int dpu_debugfs_danger_stats_show(struct seq_file *s, void *v) { return _dpu_danger_signal_status(s, true); } -DEFINE_DPU_DEBUGFS_SEQ_FOPS(dpu_debugfs_danger_stats); +DEFINE_SHOW_ATTRIBUTE(dpu_debugfs_danger_stats); static int dpu_debugfs_safe_stats_show(struct seq_file *s, void *v) { return _dpu_danger_signal_status(s, false); } -DEFINE_DPU_DEBUGFS_SEQ_FOPS(dpu_debugfs_safe_stats); +DEFINE_SHOW_ATTRIBUTE(dpu_debugfs_safe_stats); static void dpu_debugfs_danger_destroy(struct dpu_kms *dpu_kms) { @@ -162,7 +149,7 @@ static int dpu_debugfs_danger_init(struct dpu_kms *dpu_kms, return 0; } -static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data) +static int dpu_debugfs_regset32_show(struct seq_file *s, void *data) { struct dpu_debugfs_regset32 *regset; struct dpu_kms *dpu_kms; @@ -212,18 +199,7 @@ static int _dpu_debugfs_show_regset32(struct seq_file *s, void *data) return 0; } -static int dpu_debugfs_open_regset32(struct inode *inode, - struct file *file) -{ - return single_open(file, _dpu_debugfs_show_regset32, inode->i_private); -} - -static const struct file_operations dpu_fops_regset32 = { - .open = dpu_debugfs_open_regset32, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(dpu_debugfs_regset32); void dpu_debugfs_setup_regset32(struct dpu_debugfs_regset32 *regset, uint32_t offset, uint32_t length, struct dpu_kms *dpu_kms) @@ -245,7 +221,7 @@ void *dpu_debugfs_create_regset32(const char *name, umode_t mode, regset->offset = round_down(regset->offset, 4); return debugfs_create_file(name, mode, parent, - regset, &dpu_fops_regset32); + regset, &dpu_debugfs_regset32_fops); } static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)