From nobody Fri Apr 3 06:46:19 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D721ECAAD8 for ; Thu, 15 Sep 2022 01:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbiIOByg (ORCPT ); Wed, 14 Sep 2022 21:54:36 -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: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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, v= oid *v) return 0; } =20 -static const struct seq_operations memtype_seq_ops =3D { +static const struct seq_operations memtype_sops =3D { .start =3D memtype_seq_start, .next =3D memtype_seq_next, .stop =3D memtype_seq_stop, .show =3D 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 =3D { - .open =3D memtype_seq_open, - .read =3D seq_read, - .llseek =3D seq_lseek, - .release =3D seq_release, -}; +DEFINE_SEQ_ATTRIBUTE(memtype); =20 static int __init pat_memtype_list_init(void) { --=20 2.25.1