From patchwork Mon Jul 4 13:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12905358 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 0B1D3C433EF for ; Mon, 4 Jul 2022 13:22:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E83B16B007D; Mon, 4 Jul 2022 09:22:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E34646B0074; Mon, 4 Jul 2022 09:22:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D23796B007D; Mon, 4 Jul 2022 09:22:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C24116B0073 for ; Mon, 4 Jul 2022 09:22:17 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9DB4E20F1D for ; Mon, 4 Jul 2022 13:22:17 +0000 (UTC) X-FDA: 79649481114.10.94E3657 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf02.hostedemail.com (Postfix) with ESMTP id 0520380007 for ; Mon, 4 Jul 2022 13:22:16 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Lc5wb4tZ9zTgWf; Mon, 4 Jul 2022 21:18:39 +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; Mon, 4 Jul 2022 21:22:13 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v3 08/16] mm/huge_memory: use helper macro __ATTR_RW Date: Mon, 4 Jul 2022 21:21:53 +0800 Message-ID: <20220704132201.14611-9-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220704132201.14611-1-linmiaohe@huawei.com> References: <20220704132201.14611-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656940937; 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=h0X/V0UQZzOrze5BIj8/NRARUbv/n4PYKXGDWAstF68=; b=vJrk1iMY1FH3Jr/AMu15W3SPQhi5BEgAwyQ8icU9c9daRFUK/j3j+IymaE8sibCXHW+wkt kgHobw1ZpnEcFspF3aySJKiZO8zq/sYtQYWo+dC3PozOF1gVserl/vgr95CpUC82csG49p Oanwq8kg3Ls6YPaHQJHwMhevjmB5dTs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656940937; a=rsa-sha256; cv=none; b=yDJ0aZ1FdAAPVw3iASLAGgpereBc8M/PEggfum0me9bbSD1b3Ucc1jH9lmTgbaVDId2jtF jIKQWDVW4/ufgeyzTwcLpDorkeRnM4B8usHfNslFnPEVVWOUoLRM+Pq98d47YjN/ulghst DB+TPxOcnG1TiBaB5kdoZVcyuGQp1po= X-Rspam-User: X-Rspamd-Queue-Id: 0520380007 Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: kj4tt1145uupnxsrobqcgy4ph3ichmmp X-Rspamd-Server: rspam08 X-HE-Tag: 1656940936-825811 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 5f5123130b28..32a45a1e98b7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -277,8 +277,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, @@ -367,8 +367,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) @@ -382,8 +381,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)