From patchwork Fri Dec 22 12:28:56 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: 182657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1025248dyi; Fri, 22 Dec 2023 04:30:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCaR+xxCsc0kiq85SMFvqS2md5rJJO0FihAXW+4z0/NXJxbIF9GBlGJw1kFKd/ZF53zzVE X-Received: by 2002:ad4:5963:0:b0:67f:2f17:e586 with SMTP id eq3-20020ad45963000000b0067f2f17e586mr1814873qvb.29.1703248219137; Fri, 22 Dec 2023 04:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703248219; cv=none; d=google.com; s=arc-20160816; b=QMfD+yvVeVxYOO6PCE8mqqjIeTC7gTokM/XN754u5/yklK3/zVAtxu9QbNWA0trG4M idLGlEdzlFiA8HO+1GopYfYr+s6J2cz+biypjDjdJMxrqbXRM77ON1DTNzbJ7ZJgNxS7 PTLonFSqqIkC3yJ84FsGqCcTL+ixC/Agtwwl8dR+hRNGMNMro0toXPUzRrIauBeLBE/+ eyC5aTQyzzay8z0Hp+ZTw+eOGFNm00ys0QervH4K83pvnfsdDaXD00o0EsYtkM4NwD5N /MSR1pG1mWbsB2+TizZFoSNMBW5mvz9momoidr3SVhj/uzLltSH5wdxNd/0YYi6QOuHX jEVA== 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=7E8yJdNIAjCM373VsAfPNBbwmjzSBgMf+0sKMRGWI7Y=; fh=yqUIIgKqVOYsTyZW6w8zcpjOuZt/iZwb7E0FG62Kafw=; b=xyrQy7t3GnRyueC0abLjx31Tfl2776EgMBokfTcuTOFuyyndj2G8oyKbexpTmSv+eN J2vdr7SWJCsuRlLQ23twHOkWr4o6+VTUvq2GoA9eXojT7wJSVG3H25C1udC8uq3+cULz 3Fq6TG4O3dlsYpCWMOWgMYyhpBZq8S4599Q2yBPLl3Xs8+3qWFaFkpRXRYqHp/eV8j/e qBPE8yj1paPPQ7ogI9kb4+r0bnJyuv8h2bXUaWEAu/G5EToZA/+4bnrYS31zvCLexwW5 sOdVB4el73Ju2kkYUeiW9gsPeEWQ24gqfomlviMOWVeEM+o0eWwBjCHD/MSCXdUTX1lP sdYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z6uTlkz8; spf=pass (google.com: domain of linux-kernel+bounces-9703-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9703-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r9-20020a0cb289000000b0067f94768e7bsi1516658qve.246.2023.12.22.04.30.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:30:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9703-ouuuleilei=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=@intel.com header.s=Intel header.b=Z6uTlkz8; spf=pass (google.com: domain of linux-kernel+bounces-9703-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9703-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E7E8D1C21A0B for ; Fri, 22 Dec 2023 12:30:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D9761C6B6; Fri, 22 Dec 2023 12:29:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Z6uTlkz8" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 52E9B18624; Fri, 22 Dec 2023 12:29:39 +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=1703248179; x=1734784179; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uopUxSQLxNwYXjsIbC+ClqKACsRbcTsdX+UmVSTtVOc=; b=Z6uTlkz8IxZ5uEJ+NrNTdjscP7v07R6PgYIsTQ5nClJX2uhJcTggcIWD JLE5giTh7LWP8g1VqlsD//WNokW03bSB6oVUfzP60/dHGHqXCsRXZJ16e iOJojXGbQLrdKfgVFy7bim7CMttIsDgOFrdloFLNHzale5hs60zHB1sEV /dItKDznMaVHHW2MjxEzCy3tV+Joo/Y4uNeLsdm34ZHOdJvPOJBwskyTw K7KKLEKrJQf8g7Zz9C/irq+BwqgHts5orfhe7E0jQZlj3ZraVJ+5VE8tO 7ohz6YXoFHKRAd9O3AhahwF6xtiOhNkXSi7tL98ZPYhmb3Q/zj14xyihS Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="3195395" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="3195395" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 04:29:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="950263959" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="950263959" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.94.248.105]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 04:29:33 -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?= Subject: [PATCH 2/7] resource: Rename find_resource() to find_empty_resource_slot() Date: Fri, 22 Dec 2023 14:28:56 +0200 Message-Id: <20231222122901.49538-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231222122901.49538-1-ilpo.jarvinen@linux.intel.com> References: <20231222122901.49538-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: 1785985204109446173 X-GMAIL-MSGID: 1785985204109446173 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);