Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp198569rwn; Wed, 14 Sep 2022 18:58:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR60MhGuJK2DF5/8TtnjkvzQK4a7M//DZLrklFOyty1bkKPcQIpNom+imDzXrtoB4smP222W X-Received: by 2002:a05:6402:350a:b0:44e:9da7:2afb with SMTP id b10-20020a056402350a00b0044e9da72afbmr33395560edd.290.1663207085555; Wed, 14 Sep 2022 18:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663207085; cv=none; d=google.com; s=arc-20160816; b=GjKEEQJrpi17/SsaaSMxeKQq5s5RsolJIuLEpAMKMV/MCDo0f3H+HpH9liEdIVC8Nc SYLOxaGlAcfdw3Cvm15GOQDGq3mAWPVsqQxlWSoUGtCNtkFI2V5NgFAcTt94zExeWrsg ETOcTYjXj2LZKTmvzJ98P1Ccvu9rxmO+w5TyJGR27estxWAySscFA5e4jU6guez+Iyv0 lRZAxya3C75kgcKdR9Zx0Db3Rv1+kye/G7iKmWdP2tvoK+xZgSw70Ex9gWOqlw+hpUGi vJJbxlEMzaGu5a4JYpeKPeRo5cOH8gRogfhuQiRXqOf2m0iUgsq06YezZoucz4KO4QZV Drng== 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=ivd8hZsfPgAtdHoJykga3GA/7hq6XXVlVZHjBDVZYqw=; b=otSJno2NMmkwLr4C4NRew3k55kNtbhFnI/FizCaSxekyUcbj9ThRpeh1aFUgMe0X9H q2Lfpsh9kpaF5SsDW2Z5SRPfczi1dW8LUlaz8O73VIHaSq4wgMvTBXrisM1d+xq7iz5D oklTGgaIxGShDMRvv7s1YMx7JVlyg3PTGcP/AIppe5W/66s1ceVju1VyiuvnPrc6eWnZ kRZO8+QiVzKWCgmK0ukZ3ObDdEmxcpO6OVa4ABQmILx4AnMxlkoJdBVv7eGrvyWTot15 yT/IHyK3H+uV9XQCII2Fxb2Dn3Vj8RijuyREyMqw2aYWYUNFW553iVyvZ0qGZc33/QKg II1A== 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 qf39-20020a1709077f2700b0077be3bbf25csi2069633ejc.166.2022.09.14.18.57.39; Wed, 14 Sep 2022 18:58:05 -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 S229683AbiIOByf (ORCPT + 99 others); Wed, 14 Sep 2022 21:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbiIOByd (ORCPT ); Wed, 14 Sep 2022 21:54:33 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 512A81168 for ; Wed, 14 Sep 2022 18:54:32 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MSgBv5FT3zlVmR; Thu, 15 Sep 2022 09:50:31 +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; Thu, 15 Sep 2022 09:54:30 +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; Thu, 15 Sep 2022 09:54:29 +0800 From: Liu Shixin To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , "H. Peter Anvin" CC: , Liu Shixin Subject: [PATCH] x86/mm/pat: use DEFINE_SEQ_ATTRIBUTE to simplify memtype Date: Thu, 15 Sep 2022 10:28:18 +0800 Message-ID: <20220915022818.3119304-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 --- arch/x86/mm/pat/memtype.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c index 66a209f7eb86..3cf4ec3701f6 100644 --- a/arch/x86/mm/pat/memtype.c +++ b/arch/x86/mm/pat/memtype.c @@ -1201,24 +1201,13 @@ static int memtype_seq_show(struct seq_file *seq, void *v) return 0; } -static const struct seq_operations memtype_seq_ops = { +static const struct seq_operations memtype_sops = { .start = memtype_seq_start, .next = memtype_seq_next, .stop = memtype_seq_stop, .show = memtype_seq_show, }; - -static int memtype_seq_open(struct inode *inode, struct file *file) -{ - return seq_open(file, &memtype_seq_ops); -} - -static const struct file_operations memtype_fops = { - .open = memtype_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, -}; +DEFINE_SEQ_ATTRIBUTE(memtype); static int __init pat_memtype_list_init(void) { -- 2.25.1