linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] scsi: qla2xxx: Fix build error implicit-function-declaration
@ 2022-09-19  3:08 Ren Zhijie
  2022-09-19  7:17 ` Daniel Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: Ren Zhijie @ 2022-09-19  3:08 UTC (permalink / raw)
  To: njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen,
	aeasi, dwagner, himanshu.madhani
  Cc: linux-scsi, linux-kernel, Ren Zhijie

If CONFIG_TRACING is not set,
make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-,
will be failed, like this:

drivers/scsi/qla2xxx/qla_os.c: In function ‘qla_trace_init’:
drivers/scsi/qla2xxx/qla_os.c:2854:18: error: implicit declaration of function ‘trace_array_get_by_name’; did you mean ‘trace_array_set_clr_event’? [-Werror=implicit-function-declaration]
  qla_trc_array = trace_array_get_by_name("qla2xxx");
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  trace_array_set_clr_event
drivers/scsi/qla2xxx/qla_os.c:2854:16: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
  qla_trc_array = trace_array_get_by_name("qla2xxx");
                ^
drivers/scsi/qla2xxx/qla_os.c: In function ‘qla_trace_uninit’:
drivers/scsi/qla2xxx/qla_os.c:2869:2: error: implicit declaration of function ‘trace_array_put’; did you mean ‘trace_seq_putc’? [-Werror=implicit-function-declaration]
  trace_array_put(qla_trc_array);
  ^~~~~~~~~~~~~~~
  trace_seq_putc
cc1: all warnings being treated as errors

To fix this error, wrap up all the relevant code with CONFIG_TRACING.

Fixes: 8bfc149ba24c ("scsi: qla2xxx: Enhance driver tracing with separate tunable and more")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2c85f3cce726..e445105ee16d 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -37,7 +37,9 @@ static int apidev_major;
  */
 struct kmem_cache *srb_cachep;
 
+#ifdef CONFIG_TRACING
 static struct trace_array *qla_trc_array;
+#endif
 
 int ql2xfulldump_on_mpifail;
 module_param(ql2xfulldump_on_mpifail, int, S_IRUGO | S_IWUSR);
@@ -2848,6 +2850,7 @@ static void qla2x00_iocb_work_fn(struct work_struct *work)
 	spin_unlock_irqrestore(&vha->work_lock, flags);
 }
 
+#ifdef CONFIG_TRACING
 static void
 qla_trace_init(void)
 {
@@ -2868,7 +2871,7 @@ qla_trace_uninit(void)
 		return;
 	trace_array_put(qla_trc_array);
 }
-
+#endif
 /*
  * PCI driver interface
  */
@@ -8209,7 +8212,9 @@ qla2x00_module_init(void)
 	BUILD_BUG_ON(sizeof(sw_info_t) != 32);
 	BUILD_BUG_ON(sizeof(target_id_t) != 2);
 
+#ifdef CONFIG_TRACING
 	qla_trace_init();
+#endif
 
 	/* Allocate cache for SRBs. */
 	srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
@@ -8290,7 +8295,9 @@ qla2x00_module_init(void)
 destroy_cache:
 	kmem_cache_destroy(srb_cachep);
 
+#ifdef CONFIG_TRACING
 	qla_trace_uninit();
+#endif
 	return ret;
 }
 
@@ -8309,7 +8316,9 @@ qla2x00_module_exit(void)
 	fc_release_transport(qla2xxx_transport_template);
 	qlt_exit();
 	kmem_cache_destroy(srb_cachep);
+#ifdef CONFIG_TRACING
 	qla_trace_uninit();
+#endif
 }
 
 module_init(qla2x00_module_init);
-- 
2.17.1


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

* Re: [PATCH -next] scsi: qla2xxx: Fix build error implicit-function-declaration
  2022-09-19  3:08 [PATCH -next] scsi: qla2xxx: Fix build error implicit-function-declaration Ren Zhijie
@ 2022-09-19  7:17 ` Daniel Wagner
  2022-09-19 13:20   ` Ren Zhijie
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Wagner @ 2022-09-19  7:17 UTC (permalink / raw)
  To: Ren Zhijie
  Cc: njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen,
	aeasi, himanshu.madhani, linux-scsi, linux-kernel

On Mon, Sep 19, 2022 at 11:08:10AM +0800, Ren Zhijie wrote:
> +#ifdef CONFIG_TRACING
>  static void
>  qla_trace_init(void)
>  {
> @@ -2868,7 +2871,7 @@ qla_trace_uninit(void)
>  		return;
>  	trace_array_put(qla_trc_array);
>  }
> -
> +#endif

FWIW, the qla2xxx driver uses a different pattern for ifdefs

	static void
	qla_trace_init(void)
	{
	#ifdef CONFIG_TRACING
	[...]
        #endif
        }

This avoid to updated the callside with ifdefs.

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

* Re: [PATCH -next] scsi: qla2xxx: Fix build error implicit-function-declaration
  2022-09-19  7:17 ` Daniel Wagner
@ 2022-09-19 13:20   ` Ren Zhijie
  0 siblings, 0 replies; 3+ messages in thread
From: Ren Zhijie @ 2022-09-19 13:20 UTC (permalink / raw)
  To: Daniel Wagner
  Cc: njavali, GR-QLogic-Storage-Upstream, jejb, martin.petersen,
	aeasi, himanshu.madhani, linux-scsi, linux-kernel


在 2022/9/19 15:17, Daniel Wagner 写道:
> On Mon, Sep 19, 2022 at 11:08:10AM +0800, Ren Zhijie wrote:
>> +#ifdef CONFIG_TRACING
>>   static void
>>   qla_trace_init(void)
>>   {
>> @@ -2868,7 +2871,7 @@ qla_trace_uninit(void)
>>   		return;
>>   	trace_array_put(qla_trc_array);
>>   }
>> -
>> +#endif
> FWIW, the qla2xxx driver uses a different pattern for ifdefs
>
> 	static void
> 	qla_trace_init(void)
> 	{
> 	#ifdef CONFIG_TRACING
> 	[...]
>          #endif
>          }
>
> This avoid to updated the callside with ifdefs.

Thanks, I will send patch v2.

Ren

> .
.

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

end of thread, other threads:[~2022-09-19 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  3:08 [PATCH -next] scsi: qla2xxx: Fix build error implicit-function-declaration Ren Zhijie
2022-09-19  7:17 ` Daniel Wagner
2022-09-19 13:20   ` Ren Zhijie

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).