From nobody Mon Feb 9 04:14:37 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 C093434575E; Tue, 28 Oct 2025 17:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761673008; cv=none; b=U3AUVKXF98oEaez21Kqpn+t+93CddP97PSr5NMS3GRRJfcIeEA73LUwWdjG0G6Qsyt388Gv2hD2188P8jFv8iqlczMjydNhnarkUdCw7Nzzh4UrQjS+E+ymXlLQ3tFed8YODbcekyqDufxgu7y4nn1LWRCWAJ+akWfduc2amzHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761673008; c=relaxed/simple; bh=di5GEvT3KUkXT7OWsKsdLxJyHADgOdeBIjyqf73f89E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=H7B8JyGOivHrO2rE51l0zomyW5Rwh1Te6pwV1z5uV5TiGLSr+a6A18QvXz7A8MVxvc/cqDRsAsvddL/BQV68wQzjwtpv8yJ6ig7CtJueiV/ivvhiWJNk/SYW31NClGRDryJjAfMvjNnhDTZjplt/lx4yiD6SGDd5J6KMXbh6LnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V+xIw3Js; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass 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="V+xIw3Js" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761673007; x=1793209007; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=di5GEvT3KUkXT7OWsKsdLxJyHADgOdeBIjyqf73f89E=; b=V+xIw3JsrFXFFA497gTarYkgClZBZLAfqn9EZD30cjSpxwi4OfS592v/ 2juUpZA0xQAWcOQP7ejmpySLgQjJ4K7TxulpaKL0u5lu02b4i0PyYQTyg f5SgOT21zma/8D+SiWmqqiC1UoLFjdfNhplrxoxhO24DkJpOTHZ7tmEGS +QhdtiuAHZWSggWjZKn2/pSiSbr30uMwH2nwj8E1ZHw5+SakQgJRrUBGE WXkatlBAAQ4wiJt3wCReeSqRkJCm+BUdy1+FMipVfarbI25K8jQmgrph0 pC7VEEWHvmo/tqobhQo35On+8oPRoiz4hO9wlHN7nrNcoMrGveHI7hn4r g==; X-CSE-ConnectionGUID: HnqXs2eMTgWAH4+rUprRIw== X-CSE-MsgGUID: GlPks04TRQ2K7mnZzjupFA== X-IronPort-AV: E=McAfee;i="6800,10657,11586"; a="86410717" X-IronPort-AV: E=Sophos;i="6.19,261,1754982000"; d="scan'208";a="86410717" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2025 10:36:46 -0700 X-CSE-ConnectionGUID: cIhGgUyjTVSF3DcB+zd31g== X-CSE-MsgGUID: KKP4sCC5Tvq+pn6ETKCdlg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,261,1754982000"; d="scan'208";a="189465498" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.182]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2025 10:36:39 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Simon Richter , Lucas De Marchi , Alex Deucher , amd-gfx@lists.freedesktop.org, Bjorn Helgaas , David Airlie , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , linux-pci@vger.kernel.org, Rodrigo Vivi , Simona Vetter , Tvrtko Ursulin , =?UTF-8?q?Christian=20K=C3=B6nig?= , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Micha=C5=82=20Winiarski?= , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 3/9] PCI: Change pci_dev variable from 'bridge' to 'dev' Date: Tue, 28 Oct 2025 19:35:45 +0200 Message-Id: <20251028173551.22578-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251028173551.22578-1-ilpo.jarvinen@linux.intel.com> References: <20251028173551.22578-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 Upcoming fix to BAR resize will store also device BAR resource into the saved list. Change the pci_dev variable in the loop from 'bridge' to 'dev' as the former would be misleading with non-bridges in the list. This is in a separate change to reduce churn in the upcoming BAR resize fix. While it appears that the logic in the loop doing pci_setup_bridge() is altered as 'bridge' variable is no longer updated, a bridge should never appear more than once in the saved list so the if check can only match to the first entry. As such, the code with two distinct pci_dev variables better represent the intention of the check compared with the old code where bridge variable was reused for different purpose. Signed-off-by: Ilpo J=C3=A4rvinen --- drivers/pci/setup-bus.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index e6984bb530ae..d58f025aeaff 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -2479,12 +2479,13 @@ int pbus_reassign_bridge_resources(struct pci_bus *= bus, struct resource *res) } =20 list_for_each_entry(dev_res, &saved, list) { + struct pci_dev *dev =3D dev_res->dev; + /* Skip the bridge we just assigned resources for */ - if (bridge =3D=3D dev_res->dev) + if (bridge =3D=3D dev) continue; =20 - bridge =3D dev_res->dev; - pci_setup_bridge(bridge->subordinate); + pci_setup_bridge(dev->subordinate); } =20 free_list(&saved); @@ -2500,19 +2501,19 @@ int pbus_reassign_bridge_resources(struct pci_bus *= bus, struct resource *res) /* Revert to the old configuration */ list_for_each_entry(dev_res, &saved, list) { struct resource *res =3D dev_res->res; + struct pci_dev *dev =3D dev_res->dev; =20 - bridge =3D dev_res->dev; - i =3D pci_resource_num(bridge, res); + i =3D pci_resource_num(dev, res); =20 if (res->parent) { release_child_resources(res); - pci_release_resource(bridge, i); + pci_release_resource(dev, i); } =20 restore_dev_resource(dev_res); =20 - pci_claim_resource(bridge, i); - pci_setup_bridge(bridge->subordinate); + pci_claim_resource(dev, i); + pci_setup_bridge(dev->subordinate); } free_list(&saved); up_read(&pci_bus_sem); --=20 2.39.5