diff mbox series

[v2] lpfc: Fix compilation errors on kernels with no CONFIG_DEBUG_FS

Message ID 20210908050927.37275-1-jsmart2021@gmail.com (mailing list archive)
State Accepted
Headers show
Series [v2] lpfc: Fix compilation errors on kernels with no CONFIG_DEBUG_FS | expand

Commit Message

James Smart Sept. 8, 2021, 5:09 a.m. UTC
The Kernel test robot flagged the following warning:
".../lpfc_init.c:7788:35: error: 'struct lpfc_sli4_hba' has no member
named 'c_stat'"

Reviewing this issue highlighted that one of the recent patches caused
the driver to no longer compile cleanly if CONFIG_DEBUG_FS is not set.

Correct the different areas that are failing to compile.

Fixes: 02243836ad6f ("scsi: lpfc: Add support for the CM framework")
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>

---
v2:
 Address review comments:
 ifdef order in lpfc_sli4_driver_resource_setup()
 Initialization of 0L in lpfc_queuecommand()
---
 drivers/scsi/lpfc/lpfc_init.c | 4 ++--
 drivers/scsi/lpfc/lpfc_nvme.c | 2 --
 drivers/scsi/lpfc/lpfc_scsi.c | 6 +-----
 3 files changed, 3 insertions(+), 9 deletions(-)

Comments

Nathan Chancellor Sept. 8, 2021, 5:21 p.m. UTC | #1
On Tue, Sep 07, 2021 at 10:09:27PM -0700, James Smart wrote:
> The Kernel test robot flagged the following warning:
> ".../lpfc_init.c:7788:35: error: 'struct lpfc_sli4_hba' has no member
> named 'c_stat'"
> 
> Reviewing this issue highlighted that one of the recent patches caused
> the driver to no longer compile cleanly if CONFIG_DEBUG_FS is not set.
> 
> Correct the different areas that are failing to compile.
> 
> Fixes: 02243836ad6f ("scsi: lpfc: Add support for the CM framework")
> Co-developed-by: Justin Tee <justin.tee@broadcom.com>
> Signed-off-by: Justin Tee <justin.tee@broadcom.com>
> Signed-off-by: James Smart <jsmart2021@gmail.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Build-tested-by: Nathan Chancellor <nathan@kernel.org>

> ---
> v2:
>  Address review comments:
>  ifdef order in lpfc_sli4_driver_resource_setup()
>  Initialization of 0L in lpfc_queuecommand()
> ---
>  drivers/scsi/lpfc/lpfc_init.c | 4 ++--
>  drivers/scsi/lpfc/lpfc_nvme.c | 2 --
>  drivers/scsi/lpfc/lpfc_scsi.c | 6 +-----
>  3 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index d3f1fa38269f..d2c16e4410a9 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -8277,11 +8277,11 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
>  	return 0;
>  
>  out_free_hba_hdwq_info:
> -	free_percpu(phba->sli4_hba.c_stat);
>  #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
> +	free_percpu(phba->sli4_hba.c_stat);
>  out_free_hba_idle_stat:
> -	kfree(phba->sli4_hba.idle_stat);
>  #endif
> +	kfree(phba->sli4_hba.idle_stat);
>  out_free_hba_eq_info:
>  	free_percpu(phba->sli4_hba.eq_info);
>  out_free_hba_cpu_map:
> diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
> index 73a3568ff17e..479b3eed6208 100644
> --- a/drivers/scsi/lpfc/lpfc_nvme.c
> +++ b/drivers/scsi/lpfc/lpfc_nvme.c
> @@ -1489,9 +1489,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,
>  	struct lpfc_nvme_qhandle *lpfc_queue_info;
>  	struct lpfc_nvme_fcpreq_priv *freqpriv;
>  	struct nvme_common_command *sqe;
> -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
>  	uint64_t start = 0;
> -#endif
>  
>  	/* Validate pointers. LLDD fault handling with transport does
>  	 * have timing races.
> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
> index 0fde1e874c7a..63d8ac9f68a7 100644
> --- a/drivers/scsi/lpfc/lpfc_scsi.c
> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
> @@ -5578,12 +5578,8 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
>  	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
>  	int err, idx;
>  	u8 *uuid = NULL;
> -#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
> -	uint64_t start = 0L;
> +	uint64_t start;
>  
> -	if (phba->ktime_on)
> -		start = ktime_get_ns();
> -#endif
>  	start = ktime_get_ns();
>  	rdata = lpfc_rport_data_from_scsi_device(cmnd->device);
>  
> -- 
> 2.26.2
> 
>
Martin K. Petersen Sept. 14, 2021, 3:43 a.m. UTC | #2
On Tue, 7 Sep 2021 22:09:27 -0700, James Smart wrote:

> The Kernel test robot flagged the following warning:
> ".../lpfc_init.c:7788:35: error: 'struct lpfc_sli4_hba' has no member
> named 'c_stat'"
> 
> Reviewing this issue highlighted that one of the recent patches caused
> the driver to no longer compile cleanly if CONFIG_DEBUG_FS is not set.
> 
> [...]

Applied to 5.15/scsi-fixes, thanks!

[1/1] lpfc: Fix compilation errors on kernels with no CONFIG_DEBUG_FS
      https://git.kernel.org/mkp/scsi/c/37e384095f20
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index d3f1fa38269f..d2c16e4410a9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8277,11 +8277,11 @@  lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	return 0;
 
 out_free_hba_hdwq_info:
-	free_percpu(phba->sli4_hba.c_stat);
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
+	free_percpu(phba->sli4_hba.c_stat);
 out_free_hba_idle_stat:
-	kfree(phba->sli4_hba.idle_stat);
 #endif
+	kfree(phba->sli4_hba.idle_stat);
 out_free_hba_eq_info:
 	free_percpu(phba->sli4_hba.eq_info);
 out_free_hba_cpu_map:
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 73a3568ff17e..479b3eed6208 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -1489,9 +1489,7 @@  lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,
 	struct lpfc_nvme_qhandle *lpfc_queue_info;
 	struct lpfc_nvme_fcpreq_priv *freqpriv;
 	struct nvme_common_command *sqe;
-#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	uint64_t start = 0;
-#endif
 
 	/* Validate pointers. LLDD fault handling with transport does
 	 * have timing races.
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 0fde1e874c7a..63d8ac9f68a7 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5578,12 +5578,8 @@  lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
 	int err, idx;
 	u8 *uuid = NULL;
-#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
-	uint64_t start = 0L;
+	uint64_t start;
 
-	if (phba->ktime_on)
-		start = ktime_get_ns();
-#endif
 	start = ktime_get_ns();
 	rdata = lpfc_rport_data_from_scsi_device(cmnd->device);