Skip to content

Commit a8cb1e9

Browse files
committed
hexagon: simplify asm/io.h for !HAS_IOPORT
Hexagon fails to build after the final patch that makes CONFIG_HAS_IOPORT optional: In file included from arch/hexagon/include/asm/io.h:328: include/asm-generic/io.h:854:18: error: static declaration of 'ioread8' follows non-static declaration 854 | static inline u8 ioread8(const volatile void __iomem *addr) | ^ include/asm-generic/io.h:853:17: note: expanded from macro 'ioread8' 853 | #define ioread8 ioread8 | ^ include/asm-generic/iomap.h:29:21: note: previous declaration is here 29 | extern unsigned int ioread8(const void __iomem *); | ^ As it turns out, most of its asm/io.h and lib/io.c files is redundant now, and just removing all that makes it build again. As with the other architectures, defining the __raw_readl()/__raw_writel() type functions instead of the non-__raw ones is better here for consistency. Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 6e3f5e6 commit a8cb1e9

File tree

4 files changed

+16
-295
lines changed

4 files changed

+16
-295
lines changed

arch/hexagon/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ config HEXAGON
3030
select HAVE_ARCH_KGDB
3131
select HAVE_ARCH_TRACEHOOK
3232
select NEED_SG_DMA_LENGTH
33-
select NO_IOPORT_MAP
3433
select GENERIC_IOREMAP
3534
select GENERIC_SMP_IDLE_THREAD
3635
select STACKTRACE_SUPPORT
@@ -58,6 +57,9 @@ config EARLY_PRINTK
5857
config MMU
5958
def_bool y
6059

60+
config NO_IOPORT_MAP
61+
def_bool y
62+
6163
config GENERIC_CSUM
6264
def_bool y
6365

arch/hexagon/include/asm/io.h

Lines changed: 12 additions & 211 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,13 @@
88
#ifndef _ASM_IO_H
99
#define _ASM_IO_H
1010

11-
#ifdef __KERNEL__
12-
1311
#include <linux/types.h>
14-
#include <asm/iomap.h>
1512
#include <asm/page.h>
1613
#include <asm/cacheflush.h>
1714

18-
/*
19-
* We don't have PCI yet.
20-
* _IO_BASE is pointing at what should be unused virtual space.
21-
*/
22-
#define IO_SPACE_LIMIT 0xffff
23-
#define _IO_BASE ((void __iomem *)0xfe000000)
24-
25-
#define IOMEM(x) ((void __force __iomem *)(x))
26-
2715
extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
2816
unsigned long end, unsigned long flags);
2917

30-
/* Defined in lib/io.c, needed for smc91x driver. */
31-
extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
32-
extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
33-
34-
extern void __raw_readsl(const void __iomem *addr, void *data, int wordlen);
35-
extern void __raw_writesl(void __iomem *addr, const void *data, int wordlen);
36-
37-
#define readsw(p, d, l) __raw_readsw(p, d, l)
38-
#define writesw(p, d, l) __raw_writesw(p, d, l)
39-
40-
#define readsl(p, d, l) __raw_readsl(p, d, l)
41-
#define writesl(p, d, l) __raw_writesl(p, d, l)
42-
4318
/*
4419
* virt_to_phys - map virtual address to physical
4520
* @address: address to map
@@ -58,21 +33,12 @@ static inline void *phys_to_virt(unsigned long address)
5833
return __va(address);
5934
}
6035

61-
/*
62-
* IO port access primitives. Hexagon doesn't have special IO access
63-
* instructions; all I/O is memory mapped.
64-
*
65-
* in/out are used for "ports", but we don't have "port instructions",
66-
* so these are really just memory mapped too.
67-
*/
68-
6936
/*
7037
* readb - read byte from memory mapped device
7138
* @addr: pointer to memory
7239
*
73-
* Operates on "I/O bus memory space"
7440
*/
75-
static inline u8 readb(const volatile void __iomem *addr)
41+
static inline u8 __raw_readb(const volatile void __iomem *addr)
7642
{
7743
u8 val;
7844
asm volatile(
@@ -82,8 +48,9 @@ static inline u8 readb(const volatile void __iomem *addr)
8248
);
8349
return val;
8450
}
51+
#define __raw_readb __raw_readb
8552

