Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp611964pxv; Thu, 8 Jul 2021 09:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOPalbIgtaevTYsAA5xFsC3uF8DCc71fWL/wxQREgxc9QBn5kiO64hiw9vwVm/5hlYy/CK X-Received: by 2002:a02:cc73:: with SMTP id j19mr27389970jaq.121.1625763088942; Thu, 08 Jul 2021 09:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625763088; cv=none; d=google.com; s=arc-20160816; b=VHc8gKx+/cVVuKOl0+CeoZfxVM8zAdQwW6RHtIdFVCW/Ht0vcJiEbg7ob3hgD4g/fs zn3r7YWC2gKhOdtKpIAnhq61yYyadjnDzXvBKQ42IDoPdmbaO+ufqUh/J6PvDNXoQReU WpjE5M/+oCbsmpapG/KR3nMf4BzdkP2mZZ6lh62WQeuWwvdnNGWoigu0S5+UuqVrcOj6 Fo0L+xMST1sVL+h8j+A7Wqd/yKpJxNUaoPolDJSpeRJZh3wZCiVN9lpelJHAGPTe9Kx9 9dFF5zIaGCr5SI3QE+aH1EqjgSvaqX16T3He8/wJ5qT1lEjKLrjXYemmpL5ADFZ6yBdb ygbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=EN2kBRf03uRDWhZX+BIGmNUaha54UWtK3L/3mvDqub0=; b=X34lwyajBOBM5CPCcPie5W8lcCoTnrPt0A29jt1l6VRKRs3lIzmk2KqXBDnqJB7ot7 Nc5y58QsYz0kVd2a3KPFbLmW/uoSaGY7cd7GIIGfYaHTRy/OceR6mxbkOhYYZUn7Pg7a zx080W8lymS2iOL8op6nkdiDQEq2qZSnyIJ3SPJky8Mr5eooKoUlv7/a9H+f/fmVhxN1 cqI7+poLFhGoRs6eV+ilikC1HtyZx0V7sFPHUEMbZ9nv2Qv+sYPq5W8nBaIuR+sPzwA5 B3Pog5177gVciq5u1Ok6zr+RCm2PC4rdtKyMowMpJPg15UQW50NKASK7An3++4rLQwY5 5cRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si2648484jat.99.2021.07.08.09.51.17; Thu, 08 Jul 2021 09:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229779AbhGHQw0 (ORCPT + 99 others); Thu, 8 Jul 2021 12:52:26 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:13208 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbhGHQwZ (ORCPT ); Thu, 8 Jul 2021 12:52:25 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4GLMhh611TzBF30; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r1TlggcMUpku; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4GLMhh56LjzBF2R; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A57348B801; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id FRg5FVR7RJ2G; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) Received: from po9473vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 68F408B7E3; Thu, 8 Jul 2021 18:49:40 +0200 (CEST) Received: by po9473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 3C273663A2; Thu, 8 Jul 2021 16:49:40 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH v4 1/4] powerpc/ptdump: Use DEFINE_SHOW_ATTRIBUTE() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 8 Jul 2021 16:49:40 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE() instead of open coding open() and fops. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/ptdump/bats.c | 14 ++------------ arch/powerpc/mm/ptdump/hashpagetable.c | 12 +----------- arch/powerpc/mm/ptdump/ptdump.c | 13 +------------ arch/powerpc/mm/ptdump/segment_regs.c | 12 +----------- 4 files changed, 5 insertions(+), 46 deletions(-) diff --git a/arch/powerpc/mm/ptdump/bats.c b/arch/powerpc/mm/ptdump/bats.c index c4c628b03cf8..4ed3418f07d9 100644 --- a/arch/powerpc/mm/ptdump/bats.c +++ b/arch/powerpc/mm/ptdump/bats.c @@ -57,7 +57,7 @@ static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, bool #define BAT_SHOW_603(_m, _n, _l, _u, _d) bat_show_603(_m, _n, mfspr(_l), mfspr(_u), _d) -static int bats_show_603(struct seq_file *m, void *v) +static int bats_show(struct seq_file *m, void *v) { seq_puts(m, "---[ Instruction Block Address Translation ]---\n"); @@ -88,17 +88,7 @@ static int bats_show_603(struct seq_file *m, void *v) return 0; } -static int bats_open(struct inode *inode, struct file *file) -{ - return single_open(file, bats_show_603, NULL); -} - -static const struct file_operations bats_fops = { - .open = bats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(bats); static int __init bats_init(void) { diff --git a/arch/powerpc/mm/ptdump/hashpagetable.c b/arch/powerpc/mm/ptdump/hashpagetable.c index ad6df9a2e7c8..c7f824d294b2 100644 --- a/arch/powerpc/mm/ptdump/hashpagetable.c +++ b/arch/powerpc/mm/ptdump/hashpagetable.c @@ -526,17 +526,7 @@ static int ptdump_show(struct seq_file *m, void *v) return 0; } -static int ptdump_open(struct inode *inode, struct file *file) -{ - return single_open(file, ptdump_show, NULL); -} - -static const struct file_operations ptdump_fops = { - .open = ptdump_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(ptdump); static int ptdump_init(void) { diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index 5062c58b1e5b..349fd8fe173f 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -397,18 +397,7 @@ static int ptdump_show(struct seq_file *m, void *v) return 0; } - -static int ptdump_open(struct inode *inode, struct file *file) -{ - return single_open(file, ptdump_show, NULL); -} - -static const struct file_operations ptdump_fops = { - .open = ptdump_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(ptdump); static void build_pgtable_complete_mask(void) { diff --git a/arch/powerpc/mm/ptdump/segment_regs.c b/arch/powerpc/mm/ptdump/segment_regs.c index 565048a0c9be..3054944d3d7e 100644 --- a/arch/powerpc/mm/ptdump/segment_regs.c +++ b/arch/powerpc/mm/ptdump/segment_regs.c @@ -41,17 +41,7 @@ static int sr_show(struct seq_file *m, void *v) return 0; } -static int sr_open(struct inode *inode, struct file *file) -{ - return single_open(file, sr_show, NULL); -} - -static const struct file_operations sr_fops = { - .open = sr_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(sr); static int __init sr_init(void) { -- 2.25.0