diff mbox series

cxl: fix compile warning for cxl_security_ops extern

Message ID 167771196186.3285982.18283746206612049722.stgit@djiang5-mobl3.local
State New, archived
Headers show
Series cxl: fix compile warning for cxl_security_ops extern | expand

Commit Message

Dave Jiang March 1, 2023, 11:06 p.m. UTC
Jonathan says he has observed compiler warning when using running with W=1
C=1 for cxl_security_ops that is declared as an extern in cxl/pmem.c. Move
to cxl.h to make it visible to all cxl sources.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---

Hi Jonathan, I was not able to reproduce the issue with W=1 C=1. Can you
please see if this fixes what you were seeing? Thanks!

 drivers/cxl/cxl.h  |    2 ++
 drivers/cxl/pmem.c |    2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Alison Schofield March 2, 2023, 12:17 a.m. UTC | #1
On Wed, Mar 01, 2023 at 04:06:58PM -0700, Dave Jiang wrote:
> Jonathan says he has observed compiler warning when using running with W=1
> C=1 for cxl_security_ops that is declared as an extern in cxl/pmem.c. Move
> to cxl.h to make it visible to all cxl sources.
> 
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> Hi Jonathan, I was not able to reproduce the issue with W=1 C=1. Can you
> please see if this fixes what you were seeing? Thanks!

I was seeing this with make C=2 -Wsparse-all
Works without complaint now.

Tested-by: Alison Schofield <alison.schofield@intel.com>

