Skip to content

Commit 2c4ce3e

Browse files
BenjaminGrayNp1mpe
authored andcommitted
powerpc: Cast away __iomem in low level IO routines
Sparse reports dereferencing an __iomem pointer. These routines are clearly low level handlers for IO memory, so force cast away the __iomem annotation to tell sparse the dereferences are safe. Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20231011053711.93427-11-bgray@linux.ibm.com
1 parent c6519c6 commit 2c4ce3e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • arch/powerpc/kernel

arch/powerpc/kernel/io.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void _insb(const volatile u8 __iomem *port, void *buf, long count)
3333
return;
3434
asm volatile("sync");
3535
do {
36-
tmp = *port;
36+
tmp = *(const volatile u8 __force *)port;
3737
eieio();
3838
*tbuf++ = tmp;
3939
} while (--count != 0);
@@ -49,7 +49,7 @@ void _outsb(volatile u8 __iomem *port, const void *buf, long count)
4949
return;
5050
asm volatile("sync");
5151
do {
52-
*port = *tbuf++;
52+
*(volatile u8 __force *)port = *tbuf++;
5353
} while (--count != 0);
5454
asm volatile("sync");
5555
}
@@ -64,7 +64,7 @@ void _insw_ns(const volatile u16 __iomem *port, void *buf, long count)
6464
return;
6565
asm volatile("sync");
6666
do {
67-
tmp = *port;
67+
tmp = *(const volatile u16 __force *)port;
6868
eieio();
6969
*tbuf++ = tmp;
7070
} while (--count != 0);
@@ -80,7 +80,7 @@ void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count)
8080
return;
8181
asm volatile("sync");
8282
do {
83-
*port = *tbuf++;
83+
*(volatile u16 __force *)port = *tbuf++;
8484
} while (--count != 0);
8585
asm volatile("sync");
8686
}
@@ -95,7 +95,7 @@ void _insl_ns(const volatile u32 __iomem *port, void *buf, long count)
9595
return;
9696
asm volatile("sync");
9797
do {
98-
tmp = *port;
98+
tmp = *(const volatile u32 __force *)port;
9999
eieio();
100100
*tbuf++ = tmp;
101101
} while (--count != 0);
@@ -111,7 +111,7 @@ void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count)
111111
return;
112112
asm volatile("sync");
113113
do {
114-
*port = *tbuf++;
114+
*(volatile u32 __force *)port = *tbuf++;
115115
} while (--count != 0);
116116
asm volatile("sync");
117117
}

0 commit comments

Comments
 (0)