Skip to content

Commit 3838b82

Browse files
committed
unicore32 i8042: adjust io funcs of i8042-unicore32io.h
replace inb/outb with readb/writeb in i8042-unicore32io.h and correct typecasting of register and region macros -- by advice with Arnd Bergmann Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
1 parent bd42aa7 commit 3838b82

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

‎drivers/input/serio/i8042-unicore32io.h‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,36 @@
2929
/*
3030
* Register numbers.
3131
*/
32-
#define I8042_COMMAND_REG ((unsigned long)&PS2_COMMAND)
33-
#define I8042_STATUS_REG ((unsigned long)&PS2_STATUS)
34-
#define I8042_DATA_REG ((unsigned long)&PS2_DATA)
32+
#define I8042_COMMAND_REG ((volatile void __iomem *)&PS2_COMMAND)
33+
#define I8042_STATUS_REG ((volatile void __iomem *)&PS2_STATUS)
34+
#define I8042_DATA_REG ((volatile void __iomem *)&PS2_DATA)
35+
36+
#define I8042_REGION_START (resource_size_t)(&PS2_DATA)
37+
#define I8042_REGION_SIZE (resource_size_t)(16)
3538

3639
static inline int i8042_read_data(void)
3740
{
38-
return inb(I8042_DATA_REG);
41+
return readb(I8042_DATA_REG);
3942
}
4043

4144
static inline int i8042_read_status(void)
4245
{
43-
return inb(I8042_STATUS_REG);
46+
return readb(I8042_STATUS_REG);
4447
}
4548

4649
static inline void i8042_write_data(int val)
4750
{
48-
outb(val, I8042_DATA_REG);
51+
writeb(val, I8042_DATA_REG);
4952
}
5053

5154
static inline void i8042_write_command(int val)
5255
{
53-
outb(val, I8042_COMMAND_REG);
56+
writeb(val, I8042_COMMAND_REG);
5457
}
5558

5659
static inline int i8042_platform_init(void)
5760
{
58-
if (!request_region(I8042_DATA_REG, 16, "i8042"))
61+
if (!request_region(I8042_REGION_START, I8042_REGION_SIZE, "i8042"))
5962
return -EBUSY;
6063

6164
i8042_reset = 1;
@@ -64,7 +67,7 @@ static inline int i8042_platform_init(void)
6467

6568
static inline void i8042_platform_exit(void)
6669
{
67-
release_region(I8042_DATA_REG, 16);
70+
release_region(I8042_REGION_START, I8042_REGION_SIZE);
6871
}
6972

7073
#endif /* _I8042_UNICORE32_H */

0 commit comments

Comments
 (0)