From: Hans Zhang <18255117159@163.com>
To: mahesh@linux.ibm.com, bhelgaas@google.com
Cc: oohall@gmail.com, mani@kernel.org, lukas@wunner.de,
linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, Hans Zhang <18255117159@163.com>
Subject: [RESEND PATCH v4 1/2] PCI: Introduce pci_clear/set_config_dword()
Date: Sun, 2 Nov 2025 00:22:18 +0800 [thread overview]
Message-ID: <20251101162219.12016-2-18255117159@163.com> (raw)
In-Reply-To: <20251101162219.12016-1-18255117159@163.com>
Add helper functions to clear or set bits in PCI config space.
These helpers reduce code duplication and improve readability for config
space modifications by encapsulating common read-modify-write patterns.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
include/linux/pci.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 59876de13860..bb0dba2b7aee 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1341,6 +1341,18 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
return pcie_capability_clear_and_set_dword(dev, pos, clear, 0);
}
+static inline void pci_clear_config_dword(const struct pci_dev *dev, int pos,
+ u32 clear)
+{
+ pci_clear_and_set_config_dword(dev, pos, clear, 0);
+}
+
+static inline void pci_set_config_dword(const struct pci_dev *dev, int pos,
+ u32 set)
+{
+ pci_clear_and_set_config_dword(dev, pos, 0, set);
+}
+
/* User-space driven config access */
int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);
int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val);
--
2.25.1
next prev parent reply other threads:[~2025-11-01 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-01 16:22 [RESEND PATCH v4 0/2] PCI: Introduce pci_clear/set_config_dword() Hans Zhang
2025-11-01 16:22 ` Hans Zhang [this message]
2025-11-01 16:22 ` [RESEND PATCH v4 2/2] PCI/AER: Use pci_clear/set_config_dword to simplify code Hans Zhang
2026-01-18 13:47 ` [RESEND PATCH v4 0/2] PCI: Introduce pci_clear/set_config_dword() Hans Zhang
2026-03-06 15:50 ` Hans Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251101162219.12016-2-18255117159@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lukas@wunner.de \
--cc=mahesh@linux.ibm.com \
--cc=mani@kernel.org \
--cc=oohall@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox