From nobody Tue Sep 30 22:41:31 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72ABF14EC4D; Tue, 7 May 2024 10:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077564; cv=none; b=l4sTgQCdJvtgXluO0gG6nT63V7pQtU9F0qAv5u+2HLS0NST0IqlUSBPCv9+193ZJWSJBt2FlTxtqGyXeWka7VjrCDKm5UJCSsHMMYK7VICoNwgTMJ/APkHvTGDAdiLtOugInKgk5wmaiAmbkhXGtTTFv+IumrNFSAccqYGsw0lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715077564; c=relaxed/simple; bh=W/1p5rLCE7EfDYekQAv2sivheXm6yRukXo8sDbl94r4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=X1LsJxdLETV/gQuLvI2aMmTG8eP8KDNtiam3DP+XMBj2t9oZqCtGJUCCeCNMaLwdI4QBm9ZT88PL1Mts+9e/5L24No/DRkS5ENuMz5cWpxJzBi1gcZiqzI2maJ6ha4PQc24N7AJ8bKGXiZp4WmXjqNHDeobKxITo3qxaw6oMIcY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CCqgXBSW; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CCqgXBSW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715077561; x=1746613561; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W/1p5rLCE7EfDYekQAv2sivheXm6yRukXo8sDbl94r4=; b=CCqgXBSWNnqpLmAmfEgx0ntx027cmcU/xgolEB7UyKfhBC/8YmATkrPn 3G1mQ7zTLYflEd9Y3FAJhCLcR/KKBfWIxmITSi+6t+6WhUllttBXmwl1J kZ/l2hXlPlTRbWxgk9lk+E6llYN32tvOUtvGCuXgtzjRCq26Sb8hOQhbe ifkt6j67IR9cu0MhP7bYpmcdBj3yA+gHbwf9ckUqNafDy1Yk6Odgg1EOM kGg3cHt91e7xtn0U7FPOpczLpb28rQrCN0QAJm36EF00k/wv3aeD/NjqA 57Kj9Px1yN4oZnl5D6Fxr1lMoVinOGD3PXxRkHHZkw2eyB4rGueMJhg1g g==; X-CSE-ConnectionGUID: FCVUeelfQZucYO9jy2tb/A== X-CSE-MsgGUID: L24ZPt+xRvS+tf1VYG83jA== X-IronPort-AV: E=McAfee;i="6600,9927,11065"; a="10746752" X-IronPort-AV: E=Sophos;i="6.07,261,1708416000"; d="scan'208";a="10746752" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 03:26:00 -0700 X-CSE-ConnectionGUID: izw6jrMIT2qzxXAzWAkc2A== X-CSE-MsgGUID: iIg+bEoTSIaBdp/zD8jIRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,261,1708416000"; d="scan'208";a="59647773" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.74]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2024 03:25:56 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Igor Mammedov , Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , Jonathan Cameron , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Lidong Wang , Andy Shevchenko Subject: [PATCH v3 2/8] resource: Rename find_resource() to find_resource_space() Date: Tue, 7 May 2024 13:25:17 +0300 Message-Id: <20240507102523.57320-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507102523.57320-1-ilpo.jarvinen@linux.intel.com> References: <20240507102523.57320-1-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Rename find_resource() to find_resource_space() to better describe what the functions does. This is a preparation for exposing it beyond resource.c which is needed by PCI core. Also rename the __ variant to match the names. Tested-by: Lidong Wang Signed-off-by: Ilpo J=C3=A4rvinen Reviewed-by: Andy Shevchenko Reviewed-by: Mika Westerberg --- kernel/resource.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/kernel/resource.c b/kernel/resource.c index fcbca39dbc45..e163e0a8f2f8 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -628,13 +628,12 @@ static void resource_clip(struct resource *res, resou= rce_size_t min, } =20 /* - * Find empty slot in the resource tree with the given range and + * Find empty space in the resource tree with the given range and * alignment constraints */ -static int __find_resource(struct resource *root, struct resource *old, - struct resource *new, - resource_size_t size, - struct resource_constraint *constraint) +static int __find_resource_space(struct resource *root, struct resource *o= ld, + struct resource *new, resource_size_t size, + struct resource_constraint *constraint) { struct resource *this =3D root->child; struct resource tmp =3D *new, avail, alloc; @@ -688,13 +687,13 @@ next: if (!this || this->end =3D=3D root->end) } =20 /* - * Find empty slot in the resource tree given range and alignment. + * Find empty space in the resource tree given range and alignment. */ -static int find_resource(struct resource *root, struct resource *new, - resource_size_t size, - struct resource_constraint *constraint) +static int find_resource_space(struct resource *root, struct resource *new, + resource_size_t size, + struct resource_constraint *constraint) { - return __find_resource(root, NULL, new, size, constraint); + return __find_resource_space(root, NULL, new, size, constraint); } =20 /** @@ -717,7 +716,7 @@ static int reallocate_resource(struct resource *root, s= truct resource *old, =20 write_lock(&resource_lock); =20 - if ((err =3D __find_resource(root, old, &new, newsize, constraint))) + if ((err =3D __find_resource_space(root, old, &new, newsize, constraint))) goto out; =20 if (resource_contains(&new, old)) { @@ -786,7 +785,7 @@ int allocate_resource(struct resource *root, struct res= ource *new, } =20 write_lock(&resource_lock); - err =3D find_resource(root, new, size, &constraint); + err =3D find_resource_space(root, new, size, &constraint); if (err >=3D 0 && __request_resource(root, new)) err =3D -EBUSY; write_unlock(&resource_lock); --=20 2.39.2