diff mbox series

[v4,5/9] PCI/PTM: Move pci_ptm_info() body into its only caller

Message ID 20220909202505.314195-6-helgaas@kernel.org
State New
Headers show
Series PCI/PM: Always disable PTM for all devices during suspend | expand

Commit Message

Bjorn Helgaas Sept. 9, 2022, 8:25 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

pci_ptm_info() is simple and is only called by pci_enable_ptm().  Move the
entire body there.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pcie/ptm.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

Comments

Kuppuswamy Sathyanarayanan Sept. 9, 2022, 11:45 p.m. UTC | #1
On 9/9/22 1:25 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> pci_ptm_info() is simple and is only called by pci_enable_ptm().  Move the
> entire body there.  No functional change intended.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---

Looks good to me.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

>  drivers/pci/pcie/ptm.c | 38 +++++++++++++++++---------------------
>  1 file changed, 17 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
> index 70a28b74e721..fc296b352fe2 100644
> --- a/drivers/pci/pcie/ptm.c
> +++ b/drivers/pci/pcie/ptm.c
> @@ -9,26 +9,6 @@
>  #include <linux/pci.h>
>  #include "../pci.h"
>  
> -static void pci_ptm_info(struct pci_dev *dev)
> -{
> -	char clock_desc[8];
> -
> -	switch (dev->ptm_granularity) {
> -	case 0:
> -		snprintf(clock_desc, sizeof(clock_desc), "unknown");
> -		break;
> -	case 255:
> -		snprintf(clock_desc, sizeof(clock_desc), ">254ns");
> -		break;
> -	default:
> -		snprintf(clock_desc, sizeof(clock_desc), "%uns",
> -			 dev->ptm_granularity);
> -		break;
> -	}
> -	pci_info(dev, "PTM enabled%s, %s granularity\n",
> -		 dev->ptm_root ? " (root)" : "", clock_desc);
> -}
> -
>  static void __pci_disable_ptm(struct pci_dev *dev)
>  {
>  	u16 ptm = dev->ptm_cap;
> @@ -213,16 +193,32 @@ static int __pci_enable_ptm(struct pci_dev *dev)
>  int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
>  {
>  	int rc;
> +	char clock_desc[8];
>  
>  	rc = __pci_enable_ptm(dev);
>  	if (rc)
>  		return rc;
>  
>  	dev->ptm_enabled = 1;
> -	pci_ptm_info(dev);
>  
>  	if (granularity)
>  		*granularity = dev->ptm_granularity;
> +
> +	switch (dev->ptm_granularity) {
> +	case 0:
> +		snprintf(clock_desc, sizeof(clock_desc), "unknown");
> +		break;
> +	case 255:
> +		snprintf(clock_desc, sizeof(clock_desc), ">254ns");
> +		break;
> +	default:
> +		snprintf(clock_desc, sizeof(clock_desc), "%uns",
> +			 dev->ptm_granularity);
> +		break;
> +	}
> +	pci_info(dev, "PTM enabled%s, %s granularity\n",
> +		 dev->ptm_root ? " (root)" : "", clock_desc);
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL(pci_enable_ptm);
diff mbox series

Patch

diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
index 70a28b74e721..fc296b352fe2 100644
--- a/drivers/pci/pcie/ptm.c
+++ b/drivers/pci/pcie/ptm.c
@@ -9,26 +9,6 @@ 
 #include <linux/pci.h>
 #include "../pci.h"
 
-static void pci_ptm_info(struct pci_dev *dev)
-{
-	char clock_desc[8];
-
-	switch (dev->ptm_granularity) {
-	case 0:
-		snprintf(clock_desc, sizeof(clock_desc), "unknown");
-		break;
-	case 255:
-		snprintf(clock_desc, sizeof(clock_desc), ">254ns");
-		break;
-	default:
-		snprintf(clock_desc, sizeof(clock_desc), "%uns",
-			 dev->ptm_granularity);
-		break;
-	}
-	pci_info(dev, "PTM enabled%s, %s granularity\n",
-		 dev->ptm_root ? " (root)" : "", clock_desc);
-}
-
 static void __pci_disable_ptm(struct pci_dev *dev)
 {
 	u16 ptm = dev->ptm_cap;
@@ -213,16 +193,32 @@  static int __pci_enable_ptm(struct pci_dev *dev)
 int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
 {
 	int rc;
+	char clock_desc[8];
 
 	rc = __pci_enable_ptm(dev);
 	if (rc)
 		return rc;
 
 	dev->ptm_enabled = 1;
-	pci_ptm_info(dev);
 
 	if (granularity)
 		*granularity = dev->ptm_granularity;
+
+	switch (dev->ptm_granularity) {
+	case 0:
+		snprintf(clock_desc, sizeof(clock_desc), "unknown");
+		break;
+	case 255:
+		snprintf(clock_desc, sizeof(clock_desc), ">254ns");
+		break;
+	default:
+		snprintf(clock_desc, sizeof(clock_desc), "%uns",
+			 dev->ptm_granularity);
+		break;
+	}
+	pci_info(dev, "PTM enabled%s, %s granularity\n",
+		 dev->ptm_root ? " (root)" : "", clock_desc);
+
 	return 0;
 }
 EXPORT_SYMBOL(pci_enable_ptm);