Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1644966rwn; Fri, 9 Sep 2022 01:32:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4CmJ5iJthooHNsCl7cUVb5NioLQJGnSYgRK0T5pYb6VIsr/1RVqC3ToN/eeXuDVsqvJe27 X-Received: by 2002:a05:651c:222c:b0:25f:e654:36e3 with SMTP id y44-20020a05651c222c00b0025fe65436e3mr3443872ljq.20.1662712321314; Fri, 09 Sep 2022 01:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662712321; cv=none; d=google.com; s=arc-20160816; b=LxfLSjY5nujIf9+iFjQJgdf1mO4RB8iv6MZqCoZJrzxiCguCaUmKVIcDg7XrT505S7 DjVMtdFsBCKUfFrotfzb5RcrymOTWXc6vr1p26q7VmaqWH5vksv4MmStiFqltHh9AUS3 k5Hd3gtc8ZuciY4Vx5ruDS1aYa9emoG4hrmgYV29yIl9W2h/MZkBDEwAjJ0c5ZeRPY9Q uvHY1vTpk/1oCcczbwwqSMKTG7dXZ6G+FpwllrZBRu9bC0/LUD7/YKcES5M4ZwwehfBn rkd/JbddetGJR0Nn2wBvCK/djY0aXzBT2x9gvTJr9gCdBb+H+QhZADssYKz4NvcyNxI2 er3Q== 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=t/XrLnh9dZBSEhabXVViw2WefuZ4HcX2J79lqIU8v8k=; b=by8c0cRV7T3hmK39FjR8HofY/muULFxu4M8zvQ05Tyz173oOsI/tlYanMkf9PzGqI7 x52t7H1l4vOcHBY8CKfybrJyZOKTnvS5VVR6YCfEqUIXF/A8LUTfExqbSfF3gkQ3O3GB V2/6XrDfp/5pzMNEI27R8liVr+aaadoTwHj6p+otAkHWKYxgxIhrFhiZvDiP/29TZQ8N Isggk0jZfSKQ4jtVwr3vpG7TYC0KajFt+j4PAcgIj8gJs+E4wxIEDO7tsjKAqRBM5LqR loVTncWpbup5XPEOxr+LV1QroAnRVgFpp+RFZD6qmpsNTnX6lnLIqblbyRxrc3MQvrER Xe2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e18-20020a2e8192000000b0026be1030c78si518930ljg.437.2022.09.09.01.31.31; Fri, 09 Sep 2022 01:32:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229455AbiIIH6u (ORCPT + 99 others); Fri, 9 Sep 2022 03:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231597AbiIIH6e (ORCPT ); Fri, 9 Sep 2022 03:58:34 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2409D11B029 for ; Fri, 9 Sep 2022 00:57:33 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SEQ_ATTRIBUTE helper macro to simplify the code. Signed-off-by: Liu Shixin --- 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) { -- 2.25.1