[PATCH 1/4] cxl: Compile with -Werror

Subsystems: char and misc drivers, the rest

STALE4021d

14 messages, 3 authors, 2015-08-13 · open the first message on its own page

[PATCH 1/4] cxl: Compile with -Werror

From: Daniel Axtens <hidden>
Date: 2015-08-07 03:20:53

It's a good idea, and it brings us in line with the rest of arch/powerpc.

Signed-off-by: Daniel Axtens <redacted>
---
 drivers/misc/cxl/Makefile | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
index 14e3f8219a11..6f484dfe78f9 100644
--- a/drivers/misc/cxl/Makefile
+++ b/drivers/misc/cxl/Makefile
@@ -1,3 +1,5 @@
+ccflags-y := -Werror
+
 cxl-y				+= main.o file.o irq.o fault.o native.o
 cxl-y				+= context.o sysfs.o debugfs.o pci.o trace.o
 cxl-y				+= vphb.o api.o
-- 
2.1.4

[PATCH 2/4] cxl: sparse: Make declarations static

From: Daniel Axtens <hidden>
Date: 2015-08-07 03:20:56

A few declarations were identified by sparse as needing to be static:

/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:408:6: warning: symbol 'afu_irq_name_free' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:467:6: warning: symbol 'afu_register_hwirqs' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:254:6: warning: symbol 'afu_compat_ioctl' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:399:30: warning: symbol 'afu_master_fops' was not declared. Should it be static?

Make them static.

Signed-off-by: Daniel Axtens <redacted>
---
 drivers/misc/cxl/file.c | 4 ++--
 drivers/misc/cxl/irq.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index e3f4b69527a9..c8c8bfa2679b 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -251,7 +251,7 @@ long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return -EINVAL;
 }
 
