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 A669EF36BA7 for ; Sat, 11 Apr 2026 08:04:09 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4ft5kl3S4Mz2yql; Sat, 11 Apr 2026 18:02:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775894575; cv=none; b=HyIhCED2+KpNwBsQnIvEN+hBQFrMyBvgByQ1RBsrgM3X0hxxcbZR92Yp20Nio99mGSCLqgdJ7/cUZ9X40/2H0QCaWVpqvKC/Ftkxa+Pi+8BNoYGpGqa86l50ouWP9M7/Ul8gwGd5eWMJh8DXkmIq0PSvxRbt1DrRAEk4hKd/dcMNAxIj0SBaS3XeimprXLoKTb+rWkIlnBu/j62UV/J7wO2zs3kUwDnLnK+uJCmGMA0B5J9zdHtTv2T1jRu8K8Onpl0Gj3WIN8iO8uM5Sk7u6sbYxXuzlkPMGgY6j9XI+E1S0PwTPATmk9CfHVlKTVXut/imiI4K2NAPoJotXGNanQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775894575; c=relaxed/relaxed; bh=XiQCvqx+dt0nj4/FmupW/urma8kJqQ/cjREvkvf3Bj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l3YappeWL4G1cIjDLtpz2DYqo+vM48H7+F2s/GHeuhoU8NicA6DEfJJ4v1mD4nY+YQG7Hon+IxgD4cdB3quqhXBmZSJcHWAB67FmBSgDDtnzfAkR6y8aeLyFc9wPw30AM1tkq9ow16G/9E+yxgsA0469A9WiJ3qzblHv2GY7FOLmL0krRk9rxt4DsezHFvU+2dBuBo7FZKy5/z59I5fK2H3FvFNI7wm9jlikg57vjgquepVZ8Umv4QfvVycQbenCJiOp9qj97g5D9WOf0aDTrtvq3Eq9bElVH5gZfdU30blL+e96fBjpZdaTqjyYrXME67+hbq/Yf165wBYa3NKBDQ== 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=QVyQr++x; dkim-atps=neutral; spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25; 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=QVyQr++x; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=kwilczynski@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) (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 4ft5kk5YSlz2yk6 for ; Sat, 11 Apr 2026 18:02:54 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 2DC4E4022B; Sat, 11 Apr 2026 08:02:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE5B6C2BCAF; Sat, 11 Apr 2026 08:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775894573; bh=gHUlVbf3Y8qWIkgDqNtVdk/vAmWeIzVKbiePuyGcqSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QVyQr++xAceybT54YwLzjt3I7WW3gS35d2xqtvJrT7muc1/K6O0wDvLvzHhjm9Enl Dag4uTfrTXM9yJw9UbFbwPk+m8DIu9ySYW+Z+bSZqtDsnbmcBJq92D/eK2XqE7eCJI +//7LbmHhSDBXeOhtgpeObDFW0lHzU+i/NbRGODitEhT4g0oFcVsekQzSZ4AfB/vwq 5fxCOQPuLJspBcMqaa9jjwS4YpuA18LIL2ZBjhIyPGLS6xdSYtV5C6rckiy9qE7PbY waplzkujfnS0px2t4cWv86ujiW1Z58sODln/+Zu5Rt6mq1AjOcfhsaggAha5AcM0gb ksW4raK7z6bMg== 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 v4 17/24] alpha/PCI: Add static PCI resource attribute macros Date: Sat, 11 Apr 2026 08:01:41 +0000 Message-ID: <20260411080148.471335-18-kwilczynski@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260411080148.471335-1-kwilczynski@kernel.org> References: <20260411080148.471335-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. 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 c136603ddf2c..824e514c4adb 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.53.0