Skip to contentSkip to conversation

pci: Fix -Wunused-function warnings for pci_ltr_*

PATCH In review Qian Cai 2 participants 2 messages Oct 1, 2020 PCI

lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH 1/1 pci: Fix -Wunused-function warnings for pci_ltr_*

When CONFIG_PCIEASPM=n,

drivers/pci/pci.c:3098:12: warning: 'pci_ltr_encode' defined but not used [-Wunused-function]
static u16 pci_ltr_encode(u64 val)

            ^~~~~~~~~~~~~~
drivers/pci/pci.c:3076:12: warning: 'pci_ltr_decode' defined but not used [-Wunused-function]
 static u64 pci_ltr_decode(u16 latency)
            ^~~~~~~~~~~~~~
Fixes 5ccf2a6e483f ("PCI/ASPM: Add support for LTR _DSM")
---
 drivers/pci/pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/pci.c +8 -2
index db8feb2033e7..e96e5933b371 100644
@@ -3069,6 +3069,7 @@ void pci_pm_init(struct pci_dev *dev)
 		dev->imm_ready = 1;
 }
 
+#ifdef CONFIG_PCIEASPM
 /**
  * pci_ltr_decode - Decode the latency to a value in ns
  * @latency: latency register value according to PCIe r5.0, sec 6.18, 7.8.2
@@ -3113,7 +3114,6 @@ static u16 pci_ltr_encode(u64 val)
  */
 void pci_ltr_init(struct pci_dev *dev)
 {
-#ifdef CONFIG_PCIEASPM
 	int ltr;
 	struct pci_dev *bridge;
 	u64 snoop = 0, nosnoop = 0;
@@ -3150,9 +3150,15 @@ void pci_ltr_init(struct pci_dev *dev)
 		pci_write_config_word(dev, ltr + PCI_LTR_MAX_NOSNOOP_LAT,
 				      nosnoop_enc);
 	}
-#endif
 }
 
+#else
+void pci_ltr_init(struct pci_dev *dev)
+{
+}
+
+#endif
+
 static unsigned long pci_ea_flags(struct pci_dev *dev, u8 prop)
 {
 	unsigned long flags = IORESOURCE_PCI_FIXED | IORESOURCE_PCI_EA_BEI;
Signature · 1 line
2.28.0
#1 lore raw
Quoted 11 lines · Qian Cai

When CONFIG_PCIEASPM=n,

drivers/pci/pci.c:3098:12: warning: 'pci_ltr_encode' defined but not used [-Wunused-function]
static u16 pci_ltr_encode(u64 val)

            ^~~~~~~~~~~~~~
drivers/pci/pci.c:3076:12: warning: 'pci_ltr_decode' defined but not used [-Wunused-function]
 static u64 pci_ltr_decode(u16 latency)
            ^~~~~~~~~~~~~~
Fixes 5ccf2a6e483f ("PCI/ASPM: Add support for LTR _DSM")

Fixed, thanks!

Quoted 44 lines
---
 drivers/pci/pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/pci.c +8 -2
index db8feb2033e7..e96e5933b371 100644
@@ -3069,6 +3069,7 @@ void pci_pm_init(struct pci_dev *dev)
 		dev->imm_ready = 1;
 }
 
+#ifdef CONFIG_PCIEASPM
 /**
  * pci_ltr_decode - Decode the latency to a value in ns
  * @latency: latency register value according to PCIe r5.0, sec 6.18, 7.8.2
@@ -3113,7 +3114,6 @@ static u16 pci_ltr_encode(u64 val)
  */
 void pci_ltr_init(struct pci_dev *dev)
 {
-#ifdef CONFIG_PCIEASPM
 	int ltr;
 	struct pci_dev *bridge;
 	u64 snoop = 0, nosnoop = 0;
@@ -3150,9 +3150,15 @@ void pci_ltr_init(struct pci_dev *dev)
 		pci_write_config_word(dev, ltr + PCI_LTR_MAX_NOSNOOP_LAT,
 				      nosnoop_enc);
 	}
-#endif
 }
 
+#else
+void pci_ltr_init(struct pci_dev *dev)
+{
+}
+
+#endif
+
 static unsigned long pci_ea_flags(struct pci_dev *dev, u8 prop)
 {
 	unsigned long flags = IORESOURCE_PCI_FIXED | IORESOURCE_PCI_EA_BEI;
Signature · 1 line
2.28.0