diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2011-03-03 09:59:01 -0800 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-03-09 17:04:12 +0000 |
commit | b65d6040e3a7cd75d9287f7ddfd115e85fde4b44 (patch) | |
tree | 398b234ea6b9501a2e9ab271c687787fa6befaf8 /drivers/video/via | |
parent | a625e305edd8e3ac08888a9b52981205b68cdb0e (diff) | |
download | kernel_samsung_aries-b65d6040e3a7cd75d9287f7ddfd115e85fde4b44.zip kernel_samsung_aries-b65d6040e3a7cd75d9287f7ddfd115e85fde4b44.tar.gz kernel_samsung_aries-b65d6040e3a7cd75d9287f7ddfd115e85fde4b44.tar.bz2 |
video via: fix iomem access
This driver is not respecting the iomem memory space restrictions
and does direct access. This works on x86 but is non-portable and
should not be done. Converted memcpy() of 2 to readw.
Last post increment of romptr was unnecessary since pointer never
used after that.
Found by sparse, compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r-- | drivers/video/via/lcd.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c index 3425c39..723fa04 100644 --- a/drivers/video/via/lcd.c +++ b/drivers/video/via/lcd.c @@ -1064,34 +1064,33 @@ static struct display_timing lcd_centering_timging(struct display_timing bool viafb_lcd_get_mobile_state(bool *mobile) { - unsigned char *romptr, *tableptr; + unsigned char __iomem *romptr, *tableptr, *biosptr; u8 core_base; - unsigned char *biosptr; /* Rom address */ - u32 romaddr = 0x000C0000; - u16 start_pattern = 0; + const u32 romaddr = 0x000C0000; + u16 start_pattern; biosptr = ioremap(romaddr, 0x10000); + start_pattern = readw(biosptr); - memcpy(&start_pattern, biosptr, 2); /* Compare pattern */ if (start_pattern == 0xAA55) { /* Get the start of Table */ /* 0x1B means BIOS offset position */ romptr = biosptr + 0x1B; - tableptr = biosptr + *((u16 *) romptr); + tableptr = biosptr + readw(romptr); /* Get the start of biosver structure */ /* 18 means BIOS version position. */ romptr = tableptr + 18; - romptr = biosptr + *((u16 *) romptr); + romptr = biosptr + readw(romptr); /* The offset should be 44, but the actual image is less three char. */ /* pRom += 44; */ romptr += 41; - core_base = *romptr++; + core_base = readb(romptr); if (core_base & 0x8) *mobile = false; |