From: Uros Bizjak <ubizjak@gmail.com>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>, Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] PCI: hotplug: Use atomic_{fetch_}andnot() where appropriate
Date: Thu, 13 Jun 2024 10:24:24 +0200 [thread overview]
Message-ID: <20240613082449.197397-1-ubizjak@gmail.com> (raw)
Use atomic_{fetch_}andnot(i, v) instead of atomic_{fetch_}and(~i, v).
No functional changes intended.
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
drivers/pci/hotplug/pciehp_ctrl.c | 4 ++--
drivers/pci/hotplug/pciehp_hpc.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index dcdbfcf404dd..7c775d9a6599 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -121,8 +121,8 @@ static void remove_board(struct controller *ctrl, bool safe_removal)
msleep(1000);
/* Ignore link or presence changes caused by power off */
- atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC),
- &ctrl->pending_events);
+ atomic_andnot(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC,
+ &ctrl->pending_events);
}
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF,
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index b1d0a1b3917d..6d192f64ea19 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -307,8 +307,8 @@ int pciehp_check_link_status(struct controller *ctrl)
/* ignore link or presence changes up to this point */
if (found)
- atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC),
- &ctrl->pending_events);
+ atomic_andnot(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC,
+ &ctrl->pending_events);
pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lnk_status);
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
@@ -568,7 +568,7 @@ static void pciehp_ignore_dpc_link_change(struct controller *ctrl,
* Could be several if DPC triggered multiple times consecutively.
*/
synchronize_hardirq(irq);
- atomic_and(~PCI_EXP_SLTSTA_DLLSC, &ctrl->pending_events);
+ atomic_andnot(PCI_EXP_SLTSTA_DLLSC, &ctrl->pending_events);
if (pciehp_poll_mode)
pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
PCI_EXP_SLTSTA_DLLSC);
@@ -702,7 +702,7 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
pci_config_pm_runtime_get(pdev);
/* rerun pciehp_isr() if the port was inaccessible on interrupt */
- if (atomic_fetch_and(~RERUN_ISR, &ctrl->pending_events) & RERUN_ISR) {
+ if (atomic_fetch_andnot(RERUN_ISR, &ctrl->pending_events) & RERUN_ISR) {
ret = pciehp_isr(irq, dev_id);
enable_irq(irq);
if (ret != IRQ_WAKE_THREAD)
--
2.45.2
next reply other threads:[~2024-06-13 8:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 8:24 Uros Bizjak [this message]
2024-06-13 15:51 ` [PATCH] PCI: hotplug: Use atomic_{fetch_}andnot() where appropriate Bjorn Helgaas
2024-06-13 16:15 ` Ilpo Järvinen
2024-06-13 16:44 ` Uros Bizjak
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=20240613082449.197397-1-ubizjak@gmail.com \
--to=ubizjak@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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