linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] offb: make the screen properties endian safe
@ 2013-10-30 16:14 Cédric Le Goater
  2013-10-31  2:08 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Cédric Le Goater @ 2013-10-30 16:14 UTC (permalink / raw)
  To: benh; +Cc: Cédric Le Goater, linuxppc-dev

The "screen" properties : depth, width, height, linebytes need
to be converted to the host endian order when read from the device
tree.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---
 drivers/video/offb.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index 0c4f343..c1cf591 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -536,7 +536,7 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
 	unsigned int flags, rsize, addr_prop = 0;
 	unsigned long max_size = 0;
 	u64 rstart, address = OF_BAD_ADDR;
-	const u32 *pp, *addrp, *up;
+	const __be32 *pp, *addrp, *up;
 	u64 asize;
 	int foreign_endian = 0;
 
@@ -552,25 +552,25 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
 	if (pp == NULL)
 		pp = of_get_property(dp, "depth", &len);
 	if (pp && len == sizeof(u32))
-		depth = *pp;
+		depth = be32_to_cpu(*pp);
 
 	pp = of_get_property(dp, "linux,bootx-width", &len);
 	if (pp == NULL)
 		pp = of_get_property(dp, "width", &len);
 	if (pp && len == sizeof(u32))
-		width = *pp;
+		width = be32_to_cpu(*pp);
 
 	pp = of_get_property(dp, "linux,bootx-height", &len);
 	if (pp == NULL)
 		pp = of_get_property(dp, "height", &len);
 	if (pp && len == sizeof(u32))
-		height = *pp;
+		height = be32_to_cpu(*pp);
 
 	pp = of_get_property(dp, "linux,bootx-linebytes", &len);
 	if (pp == NULL)
 		pp = of_get_property(dp, "linebytes", &len);
 	if (pp && len == sizeof(u32) && (*pp != 0xffffffffu))
-		pitch = *pp;
+		pitch = be32_to_cpu(*pp);
 	else
 		pitch = width * ((depth + 7) / 8);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-12-04 16:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 16:14 [PATCH] offb: make the screen properties endian safe Cédric Le Goater
2013-10-31  2:08 ` Benjamin Herrenschmidt
2013-10-31  9:36   ` [PATCH v2] " Cédric Le Goater
2013-11-20 22:50     ` Benjamin Herrenschmidt
2013-11-21 15:45       ` Cedric Le Goater
2013-11-21 19:57         ` Benjamin Herrenschmidt
2013-11-23 17:38           ` Cedric Le Goater
2013-11-23 21:04             ` Benjamin Herrenschmidt
2013-12-04 16:47               ` Cedric Le Goater
2013-12-04 16:49               ` [PATCH v3 1/2] offb: little endian fixes Cédric Le Goater
2013-12-04 16:49               ` [PATCH v3 2/2] offb: add palette hack for little endian Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).