summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Wilczynski <kw@linux.com>2019-08-26 00:46:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-07 18:59:32 +0200
commit1c8c46bdfcdeb58b30b53584c50cf33b33ea8df3 (patch)
treef260965721d50ed789d7a3214e370f8868cca870
parent400a250cc06f40548042561ce166505aff2fce11 (diff)
downloadlinux-stable-1c8c46bdfcdeb58b30b53584c50cf33b33ea8df3.tar.gz
linux-stable-1c8c46bdfcdeb58b30b53584c50cf33b33ea8df3.tar.bz2
linux-stable-1c8c46bdfcdeb58b30b53584c50cf33b33ea8df3.zip
PCI: Add pci_info_ratelimited() to ratelimit PCI separately
[ Upstream commit 7f1c62c443a453deb6eb3515e3c05650ffe0dcf0 ] Do not use printk_ratelimit() in drivers/pci/pci.c as it shares the rate limiting state with all other callers to the printk_ratelimit(). Add pci_info_ratelimited() (similar to pci_notice_ratelimited() added in the commit a88a7b3eb076 ("vfio: Use dev_printk() when possible")) and use it instead of printk_ratelimit() + pci_info(). Link: https://lore.kernel.org/r/20190825224616.8021-1-kw@linux.com Signed-off-by: Krzysztof Wilczynski <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/pci/pci.c4
-rw-r--r--include/linux/pci.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 088fcdc8d2b4..f2ab112c0a71 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -884,8 +884,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
- if (dev->current_state != state && printk_ratelimit())
- pci_info(dev, "Refused to change power state, currently in D%d\n",
+ if (dev->current_state != state)
+ pci_info_ratelimited(dev, "Refused to change power state, currently in D%d\n",
dev->current_state);
/*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index dd436da7eccc..9feb59ac8550 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2375,4 +2375,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type);
#define pci_notice_ratelimited(pdev, fmt, arg...) \
dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg)
+#define pci_info_ratelimited(pdev, fmt, arg...) \
+ dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
+
#endif /* LINUX_PCI_H */