{"id":2231396,"url":"http://patchwork.ozlabs.org/api/patches/2231396/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260430162420.42839-7-18255117159@163.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430162420.42839-7-18255117159@163.com>","list_archive_url":null,"date":"2026-04-30T16:24:10","name":"[RESEND,06/16] PCI/MSI: Use FIELD_MODIFY()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1ea42ddec26fa7f03c6070d76e8065c09964ad08","submitter":{"id":89937,"url":"http://patchwork.ozlabs.org/api/people/89937/?format=json","name":"Hans Zhang","email":"18255117159@163.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260430162420.42839-7-18255117159@163.com/mbox/","series":[{"id":502340,"url":"http://patchwork.ozlabs.org/api/series/502340/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=502340","date":"2026-04-30T16:24:06","name":"PCI: Use FIELD_MODIFY() to simplify bitfield operations","version":1,"mbox":"http://patchwork.ozlabs.org/series/502340/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231396/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231396/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-53517-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256\n header.s=s110527 header.b=iTpJViCr;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-53517-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=\"iTpJViCr\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=117.135.210.4","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=163.com"],"Received":["from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g607b6QP2z1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 02:32:11 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 0AD623041BCA\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 16:25:13 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4A9A84779B0;\n\tThu, 30 Apr 2026 16:24:58 +0000 (UTC)","from m16.mail.163.com (m16.mail.163.com [117.135.210.4])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id DB5EB4611CF;\n\tThu, 30 Apr 2026 16:24:50 +0000 (UTC)","from zhb.. (unknown [])\n\tby gzga-smtp-mtada-g0-3 (Coremail) with SMTP id\n _____wAHJXM2gvNpY8PXCg--.48992S8;\n\tFri, 01 May 2026 00:24:27 +0800 (CST)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777566297; cv=none;\n b=QlMhugr/NuB/9SJVlDQxMXYQEmr005qm03eIOwco7fIBaM2uVVqXchp6VVOZ6p/sS3mQ0rgsg4MLymG2hKyVIFUFOFlaX9BpZ2A4nY2Fh/KWwd6kLqvmn5vTh1w/WG3bIWKowKIwZ2P44ricq5aIc9cpByuHFnGTD/xmTewkCvA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777566297; c=relaxed/simple;\n\tbh=sCsHoa8O9H1cL+Uy+UCJ1dvw/lw4dcrYTpEvOuCWps0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=Kg/IBa2BtsGbwUk2Dg5erMBqGqkIex6Xu8s0mUnE8rtWOb4J8IdY7GdeABjS6sqzzSaLbZreRF0BKDX554eh7benDBiqXTxKwcUp1jFJcUg2pOMurwlDmVwmUKkhlMWsYxw2NsN+LLy/YCehIwJa0OFKBtGRukd7a+qWHbVGUCI=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com;\n spf=pass smtp.mailfrom=163.com;\n dkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=iTpJViCr; arc=none smtp.client-ip=117.135.210.4","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n\ts=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=f4\n\tuCdZZ0oXhBkkne4HIBGaYPsR9cIC0DI5x1vctw3r8=; b=iTpJViCr8ZkwKKp+wM\n\twNAgc5CHD86tKz0MZTYqJki/hlr3qT2ckcB2pDWLV/ckDQSezlJwCUt2kHC43+Z8\n\tKBZEw/W88eAjmOf1fxyaotTOZR1FMymlw9WIld79O2BBiwFU4sb+kCtJwuuU9r5A\n\tq3MkKUO4zc3MSLaN4nYuCaNM0=","From":"Hans Zhang <18255117159@163.com>","To":"bhelgaas@google.com,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tmani@kernel.org,\n\tjingoohan1@gmail.com","Cc":"robh@kernel.org,\n\ts32@nxp.com,\n\tlinux-pci@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tHans Zhang <18255117159@163.com>","Subject":"[RESEND PATCH 06/16] PCI/MSI: Use FIELD_MODIFY()","Date":"Fri,  1 May 2026 00:24:10 +0800","Message-Id":"<20260430162420.42839-7-18255117159@163.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260430162420.42839-1-18255117159@163.com>","References":"<20260430162420.42839-1-18255117159@163.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-CM-TRANSID":"_____wAHJXM2gvNpY8PXCg--.48992S8","X-Coremail-Antispam":"1Uf129KBjvJXoW7urW7uF4fKw17Gw1UWF1kAFb_yoW8Zw4UpF\n\tWFgFWUKayrta1rXFsxuF1q9F12vFs8tF97GF42kw17uryrZw1qyFy5tF4UKF1fXFW7Zr45\n\tAwnYy3y7Ka98GFUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRPUUUUUUUU=","X-CM-SenderInfo":"rpryjkyvrrlimvzbiqqrwthudrp/xtbCxBsGqWnzgjta9QAA38"},"content":"Use FIELD_MODIFY() to remove open-coded bit manipulation.\nNo functional change intended.\n\nSigned-off-by: Hans Zhang <18255117159@163.com>\n---\n drivers/pci/msi/msi.c | 11 ++++-------\n 1 file changed, 4 insertions(+), 7 deletions(-)","diff":"diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c\nindex 81d24a270a79..33c8b5b98684 100644\n--- a/drivers/pci/msi/msi.c\n+++ b/drivers/pci/msi/msi.c\n@@ -201,8 +201,7 @@ static inline void pci_write_msg_msi(struct pci_dev *dev, struct msi_desc *desc,\n \tu16 msgctl;\n \n \tpci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl);\n-\tmsgctl &= ~PCI_MSI_FLAGS_QSIZE;\n-\tmsgctl |= FIELD_PREP(PCI_MSI_FLAGS_QSIZE, desc->pci.msi_attrib.multiple);\n+\tFIELD_MODIFY(PCI_MSI_FLAGS_QSIZE, &msgctl, desc->pci.msi_attrib.multiple);\n \tpci_write_config_word(dev, pos + PCI_MSI_FLAGS, msgctl);\n \n \tpci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, msg->address_lo);\n@@ -532,9 +531,8 @@ void __pci_restore_msi_state(struct pci_dev *dev)\n \n \tpci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);\n \tpci_msi_update_mask(entry, 0, 0);\n-\tcontrol &= ~PCI_MSI_FLAGS_QSIZE;\n-\tcontrol |= PCI_MSI_FLAGS_ENABLE |\n-\t\t   FIELD_PREP(PCI_MSI_FLAGS_QSIZE, entry->pci.msi_attrib.multiple);\n+\tFIELD_MODIFY(PCI_MSI_FLAGS_QSIZE, &control, entry->pci.msi_attrib.multiple);\n+\tcontrol |= PCI_MSI_FLAGS_ENABLE;\n \tpci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);\n }\n \n@@ -970,8 +968,7 @@ int pci_msix_write_tph_tag(struct pci_dev *pdev, unsigned int index, u16 tag)\n \tif (!msi_desc || msi_desc->pci.msi_attrib.is_virtual)\n \t\treturn -ENXIO;\n \n-\tmsi_desc->pci.msix_ctrl &= ~PCI_MSIX_ENTRY_CTRL_ST;\n-\tmsi_desc->pci.msix_ctrl |= FIELD_PREP(PCI_MSIX_ENTRY_CTRL_ST, tag);\n+\tFIELD_MODIFY(PCI_MSIX_ENTRY_CTRL_ST, &msi_desc->pci.msix_ctrl, tag);\n \tpci_msix_write_vector_ctrl(msi_desc, msi_desc->pci.msix_ctrl);\n \t/* Flush the write */\n \treadl(pci_msix_desc_addr(msi_desc));\n","prefixes":["RESEND","06/16"]}