From: Hans Zhang <18255117159@163.com>
To: bhelgaas@google.com, lpieralisi@kernel.org,
kwilczynski@kernel.org, mani@kernel.org, jingoohan1@gmail.com
Cc: robh@kernel.org, s32@nxp.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, Hans Zhang <18255117159@163.com>
Subject: [RESEND PATCH 06/16] PCI/MSI: Use FIELD_MODIFY()
Date: Fri, 1 May 2026 00:24:10 +0800 [thread overview]
Message-ID: <20260430162420.42839-7-18255117159@163.com> (raw)
In-Reply-To: <20260430162420.42839-1-18255117159@163.com>
Use FIELD_MODIFY() to remove open-coded bit manipulation.
No functional change intended.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/msi/msi.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 81d24a270a79..33c8b5b98684 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -201,8 +201,7 @@ static inline void pci_write_msg_msi(struct pci_dev *dev, struct msi_desc *desc,
u16 msgctl;
pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl);
- msgctl &= ~PCI_MSI_FLAGS_QSIZE;
- msgctl |= FIELD_PREP(PCI_MSI_FLAGS_QSIZE, desc->pci.msi_attrib.multiple);
+ FIELD_MODIFY(PCI_MSI_FLAGS_QSIZE, &msgctl, desc->pci.msi_attrib.multiple);
pci_write_config_word(dev, pos + PCI_MSI_FLAGS, msgctl);
pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, msg->address_lo);
@@ -532,9 +531,8 @@ void __pci_restore_msi_state(struct pci_dev *dev)
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
pci_msi_update_mask(entry, 0, 0);
- control &= ~PCI_MSI_FLAGS_QSIZE;
- control |= PCI_MSI_FLAGS_ENABLE |
- FIELD_PREP(PCI_MSI_FLAGS_QSIZE, entry->pci.msi_attrib.multiple);
+ FIELD_MODIFY(PCI_MSI_FLAGS_QSIZE, &control, entry->pci.msi_attrib.multiple);
+ control |= PCI_MSI_FLAGS_ENABLE;
pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
}
@@ -970,8 +968,7 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)
if (!msi_desc || msi_desc->pci.msi_attrib.is_virtual)
return -ENXIO;
- msi_desc->pci.msix_ctrl &= ~PCI_MSIX_ENTRY_CTRL_ST;
- msi_desc->pci.msix_ctrl |= FIELD_PREP(PCI_MSIX_ENTRY_CTRL_ST, tag);
+ FIELD_MODIFY(PCI_MSIX_ENTRY_CTRL_ST, &msi_desc->pci.msix_ctrl, tag);
pci_msix_write_vector_ctrl(msi_desc, msi_desc->pci.msix_ctrl);
/* Flush the write */
readl(pci_msix_desc_addr(msi_desc));
--
2.34.1
next prev parent reply other threads:[~2026-04-30 16:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 16:24 [RESEND PATCH 00/16] PCI: Use FIELD_MODIFY() to simplify bitfield operations Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 01/16] PCI: Use FIELD_MODIFY() Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 02/16] PCI/PTM: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 03/16] PCI/IDE: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 04/16] PCI/IOV: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 05/16] PCI/TPH: " Hans Zhang
2026-04-30 16:24 ` Hans Zhang [this message]
2026-04-30 16:24 ` [RESEND PATCH 07/16] PCI/REBAR: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 08/16] PCI/CARDBUS: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 09/16] PCI: al: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 10/16] PCI: eswin: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 11/16] PCI: s32g: " Hans Zhang
2026-05-04 19:12 ` Frank Li
2026-04-30 16:24 ` [RESEND PATCH 12/16] PCI: tegra194: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 13/16] PCI: qcom: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 14/16] PCI: dwc: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 15/16] PCI: mvebu: " Hans Zhang
2026-04-30 16:24 ` [RESEND PATCH 16/16] PCI: mediatek-gen3: " Hans Zhang
2026-04-30 18:08 ` [RESEND PATCH 00/16] PCI: Use FIELD_MODIFY() to simplify bitfield operations Bjorn Helgaas
2026-05-01 14:19 ` Hans Zhang
2026-05-05 16:54 ` Bjorn Helgaas
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=20260430162420.42839-7-18255117159@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=s32@nxp.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