From patchwork Sat Dec 1 15:58:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10707737 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 E0B0114E2 for ; Sat, 1 Dec 2018 15:58:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEB352C4D0 for ; Sat, 1 Dec 2018 15:58:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0E442C4DB; Sat, 1 Dec 2018 15:58:42 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 682CE2C4D0 for ; Sat, 1 Dec 2018 15:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbeLBDLb (ORCPT ); Sat, 1 Dec 2018 22:11:31 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36756 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726887AbeLBDLa (ORCPT ); Sat, 1 Dec 2018 22:11:30 -0500 Received: by mail-pl1-f195.google.com with SMTP id g9so4310686plo.3; Sat, 01 Dec 2018 07:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6Nlkx8dqzw9t0rvZXiELgUJGbtAVvFRbbQ2v5ajcc78=; b=X7tm5DosNXhQu/yEC2gwRz1Lv+XUZCNZYRGMv8/Q/xG2/aSDfh95mNhoo7LYU4PANp fLTORTmfXhpJLkgO+B+mfihePdnt4B8Jfehebeio/ttlTm6+0crtCcnfd7S0t9d3jJOw fQnH8173Cd0GTVFBkbET+RcAIfVXC+hCGdk1KKLZeqYwdiUtOM53Mij7KN7d+nOHtblQ My2/AOgOSW/uW+zAlLBWtuBwEVRUWVOKeZpgBzKy6PLonAgenkiqTIveJBJARmeLgGpC 17O6HA4Z8VzqfBcgKdVXC72RG+qZaje/d0Gd20uV3XlAMKpSGa8KS6ZA1olH7a7u9fLZ 8VSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6Nlkx8dqzw9t0rvZXiELgUJGbtAVvFRbbQ2v5ajcc78=; b=nI8BPlj00wKyIZUYiOCesclGQHEsuM8/2gVlPOdd0NDl5OOx7qZwliYHP6cS+FNIzQ fg4qbQjrIVeeLN8TeqK4lFMT0gUgTn4R723m+2IIfXzMwFiVcpna3r/2Um8cgQ0Nwn0A Ls6tLrx+XKQaxvXoW05xqdneqxrpbMn/WAY2Vp/j4fcp30PBuOCbz9k6g64n+My/LcOM u5urhr6UMpYagN2YnGWPZ1lcrbAemIUVWyATinO2sZXD6jI7hWblN28HdCvXN7UL8/6p ftloOe2YRh+cpLdLaZaVPutgW6zW/q2bYiAuFmc//nI/QfIGhF5pzx4T2i0Usua03WT2 Kcag== X-Gm-Message-State: AA+aEWYvrts2pJSrk4IzNGA19SaZDQ6T+9uQToOh/3S3dkswlosSbDWI DYIdio4UPwNeIIY/yH/xEaE= X-Google-Smtp-Source: AFSGD/Uhxex80TRguECaTbW/cu27VqKD1+5rdP0AOz8MHiSAO1pbXhE/YGbAAJdHzWubIzvEq8Eqqg== X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr9568283pll.33.1543679921293; Sat, 01 Dec 2018 07:58:41 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id x19sm14504083pfk.14.2018.12.01.07.58.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Dec 2018 07:58:40 -0800 (PST) From: Yangtao Li To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] remoteproc: convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 1 Dec 2018 10:58:38 -0500 Message-Id: <20181201155838.8619-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li --- drivers/remoteproc/remoteproc_debugfs.c | 28 ++++--------------------- 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index e90135c64af0..f936c2e485ac 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c @@ -240,17 +240,7 @@ static int rproc_rsc_table_show(struct seq_file *seq, void *p) return 0; } -static int rproc_rsc_table_open(struct inode *inode, struct file *file) -{ - return single_open(file, rproc_rsc_table_show, inode->i_private); -} - -static const struct file_operations rproc_rsc_table_ops = { - .open = rproc_rsc_table_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(rproc_rsc_table); /* Expose carveout content via debugfs */ static int rproc_carveouts_show(struct seq_file *seq, void *p) @@ -270,17 +260,7 @@ static int rproc_carveouts_show(struct seq_file *seq, void *p) return 0; } -static int rproc_carveouts_open(struct inode *inode, struct file *file) -{ - return single_open(file, rproc_carveouts_show, inode->i_private); -} - -static const struct file_operations rproc_carveouts_ops = { - .open = rproc_carveouts_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(rproc_carveouts); void rproc_remove_trace_file(struct dentry *tfile) { @@ -326,9 +306,9 @@ void rproc_create_debug_dir(struct rproc *rproc) debugfs_create_file("recovery", 0400, rproc->dbg_dir, rproc, &rproc_recovery_ops); debugfs_create_file("resource_table", 0400, rproc->dbg_dir, - rproc, &rproc_rsc_table_ops); + rproc, &rproc_rsc_table_fops); debugfs_create_file("carveout_memories", 0400, rproc->dbg_dir, - rproc, &rproc_carveouts_ops); + rproc, &rproc_carveouts_fops); } void __init rproc_init_debugfs(void)