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 522B2CD3436 for ; Fri, 8 May 2026 04:37:58 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gBbtT24wgz30HQ; Fri, 08 May 2026 14:36:49 +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=1778215009; cv=none; b=OZjKd0c20o7Rfe6pCLq4G24+g3/6DoKiiPCFFT7PXEm0jd8VgQ3VrnFOaWpIfVmnxoqrZuSX0ZmnRok4vrgftxeeSk6j5dAWdAEA/IRto6GmtaVw5JCB49KpLAIv/oPO0WUAy+LKjMIcjhRf62jwIohz2BjGi3gE5c9Xl/BDdx9MwElswmQhcFobIeCBnna4vXcazo6RDYTrVTMqxv2WqjnxwWGbB40LDRLi3SgmbHJ0lT9jl1/XS6KOUWEs2vJ32Y7s2MD4doocAYcpXlAZwl7Kxmcyrv706/ATST6z0CTA9jdHmFen+q9faDp8FlN/IKQjoW4Ydf5B3auYEzLt3A== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1778215009; c=relaxed/relaxed; bh=Ilq1LAaEYkFk6FbN9UMEPQ2o2ihdCZarfxy8C4998Fc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MP1Md7ta64oSCAFWkuvRGVheb2q2oDgsEEce4jm/1duSklSQRyJ+tItQqBtOSmaOn8WJ5uGQfn5+BErL4PqSZvZ0879eAQKSzxsWhWT8Vt8H7GVt/R8I1AlyrRC1ZO4gdJI6zihs8qNLH5PJGoVUbtAtwGwluiOM1FdWaQdChujGF8duQ2wWRLims3povextBbyEq6+cPv2x7gG5U79k2rAGhwUziW3Bcoeq78dAyKRUJy/PIb/vYyXE7eNvMzDeQHF2bnhagcmr/4uspZbR6SiXF6iIOLBGePc+3NOEB+3FRv3/+r1ZqTrvHLERBDu9GW6I+Jj2Br8I8KBOHaLgQQ== 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=is6VcbmI; 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=is6VcbmI; 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 4gBbtS4kGqz2xPb for ; Fri, 08 May 2026 14:36:48 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 262D143ED0; Fri, 8 May 2026 04:36:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7695C2BCB0; Fri, 8 May 2026 04:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778215007; bh=/RwghHanAn6lsGhprPzwE0OVa63WsjjjMpcAfzd54OU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=is6VcbmItJK+wucHOxI/Rzr8eobabubSF05p3tb3KkUVquAazMA+HCH+pqKrzyi6J LIM+sGXuVJbO0WGzX39AFq/k3JgzGlbRfy18JkP4g3H8Lx2Uv7QqxzOSYkb4hYVnra VhG0673LrTjdaj9L3s0/rpQOH/T17V9FTQyP9IcHLk0pqxas1s0CBP3YUUrTW5jpP+ qzdxzU5UIGvroExRr7fJ4z/jaj35FTGLuqTM6fEGUH7MC7zgFF9IzoBoQTvydoWQAV seZNeVhyB7mTeI+qei0XPNfygRmSQyOxQODg4Zq9q1J7UuWbD1aTFmk5+BAV05ab4Y Qw/tLwZp5GYVA== From: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= To: Bjorn Helgaas Cc: Bjorn Helgaas , Manivannan Sadhasivam , Lorenzo Pieralisi , Alex Williamson , 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 v7 16/24] alpha/PCI: Add static PCI resource attribute macros Date: Fri, 8 May 2026 04:35:35 +0000 Message-ID: <20260508043543.217179-17-kwilczynski@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260508043543.217179-1-kwilczynski@kernel.org> References: <20260508043543.217179-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 Add macros for declaring static binary attributes for Alpha's PCI resource files: - pci_dev_resource_attr(), for dense/BWX systems (mmap dense) - pci_dev_resource_sparse_attr(), for sparse systems (mmap sparse) - pci_dev_resource_dense_attr(), for dense companion files (mmap dense) Each macro creates a const bin_attribute with the BAR index stored in the .private property and the appropriate .mmap callback. Tested-by: Magnus Lindholm Tested-by: Shivaprasad G Bhat Acked-by: Magnus Lindholm Signed-off-by: Krzysztof WilczyƄski --- arch/alpha/kernel/pci-sysfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index a8dade7d084b..b537313d1717 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -104,6 +104,26 @@ static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj, return pci_mmap_resource(kobj, attr, vma, 0); } +#define __pci_dev_resource_attr(_bar, _name, _suffix, _mmap) \ +static const struct bin_attribute \ +pci_dev_resource##_bar##_suffix##_attr = { \ + .attr = { .name = __stringify(_name), .mode = 0600 }, \ + .private = (void *)(unsigned long)(_bar), \ + .mmap = (_mmap), \ +} + +#define pci_dev_resource_attr(_bar) \ + __pci_dev_resource_attr(_bar, resource##_bar,, \ + pci_mmap_resource_dense) + +#define pci_dev_resource_sparse_attr(_bar) \ + __pci_dev_resource_attr(_bar, resource##_bar##_sparse, _sparse, \ + pci_mmap_resource_sparse) + +#define pci_dev_resource_dense_attr(_bar) \ + __pci_dev_resource_attr(_bar, resource##_bar##_dense, _dense, \ + pci_mmap_resource_dense) + /** * pci_remove_resource_files - cleanup resource files * @pdev: pci_dev to cleanup -- 2.54.0