> 
>  drivers/cxl/cxl.h  |    2 ++
>  drivers/cxl/pmem.c |    2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index f2b0962a552d..6f00b938f342 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -10,6 +10,8 @@
>  #include <linux/log2.h>
>  #include <linux/io.h>
>  
> +extern const struct nvdimm_security_ops *cxl_security_ops;
> +
>  /**
>   * DOC: cxl objects
>   *
> diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> index 71cfa1fdf902..55930567fc01 100644
> --- a/drivers/cxl/pmem.c
> +++ b/drivers/cxl/pmem.c
> @@ -11,8 +11,6 @@
>  #include "cxlmem.h"
>  #include "cxl.h"
>  
> -extern const struct nvdimm_security_ops *cxl_security_ops;
> -
>  static __read_mostly DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
>  
>  static void clear_exclusive(void *cxlds)
> 
>
Jonathan Cameron March 3, 2023, 12:15 p.m. UTC | #2
On Wed, 01 Mar 2023 16:06:58 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> Jonathan says he has observed compiler warning when using running with W=1
> C=1 for cxl_security_ops that is declared as an extern in cxl/pmem.c. Move
> to cxl.h to make it visible to all cxl sources.
> 
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> Hi Jonathan, I was not able to reproduce the issue with W=1 C=1. Can you
> please see if this fixes what you were seeing? Thanks!

Meh. Compiler version difference I guess.

This indeed 'fixes' it. Thanks!

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
>  drivers/cxl/cxl.h  |    2 ++
>  drivers/cxl/pmem.c |    2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index f2b0962a552d..6f00b938f342 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -10,6 +10,8 @@
>  #include <linux/log2.h>
>  #include <linux/io.h>
>  
> +extern const struct nvdimm_security_ops *cxl_security_ops;
> +
>  /**
>   * DOC: cxl objects
>   *
> diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> index 71cfa1fdf902..55930567fc01 100644
> --- a/drivers/cxl/pmem.c
> +++ b/drivers/cxl/pmem.c
> @@ -11,8 +11,6 @@
>  #include "cxlmem.h"
>  #include "cxl.h"
>  
> -extern const struct nvdimm_security_ops *cxl_security_ops;
> -
>  static __read_mostly DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
>  
>  static void clear_exclusive(void *cxlds)
> 
>
Alison Schofield Aug. 4, 2023, 6:02 p.m. UTC | #3
Hi Dave,

I'm seeing this sparse warning today, and it appears this patch was
never merged. Please check on it.

Alison


On Wed, Mar 01, 2023 at 04:06:58PM -0700, Dave Jiang wrote:
> Jonathan says he has observed compiler warning when using running with W=1
> C=1 for cxl_security_ops that is declared as an extern in cxl/pmem.c. Move
> to cxl.h to make it visible to all cxl sources.
> 
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> Hi Jonathan, I was not able to reproduce the issue with W=1 C=1. Can you
> please see if this fixes what you were seeing? Thanks!
> 
>  drivers/cxl/cxl.h  |    2 ++
>  drivers/cxl/pmem.c |    2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index f2b0962a552d..6f00b938f342 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -10,6 +10,8 @@
>  #include <linux/log2.h>
>  #include <linux/io.h>
>  
> +extern const struct nvdimm_security_ops *cxl_security_ops;
> +
>  /**
>   * DOC: cxl objects
>   *
> diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> index 71cfa1fdf902..55930567fc01 100644
> --- a/drivers/cxl/pmem.c
> +++ b/drivers/cxl/pmem.c
> @@ -11,8 +11,6 @@
>  #include "cxlmem.h"
>  #include "cxl.h"
>  
> -extern const struct nvdimm_security_ops *cxl_security_ops;
> -
>  static __read_mostly DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
>  
>  static void clear_exclusive(void *cxlds)
> 
>
Alison Schofield Aug. 16, 2023, 6:07 p.m. UTC | #4
On Wed, Mar 01, 2023 at 04:17:04PM -0800, Alison Schofield wrote:
> On Wed, Mar 01, 2023 at 04:06:58PM -0700, Dave Jiang wrote:
> > Jonathan says he has observed compiler warning when using running with W=1
> > C=1 for cxl_security_ops that is declared as an extern in cxl/pmem.c. Move
> > to cxl.h to make it visible to all cxl sources.
> > 
> > Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
> > Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> > ---
> > 
> > Hi Jonathan, I was not able to reproduce the issue with W=1 C=1. Can you
> > please see if this fixes what you were seeing? Thanks!
> 
> I was seeing this with make C=2 -Wsparse-all
> Works without complaint now.
> 
> Tested-by: Alison Schofield <alison.schofield@intel.com>
> 

A cleanup for 6.6 -

Tested-by: Alison Schofield <alison.schofield@intel.com>


> > 
> >  drivers/cxl/cxl.h  |    2 ++
> >  drivers/cxl/pmem.c |    2 --
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> > index f2b0962a552d..6f00b938f342 100644
> > --- a/drivers/cxl/cxl.h
> > +++ b/drivers/cxl/cxl.h
> > @@ -10,6 +10,8 @@
> >  #include <linux/log2.h>
> >  #include <linux/io.h>
> >  
> > +extern const struct nvdimm_security_ops *cxl_security_ops;
> > +
> >  /**
> >   * DOC: cxl objects
> >   *
> > diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> > index 71cfa1fdf902..55930567fc01 100644
> > --- a/drivers/cxl/pmem.c
> > +++ b/drivers/cxl/pmem.c
> > @@ -11,8 +11,6 @@
> >  #include "cxlmem.h"
> >  #include "cxl.h"
> >  
> > -extern const struct nvdimm_security_ops *cxl_security_ops;
> > -
> >  static __read_mostly DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
> >  
> >  static void clear_exclusive(void *cxlds)
> > 
> >
diff mbox series

Patch

diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index f2b0962a552d..6f00b938f342 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -10,6 +10,8 @@ 
 #include <linux/log2.h>
 #include <linux/io.h>
 
+extern const struct nvdimm_security_ops *cxl_security_ops;
+
 /**
  * DOC: cxl objects
  *
diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
index 71cfa1fdf902..55930567fc01 100644
--- a/drivers/cxl/pmem.c
+++ b/drivers/cxl/pmem.c
@@ -11,8 +11,6 @@ 
 #include "cxlmem.h"
 #include "cxl.h"
 
-extern const struct nvdimm_security_ops *cxl_security_ops;
-
 static __read_mostly DECLARE_BITMAP(exclusive_cmds, CXL_MEM_COMMAND_ID_MAX);
 
 static void clear_exclusive(void *cxlds)