Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp761533rdb; Fri, 22 Dec 2023 04:30:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+u0kHPA8CF7OB5wJxXdoo5eH7QJAMwFo5EPTDYfL6sEn0AWHwvZHEci2xRbXr2NegXckL X-Received: by 2002:a17:902:d506:b0:1d4:11cb:fd54 with SMTP id b6-20020a170902d50600b001d411cbfd54mr849555plg.15.1703248208780; Fri, 22 Dec 2023 04:30:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703248208; cv=none; d=google.com; s=arc-20160816; b=XJC1TxxEq92WjfH6vUYNc/4qmGEeDN0JF3lJ9iRlZZgLEdneToxtaal7Gy55DiuOsP z12LHt6bhTuWgDoQ1pZQ7HDQqKqiQQEM/ips8LCIVtVZo7STaKfeOMeKaP1SfMq7/INt SuUfV20+d8yaI5tkAv8clYKDf71//eq5+OfKhkTzR9sZPoFmOYGH+wX1w3dWsRJLlIjz aph+JJTFs/nVp+GTUM7Z6ZhkEyrYNrWbDFU8khkkpAQzlMenzoqP+zGbec7AzuTIT3fW El1RmCTtDpUtS1xZ+8Zpv4rQI6ToMJvr88i3P2ETu9A3j/bosglKdOHqIkHLzXH2ybxv xUuw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9703-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l10-20020a170903244a00b001d37c1691bfsi3246077pls.330.2023.12.22.04.30.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:30:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9703-linux.lists.archive=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 71E51287725 for ; Fri, 22 Dec 2023 12:30:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6636918C20; Fri, 22 Dec 2023 12:29:41 +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=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Igor Mammedov , Lukas Wunner , Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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