Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1643864pxk; Fri, 18 Sep 2020 19:54:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOQNoFxoP58FVsJ7uWojcQt7OoWRhNmClbZ/j2FGPhFGe+91+7/opkcndEUfKxfX0o95lR X-Received: by 2002:a05:6402:b64:: with SMTP id cb4mr41837627edb.25.1600484068017; Fri, 18 Sep 2020 19:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600484068; cv=none; d=google.com; s=arc-20160816; b=HODEsuQz5aX+WBpRQAWJw1WEd6U8Em3B0cf0vtkNlf+eoj+fMujOx2tI06I01jOE4F Z279saLLFMv2SMIWaZSHY/c/Oi1jFRXeNnZ68pyHxMLNjm0P7ipwQ7J4P8np0naBUkrw 9H9hjqCF69jytD8ok07Csy4GVdkG3Z6I1YCGKiUbsO6Wj0+dNNLXt/Vccv1ZWdM1CFUj Tf/ChPtou2UGbkRhBKF1xEraBr27U70z+kKKOmktB8lmSHsgw4EZSxcPRFGt5LlLQqvS m6y/GJr+EbAdBIXf0vRe7W7tGiNV7FwwFhsOGtavKwWcWpxgRoI3CuEnqwKeWXBPtUd/ coVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=K2PEA0Odsa78XdnpXRzmsJlQ668etzU3qcxRxrwAoRA=; b=oShXjiQ+St74ani8xnExHehssi2F/4zJBXelwE+bdX1CQLh7fZeRCqP+Km1wTYRcWk 5glRCxW0exyQMPeIpvbzhAY/3Ej2oJzZNXNZz63LXxGXZxgUOpzq+Q+K+X7W4pKcvcim OU1YgqmfN0ijX+DahOl5P1eO/9C7ivQbd8TJrchTGq0jcr4kaUuT5RRUUBxsjGCdobsB nMlpo10cQ+IKKciJri3GWVqGvmGg/lg6A9/crV1SjcSu++twh1eNTFtTwCYheRm/1CFV GOr3piMvOK+V3tRvmnlyR+kYMdVbcYuSC6LjG1WCF8IdpXYOdaAhte3RD9Q135jOxEd/ ImHg== 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 pw3si2614954ejb.249.2020.09.18.19.54.04; Fri, 18 Sep 2020 19:54: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 S1726493AbgISCwH (ORCPT + 99 others); Fri, 18 Sep 2020 22:52:07 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13716 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726393AbgISCvm (ORCPT ); Fri, 18 Sep 2020 22:51:42 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1BCBB63CA26479BB4EDA; Sat, 19 Sep 2020 10:51:41 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 10:51:33 +0800 From: Qinglang Miao To: Yoshinori Sato , Rich Felker CC: , , Qinglang Miao Subject: [PATCH -next v2] sh: mm: Convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 19 Sep 2020 10:52:05 +0800 Message-ID: <20200919025205.17667-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao --- v2: based on linux-next(20200917), and can be applied to mainline cleanly now. arch/sh/mm/asids-debugfs.c | 15 ++------------- arch/sh/mm/cache-debugfs.c | 15 ++------------- arch/sh/mm/pmb.c | 15 ++------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c index 4c1ca197e..d16d6f5ec 100644 --- a/arch/sh/mm/asids-debugfs.c +++ b/arch/sh/mm/asids-debugfs.c @@ -26,7 +26,7 @@ #include #include -static int asids_seq_show(struct seq_file *file, void *iter) +static int asids_debugfs_show(struct seq_file *file, void *iter) { struct task_struct *p; @@ -48,18 +48,7 @@ static int asids_seq_show(struct seq_file *file, void *iter) return 0; } -static int asids_debugfs_open(struct inode *inode, struct file *file) -{ - return single_open(file, asids_seq_show, inode->i_private); -} - -static const struct file_operations asids_debugfs_fops = { - .owner = THIS_MODULE, - .open = asids_debugfs_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(asids_debugfs); static int __init asids_debugfs_init(void) { diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c index 17d780794..b0f185169 100644 --- a/arch/sh/mm/cache-debugfs.c +++ b/arch/sh/mm/cache-debugfs.c @@ -22,7 +22,7 @@ enum cache_type { CACHE_TYPE_UNIFIED, }; -static int cache_seq_show(struct seq_file *file, void *iter) +static int cache_debugfs_show(struct seq_file *file, void *iter) { unsigned int cache_type = (unsigned int)file->private; struct cache_info *cache; @@ -94,18 +94,7 @@ static int cache_seq_show(struct seq_file *file, void *iter) return 0; } -static int cache_debugfs_open(struct inode *inode, struct file *file) -{ - return single_open(file, cache_seq_show, inode->i_private); -} - -static const struct file_operations cache_debugfs_fops = { - .owner = THIS_MODULE, - .open = cache_debugfs_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(cache_debugfs); static int __init cache_debugfs_init(void) { diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c index b20aba6e1..68eb7cc6e 100644 --- a/arch/sh/mm/pmb.c +++ b/arch/sh/mm/pmb.c @@ -812,7 +812,7 @@ bool __in_29bit_mode(void) return (__raw_readl(PMB_PASCR) & PASCR_SE) == 0; } -static int pmb_seq_show(struct seq_file *file, void *iter) +static int pmb_debugfs_show(struct seq_file *file, void *iter) { int i; @@ -846,18 +846,7 @@ static int pmb_seq_show(struct seq_file *file, void *iter) return 0; } -static int pmb_debugfs_open(struct inode *inode, struct file *file) -{ - return single_open(file, pmb_seq_show, NULL); -} - -static const struct file_operations pmb_debugfs_fops = { - .owner = THIS_MODULE, - .open = pmb_debugfs_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(pmb_debugfs); static int __init pmb_debugfs_init(void) { -- 2.23.0