86-
static inline u16 readw(const volatile void __iomem *addr)
53+
static inline u16 __raw_readw(const volatile void __iomem *addr)
8754
{
8855
u16 val;
8956
asm volatile(
@@ -93,8 +60,9 @@ static inline u16 readw(const volatile void __iomem *addr)
9360
);
9461
return val;
9562
}
63+
#define __raw_readw __raw_readw
9664

97-
static inline u32 readl(const volatile void __iomem *addr)
65+
static inline u32 __raw_readl(const volatile void __iomem *addr)
9866
{
9967
u32 val;
10068
asm volatile(
@@ -104,14 +72,15 @@ static inline u32 readl(const volatile void __iomem *addr)
10472
);
10573
return val;
10674
}
75+
#define __raw_readl __raw_readl
10776

10877
/*
10978
* writeb - write a byte to a memory location
11079
* @data: data to write to
11180
* @addr: pointer to memory
11281
*
11382
*/
114-
static inline void writeb(u8 data, volatile void __iomem *addr)
83+
static inline void __raw_writeb(u8 data, volatile void __iomem *addr)
11584
{
11685
asm volatile(
11786
"memb(%0) = %1;"
@@ -120,8 +89,9 @@ static inline void writeb(u8 data, volatile void __iomem *addr)
12089
: "memory"
12190
);
12291
}
92+
#define __raw_writeb __raw_writeb
12393

124-
static inline void writew(u16 data, volatile void __iomem *addr)
94+
static inline void __raw_writew(u16 data, volatile void __iomem *addr)
12595
{
12696
asm volatile(
12797
"memh(%0) = %1;"
@@ -131,8 +101,9 @@ static inline void writew(u16 data, volatile void __iomem *addr)
131101
);
132102

133103
}
104+
#define __raw_writew __raw_writew
134105

135-
static inline void writel(u32 data, volatile void __iomem *addr)
106+
static inline void __raw_writel(u32 data, volatile void __iomem *addr)
136107
{
137108
asm volatile(
138109
"memw(%0) = %1;"
@@ -141,167 +112,14 @@ static inline void writel(u32 data, volatile void __iomem *addr)
141112
: "memory"
142113
);
143114
}
144-
145-
#define __raw_writeb writeb
146-
#define __raw_writew writew
147-
#define __raw_writel writel
148-
149-
#define __raw_readb readb
150-
#define __raw_readw readw
151-
#define __raw_readl readl
152-
153-
/*
154-
* http://comments.gmane.org/gmane.linux.ports.arm.kernel/117626
155-
*/
156-
157-
#define readb_relaxed __raw_readb
158-
#define readw_relaxed __raw_readw
159-
#define readl_relaxed __raw_readl
160-
161-
#define writeb_relaxed __raw_writeb
162-
#define writew_relaxed __raw_writew
163-
#define writel_relaxed __raw_writel
115+
#define __raw_writel __raw_writel
164116

165117
/*
166118
* I/O memory mapping functions.
167119
*/
168120
#define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
169121
(__HEXAGON_C_DEV << 6))
170122

