Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1610631pxk; Fri, 18 Sep 2020 18:24:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSO7qM/PmrNkjj6vmLyoqvPJ3NEbbURGNlWtoQQ+6lMMG8WNfOWITFJ4c150a5YwRFnrVK X-Received: by 2002:a17:906:1e11:: with SMTP id g17mr36840398ejj.298.1600478688578; Fri, 18 Sep 2020 18:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600478688; cv=none; d=google.com; s=arc-20160816; b=UMUNhB2nmUcP4qFVz89m/2woYe4RJWaanA5pHqnDRFaRCcVu+hTRHhQAaXRy0yBuHT qT4/HNV4hgdbRHkAgtS5lv4oTH5QcLQdV6Gc+EgPrAxOqtVTWKeLbZLSVWofnX3Jv+iT 9XukO7xSzF3jMak9Y1jsmeE/pIeqVtJg+U+hBKVStFGCqVeINpAVrv/MAKx3yRUINf1p W/snB7qePB29HFAWFMZZZBfrwVq5jcLsuFGZFt394u9hznvygU2W7jKajFKG/k0yYRPA bTjcv5v5QItu1OLNRmo30vhAUJjHLnyCwli8Ax45OwVFBX4eqTdy3kr0dXO9GJUvIiC8 NyLQ== 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=lrWEg6kWujVqGGOcWaV4EpUUwDZNpHTaW7gY60bBQs4=; b=0w8S9HP0H5M9KAzmjY7oJoJXBGfqSl3VcsXe3GI98Z91VnbuNjv32qTjI9tF6CThC2 gS7aU/vQeor3lpvKqY9aqauKUHV8ufuqF+x9Nm2poMBLP0yxfbm5JC+pXqfGHwv+KknL zHHGrfw2uNrhr8bC/SrkvZo04wGbaSlZz6lwSdmZJZigJ84SCok8FojkVHSEzz+UGWrH zSmFLdY9pZ1JvR3/53Fp2Yeb4CiNGNMug2xiInDu0ZbL08zbr476oTtjT38xBIk9ErWC UI1XxknFjkHtDfxBuXOu6kJ6/68zltA5Dq85CSbPbGyCPTsnqMXU9DmufpH3ORTmEoo9 C9Yw== 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 d20si3243373ejr.206.2020.09.18.18.24.25; Fri, 18 Sep 2020 18:24:48 -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 S1726267AbgISBWc (ORCPT + 99 others); Fri, 18 Sep 2020 21:22:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:50744 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726009AbgISBWb (ORCPT ); Fri, 18 Sep 2020 21:22:31 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 646C5DEA6396A4285BA7; Sat, 19 Sep 2020 09:22:30 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 09:22:21 +0800 From: Qinglang Miao To: Tony Luck , Borislav Petkov CC: , , "Qinglang Miao" Subject: [PATCH -next v2] RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE Date: Sat, 19 Sep 2020 09:22:52 +0800 Message-ID: <20200919012252.171437-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. 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 6939aa5b3..ddecf25b5 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 = seq_read, - .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.23.0