mbox series

[v3,0/1] Tracing: Compile error with qla2xxx

Message ID 20220907233308.4153-1-aeasi@marvell.com
Headers show
Series Tracing: Compile error with qla2xxx | expand

Message

Arun Easi Sept. 7, 2022, 11:33 p.m. UTC
Hi Steve, et.al,

Please find a patch to fix compile error coming from qla2xxx driver
when CONFIG_TRACING is disabled.

Hi Martin,

Please apply this patch to the SCSI tree once Steve approves it. Here
is a link to the discussion:
    https://lore.kernel.org/linux-scsi/YxdZ%2F9XOsWilvVSd@debian/T/#m6efb601ed65c907124a03cfd5f3f38f1eb8c5925

Changes from V2:
    * Incorporated Bart's review comments (use of git clang-format)

Changes from V1:
    * Incorporated Steve's review comments (change to inline etc.)

Regards,
-Arun

Arun Easi (1):
  tracing: Fix compile error in trace_array calls when TRACING is
    disabled

 include/linux/trace.h | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

Comments

Bart Van Assche Sept. 8, 2022, 4:55 p.m. UTC | #1
On 9/7/22 16:33, Arun Easi wrote:
> diff --git a/include/linux/trace.h b/include/linux/trace.h
> index bf16961..b5e16e4 100644
> --- a/include/linux/trace.h
> +++ b/include/linux/trace.h
> @@ -2,8 +2,6 @@
>   #ifndef _LINUX_TRACE_H
>   #define _LINUX_TRACE_H
>   
> -#ifdef CONFIG_TRACING
> -
>   #define TRACE_EXPORT_FUNCTION	BIT(0)
>   #define TRACE_EXPORT_EVENT	BIT(1)
>   #define TRACE_EXPORT_MARKER	BIT(2)
> @@ -28,6 +26,8 @@ struct trace_export {
>   	int flags;
>   };
>   
> +#ifdef CONFIG_TRACING
> +
>   int register_ftrace_export(struct trace_export *export);
>   int unregister_ftrace_export(struct trace_export *export);
>   
> @@ -48,6 +48,38 @@ void osnoise_arch_unregister(void);
>   void osnoise_trace_irq_entry(int id);
>   void osnoise_trace_irq_exit(int id, const char *desc);
>   
> +#else /* CONFIG_TRACING */
> +static inline int register_ftrace_export(struct trace_export *export)
> +{
> +	return -EINVAL;
> +}
> +static inline int unregister_ftrace_export(struct trace_export *export)
> +{
> +	return 0;
> +}
> +static inline void trace_printk_init_buffers(void)
> +{
> +}
> +static inline int trace_array_printk(struct trace_array *tr, unsigned long ip,
> +				     const char *fmt, ...)
> +{
> +	return 0;
> +}
> +static inline int trace_array_init_printk(struct trace_array *tr)
> +{
> +	return -EINVAL;
> +}
> +static inline void trace_array_put(struct trace_array *tr)
> +{
> +}
> +static inline struct trace_array *trace_array_get_by_name(const char *name)
> +{
> +	return NULL;
> +}
> +static inline int trace_array_destroy(struct trace_array *tr)
> +{
> +	return 0;
> +}
>   #endif	/* CONFIG_TRACING */
>   
>   #endif	/* _LINUX_TRACE_H */

Thanks for having addressed my feedback. The above looks good to me. 
However, I'm not very familiar with the tracing framework so I will 
leave it to others to formally review this patch.

Thanks,

Bart.
Arun Easi Sept. 8, 2022, 7:12 p.m. UTC | #2
On Thu, 8 Sep 2022, 9:55am, Bart Van Assche wrote:

> 
> ----------------------------------------------------------------------
> On 9/7/22 16:33, Arun Easi wrote:
> > diff --git a/include/linux/trace.h b/include/linux/trace.h
> > index bf16961..b5e16e4 100644
> > --- a/include/linux/trace.h
> > +++ b/include/linux/trace.h
> > @@ -2,8 +2,6 @@
> >   #ifndef _LINUX_TRACE_H
> >   #define _LINUX_TRACE_H
> >   -#ifdef CONFIG_TRACING
> > -
> >   #define TRACE_EXPORT_FUNCTION	BIT(0)
> >   #define TRACE_EXPORT_EVENT	BIT(1)
> >   #define TRACE_EXPORT_MARKER	BIT(2)
> > @@ -28,6 +26,8 @@ struct trace_export {
> >   	int flags;
> >   };
> >   +#ifdef CONFIG_TRACING
> > +
> >   int register_ftrace_export(struct trace_export *export);
> >   int unregister_ftrace_export(struct trace_export *export);
> >   @@ -48,6 +48,38 @@ void osnoise_arch_unregister(void);
> >   void osnoise_trace_irq_entry(int id);
> >   void osnoise_trace_irq_exit(int id, const char *desc);
> >   +#else /* CONFIG_TRACING */
> > +static inline int register_ftrace_export(struct trace_export *export)
> > +{
> > +	return -EINVAL;
> > +}
> > +static inline int unregister_ftrace_export(struct trace_export *export)
> > +{
> > +	return 0;
> > +}
> > +static inline void trace_printk_init_buffers(void)
> > +{
> > +}
> > +static inline int trace_array_printk(struct trace_array *tr, unsigned long
> > ip,
> > +				     const char *fmt, ...)
> > +{
> > +	return 0;
> > +}
> > +static inline int trace_array_init_printk(struct trace_array *tr)
> > +{
> > +	return -EINVAL;
> > +}
> > +static inline void trace_array_put(struct trace_array *tr)
> > +{
> > +}
> > +static inline struct trace_array *trace_array_get_by_name(const char *name)
> > +{
> > +	return NULL;
> > +}
> > +static inline int trace_array_destroy(struct trace_array *tr)
> > +{
> > +	return 0;
> > +}
> >   #endif	/* CONFIG_TRACING */
> >     #endif	/* _LINUX_TRACE_H */
> 
> Thanks for having addressed my feedback. The above looks good to me. However,
> I'm not very familiar with the tracing framework so I will leave it to others
> to formally review this patch.
> 

Thanks for the review and suggestion of the clang-format command line, 
Bart. That is a useful one to remember.

Steve, does this look ok? If so, your approval is appreciated, as this is 
a build blocker fix.

Regards,
-Arun