From patchwork Fri Sep 9 08:31:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 12971206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B26ECAAA1 for ; Fri, 9 Sep 2022 07:57:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DAD680008; Fri, 9 Sep 2022 03:57:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38AD780007; Fri, 9 Sep 2022 03:57:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2794380008; Fri, 9 Sep 2022 03:57:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 17C6480007 for ; Fri, 9 Sep 2022 03:57:36 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E2152A03DF for ; Fri, 9 Sep 2022 07:57:35 +0000 (UTC) X-FDA: 79891792470.07.9732062 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf04.hostedemail.com (Postfix) with ESMTP id 5D1B34007C for ; Fri, 9 Sep 2022 07:57:35 +0000 (UTC) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MP7Zt5BqpzHnlH; Fri, 9 Sep 2022 15:55:34 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 9 Sep 2022 15:57:31 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 9 Sep 2022 15:57:30 +0800 From: Liu Shixin To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton CC: , , , Liu Shixin , "Kefeng Wang" Subject: [PATCH] mm: kfence: convert to DEFINE_SEQ_ATTRIBUTE Date: Fri, 9 Sep 2022 16:31:40 +0800 Message-ID: <20220909083140.3592919-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662710255; a=rsa-sha256; cv=none; b=2LsGZ3waarhKcwvCiWNVWdaIF6ah5HsvG3Hs2N8Dvr1Wf2xupapLEecwSLe6mMyXtPfmcW JvU4bS30oAd3q1f712GJFSWponbyUJGoxoqacngd/R4ERGMWTNuPwWKjygSbV/KqckzFh/ OBCxL0WsqXlFJJz7MmRN4zFoULr6mNI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662710255; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=t/XrLnh9dZBSEhabXVViw2WefuZ4HcX2J79lqIU8v8k=; b=mNQ9Qrx+1SzNKKVSlbtNpVAV8HwJTTCP1bVn1rmZtM9FRvI5+2iAE2rMPqDxNmoeaIMzJg Vmc34aWTldG3+KtyiPgIoLmVZ2+jmzb6TaN6r9FN8KVc8Jv6LRrSNaWiH6DJ/XHtG2bm6U jQ80YsaZBOCc+9xl2e3ZKlziRkweTyg= X-Rspamd-Queue-Id: 5D1B34007C Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=liushixin2@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: a6u9qsoc7jizhcm9868ypriin7xuqgo9 X-HE-Tag: 1662710255-363139 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use DEFINE_SEQ_ATTRIBUTE helper macro to simplify the code. Signed-off-by: Liu Shixin Reviewed-by: Marco Elver Tested-by: Marco Elver --- mm/kfence/core.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/mm/kfence/core.c b/mm/kfence/core.c index 8c08ae2101d7..26de62a51665 100644 --- a/mm/kfence/core.c +++ b/mm/kfence/core.c @@ -719,24 +719,13 @@ static int show_object(struct seq_file *seq, void *v) return 0; } -static const struct seq_operations object_seqops = { +static const struct seq_operations objects_sops = { .start = start_object, .next = next_object, .stop = stop_object, .show = show_object, }; - -static int open_objects(struct inode *inode, struct file *file) -{ - return seq_open(file, &object_seqops); -} - -static const struct file_operations objects_fops = { - .open = open_objects, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; +DEFINE_SEQ_ATTRIBUTE(objects); static int __init kfence_debugfs_init(void) {