[U-Boot] [PATCH] lcd: remove unaligned access in lcd_dt_simplefb_configure_node()

From: Stephen Warren swarren@nvidia.com
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:
const char format[] = "r5g6b5";
Make this data static since it doesn't chagne; the compiler will simply place it into the .rodata section directly, and avoid any unaligned run- time initialization.
Signed-off-by: Stephen Warren swarren@nvidia.com --- common/lcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c index 3a60484..c9a589e 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -1193,7 +1193,7 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off) u32 stride; fdt32_t cells[2]; int ret; - const char format[] = + static const char format[] = #if LCD_BPP == LCD_COLOR16 "r5g6b5"; #else @@ -1239,8 +1239,8 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off)
int lcd_dt_simplefb_add_node(void *blob) { - const char compat[] = "simple-framebuffer"; - const char disabled[] = "disabled"; + static const char compat[] = "simple-framebuffer"; + static const char disabled[] = "disabled"; int off, ret;
off = fdt_add_subnode(blob, 0, "framebuffer");

On 06/13/2013 05:13 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:
const char format[] = "r5g6b5";
Make this data static since it doesn't chagne; the compiler will simply place it into the .rodata section directly, and avoid any unaligned run- time initialization.
I don't think this has been applied yet. Will it be applied for this release? Should I resend the patch?

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/01/2013 12:30 PM, Stephen Warren wrote:
On 06/13/2013 05:13 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:
const char format[] = "r5g6b5";
Make this data static since it doesn't chagne; the compiler will simply place it into the .rodata section directly, and avoid any unaligned run- time initialization.
I don't think this has been applied yet. Will it be applied for this release? Should I resend the patch?
It's a bug fix and as such I want it. Anatolij, there's a few "video" patches out there, are you going to grab things / has this spurred you to grab things or should I take a look around and pull up a patch set? Thanks!
- -- Tom

On Mon, 1 Jul 2013 12:35:46 -0400 Tom Rini trini@ti.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 07/01/2013 12:30 PM, Stephen Warren wrote:
On 06/13/2013 05:13 PM, Stephen Warren wrote:
From: Stephen Warren swarren@nvidia.com
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:
const char format[] = "r5g6b5";
Make this data static since it doesn't chagne; the compiler will simply place it into the .rodata section directly, and avoid any unaligned run- time initialization.
I don't think this has been applied yet. Will it be applied for this release? Should I resend the patch?
It's a bug fix and as such I want it. Anatolij, there's a few "video" patches out there, are you going to grab things / has this spurred you to grab things or should I take a look around and pull up a patch set? Thanks!
I'll look at video patches and grab them for release. Thanks for reminding me!
Anatolij

On Thu, 13 Jun 2013 17:13:11 -0600 Stephen Warren swarren@wwwdotorg.org wrote:
From: Stephen Warren swarren@nvidia.com
Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as:
const char format[] = "r5g6b5";
Make this data static since it doesn't chagne; the compiler will simply place it into the .rodata section directly, and avoid any unaligned run- time initialization.
Signed-off-by: Stephen Warren swarren@nvidia.com
common/lcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Applied to u-boot-video/master. Thanks!
Anatolij
participants (3)
-
Anatolij Gustschin
-
Stephen Warren
-
Tom Rini