linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] pci: Fix -Wunused-function warnings for pci_ltr_*
@ 2020-10-01 13:28 Qian Cai
  2020-10-01 17:01 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2020-10-01 13:28 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Puranjay Mohan, linux-pci, linux-kernel

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")
Signed-off-by: Qian Cai <cai@redhat.com>
---
 drivers/pci/pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index db8feb2033e7..e96e5933b371 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -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;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] pci: Fix -Wunused-function warnings for pci_ltr_*
  2020-10-01 13:28 [PATCH -next] pci: Fix -Wunused-function warnings for pci_ltr_* Qian Cai
@ 2020-10-01 17:01 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-10-01 17:01 UTC (permalink / raw)
  To: Qian Cai; +Cc: Bjorn Helgaas, Puranjay Mohan, linux-pci, linux-kernel

On Thu, Oct 01, 2020 at 09:28:49AM -0400, Qian Cai wrote:
> 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")
> Signed-off-by: Qian Cai <cai@redhat.com>

Fixed, thanks!

> ---
>  drivers/pci/pci.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index db8feb2033e7..e96e5933b371 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -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;
> -- 
> 2.28.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-01 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-01 13:28 [PATCH -next] pci: Fix -Wunused-function warnings for pci_ltr_* Qian Cai
2020-10-01 17:01 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).