Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video: use get/put_unaligned_* helpers

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Harvey Harrison and committed by
Linus Torvalds
d15c0a4d a5abdeaf

+17 -20
+14 -14
drivers/video/matrox/matroxfb_misc.c
··· 522 522 #endif 523 523 } 524 524 525 - #define get_u16(x) (le16_to_cpu(get_unaligned((__u16*)(x)))) 526 - #define get_u32(x) (le32_to_cpu(get_unaligned((__u32*)(x)))) 527 525 static int parse_pins1(WPMINFO const struct matrox_bios* bd) { 528 526 unsigned int maxdac; 529 527 ··· 530 532 case 1: maxdac = 220000; break; 531 533 default: maxdac = 240000; break; 532 534 } 533 - if (get_u16(bd->pins + 24)) { 534 - maxdac = get_u16(bd->pins + 24) * 10; 535 + if (get_unaligned_le16(bd->pins + 24)) { 536 + maxdac = get_unaligned_le16(bd->pins + 24) * 10; 535 537 } 536 538 MINFO->limits.pixel.vcomax = maxdac; 537 - MINFO->values.pll.system = get_u16(bd->pins + 28) ? get_u16(bd->pins + 28) * 10 : 50000; 539 + MINFO->values.pll.system = get_unaligned_le16(bd->pins + 28) ? 540 + get_unaligned_le16(bd->pins + 28) * 10 : 50000; 538 541 /* ignore 4MB, 8MB, module clocks */ 539 542 MINFO->features.pll.ref_freq = 14318; 540 543 MINFO->values.reg.mctlwtst = 0x00030101; ··· 574 575 static int parse_pins3(WPMINFO const struct matrox_bios* bd) { 575 576 MINFO->limits.pixel.vcomax = 576 577 MINFO->limits.system.vcomax = (bd->pins[36] == 0xFF) ? 230000 : ((bd->pins[36] + 100) * 1000); 577 - MINFO->values.reg.mctlwtst = get_u32(bd->pins + 48) == 0xFFFFFFFF ? 0x01250A21 : get_u32(bd->pins + 48); 578 + MINFO->values.reg.mctlwtst = get_unaligned_le32(bd->pins + 48) == 0xFFFFFFFF ? 579 + 0x01250A21 : get_unaligned_le32(bd->pins + 48); 578 580 /* memory config */ 579 581 MINFO->values.reg.memrdbk = ((bd->pins[57] << 21) & 0x1E000000) | 580 582 ((bd->pins[57] << 22) & 0x00C00000) | ··· 601 601 static int parse_pins4(WPMINFO const struct matrox_bios* bd) { 602 602 MINFO->limits.pixel.vcomax = (bd->pins[ 39] == 0xFF) ? 230000 : bd->pins[ 39] * 4000; 603 603 MINFO->limits.system.vcomax = (bd->pins[ 38] == 0xFF) ? MINFO->limits.pixel.vcomax : bd->pins[ 38] * 4000; 604 - MINFO->values.reg.mctlwtst = get_u32(bd->pins + 71); 604 + MINFO->values.reg.mctlwtst = get_unaligned_le32(bd->pins + 71); 605 605 MINFO->values.reg.memrdbk = ((bd->pins[87] << 21) & 0x1E000000) | 606 606 ((bd->pins[87] << 22) & 0x00C00000) | 607 607 ((bd->pins[86] << 1) & 0x000001E0) | ··· 609 609 MINFO->values.reg.opt = ((bd->pins[53] << 15) & 0x00400000) | 610 610 ((bd->pins[53] << 22) & 0x10000000) | 611 611 ((bd->pins[53] << 7) & 0x00001C00); 612 - MINFO->values.reg.opt3 = get_u32(bd->pins + 67); 612 + MINFO->values.reg.opt3 = get_unaligned_le32(bd->pins + 67); 613 613 MINFO->values.pll.system = (bd->pins[ 65] == 0xFF) ? 200000 : bd->pins[ 65] * 4000; 614 614 MINFO->features.pll.ref_freq = (bd->pins[ 92] & 0x01) ? 14318 : 27000; 615 615 return 0; ··· 640 640 MINFO->limits.video.vcomin = (bd->pins[122] == 0xFF) ? MINFO->limits.system.vcomin : bd->pins[122] * mult; 641 641 MINFO->values.pll.system = 642 642 MINFO->values.pll.video = (bd->pins[ 92] == 0xFF) ? 284000 : bd->pins[ 92] * 4000; 643 - MINFO->values.reg.opt = get_u32(bd->pins+ 48); 644 - MINFO->values.reg.opt2 = get_u32(bd->pins+ 52); 645 - MINFO->values.reg.opt3 = get_u32(bd->pins+ 94); 646 - MINFO->values.reg.mctlwtst = get_u32(bd->pins+ 98); 647 - MINFO->values.reg.memmisc = get_u32(bd->pins+102); 648 - MINFO->values.reg.memrdbk = get_u32(bd->pins+106); 643 + MINFO->values.reg.opt = get_unaligned_le32(bd->pins + 48); 644 + MINFO->values.reg.opt2 = get_unaligned_le32(bd->pins + 52); 645 + MINFO->values.reg.opt3 = get_unaligned_le32(bd->pins + 94); 646 + MINFO->values.reg.mctlwtst = get_unaligned_le32(bd->pins + 98); 647 + MINFO->values.reg.memmisc = get_unaligned_le32(bd->pins + 102); 648 + MINFO->values.reg.memrdbk = get_unaligned_le32(bd->pins + 106); 649 649 MINFO->features.pll.ref_freq = (bd->pins[110] & 0x01) ? 14318 : 27000; 650 650 MINFO->values.memory.ddr = (bd->pins[114] & 0x60) == 0x20; 651 651 MINFO->values.memory.dll = (bd->pins[115] & 0x02) != 0;
+3 -6
drivers/video/metronomefb.c
··· 206 206 } 207 207 208 208 /* check waveform mode table address checksum */ 209 - wmta = le32_to_cpu(get_unaligned((__le32 *) wfm_hdr->wmta)); 210 - wmta &= 0x00FFFFFF; 209 + wmta = get_unaligned_le32(wfm_hdr->wmta) & 0x00FFFFFF; 211 210 cksum_idx = wmta + m*4 + 3; 212 211 if (cksum_idx > size) 213 212 return -EINVAL; ··· 218 219 } 219 220 220 221 /* check waveform temperature table address checksum */ 221 - tta = le32_to_cpu(get_unaligned((int *) (mem + wmta + m*4))); 222 - tta &= 0x00FFFFFF; 222 + tta = get_unaligned_le32(mem + wmta + m * 4) & 0x00FFFFFF; 223 223 cksum_idx = tta + trn*4 + 3; 224 224 if (cksum_idx > size) 225 225 return -EINVAL; ··· 231 233 232 234 /* here we do the real work of putting the waveform into the 233 235 metromem buffer. this does runlength decoding of the waveform */ 234 - wfm_idx = le32_to_cpu(get_unaligned((__le32 *) (mem + tta + trn*4))); 235 - wfm_idx &= 0x00FFFFFF; 236 + wfm_idx = get_unaligned_le32(mem + tta + trn * 4) & 0x00FFFFFF; 236 237 owfm_idx = wfm_idx; 237 238 if (wfm_idx > size) 238 239 return -EINVAL;