Skip to contentSkip to conversation

drivers: staging: cxt1e1: hwprobe Fix different address spaces

PATCH In review Matei Oprea 3 participants 3 messages Mar 21, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: staging: cxt1e1: hwprobe Fix different address spaces

Fix different address spaces when unmapping IO. hi->addr_mapped[0] and hi->addr_mapped[1] should be tagged __iomem.

Cc ROSEdu Kernel Community <[email protected]>
---
 drivers/staging/cxt1e1/hwprobe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/cxt1e1/hwprobe.c +2 -2
index 9b4198b..f55c27e 100644
@@ -174,12 +174,12 @@ cleanup_ioremap(void)
 		if (hi->pci_slot == 0xff)
 			break;
 		if (hi->addr_mapped[0]) {
-			iounmap((void *)(hi->addr_mapped[0]));
+			iounmap((void __iomem *)(hi->addr_mapped[0]));
 			release_mem_region((long) hi->addr[0], hi->len[0]);
 			hi->addr_mapped[0] = 0;
 		}
 		if (hi->addr_mapped[1]) {
-			iounmap((void *)(hi->addr_mapped[1]));
+			iounmap((void __iomem *)(hi->addr_mapped[1]));
 			release_mem_region((long) hi->addr[1], hi->len[1]);
 			hi->addr_mapped[1] = 0;
 		}
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 19 lines · Matei Oprea

Fix different address spaces when unmapping IO. hi->addr_mapped[0] and hi->addr_mapped[1] should be tagged __iomem.

Cc ROSEdu Kernel Community <[email protected]>
---
 drivers/staging/cxt1e1/hwprobe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/cxt1e1/hwprobe.c +0 -1
index 9b4198b..f55c27e 100644
@@ -174,12 +174,12 @@ cleanup_ioremap(void)
 		if (hi->pci_slot == 0xff)
 			break;
 		if (hi->addr_mapped[0]) {
-			iounmap((void *)(hi->addr_mapped[0]));

drivers/staging/cxt1e1/hwprobe.c cleanup_ioremap(void) · line 185

Quoted 10 lines
drivers/staging/cxt1e1/hwprobe.c +2 -1
+			iounmap((void __iomem *)(hi->addr_mapped[0]));
 			release_mem_region((long) hi->addr[0], hi->len[0]);
 			hi->addr_mapped[0] = 0;
 		}
 		if (hi->addr_mapped[1]) {
-			iounmap((void *)(hi->addr_mapped[1]));
+			iounmap((void __iomem *)(hi->addr_mapped[1]));
 			release_mem_region((long) hi->addr[1], hi->len[1]);
 			hi->addr_mapped[1] = 0;
 		}

__iomem annotations should be added to the private structure pointers. Look at the iounmap usage in the drivers.

Quoted 8 lines

--
1.7.9.5

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Signature · 2 lines
Regards,
Denis
#2 lore raw
In reply to Matei Oprea
Quoted 14 lines · Matei Oprea

Fix different address spaces when unmapping IO. hi->addr_mapped[0] and hi->addr_mapped[1] should be tagged __iomem.

Cc ROSEdu Kernel Community <[email protected]>
---
 drivers/staging/cxt1e1/hwprobe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/cxt1e1/hwprobe.c +0 -0
index 9b4198b..f55c27e 100644

drivers/staging/cxt1e1/hwprobe.c cleanup_ioremap(void) · line 177

Quoted 5 lines
drivers/staging/cxt1e1/hwprobe.c +1 -1
@@ -174,12 +174,12 @@ cleanup_ioremap(void)
 		if (hi->pci_slot == 0xff)
 			break;
 		if (hi->addr_mapped[0]) {
-			iounmap((void *)(hi->addr_mapped[0]));
+			iounmap((void __iomem *)(hi->addr_mapped[0]));

While this may "fix" the sparse warning, it's far from ideal. Like I had suggested on IRC, a much better cleanup would be to make the addr_mapped member an array of __iomem-tagged pointers, and fixup the users.

Josh