Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp71712lqh; Fri, 3 May 2024 13:49:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVDaWNciwxYiD1NRZ6r8EySqQ20QprWv0o/lrYKiyQCmyeq0diDN2pjRiPPrJkJibds8vBrGIDcH0tzA3eYK9KvE+PfwTLT6Da17uSX0A== X-Google-Smtp-Source: AGHT+IGe6LXzBqJlS2723cC9AUFjFULMaw0qUW4JjgCI11wkm4wpHu4qQ3rIucr8pzm3+lMDEoAs X-Received: by 2002:ad4:5746:0:b0:6a0:cd3e:aeb3 with SMTP id q6-20020ad45746000000b006a0cd3eaeb3mr4549445qvx.32.1714769360078; Fri, 03 May 2024 13:49:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714769360; cv=pass; d=google.com; s=arc-20160816; b=0LAAK2TSIUGvrW6UqI13+KbYKJh0uYRH7Wu/imYmHqqDXOrBeATlM5j64qcHXlg9Zp zS8+YdMh2qcw3deSh1QWbopHa/1c7fPBBA/WniicSWMbjFSP76OKLCjIsUgRc3SbHilR DGf6iIj6Ahp1q/XTvvbCFUlh1L3UWrEaL425oyU2Jmqn9EdQQJjUmUzRUEFLOExrvQYb bHcKJFaJulgix+WXAUMoq7rqmZIiLB3oW/TaXobpvQHt4fNkFLOPdR1v7xejjErPJ4Gk ln8+FXx3neZPoq6xRH710I7QkdgjS5sedJeHyqwmD4VftsHDGLV/YVJTEFJBLP6fr2vs qwZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:subject:cc:to:from:date:dkim-signature; bh=IMiaHemqYmkOneNc58jWwhXUGk1kwrHwn4QK0FdM6sI=; fh=PbaX4+WlPiDRDuH5nFrHaeRfFkFHQgCqZTbdmK/VaH4=; b=pS0WYDS1NmqG/Yujt6pAX4zSF5m8YtPk9efYFb7V0BDMhRHYE7FYMad2yXmFqcPxPi egWvql+5+yMoRBYyRVwKcQ2sTpHsj/DXkGQ0YhZ2VdoyrguQzR65EiltqGFDKLtt+Io6 5neeX5VS8j/rwI/z18vIEBUlqkipXafcjk6+0dcFRndwKvj9kt8JTEeULzo282/jaMTy JgpjCbxbFRR91NLubYBJjnQOcIPL2qsOyMfPygva8NFFh0RkLFh23eDuRKStN4okDFUu K1ziaZL7W5KVx1x3LQEBR2C3Nl2R9nYz229y645P4hpheLjKXokYn9m2rUonJuJv4vrn t79g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCLqlcw1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n9-20020a0ce949000000b006a0cd406409si3591351qvo.130.2024.05.03.13.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 13:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCLqlcw1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168203-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C4A591C2319E for ; Fri, 3 May 2024 20:49:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B6722EB1D; Fri, 3 May 2024 20:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PCLqlcw1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A932E22F08; Fri, 3 May 2024 20:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714769352; cv=none; b=rb8s5zg93vqvZ9i0dmuwxjjtUc0cxs7IuWOWTDvoBbxE4KXkCZXcqZkrE4lt+TiNvWLGotE3te55RZFflAE0+0KrJuF1Yg8n2FKJDkgHgRHJN3ViAgcMW5k4U3JTJ0EAheSBPN4s31lZojA/mwgg74tWalRvMsa2Gs1i17ySGbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714769352; c=relaxed/simple; bh=4z4NtWY+hIBBvVSonfOpc0dCyguz5kR/ln02LAqO7i8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=A4495SAP2MXuf48RkJmNyOjOSWMDRD3LSCPBcl2gb0fAWahcU5UuwrNI30gEur/hQSqQ7oRm+RD9m1ua/SNeO1badmI1gcoN3yyx4W7w8UBCx0/OIlrMgApERWS8QtlWB+5sl1Mj0i8GByBxF8L1r3EBINzYw1SsLGQH0zzadN0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PCLqlcw1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13FF2C116B1; Fri, 3 May 2024 20:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714769352; bh=4z4NtWY+hIBBvVSonfOpc0dCyguz5kR/ln02LAqO7i8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=PCLqlcw1FWL4kOhGFRycyOYpLX+ttTyqaOE25GfI0xotfk34b3K3JfcC4/dOUGJr9 ln80Mx4sfraJGJquu6Xl/WEeBLUSPm5O6s+ui8sBgaj1v9JnH8NhJdKwgZNp0Q+hmc QiQRC/t3q8WyOkVIZnJQ6D/A+Nb5O9BWJqN+msRNInnI+/KlcgR15xIXMnJCpK6edd tBx1XtZgk2TDBdu6sAiY4i00m9olO198PwOEa+88ERGStkkk/ArL1fV1jNO4OV+Wrq rFqwVBI7kbPMifmoKiA6Yy/VDbOsHn5LipANxhLX0nuf/BVYpeLZlva+8j2UvlKVlw Ca9rZBHfXiptw== Date: Fri, 3 May 2024 15:49:10 -0500 From: Bjorn Helgaas To: Ilpo =?utf-8?B?SsOkcnZpbmVu?= Cc: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Igor Mammedov , Lukas Wunner , Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH v2 2/7] resource: Rename find_resource() to find_empty_resource_slot() Message-ID: <20240503204910.GA1602543@bhelgaas> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231228165707.3447-3-ilpo.jarvinen@linux.intel.com> On Thu, Dec 28, 2023 at 06:57:02PM +0200, Ilpo Järvinen wrote: > Rename find_resource() to find_empty_resource_slot() 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. I wonder if "find_resource_space()" or "find_available_resource()" would be better than "_slot"? "Slot" *is* already used a few times in kernel/resource.c, but in most cases I think it refers to a "resource", and find_resource() basically returns a filled-in struct resource. And of course "slot" suggests something entirely different in the PCI context. > Signed-off-by: Ilpo Järvinen > Reviewed-by: Andy Shevchenko > --- > kernel/resource.c | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/kernel/resource.c b/kernel/resource.c > index 866ef3663a0b..94f67005e1e2 100644 > --- a/kernel/resource.c > +++ b/kernel/resource.c > @@ -574,10 +574,9 @@ static void resource_clip(struct resource *res, resource_size_t min, > * Find empty slot 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_empty_resource_slot(struct resource *root, struct resource *old, > + struct resource *new, resource_size_t size, > + struct resource_constraint *constraint) > { > struct resource *this = root->child; > struct resource tmp = *new, avail, alloc; > @@ -633,11 +632,11 @@ next: if (!this || this->end == root->end) > /* > * Find empty slot 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_empty_resource_slot(struct resource *root, struct resource *new, > + resource_size_t size, > + struct resource_constraint *constraint) > { > - return __find_resource(root, NULL, new, size, constraint); > + return __find_empty_resource_slot(root, NULL, new, size, constraint); > } > > /** > @@ -660,7 +659,7 @@ static int reallocate_resource(struct resource *root, struct resource *old, > > write_lock(&resource_lock); > > - if ((err = __find_resource(root, old, &new, newsize, constraint))) > + if ((err = __find_empty_resource_slot(root, old, &new, newsize, constraint))) > goto out; > > if (resource_contains(&new, old)) { > @@ -729,7 +728,7 @@ int allocate_resource(struct resource *root, struct resource *new, > } > > write_lock(&resource_lock); > - err = find_resource(root, new, size, &constraint); > + err = find_empty_resource_slot(root, new, size, &constraint); > if (err >= 0 && __request_resource(root, new)) > err = -EBUSY; > write_unlock(&resource_lock); > -- > 2.30.2 >