From patchwork Mon Nov 5 23:30:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 10669427 X-Patchwork-Delegate: agross@codeaurora.org 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 79E951751 for ; Mon, 5 Nov 2018 23:31:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70BE62A009 for ; Mon, 5 Nov 2018 23:31:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F19A2A012; Mon, 5 Nov 2018 23:31:17 +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 BA0B12A00E for ; Mon, 5 Nov 2018 23:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725852AbeKFIx0 (ORCPT ); Tue, 6 Nov 2018 03:53:26 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:55560 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbeKFIx0 (ORCPT ); Tue, 6 Nov 2018 03:53:26 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E618861678; Mon, 5 Nov 2018 23:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541460675; bh=D0qUA0Q9EQrPIvnSExC9KJS8VDS2/RcoMURqBMxEbL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjVZPGKfkM5zYgc8dndvYog0PVfwei6V33dlddxJ+vuOwnhcsH2dA+sbdC2cBP6Nj Ym3Yjv693kQMR7jjZz8G9yo1385gJcdB/PTs6pcGe/WZD2Ua8qHjYdO85b3JN9hOHT bn9LODLxJ/fZ8e3CDKQbBOR0zR4Rjs/7ML3eGg1A= 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 5219C61672; Mon, 5 Nov 2018 23:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1541460670; bh=D0qUA0Q9EQrPIvnSExC9KJS8VDS2/RcoMURqBMxEbL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EN0KixdbC0RpxL319aKvzSFk17u4W0akLv42WlcTTYY6AD8os3Qw8XiUkBDV0H20d fiv5oySE88WcVzL6dYBzVbQc/as8wyWF6mpWpWrYu0KmXeCGCyqOdbz4q8JyAMHvgE YzGahkoxbeRer3CQw3xiikDKXXElya5lkqMRKJBg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5219C61672 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, seanpaul@chromium.org, abhinavk@codeaurora.org, dri-devel@lists.freedesktop.org, bzwang@chromium.org, sam@ravnborg.org Subject: [PATCH 02/11] drm/msm/dpu: Use DEFINE_SHOW_ATTRIBUTE Date: Mon, 5 Nov 2018 16:30:54 -0700 Message-Id: <20181105233103.7657-3-jcrouse@codeaurora.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181105233103.7657-1-jcrouse@codeaurora.org> References: <20181105233103.7657-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. v2: Added a cleanup for dpu_encoder.c too Signed-off-by: Jordan Crouse Reviewed-by: Sean Paul --- 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_encoder.c | 20 +++--------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 34 +++----------------- 4 files changed, 14 insertions(+), 85 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 ed84cf44a222..11052bee03cf 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_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d5e252941ba8..5559e5d40142 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1836,7 +1836,7 @@ void dpu_encoder_prepare_commit(struct drm_encoder *drm_enc) } #ifdef CONFIG_DEBUG_FS -static int _dpu_encoder_status_show(struct seq_file *s, void *data) +static int dpu_encoder_status_show(struct seq_file *s, void *data) { struct dpu_encoder_virt *dpu_enc; int i; @@ -1875,11 +1875,7 @@ static int _dpu_encoder_status_show(struct seq_file *s, void *data) return 0; } -static int _dpu_encoder_debugfs_status_open(struct inode *inode, - struct file *file) -{ - return single_open(file, _dpu_encoder_status_show, inode->i_private); -} +DEFINE_SHOW_ATTRIBUTE(dpu_encoder_status); static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) { @@ -1887,14 +1883,6 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) struct msm_drm_private *priv; struct dpu_kms *dpu_kms; int i; - - static const struct file_operations debugfs_status_fops = { - .open = _dpu_encoder_debugfs_status_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, - }; - char name[DPU_NAME_SIZE]; if (!drm_enc || !drm_enc->dev || !drm_enc->dev->dev_private) { @@ -1915,8 +1903,8 @@ static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) return -ENOMEM; /* don't error check these */ - debugfs_create_file("status", 0600, - dpu_enc->debugfs_root, dpu_enc, &debugfs_status_fops); + debugfs_create_file("status", 0600, dpu_enc->debugfs_root, dpu_enc, + &dpu_encoder_status_fops); for (i = 0; i < dpu_enc->num_phys_encs; i++) if (dpu_enc->phys_encs[i] && 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)