Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp35731pxk; Tue, 15 Sep 2020 19:31:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7F/m9x5lG9qawXrLkSjJE/xJ1lSLbHEoVPDyw8KZ9l4RSCBHltzMv9iDAltCiPFjxorn+ X-Received: by 2002:a17:906:1b04:: with SMTP id o4mr24041468ejg.332.1600223485684; Tue, 15 Sep 2020 19:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600223485; cv=none; d=google.com; s=arc-20160816; b=V7qOE5BaWNKnXGVR7wApFuxN8ynoNyusEq58IDD/Aaw77a5F7POuBZWu+oWqbnlmYE r0K/JJ9fJDE3ryvQZbdTImvqHOO7foyhkNtkOO70n5Z/zt41ifY75c1+5ZQnpsmVhNyU hHb9zABUps6/vWKYRvEu8EIL8nkOY5t2jC61TM7L6FU5mThjDWjHYiW4xvuOH8KL/ycE R/iz4Gl1XGpCPUe2FQ1lqlvjbh5sDZyf21DOVdm/hXEfOd1HkMlOOPwiJtteblocgs4p BZAYzlegsuJb9ptaPStEjvd/Oqc0dc1Ch2SSGXFwuC4KMgFPL7IC3QZyvXslQZqkUQ7y n/Ng== 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=yKU24jIssWDUAj/Wp1gVy8Et3U9+W7xMVcvf8kaONZg=; b=I3l+Rvv5/wpb4p7qKiG1xrw03V56Ewo4YAfB6foSfWqYFxB/g6wUkzNf+XbzsjR0ZC wfitloAj8wZygBXm8dw/yu/2Cc1qsUKfhmFotq/a29wm7ZAuI1FX4/lpHtlfAvCACWYp Bq3aQ2GIPMnIK1fPMcpYvki9XIsKxYWRoU/7Gs5kIHg15JksgpTbHAN0IQZDUzZmoQcp ErqXE2Y63+Z4inBOoL/npZQIROWwOyLCUUQnIKZXJRf0MfRi3VpCAcmeLtWvXkqF3Xxh tvLRJwpCuDNaY6Jdb1dPbJhpbS1FvGRgSIJoBjs5Leahwd567ga6n5eJ9wIg7frLEwuD +rig== 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 x23si10233452ejj.642.2020.09.15.19.31.03; Tue, 15 Sep 2020 19:31:25 -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 S1726553AbgIPC3b (ORCPT + 99 others); Tue, 15 Sep 2020 22:29:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12295 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726361AbgIPC14 (ORCPT ); Tue, 15 Sep 2020 22:27:56 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7CF0623DB4BD9E1241FC; Wed, 16 Sep 2020 10:27:50 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Wed, 16 Sep 2020 10:27:44 +0800 From: Liu Shixin To: Alexei Starovoitov , Josef Bacik CC: , Liu Shixin Subject: [PATCH -next] error-injection: convert to use DEFINE_SEQ_ATTRIBUTE macro Date: Wed, 16 Sep 2020 10:50:20 +0800 Message-ID: <20200916025020.3992523-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Liu Shixin --- lib/error-inject.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/error-inject.c b/lib/error-inject.c index aa63751c916f..a93103488fdd 100644 --- a/lib/error-inject.c +++ b/lib/error-inject.c @@ -194,24 +194,14 @@ static int ei_seq_show(struct seq_file *m, void *v) return 0; } -static const struct seq_operations ei_seq_ops = { +static const struct seq_operations ei_sops = { .start = ei_seq_start, .next = ei_seq_next, .stop = ei_seq_stop, .show = ei_seq_show, }; -static int ei_open(struct inode *inode, struct file *filp) -{ - return seq_open(filp, &ei_seq_ops); -} - -static const struct file_operations debugfs_ei_ops = { - .open = ei_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; +DEFINE_SEQ_ATTRIBUTE(ei); static int __init ei_debugfs_init(void) { @@ -221,7 +211,7 @@ static int __init ei_debugfs_init(void) if (!dir) return -ENOMEM; - file = debugfs_create_file("list", 0444, dir, NULL, &debugfs_ei_ops); + file = debugfs_create_file("list", 0444, dir, NULL, &ei_fops); if (!file) { debugfs_remove(dir); return -ENOMEM; -- 2.25.1