Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754935AbbDIDR2 (ORCPT ); Wed, 8 Apr 2015 23:17:28 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:34120 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753787AbbDIDR0 (ORCPT ); Wed, 8 Apr 2015 23:17:26 -0400 Message-ID: <5525EF43.1040309@gmail.com> Date: Wed, 08 Apr 2015 20:17:23 -0700 From: Florian Fainelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: frowand.list@gmail.com CC: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, grant.likely@linaro.org Subject: Re: [PATCH] of/flattree: print memory scan node results in CPU endian References: <1428475450-12072-1-git-send-email-f.fainelli@gmail.com> <55259B4D.2020304@gmail.com> In-Reply-To: <55259B4D.2020304@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1900 Lines: 43 Le 08/04/2015 14:19, Frank Rowand a écrit : > On 4/7/2015 11:44 PM, Florian Fainelli wrote: >> Commit 51975db0b7333 ("of/flattree: merge early_init_dt_scan_memory() >> common code") consolidated some code from PowerPC (typically >> big-endian), and ended-up adding a pr_debug() printing reg properties in >> big-endian (DT native) format, not CPU endian. Unsurprisingly, when >> these messages are turned on a little-endian systems, this is confusing, >> so do the conversion while printing the values. >> >> Signed-off-by: Florian Fainelli >> --- >> drivers/of/fdt.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c >> index 3a896c9aeb74..0d8f0e4bd107 100644 >> --- a/drivers/of/fdt.c >> +++ b/drivers/of/fdt.c >> @@ -880,7 +880,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, >> endp = reg + (l / sizeof(__be32)); >> >> pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n", >> - uname, l, reg[0], reg[1], reg[2], reg[3]); >> + uname, l, be32_to_cpu(reg[0]), be32_to_cpu(reg[1]), >> + be32_to_cpu(reg[2]), be32_to_cpu(reg[3])); > > The pr_debug() assumes that the length of reg[] is >= 4 elements, which might not be true. > Since the following while loop checks the length of reg[] and then uses pr_debug() to > print each (base, size) tuple with the correct endian, maybe it would be better to > just remove reg[0] through reg[3] from the above pr_debug() instead of fixing the > endian issue. Right, that works too, will follow-up with a patch removing the reg[0..3] prints. Thanks! -- Florian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/