Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1060237ybh; Thu, 16 Jul 2020 01:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDhgesYtzA+i6EqtxpTEDZnkmpMGmtjzuPa2mxO5k2nPYz5bh+wozW0NS2p9kzosH9D0G7 X-Received: by 2002:a05:6402:2067:: with SMTP id bd7mr3416987edb.143.1594889750830; Thu, 16 Jul 2020 01:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594889750; cv=none; d=google.com; s=arc-20160816; b=0QlWJf2wAHrDqo3CrDtgI3apxzxBsAlvg8I3F+ZhTeNDMd06o7RQYtbFQhLYtD94GU MhDMHGRY0tqk4rxFbqfDOZo+D7jkyzznHd25omj4aa2ruHWZn7pv8nOZ9NeUxeMbRUq7 KGD/fehxIWdNKlc+DRkFD9iIRQnir0JWZXp1f2o9FlFBPdzeaLvwHtDtiLfeTNnkkGps YtnWImnI1WhU7Pnigws9IWmM0bNQa1f7JYFr71g6Mvshuf3TV1BXAnKcbI+n7CmwcgeC dXH+hrcvCtsVHGOWSWEvp6mNRd8c3PaNzANBGipiwJR0PD47hk+BRRfCgP/GWjmUkb2d Pv/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=A9mFXqpVrawlqt/fp0PJ8lBhrdaJ18ztOW1YdP+RmBk=; b=nnxV1tWU9Qp5lb31bkxD0PNBqxZLrn//DBCe+nEXpPI4wNPNe3h/7HbsjLiEDdB7bt UkRNM9XKHxNjzg1hNri1FlbHA9tr5zX1cbs8UDKcH7BxuBMLkIzZndJhtdelVmHDkQvS pzOfoy1wH8n4KN21QSki5L70PDZ9LyDJq27cT6A6taQS04QJE7cB81c89ODoMdX+Pq4I q6cnqWOCnYYSxiYKyI56r8Ve4Vo0u83FZwl39yXnjOc1sYprZnbP+XO66h/prm3ipyl6 1IzoMpWVD/I8l9+Iy/B8+dMvj5s3KrCGhmDq2k26yBk/JuC2vI8jh6T3z0Hgh1wqZ5bn GOyw== 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 y17si2724047ejk.677.2020.07.16.01.55.28; Thu, 16 Jul 2020 01:55:50 -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 S1726224AbgGPIyo (ORCPT + 99 others); Thu, 16 Jul 2020 04:54:44 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:7759 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726013AbgGPIyn (ORCPT ); Thu, 16 Jul 2020 04:54:43 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 398F9A10BBD81C6EFCED; Thu, 16 Jul 2020 16:54:42 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Thu, 16 Jul 2020 16:54:40 +0800 From: Qinglang Miao To: Greg Kroah-Hartman , Tony Luck , Borislav Petkov CC: , Subject: [PATCH -next] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Date: Thu, 16 Jul 2020 16:58:34 +0800 Message-ID: <20200716085834.11484-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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Liu Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yongqiang Liu --- drivers/ras/cec.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index a992bb426..ed47b59e4 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -435,7 +435,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(action_threshold_ops, u64_get, action_threshold_set, "% static const char * const bins[] = { "00", "01", "10", "11" }; -static int array_dump(struct seq_file *m, void *v) +static int array_show(struct seq_file *m, void *v) { struct ce_array *ca = &ce_arr; int i; @@ -467,18 +467,7 @@ static int array_dump(struct seq_file *m, void *v) return 0; } -static int array_open(struct inode *inode, struct file *filp) -{ - return single_open(filp, array_dump, NULL); -} - -static const struct file_operations array_ops = { - .owner = THIS_MODULE, - .open = array_open, - .read_iter = seq_read_iter, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(array); static int __init create_debugfs_nodes(void) { @@ -513,7 +502,7 @@ static int __init create_debugfs_nodes(void) goto err; } - array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_ops); + array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops); if (!array) { pr_warn("Error creating array debugfs node!\n"); goto err; -- 2.17.1