From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E96FFA1FD0 for ; Wed, 22 Apr 2026 16:16:07 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4g147X0pKVz2yv9; Thu, 23 Apr 2026 02:15:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=172.234.252.31 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1776874504; cv=none; b=VMApVReiP9M8s5frDRl+GsjQ/38UtO2Jncom96awjRTA6aoU03NoqmLebIdeJfb+hkOyo8Jn2lnZU+5pXp55Wfvim7jFI27dEO+MzRbQqfdhiNxkqO0dROrh+F1f+bgRbe13bfzQzbW8VQzjzZH2+trKhLaLEEKBUcL1MNBaZv3PRdo4OD9vbUs8rqormxFdhYlnTN771sDMfF6bQvNfMiHIBM5UuGVyBHiXWZFQqAIPEDPRmEBNQh1YALCVvH1Svk0W8Mb7hlsa1FGnAJMGHMHzD5b0JwMDtNSeIKI5Cww0MWmrq3ldolZqTVHFkkwYC/2Y9CG3xc7SCc3hhkDgLA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1776874504; c=relaxed/relaxed; bh=JdxYMoo7z/KYxp4KhkeWZz9R0zaB/vDuSUjr4PZqmj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nXONBaLj0uDH81Psd2nmga1tSbuLGTyyI0WRDAQJalzG5EJXWX2TMk8EmI9qEaqQkrKp0yq00hDXLqK4SxxnPd+yDwYWuAgB7NcSEw3msNV7w9xuB9sDbk6I9Lfk4vc5v6AIqxdUN/B78LGfIhi5xVW2qONCPDlxucwzevX5c94ujlDFDqknLM7RVsG2bP9pkjNSj6ix+Z7kwEXa3yqP547H3Jq5mna5sssKyQVJF0q4mVK0zET6p+GI89thN5s2jUcVCgMv9lj3bR4OgmTw/NrBaNMLD442uJmPuCS5HeqyYZ/1LSQXM1G5etoQ16YGsIe5cQp5uRSjGZT4nHbnog== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Shun704J; dkim-atps=neutral; spf=pass (client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Shun704J; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4g147Q5gBgz2yr9 for ; Thu, 23 Apr 2026 02:14:58 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 471C942DF0; Wed, 22 Apr 2026 16:14:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08687C2BCAF; Wed, 22 Apr 2026 16:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776874497; bh=IMcdakq99wbD1qVW6H0LK/hocegXH8/apKioYrKdwvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Shun704JkGUg6uA5ladCW4/NmkGjytnYYQ2SaGF6nupdSJ28rbcXO9fHocNUnWxzt SjDSwsD07qoZIwr8NKSFrY9b0XZoMLhUFIu4LoT4Y1nwYopUdSJUpupO+jXoImTtKV xtf1sFRuATsmPcNX4OTaX6yPr9SzSLx2MV9jgoNUND1ms3nOX72CKexebh3gFMmYKY 41Iaqd0hz+7E/TdMv3DFdVErvkyjCTiAx9fE5q0/Kzs1oQ+CbgKRK/8qyYSmrPO1yo VIapYPvcW3GqaIumZ+2vimnKL4HIoI95L3Dx0/xx0jAtXq9sLgyKPJPuqL3ASrgA2T Hw7E7Leu3FJTA== 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 v6 13/24] alpha/PCI: Use PCI resource accessor macros Date: Wed, 22 Apr 2026 16:13:56 +0000 Message-ID: <20260422161407.118748-14-kwilczynski@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260422161407.118748-1-kwilczynski@kernel.org> References: <20260422161407.118748-1-kwilczynski@kernel.org> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list 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 open-coded res->flags type checks with pci_resource_is_mem() and pci_resource_start() helpers. While at it, move the pci_resource_n() call directly into pcibios_resource_to_bus() and drop the local struct resource pointer. No functional changes intended. Tested-by: Magnus Lindholm Reviewed-by: Ilpo Järvinen Acked-by: Magnus Lindholm Signed-off-by: Krzysztof Wilczyński --- arch/alpha/kernel/pci-sysfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index 2330ab84d59c..5c29f1d2821c 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -70,7 +70,6 @@ static int pci_mmap_resource(struct kobject *kobj, { struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj)); int barno = (unsigned long)attr->private; - struct resource *res = pci_resource_n(pdev, barno); enum pci_mmap_state mmap_type; struct pci_bus_region bar; int ret; @@ -79,15 +78,16 @@ static int pci_mmap_resource(struct kobject *kobj, if (ret) return ret; - if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) + if (pci_resource_is_mem(pdev, barno) && + iomem_is_exclusive(pci_resource_start(pdev, barno))) return -EINVAL; if (!__pci_mmap_fits(pdev, barno, vma, sparse)) return -EINVAL; - pcibios_resource_to_bus(pdev->bus, &bar, res); + pcibios_resource_to_bus(pdev->bus, &bar, pci_resource_n(pdev, barno)); vma->vm_pgoff += bar.start >> (PAGE_SHIFT - (sparse ? 5 : 0)); - mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; + mmap_type = pci_resource_is_mem(pdev, barno) ? pci_mmap_mem : pci_mmap_io; return hose_mmap_page_range(pdev->sysdata, vma, mmap_type, sparse); } @@ -141,7 +141,7 @@ static int sparse_mem_mmap_fits(struct pci_dev *pdev, int num) long dense_offset; unsigned long sparse_size; - pcibios_resource_to_bus(pdev->bus, &bar, &pdev->resource[num]); + pcibios_resource_to_bus(pdev->bus, &bar, pci_resource_n(pdev, num)); /* All core logic chips have 4G sparse address space, except CIA which has 16G (see xxx_SPARSE_MEM and xxx_DENSE_MEM @@ -181,7 +181,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num) suffix = ""; /* Assume bwx machine, normal resourceN files. */ nlen1 = 10; - if (pdev->resource[num].flags & IORESOURCE_MEM) { + if (pci_resource_is_mem(pdev, num)) { sparse_base = hose->sparse_mem_base; dense_base = hose->dense_mem_base; if (sparse_base && !sparse_mem_mmap_fits(pdev, num)) { -- 2.54.0