All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: hisi_sas: Make use of the helper function devm_platform_ioremap_resource()
@ 2021-09-01  8:52 Cai Huoqing
  2021-09-29  2:53 ` Cai,Huoqing
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-09-01  8:52 UTC (permalink / raw)
  To: caihuoqing
  Cc: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 9515c45affa5..0c2309c951ab 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2649,12 +2649,9 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
 	if (IS_ERR(hisi_hba->regs))
 		goto err_out;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (res) {
-		hisi_hba->sgpio_regs = devm_ioremap_resource(dev, res);
-		if (IS_ERR(hisi_hba->sgpio_regs))
-			goto err_out;
-	}
+	hisi_hba->sgpio_regs = devm_platform_ioremap_resource(pdev, 1);
+	if (IS_ERR(hisi_hba->sgpio_regs))
+		goto err_out;
 
 	if (hisi_sas_alloc(hisi_hba)) {
 		hisi_sas_free(hisi_hba);
-- 
2.25.1


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

* RE: [PATCH] scsi: hisi_sas: Make use of the helper function devm_platform_ioremap_resource()
  2021-09-01  8:52 [PATCH] scsi: hisi_sas: Make use of the helper function devm_platform_ioremap_resource() Cai Huoqing
@ 2021-09-29  2:53 ` Cai,Huoqing
  0 siblings, 0 replies; 2+ messages in thread
From: Cai,Huoqing @ 2021-09-29  2:53 UTC (permalink / raw)
  To: Cai,Huoqing
  Cc: John Garry, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

Hello,

Drop this patch.
Because sgpio_regs is optional which is used like this
	if (!hisi_hba->sgpio_regs)
		return -EOPNOTSUPP;

> -----Original Message-----
> From: Cai,Huoqing <caihuoqing@baidu.com>
> Sent: 2021年9月1日 16:52
> To: Cai,Huoqing
> Cc: John Garry; James E.J. Bottomley; Martin K. Petersen; linux-
> scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] scsi: hisi_sas: Make use of the helper function
> devm_platform_ioremap_resource()
> 
> Use the devm_platform_ioremap_resource() helper instead of
> calling platform_get_resource() and devm_ioremap_resource()
> separately
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/scsi/hisi_sas/hisi_sas_main.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c
> b/drivers/scsi/hisi_sas/hisi_sas_main.c
> index 9515c45affa5..0c2309c951ab 100644
> --- a/drivers/scsi/hisi_sas/hisi_sas_main.c
> +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
> @@ -2649,12 +2649,9 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct
> platform_device *pdev,
>  	if (IS_ERR(hisi_hba->regs))
>  		goto err_out;
> 
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (res) {
> -		hisi_hba->sgpio_regs = devm_ioremap_resource(dev, res);
> -		if (IS_ERR(hisi_hba->sgpio_regs))
> -			goto err_out;
> -	}
> +	hisi_hba->sgpio_regs = devm_platform_ioremap_resource(pdev, 1);
> +	if (IS_ERR(hisi_hba->sgpio_regs))
> +		goto err_out;
> 
>  	if (hisi_sas_alloc(hisi_hba)) {
>  		hisi_sas_free(hisi_hba);
> --
> 2.25.1


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

end of thread, other threads:[~2021-09-29  2:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01  8:52 [PATCH] scsi: hisi_sas: Make use of the helper function devm_platform_ioremap_resource() Cai Huoqing
2021-09-29  2:53 ` Cai,Huoqing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.