diff mbox

[4/4] cxl: sparse: Silence iomem warning in debugfs file creation

Message ID 1438917500-12100-4-git-send-email-dja@axtens.net (mailing list archive)
State Accepted
Delegated to: Michael Ellerman
Headers show

Commit Message

Daniel Axtens Aug. 7, 2015, 3:18 a.m. UTC
An IO address, tagged with __iomem, is passed to debugfs_create_file
as private data. This requires that it be cast to void *. The cast
creates a sparse warning:
/scratch/dja/linux-capi/drivers/misc/cxl/debugfs.c:51:57: warning: cast removes address space of expression

The address space marker is added back in the file operations
(fops_io_u64).

Silence the warning with __force.

Signed-off-by: Daniel Axtens <dja@axtens.net>
---
 drivers/misc/cxl/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Neuling Aug. 7, 2015, 4:13 a.m. UTC | #1
On Fri, 2015-08-07 at 13:18 +1000, Daniel Axtens wrote:
> An IO address, tagged with __iomem, is passed to debugfs_create_file
> as private data. This requires that it be cast to void *. The cast
> creates a sparse warning:
> /scratch/dja/linux-capi/drivers/misc/cxl/debugfs.c:51:57: warning: cast removes address space of expression
> 
> The address space marker is added back in the file operations
> (fops_io_u64).
> 
> Silence the warning with __force.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Acked-by: Michael Neuling <mikey@neuling.org>

> ---
>  drivers/misc/cxl/debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/cxl/debugfs.c b/drivers/misc/cxl/debugfs.c
> index 825c412580bc..18df6f44af2a 100644
> --- a/drivers/misc/cxl/debugfs.c
> +++ b/drivers/misc/cxl/debugfs.c
> @@ -48,7 +48,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, "0x
>  static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode,
>  					    struct dentry *parent, u64 __iomem *value)
>  {
> -	return debugfs_create_file(name, mode, parent, (void *)value, &fops_io_x64);
> +	return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
>  }
>  
>  int cxl_debugfs_adapter_add(struct cxl *adapter)
Michael Ellerman Aug. 13, 2015, 1:44 a.m. UTC | #2
On Fri, 2015-07-08 at 03:18:20 UTC, Daniel Axtens wrote:
> An IO address, tagged with __iomem, is passed to debugfs_create_file
> as private data. This requires that it be cast to void *. The cast
> creates a sparse warning:
> /scratch/dja/linux-capi/drivers/misc/cxl/debugfs.c:51:57: warning: cast removes address space of expression
> 
> The address space marker is added back in the file operations
> (fops_io_u64).
> 
> Silence the warning with __force.
> 
> Signed-off-by: Daniel Axtens <dja@axtens.net>
> Acked-by: Michael Neuling <mikey@neuling.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/83c3fee7e78f5a937b73

cheers
diff mbox

Patch

diff --git a/drivers/misc/cxl/debugfs.c b/drivers/misc/cxl/debugfs.c
index 825c412580bc..18df6f44af2a 100644
--- a/drivers/misc/cxl/debugfs.c
+++ b/drivers/misc/cxl/debugfs.c
@@ -48,7 +48,7 @@  DEFINE_SIMPLE_ATTRIBUTE(fops_io_x64, debugfs_io_u64_get, debugfs_io_u64_set, "0x
 static struct dentry *debugfs_create_io_x64(const char *name, umode_t mode,
 					    struct dentry *parent, u64 __iomem *value)
 {
-	return debugfs_create_file(name, mode, parent, (void *)value, &fops_io_x64);
+	return debugfs_create_file(name, mode, parent, (void __force *)value, &fops_io_x64);
 }
 
 int cxl_debugfs_adapter_add(struct cxl *adapter)