From patchwork Thu Dec 28 16:57:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 183782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2111084dyb; Thu, 28 Dec 2023 08:58:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmGIVXqz0jJMZYXHeuUSi1r6yib0pCjj6D2lGZ32Fim0fm4vq3dSVWS/dno35fBRv39WQK X-Received: by 2002:a17:902:d54f:b0:1d4:cae:99f9 with SMTP id z15-20020a170902d54f00b001d40cae99f9mr13828713plf.45.1703782689919; Thu, 28 Dec 2023 08:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703782689; cv=none; d=google.com; s=arc-20160816; b=KY2iG4wsm5g+gVGeD1M/bGfbR2HtxdacG+mZZCafs1kIryWvKwX2SkBezq6ug4+WBV Hr8W7iSw3Sc1T668PCJ2EtweFI12grummqv7JsF0UOCGiEn5q+ALYnmzrG6V1zNC0L6e vSA2zA+qxgpWtkJIHeXI9pvfntRpOG9kihmBI2LHg1b+BFVf0qu81oNrXzVbBL1uDENW H0GO5JpaT6Cwdcd/mi3fkJEMLypust0db6VmolL0tCB+O7dj9GNUJ5C4lkzPad8AqT2u IZLfnVQIw8yE7UqgwU4GgikSzzteJGKFIYsyAL15SQDAlF+YbhjcPLYgFELLjacITYuM arHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=p9jfYFTEcttKAzc7BbMxJVC4A/Zj4Ex60Lt7w1Pm8Gs=; fh=PcD3BSy+jXPLqmuWAB6/T4RIeSGGA+Y8ZhhYuWNsC8A=; b=nAgshoRHrlgcFTMe4lFP0Cqdl8QsbGQO0S8Kc8Ef6+KXgzymeFGUttxcMVwDXEt8Cq chR6a65AYNFtJcAAq8uU1eJNw2GlJ0s/h9yRi2Sk8IRr4VbnlkvRyzaHSn0kFnWvz101 hO+p/zP+pDCVpt9TXxubb3fijlCcgPYVGnfr/Xb2rNl6N9/wq+aGP4s7sMVurMlf2E8T j5ImvlSwr9822NOlKsRu8jdRuxQLTwx3zQkKLrCiOLDeEhGL6g14AGt0hIsyGgHfM5oJ yWgIsePQuQCQYPaiJc/uF4f2eu8mzKiMC/jnrvVMmDUqikWp0ERAFS9VGKBsKZiQOS6z MuCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cmlibASN; spf=pass (google.com: domain of linux-kernel+bounces-12789-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z16-20020a170903019000b001d364196057si10645735plg.486.2023.12.28.08.58.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 08:58:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12789-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cmlibASN; spf=pass (google.com: domain of linux-kernel+bounces-12789-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 958C6285CEA for ; Thu, 28 Dec 2023 16:58:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 322D9101F1; Thu, 28 Dec 2023 16:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cmlibASN" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) (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 4A03C101C6; Thu, 28 Dec 2023 16:57:44 +0000 (UTC) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703782664; x=1735318664; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7uBBW2FH+XAQ1x3ggNOvzbi3Xo6RF4TvkDUO9/8j5q4=; b=cmlibASNgSruc0ZrVsS+c8wXITzrUabQq3V91lmySIFPUdOSs7liZsZU cfjX+3x7WlNVZ9v0P3YxBaFpVZtmsi9TZNRx+RBr5PscQJskvMx3rOypX NN8oNimpLTS2rmwGdDze2dmlg3zaoTucl5EABFdEijlUULFVP9h/DN2ir wZvDsrEqhe1MY6C2Q/wOwTIsyXb4/b9ooF799/zfhtlooFln7nI0Bz/E4 WuVzripYdM8oscoYP+zcihT1ZxlBThIAX6/+eTL71GFMSpv8uFd9c0zi3 I8vQ7nbqiFg5Vboa29i9mYM1MKCIm24eYUXxQ4WwJhDTx8rXn54jXkj5z g==; X-IronPort-AV: E=McAfee;i="6600,9927,10937"; a="381536596" X-IronPort-AV: E=Sophos;i="6.04,312,1695711600"; d="scan'208";a="381536596" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 08:57:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10937"; a="844488473" X-IronPort-AV: E=Sophos;i="6.04,312,1695711600"; d="scan'208";a="844488473" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.94.250.171]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 08:57:39 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Igor Mammedov , Lukas Wunner , Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Subject: [PATCH v2 2/7] resource: Rename find_resource() to find_empty_resource_slot() Date: Thu, 28 Dec 2023 18:57:02 +0200 Message-Id: <20231228165707.3447-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231228165707.3447-1-ilpo.jarvinen@linux.intel.com> References: <20231228165707.3447-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786545638191780640 X-GMAIL-MSGID: 1786545638191780640 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. 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);