From patchwork Wed Oct 19 00:13:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13011221 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 E7A6DC4332F for ; Wed, 19 Oct 2022 00:13:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2479B6B0080; Tue, 18 Oct 2022 20:13:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F9A26B0082; Tue, 18 Oct 2022 20:13:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEFE36B0085; Tue, 18 Oct 2022 20:13:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C49BF6B0080 for ; Tue, 18 Oct 2022 20:13:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A0A5C1A0596 for ; Wed, 19 Oct 2022 00:13:29 +0000 (UTC) X-FDA: 80035774938.11.68BD6FC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id 36F6B40031 for ; Wed, 19 Oct 2022 00:13:28 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 86A796172E; Wed, 19 Oct 2022 00:13:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03394C43143; Wed, 19 Oct 2022 00:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666138407; bh=ujSci3Jr9yWO8XdHXzr/zi1RpAlYDD3yaad0xsGDwtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqdDiFtCwIgZRauAibxFTY0xxMT21TP4sJWBZxuoXVCoBeOE/nUzDBSSKb/XDoolr H3hSh8l2G2xHPvF3K1Wcf/Yi8+zX88kHSAj0bc242eWmBspKXRxucRxMtRSqYKPaBY N7ahcK87QvjxtfusnABfcZ9nQcZ26u5nJwi/zxHvzTVOEwG/ojX+OKcnQvvrBwJcIy ONFBk8PmkaL3RjDbJCO5g051DKHayZL1Dvf4OMRKr7MITxJqMFNs+NBnLq39y3EXRE ZAeuYmtbGwiRmVaFB1xLiL9jy1IALkSv5U4bZxSHeqVVV22jSTGHSc0ToUcdMWPjFa n6IBUKynEQUGA== From: SeongJae Park To: SeongJae Park , Andrew Morton Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 08/18] mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc() Date: Wed, 19 Oct 2022 00:13:07 +0000 Message-Id: <20221019001317.104270-9-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019001317.104270-1-sj@kernel.org> References: <20221019001317.104270-1-sj@kernel.org> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666138408; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=03ly8U/KAwHOuI8XWF1KHkMMfsjMuz58ZNQJDMju10o=; b=FAPJO24xWZtqVqeSyQiX/IYQclDCP4MeOWnqhkPqXgRWctJVIxg0tVCLBggQSVYHSiMErN VxRjjQPPZ1ONesqEbw1sgmaDQbkgquTJyk5yorUcyntcu2jRyXJbXldmG6wXRmIVyWzeWq JM93TVueRvnNc+9yswRhRWzGAG8IsY4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jqdDiFtC; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666138408; a=rsa-sha256; cv=none; b=D7weJO+DZBrRjjo5OBD92hc3BUFESfna7GEraFHz8abE1Ovg4Jr9u8Rb50EBShNvC0Zz3b gYyspySWwcL/9o4Skyuk6AonWaAQ2fG5tYk7vSszJMGJPbfy2u6Bk/3NGNvLXcgJEdiGo6 mCFkO8IC54XWxgjN+UcDGy9kGMY5o8w= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 36F6B40031 X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jqdDiFtC; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: j1wtt5ki7o4kao9exzwrets4ewbre8fd X-HE-Tag: 1666138408-688591 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: 'damon_sysfs_region_alloc()' is always called with zero-filled 'struct damon_addr_range', because the start and end addresses should set by users. Remove unnecessary parameters of the function and simplify the body by using 'kzalloc()'. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index b9183063bfea..e8bd7367d15b 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1065,17 +1065,9 @@ struct damon_sysfs_region { struct damon_addr_range ar; }; -static struct damon_sysfs_region *damon_sysfs_region_alloc( - struct damon_addr_range ar) +static struct damon_sysfs_region *damon_sysfs_region_alloc(void) { - struct damon_sysfs_region *region = kmalloc(sizeof(*region), - GFP_KERNEL); - - if (!region) - return NULL; - region->kobj = (struct kobject){}; - region->ar = ar; - return region; + return kzalloc(sizeof(struct damon_sysfs_region), GFP_KERNEL); } static ssize_t start_show(struct kobject *kobj, struct kobj_attribute *attr, @@ -1184,7 +1176,7 @@ static int damon_sysfs_regions_add_dirs(struct damon_sysfs_regions *regions, regions->regions_arr = regions_arr; for (i = 0; i < nr_regions; i++) { - region = damon_sysfs_region_alloc((struct damon_addr_range){}); + region = damon_sysfs_region_alloc(); if (!region) { damon_sysfs_regions_rm_dirs(regions); return -ENOMEM;