Commit 115e7759 authored by Ladislav Michl's avatar Ladislav Michl Committed by Bartlomiej Zolnierkiewicz

video: udlfb: Fix unaligned access

Driver generates lots of alignment trap exceptions on ARM.
Fix that by replacing typecasting of odd addresses with
byte shifting and remove uneccessary typecasting.
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent a8126522
...@@ -441,9 +441,9 @@ static void dlfb_compress_hline( ...@@ -441,9 +441,9 @@ static void dlfb_compress_hline(
*cmd++ = 0xAF; *cmd++ = 0xAF;
*cmd++ = 0x6B; *cmd++ = 0x6B;
*cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF); *cmd++ = dev_addr >> 16;
*cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF); *cmd++ = dev_addr >> 8;
*cmd++ = (uint8_t) ((dev_addr) & 0xFF); *cmd++ = dev_addr;
cmd_pixels_count_byte = cmd++; /* we'll know this later */ cmd_pixels_count_byte = cmd++; /* we'll know this later */
cmd_pixel_start = pixel; cmd_pixel_start = pixel;
...@@ -460,8 +460,8 @@ static void dlfb_compress_hline( ...@@ -460,8 +460,8 @@ static void dlfb_compress_hline(
while (pixel < cmd_pixel_end) { while (pixel < cmd_pixel_end) {
const uint16_t * const repeating_pixel = pixel; const uint16_t * const repeating_pixel = pixel;
*(uint16_t *)cmd = cpu_to_be16p(pixel); *cmd++ = *pixel >> 8;
cmd += 2; *cmd++ = *pixel;
pixel++; pixel++;
if (unlikely((pixel < cmd_pixel_end) && if (unlikely((pixel < cmd_pixel_end) &&
...@@ -1531,15 +1531,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb, ...@@ -1531,15 +1531,16 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
u8 length; u8 length;
u16 key; u16 key;
key = le16_to_cpu(*((u16 *) desc)); key = *desc++;
desc += sizeof(u16); key |= (u16)*desc++ << 8;
length = *desc; length = *desc++;
desc++;
switch (key) { switch (key) {
case 0x0200: { /* max_area */ case 0x0200: { /* max_area */
u32 max_area; u32 max_area = *desc++;
max_area = le32_to_cpu(*((u32 *)desc)); max_area |= (u32)*desc++ << 8;
max_area |= (u32)*desc++ << 16;
max_area |= (u32)*desc++ << 24;
dev_warn(&intf->dev, dev_warn(&intf->dev,
"DL chip limited to %d pixel modes\n", "DL chip limited to %d pixel modes\n",
max_area); max_area);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment