From patchwork Wed Jun 22 17:06:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12891171 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 83EF8CCA481 for ; Wed, 22 Jun 2022 17:06:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0A1B6B00CE; Wed, 22 Jun 2022 13:06:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE0788E00CF; Wed, 22 Jun 2022 13:06:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C4E8E00D0; Wed, 22 Jun 2022 13:06:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 799A76B00CF for ; Wed, 22 Jun 2022 13:06:52 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5560E35545 for ; Wed, 22 Jun 2022 17:06:52 +0000 (UTC) X-FDA: 79606501464.01.6393F53 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id 8B4C52002E for ; Wed, 22 Jun 2022 17:06:49 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LSqWf3RNkzkWdH; Thu, 23 Jun 2022 01:05:18 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 01:06:30 +0800 From: Miaohe Lin To: CC: , , , , , Subject: [PATCH 08/16] mm/huge_memory: use helper macro __ATTR_RW Date: Thu, 23 Jun 2022 01:06:19 +0800 Message-ID: <20220622170627.19786-9-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622170627.19786-1-linmiaohe@huawei.com> References: <20220622170627.19786-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655917609; a=rsa-sha256; cv=none; b=FjmNAJNDVVSEIcR/i0kQOE0BMLSuf7LREQUZ+qF0TvOxMlcSuuzPcuhZjXg52BVG50IMyt s+vzhmK8mm+eiKrSvjL5PaN716uVgNmsvXGlTBW4gfIECIN0RjnsUgYBMRLUvzcIL/y+DD diFhaQR1WOFcbbLgAFHQbqS5TBz1us4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655917609; 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:in-reply-to:references:references; bh=hPUX9Bq8a4whXwu7GKQhlUA6u4LpqfBMx0BTcDOlgKQ=; b=nHNi3GkOhxUmczsBaLw/hu3yozSWKQ5vSWv41hNBWKc1kMw+HlbyCu7TqzdOxjHj8BaVY6 VYIF2pZydu/YP70CyNoKa0J+PBmzgVX931WbrD1VYZoJdfHB3MGHKj1zoLz77ZVOs5hKqN EhFvnBNPkWYpQ6kxssc59MR6JK01upw= X-Rspamd-Queue-Id: 8B4C52002E X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam03 X-Stat-Signature: i9x6dz65x3ue1z6t8gerafk4g1axxq4u X-HE-Tag: 1655917609-952391 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 helper macro __ATTR_RW to define use_zero_page_attr, defrag_attr and enabled_attr to make code more clear. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/huge_memory.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 7cfa003b1789..b42c8fa51e46 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -273,8 +273,8 @@ static ssize_t enabled_store(struct kobject *kobj, } return ret; } -static struct kobj_attribute enabled_attr = - __ATTR(enabled, 0644, enabled_show, enabled_store); + +static struct kobj_attribute enabled_attr = __ATTR_RW(enabled); ssize_t single_hugepage_flag_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf, @@ -363,8 +363,7 @@ static ssize_t defrag_store(struct kobject *kobj, return count; } -static struct kobj_attribute defrag_attr = - __ATTR(defrag, 0644, defrag_show, defrag_store); +static struct kobj_attribute defrag_attr = __ATTR_RW(defrag); static ssize_t use_zero_page_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -378,8 +377,7 @@ static ssize_t use_zero_page_store(struct kobject *kobj, return single_hugepage_flag_store(kobj, attr, buf, count, TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG); } -static struct kobj_attribute use_zero_page_attr = - __ATTR(use_zero_page, 0644, use_zero_page_show, use_zero_page_store); +static struct kobj_attribute use_zero_page_attr = __ATTR_RW(use_zero_page); static ssize_t hpage_pmd_size_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)