PCI: Remove the use of printk_ratelimit() in pci.c
PATCH 1/1 PCI: Remove the use of printk_ratelimit() in pci.c
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 macro similar to pci_notice_ratelimited added in the commit a88a7b3eb076 ("vfio: Use dev_printk() when possible") and use it instead of pr_info inside the if-statement.
--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/pci/pci.c +2 -2
@@ -890,8 +890,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);/*
include/linux/pci.h +3 -0
@@ -2367,4 +2367,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 */
Signature · 1 line
2.22.1
Bjorn Helgaas
AppliedQuoted 8 lines · Krzysztof Wilczynski
Do not use
printk_ratelimit()indrivers/pci/pci.cas it shares the rate limiting state with all other callers to theprintk_ratelimit().Add
pci_info_ratelimitedmacro similar topci_notice_ratelimitedadded in the commita88a7b3eb076("vfio: Usedev_printk()when possible") and use it instead ofpr_infoinside the if-statement.Signed-off-by Krzysztof Wilczynski <[email protected]>
Applied to pci/misc for v5.4, thanks!
Quoted 35 lines
--- drivers/pci/pci.c | 4 ++-- include/linux/pci.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-)drivers/pci/pci.c +2
-2@@ -890,8 +890,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);/* include/linux/pci.h +3
-0@@ -2367,4 +2367,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 */ Signature · 1 line
2.22.1