-long afu_compat_ioctl(struct file *file, unsigned int cmd,
+static long afu_compat_ioctl(struct file *file, unsigned int cmd,
 			     unsigned long arg)
 {
 	return afu_ioctl(file, cmd, arg);
@@ -396,7 +396,7 @@ const struct file_operations afu_fops = {
 	.mmap           = afu_mmap,
 };
 
-const struct file_operations afu_master_fops = {
+static const struct file_operations afu_master_fops = {
 	.owner		= THIS_MODULE,
 	.open           = afu_master_open,
 	.poll		= afu_poll,
diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index 680cd263436d..77e5d0e7ebe1 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -405,7 +405,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu)
 	kfree(afu->psl_irq_name);
 }
 
-void afu_irq_name_free(struct cxl_context *ctx)
+static void afu_irq_name_free(struct cxl_context *ctx)
 {
 	struct cxl_irq_name *irq_name, *tmp;
 
@@ -464,7 +464,7 @@ out:
 	return -ENOMEM;
 }
 
-void afu_register_hwirqs(struct cxl_context *ctx)
+static void afu_register_hwirqs(struct cxl_context *ctx)
 {
 	irq_hw_number_t hwirq;
 	struct cxl_irq_name *irq_name;
-- 
2.1.4

[PATCH 3/4] cxl: sparse: Flag iomem pointers properly

From: Daniel Axtens <hidden>
Date: 2015-08-07 03:20:59

Sparse identifies the following address space issues:
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17: warning: incorrect type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    expected void volatile [noderef] <asn:2>*<noident>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    got void *<noident>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23: warning: incorrect type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    expected void [noderef] <asn:2>*cfg_data
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    got void *<noident>

Fix those by flagging __iomem in the relevant casts.

Signed-off-by: Daniel Axtens <redacted>
---
 drivers/misc/cxl/vphb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 2eba002b580b..a7b55772a91c 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -122,7 +122,7 @@ static int cxl_pcie_config_info(struct pci_bus *bus, unsigned int devfn,
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 	addr = cxl_pcie_cfg_addr(phb, bus->number, devfn, offset);
 
-	*ioaddr = (void *)(addr & ~0x3ULL);
+	*ioaddr = (void __iomem *)(addr & ~0x3ULL);
 	*shift = ((addr & 0x3) * 8);
 	switch (len) {
 	case 1:
@@ -217,7 +217,7 @@ int cxl_pci_vphb_add(struct cxl_afu *afu)
 	/* Setup the PHB using arch provided callback */
 	phb->ops = &cxl_pcie_pci_ops;
 	phb->cfg_addr = afu->afu_desc_mmio + afu->crs_offset;
-	phb->cfg_data = (void *)(u64)afu->crs_len;
+	phb->cfg_data = (void __iomem *)(u64)afu->crs_len;
 	phb->private_data = afu;
 	phb->controller_ops = cxl_pci_controller_ops;
 
-- 
2.1.4

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

From: Daniel Axtens <hidden>
Date: 2015-08-07 03:21:02

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 <redacted>
---
 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)
-- 
2.1.4

Re: [PATCH 1/4] cxl: Compile with -Werror

From: Michael Neuling <hidden>
Date: 2015-08-07 03:25:41

On Fri, 2015-08-07 at 13:18 +1000, Daniel Axtens wrote:
It's a good idea, and it brings us in line with the rest of arch/powerpc.
Do you need to put this patch last so that you don't break bisecting the
series?

Mikey
quoted hunk
Signed-off-by: Daniel Axtens <redacted>
---
 drivers/misc/cxl/Makefile | 2 ++
 1 file changed, 2 insertions(+)
=20
diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
index 14e3f8219a11..6f484dfe78f9 100644
--- a/drivers/misc/cxl/Makefile
+++ b/drivers/misc/cxl/Makefile
@@ -1,3 +1,5 @@
+ccflags-y :=3D -Werror
+
 cxl-y				+=3D main.o file.o irq.o fault.o native.o
 cxl-y				+=3D context.o sysfs.o debugfs.o pci.o trace.o
 cxl-y				+=3D vphb.o api.o

Re: [PATCH 1/4] cxl: Compile with -Werror

From: Daniel Axtens <hidden>
Date: 2015-08-07 03:28:47

Do you need to put this patch last so that you don't break bisecting the
series?
The warnings fixed in the rest of the series are from sparse, not the
compiler, so they don't break building with -Werror.

-- 
Regards,
Daniel

Re: [PATCH 1/4] cxl: Compile with -Werror

From: Michael Neuling <hidden>
Date: 2015-08-07 04:13:04

On Fri, 2015-08-07 at 13:18 +1000, Daniel Axtens wrote:
It's a good idea, and it brings us in line with the rest of arch/powerpc.
=20
Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
quoted hunk
---
 drivers/misc/cxl/Makefile | 2 ++
 1 file changed, 2 insertions(+)
=20
diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
index 14e3f8219a11..6f484dfe78f9 100644
--- a/drivers/misc/cxl/Makefile
+++ b/drivers/misc/cxl/Makefile
@@ -1,3 +1,5 @@
+ccflags-y :=3D -Werror
+
 cxl-y				+=3D main.o file.o irq.o fault.o native.o
 cxl-y				+=3D context.o sysfs.o debugfs.o pci.o trace.o
 cxl-y				+=3D vphb.o api.o

Re: [PATCH 3/4] cxl: sparse: Flag iomem pointers properly

From: Michael Neuling <hidden>
Date: 2015-08-07 04:13:10

On Fri, 2015-08-07 at 13:18 +1000, Daniel Axtens wrote:
Sparse identifies the following address space issues:
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17: warning: incorrec=
t type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    expected void =
volatile [noderef] <asn:2>*<noident>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    got void *<noi=
dent>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23: warning: incorrec=
t type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    expected void =
[noderef] <asn:2>*cfg_data
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    got void *<noi=
dent>
=20
Fix those by flagging __iomem in the relevant casts.
=20
Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
quoted hunk
---
 drivers/misc/cxl/vphb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
=20
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 2eba002b580b..a7b55772a91c 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -122,7 +122,7 @@ static int cxl_pcie_config_info(struct pci_bus *bus, =
unsigned int devfn,
quoted hunk
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 	addr =3D cxl_pcie_cfg_addr(phb, bus->number, devfn, offset);
=20
-	*ioaddr =3D (void *)(addr & ~0x3ULL);
+	*ioaddr =3D (void __iomem *)(addr & ~0x3ULL);
 	*shift =3D ((addr & 0x3) * 8);
 	switch (len) {
 	case 1:
@@ -217,7 +217,7 @@ int cxl_pci_vphb_add(struct cxl_afu *afu)
 	/* Setup the PHB using arch provided callback */
 	phb->ops =3D &cxl_pcie_pci_ops;
 	phb->cfg_addr =3D afu->afu_desc_mmio + afu->crs_offset;
-	phb->cfg_data =3D (void *)(u64)afu->crs_len;
+	phb->cfg_data =3D (void __iomem *)(u64)afu->crs_len;
 	phb->private_data =3D afu;
 	phb->controller_ops =3D cxl_pci_controller_ops;
=20

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

From: Michael Neuling <hidden>
Date: 2015-08-07 04:13:13

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 r=
emoves address space of expression
=20
The address space marker is added back in the file operations
(fops_io_u64).
=20
Silence the warning with __force.
=20
Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
quoted hunk
---
 drivers/misc/cxl/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
=20
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 mo=
de,
 					    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);
 }
=20
 int cxl_debugfs_adapter_add(struct cxl *adapter)

Re: [PATCH 2/4] cxl: sparse: Make declarations static

From: Michael Neuling <hidden>
Date: 2015-08-07 05:48:53

On Fri, 2015-08-07 at 13:18 +1000, Daniel Axtens wrote:
A few declarations were identified by sparse as needing to be static:
=20
/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:408:6: warning: symbol 'af=
u_irq_name_free' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:467:6: warning: symbol 'af=
u_register_hwirqs' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:254:6: warning: symbol 'a=
fu_compat_ioctl' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:399:30: warning: symbol '=
afu_master_fops' was not declared. Should it be static?
=20
Make them static.
=20
Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
quoted hunk
---
 drivers/misc/cxl/file.c | 4 ++--
 drivers/misc/cxl/irq.c  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
=20
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c
index e3f4b69527a9..c8c8bfa2679b 100644
--- a/drivers/misc/cxl/file.c
+++ b/drivers/misc/cxl/file.c
@@ -251,7 +251,7 @@ long afu_ioctl(struct file *file, unsigned int cmd, u=
nsigned long arg)
quoted hunk
 	return -EINVAL;
 }
=20
-long afu_compat_ioctl(struct file *file, unsigned int cmd,
+static long afu_compat_ioctl(struct file *file, unsigned int cmd,
 			     unsigned long arg)
 {
 	return afu_ioctl(file, cmd, arg);
@@ -396,7 +396,7 @@ const struct file_operations afu_fops =3D {
 	.mmap           =3D afu_mmap,
 };
=20
-const struct file_operations afu_master_fops =3D {
+static const struct file_operations afu_master_fops =3D {
 	.owner		=3D THIS_MODULE,
 	.open           =3D afu_master_open,
 	.poll		=3D afu_poll,
diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index 680cd263436d..77e5d0e7ebe1 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -405,7 +405,7 @@ void cxl_release_psl_irq(struct cxl_afu *afu)
 	kfree(afu->psl_irq_name);
 }
=20
-void afu_irq_name_free(struct cxl_context *ctx)
+static void afu_irq_name_free(struct cxl_context *ctx)
 {
 	struct cxl_irq_name *irq_name, *tmp;
=20
@@ -464,7 +464,7 @@ out:
 	return -ENOMEM;
 }
=20
-void afu_register_hwirqs(struct cxl_context *ctx)
+static void afu_register_hwirqs(struct cxl_context *ctx)
 {
 	irq_hw_number_t hwirq;
 	struct cxl_irq_name *irq_name;

Re: [3/4] cxl: sparse: Flag iomem pointers properly

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-08-12 03:19:56

On Fri, 2015-07-08 at 03:18:19 UTC, Daniel Axtens wrote:
Sparse identifies the following address space issues:
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17: warning: incorrect type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    expected void volatile [noderef] <asn:2>*<noident>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:125:17:    got void *<noident>
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23: warning: incorrect type in assignment (different address spaces)
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    expected void [noderef] <asn:2>*cfg_data
/scratch/dja/linux-capi/drivers/misc/cxl/vphb.c:220:23:    got void *<noident>
Please trim these to just the sub-path under linux, and a two space indent is nice:

  drivers/misc/cxl/vphb.c:220:23:    got void *<noident>
quoted hunk
Fix those by flagging __iomem in the relevant casts.

Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
---
 drivers/misc/cxl/vphb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 2eba002b580b..a7b55772a91c 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -122,7 +122,7 @@ static int cxl_pcie_config_info(struct pci_bus *bus, unsigned int devfn,
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 	addr = cxl_pcie_cfg_addr(phb, bus->number, devfn, offset);
 
-	*ioaddr = (void *)(addr & ~0x3ULL);
+	*ioaddr = (void __iomem *)(addr & ~0x3ULL);
But shouldn't cxl_pcie_cfg_addr() be returning something that is __iomem ?
quoted hunk
@@ -217,7 +217,7 @@ int cxl_pci_vphb_add(struct cxl_afu *afu)
 	/* Setup the PHB using arch provided callback */
 	phb->ops = &cxl_pcie_pci_ops;
 	phb->cfg_addr = afu->afu_desc_mmio + afu->crs_offset;
-	phb->cfg_data = (void *)(u64)afu->crs_len;
+	phb->cfg_data = (void __iomem *)(u64)afu->crs_len;
crs_len is already a u64 so that u64 cast is pointless.

cheers

Re: [2/4] cxl: sparse: Make declarations static

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-08-13 01:44:24

On Fri, 2015-07-08 at 03:18:18 UTC, Daniel Axtens wrote:
A few declarations were identified by sparse as needing to be static:

/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:408:6: warning: symbol 'afu_irq_name_free' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/irq.c:467:6: warning: symbol 'afu_register_hwirqs' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:254:6: warning: symbol 'afu_compat_ioctl' was not declared. Should it be static?
/scratch/dja/linux-capi/drivers/misc/cxl/file.c:399:30: warning: symbol 'afu_master_fops' was not declared. Should it be static?

Make them static.

Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/3d6b040e73387570521d

cheers

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

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-08-13 01:44:25

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 <redacted>
Acked-by: Michael Neuling <redacted>
Applied to powerpc next, thanks.

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

cheers

Re: [1/4] cxl: Compile with -Werror

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2015-08-13 01:44:26

On Fri, 2015-07-08 at 03:18:17 UTC, Daniel Axtens wrote:
It's a good idea, and it brings us in line with the rest of arch/powerpc.

Signed-off-by: Daniel Axtens <redacted>
Acked-by: Michael Neuling <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d3d73f4b38a8ece19846

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help