171-
#define __raw_writel writel
172-
173-
static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
174-
int count)
175-
{
176-
memcpy(dst, (void *) src, count);
177-
}
178-
179-
static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
180-
int count)
181-
{
182-
memcpy((void *) dst, src, count);
183-
}
184-
185-
static inline void memset_io(volatile void __iomem *addr, int value,
186-
size_t size)
187-
{
188-
memset((void __force *)addr, value, size);
189-
}
190-
191-
#define PCI_IO_ADDR (volatile void __iomem *)
192-
193-
/*
194-
* inb - read byte from I/O port or something
195-
* @port: address in I/O space
196-
*
197-
* Operates on "I/O bus I/O space"
198-
*/
199-
static inline u8 inb(unsigned long port)
200-
{
201-
return readb(_IO_BASE + (port & IO_SPACE_LIMIT));
202-
}
203-
204-
static inline u16 inw(unsigned long port)
205-
{
206-
return readw(_IO_BASE + (port & IO_SPACE_LIMIT));
207-
}
208-
209-
static inline u32 inl(unsigned long port)
210-
{
211-
return readl(_IO_BASE + (port & IO_SPACE_LIMIT));
212-
}
213-
214-
/*
215-
* outb - write a byte to a memory location
216-
* @data: data to write to
217-
* @addr: address in I/O space
218-
*/
219-
static inline void outb(u8 data, unsigned long port)
220-
{
221-
writeb(data, _IO_BASE + (port & IO_SPACE_LIMIT));
222-
}
223-
224-
static inline void outw(u16 data, unsigned long port)
225-
{
226-
writew(data, _IO_BASE + (port & IO_SPACE_LIMIT));
227-
}
228-
229-
static inline void outl(u32 data, unsigned long port)
230-
{
231-
writel(data, _IO_BASE + (port & IO_SPACE_LIMIT));
232-
}
233-
234-
#define outb_p outb
235-
#define outw_p outw
236-
#define outl_p outl
237-
238-
#define inb_p inb
239-
#define inw_p inw
240-
#define inl_p inl
241-
242-
static inline void insb(unsigned long port, void *buffer, int count)
243-
{
244-
if (count) {
245-
u8 *buf = buffer;
246-
do {
247-
u8 x = inb(port);
248-
*buf++ = x;
249-
} while (--count);
250-
}
251-
}
252-
253-
static inline void insw(unsigned long port, void *buffer, int count)
254-
{
255-
if (count) {
256-
u16 *buf = buffer;
257-
do {
258-
u16 x = inw(port);
259-
*buf++ = x;
260-
} while (--count);
261-
}
262-
}
263-
264-
static inline void insl(unsigned long port, void *buffer, int count)
265-
{
266-
if (count) {
267-
u32 *buf = buffer;
268-
do {
269-
u32 x = inw(port);
270-
*buf++ = x;
271-
} while (--count);
272-
}
273-
}
274-
275-
static inline void outsb(unsigned long port, const void *buffer, int count)
276-
{
277-
if (count) {
278-
const u8 *buf = buffer;
279-
do {
280-
outb(*buf++, port);
281-
} while (--count);
282-
}
283-
}
284-
285-
static inline void outsw(unsigned long port, const void *buffer, int count)
286-
{
287-
if (count) {
288-
const u16 *buf = buffer;
289-
do {
290-
outw(*buf++, port);
291-
} while (--count);
292-
}
293-
}
294-
295-
static inline void outsl(unsigned long port, const void *buffer, int count)
296-
{
297-
if (count) {
298-
const u32 *buf = buffer;
299-
do {
300-
outl(*buf++, port);
301-
} while (--count);
302-
}
303-
}
304-
305123
/*
306124
* These defines are necessary to use the generic io.h for filling in
307125
* the missing parts of the API contract. This is because the platform
@@ -310,23 +128,6 @@ static inline void outsl(unsigned long port, const void *buffer, int count)
310128
*/
311129
#define virt_to_phys virt_to_phys
312130
#define phys_to_virt phys_to_virt
313-
#define memset_io memset_io
314-
#define memcpy_fromio memcpy_fromio
315-
#define memcpy_toio memcpy_toio
316-
#define readb readb
317-
#define readw readw
318-
#define readl readl
319-
#define writeb writeb
320-
#define writew writew
321-
#define writel writel
322-
#define insb insb
323-
#define insw insw
324-
#define insl insl
325-
#define outsb outsb
326-
#define outsw outsw
327-
#define outsl outsl
328131
#include <asm-generic/io.h>
329132

330-
#endif /* __KERNEL__ */
331-
332133
#endif

arch/hexagon/lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
#
33
# Makefile for hexagon-specific library files.
44
#
5-
obj-y = checksum.o io.o memcpy.o memset.o memcpy_likely_aligned.o \
5+
obj-y = checksum.o memcpy.o memset.o memcpy_likely_aligned.o \
66
divsi3.o modsi3.o udivsi3.o umodsi3.o

0 commit comments

Comments
 (0)