diff mbox series

[v1] drivers: block: skd: remove skd_pci_info()

Message ID 20201214152720.11922-1-puranjay12@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series [v1] drivers: block: skd: remove skd_pci_info() | expand

Commit Message

Puranjay Mohan Dec. 14, 2020, 3:27 p.m. UTC
Change the call to skd_pci_info() to pcie_print_link_status().
pcie_print_link_status() can be used to print the link speed and
the link width, skd_pci_info() does the same and hence it is removed.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
---
v1 - Add call to pcie_print_link_status()
---
 drivers/block/skd_main.c | 33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

Comments

Damien Le Moal Dec. 14, 2020, 11:41 p.m. UTC | #1
On 2020/12/15 0:27, Puranjay Mohan wrote:
> Change the call to skd_pci_info() to pcie_print_link_status().
> pcie_print_link_status() can be used to print the link speed and
> the link width, skd_pci_info() does the same and hence it is removed.
> 
> Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
> ---
> v1 - Add call to pcie_print_link_status()
> ---
>  drivers/block/skd_main.c | 33 +--------------------------------
>  1 file changed, 1 insertion(+), 32 deletions(-)
> 
> diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> index a962b4551bed..efd69f349043 100644
> --- a/drivers/block/skd_main.c
> +++ b/drivers/block/skd_main.c
> @@ -3134,40 +3134,10 @@ static const struct pci_device_id skd_pci_tbl[] = {
>  
>  MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
>  
> -static char *skd_pci_info(struct skd_device *skdev, char *str)
> -{
> -	int pcie_reg;
> -
> -	strcpy(str, "PCIe (");
> -	pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);
> -
> -	if (pcie_reg) {
> -
> -		char lwstr[6];
> -		uint16_t pcie_lstat, lspeed, lwidth;
> -
> -		pcie_reg += 0x12;
> -		pci_read_config_word(skdev->pdev, pcie_reg, &pcie_lstat);
> -		lspeed = pcie_lstat & (0xF);
> -		lwidth = (pcie_lstat & 0x3F0) >> 4;
> -
> -		if (lspeed == 1)
> -			strcat(str, "2.5GT/s ");
> -		else if (lspeed == 2)
> -			strcat(str, "5.0GT/s ");
> -		else
> -			strcat(str, "<unknown> ");
> -		snprintf(lwstr, sizeof(lwstr), "%dX)", lwidth);
> -		strcat(str, lwstr);
> -	}
> -	return str;
> -}
> -
>  static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  {
>  	int i;
>  	int rc = 0;
> -	char pci_str[32];
>  	struct skd_device *skdev;
>  
>  	dev_dbg(&pdev->dev, "vendor=%04X device=%04x\n", pdev->vendor,
> @@ -3201,8 +3171,7 @@ static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  		goto err_out_regions;
>  	}
>  
> -	skd_pci_info(skdev, pci_str);
> -	dev_info(&pdev->dev, "%s 64bit\n", pci_str);
> +	pcie_print_link_status(pdev);
>  
>  	pci_set_master(pdev);
>  	rc = pci_enable_pcie_error_reporting(pdev);
> 

Note: V1 of this patch was the one I commented on. This one should thus be V2.

In any case, this looks OK to me.

Acked-by: Damien Le Moal <damien.lemoal@wdc.com>
diff mbox series

Patch

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a962b4551bed..efd69f349043 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -3134,40 +3134,10 @@  static const struct pci_device_id skd_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
 
-static char *skd_pci_info(struct skd_device *skdev, char *str)
-{
-	int pcie_reg;
-
-	strcpy(str, "PCIe (");
-	pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);
-
-	if (pcie_reg) {
-
-		char lwstr[6];
-		uint16_t pcie_lstat, lspeed, lwidth;
-
-		pcie_reg += 0x12;
-		pci_read_config_word(skdev->pdev, pcie_reg, &pcie_lstat);
-		lspeed = pcie_lstat & (0xF);
-		lwidth = (pcie_lstat & 0x3F0) >> 4;
-
-		if (lspeed == 1)
-			strcat(str, "2.5GT/s ");
-		else if (lspeed == 2)
-			strcat(str, "5.0GT/s ");
-		else
-			strcat(str, "<unknown> ");
-		snprintf(lwstr, sizeof(lwstr), "%dX)", lwidth);
-		strcat(str, lwstr);
-	}
-	return str;
-}
-
 static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	int i;
 	int rc = 0;
-	char pci_str[32];
 	struct skd_device *skdev;
 
 	dev_dbg(&pdev->dev, "vendor=%04X device=%04x\n", pdev->vendor,
@@ -3201,8 +3171,7 @@  static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_out_regions;
 	}
 
-	skd_pci_info(skdev, pci_str);
-	dev_info(&pdev->dev, "%s 64bit\n", pci_str);
+	pcie_print_link_status(pdev);
 
 	pci_set_master(pdev);
 	rc = pci_enable_pcie_error_reporting(pdev);