From mboxrd@z Thu Jan 1 00:00:00 1970 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 0A1AC331A63; Thu, 16 Apr 2026 18:01:15 +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=1776362476; cv=none; b=A/VA9pazPMeuLrWDxCivnL4EfDf+Hrh3W2zO201IaIOJGcxIP1MQkq1uvoEfO52Mfck7LP4jFL30ZA/WxTDFxerTEqBPqvD0j1sCQljEs+cuCtVrGDIgW0Db9yggywJikYewuLB1SwmBGUO16Znnng45KnpzFltLU95WBiw2JG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776362476; c=relaxed/simple; bh=+MngKbk4Fu+hXvrF1jLsdL88/ySXVmeG1h0/A7xlETY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KencWiUG0KkHWi6bPM5tqDPmnhvho6wPMF8N7YVMk/SiNxIeivr4L6wgd15v/Sin90cYwJBdgNLFvFj7uN07haa6igdl3US3jB5bQI0pY07RB3OUv/Qq2o1nySFFSuErNDhKtULRNrXtgnqTMArAcblQ8XDVt3+N6aPdRe/t0VU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NENq68If; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NENq68If" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B83C2BCB5; Thu, 16 Apr 2026 18:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776362475; bh=+MngKbk4Fu+hXvrF1jLsdL88/ySXVmeG1h0/A7xlETY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NENq68IfrocJdhCwKAll2dQspx559f/iK0hQtfM8tAIlfGggCHFPw7Q4HQoNpgDsz yIpkL5ETWSTDdoBpgW/jggxQI2CBMqZMsBLTIqCNKaufTU2nt9WWZI55U6w+q6Xezh ZE4gZXE4AUBOkG+UKvj74iX+BAqW95af50fT1oj7UGJHkxtSFk102UBGizlTfwVbLG 2em/vRR03cAJL9RWTPXPlG5BXNWkwnqmKAc/wM6DH7ETaFX6WlS+XHNKHlVgf0UMtx eAM0FxKU4fSrIZL0XjPbwaegZBQP6TlC5qv3FKvyFPIky3mEqTIoZVJ0dc0Zfq31/B TJ5r/Jw00cnQg== From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= To: Bjorn Helgaas Cc: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , Magnus Lindholm , Matt Turner , Richard Henderson , Christophe Leroy , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Dexuan Cui , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= , Lukas Wunner , "Oliver O'Halloran" , Saurabh Singh Sengar , Shuan He , Srivatsa Bhat , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v5 01/23] PCI/sysfs: Use PCI resource accessor macros Date: Thu, 16 Apr 2026 18:00:45 +0000 Message-ID: <20260416180107.777065-2-kwilczynski@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260416180107.777065-1-kwilczynski@kernel.org> References: <20260416180107.777065-1-kwilczynski@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace direct pdev->resource[] accesses with pci_resource_n(), and pdev->resource[].flags accesses with pci_resource_flags(). No functional changes intended. Reviewed-by: Ilpo Järvinen Signed-off-by: Krzysztof Wilczyński --- drivers/pci/pci-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 16eaaf749ba9..ad3c17f86c7f 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -177,7 +177,7 @@ static ssize_t resource_show(struct device *dev, struct device_attribute *attr, max = PCI_BRIDGE_RESOURCES; for (i = 0; i < max; i++) { - struct resource *res = &pci_dev->resource[i]; + struct resource *res = pci_resource_n(pci_dev, i); struct resource zerores = {}; /* For backwards compatibility */ @@ -715,7 +715,7 @@ static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr, return sysfs_emit(buf, "%u\n", (pdev == vga_dev)); return sysfs_emit(buf, "%u\n", - !!(pdev->resource[PCI_ROM_RESOURCE].flags & + !!(pci_resource_flags(pdev, PCI_ROM_RESOURCE) & IORESOURCE_ROM_SHADOW)); } static DEVICE_ATTR_RO(boot_vga); @@ -1108,7 +1108,7 @@ static int pci_mmap_resource(struct kobject *kobj, const struct bin_attribute *a struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); int bar = (unsigned long)attr->private; enum pci_mmap_state mmap_type; - struct resource *res = &pdev->resource[bar]; + struct resource *res = pci_resource_n(pdev, bar); int ret; ret = security_locked_down(LOCKDOWN_PCI_ACCESS); @@ -1312,7 +1312,7 @@ static int pci_create_resource_files(struct pci_dev *pdev) retval = pci_create_attr(pdev, i, 0); /* for prefetchable resources, create a WC mappable file */ if (!retval && arch_can_pci_mmap_wc() && - pdev->resource[i].flags & IORESOURCE_PREFETCH) + pci_resource_flags(pdev, i) & IORESOURCE_PREFETCH) retval = pci_create_attr(pdev, i, 1); if (retval) { pci_remove_resource_files(pdev); -- 2.53.0