From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH] drivers/of: use __be32 types for big-endian device tree data Date: Tue, 14 Sep 2010 13:23:21 +1000 Message-ID: <20100914032321.GJ13154@yookeroo> References: <1284434031.863044.443635323150.1.gpush@pororo> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Timur Tabi Cc: Jeremy Kerr , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: devicetree@vger.kernel.org On Mon, Sep 13, 2010 at 10:20:11PM -0500, Timur Tabi wrote: > On Mon, Sep 13, 2010 at 10:13 PM, Jeremy Kerr wrote: > > Use the sparse annotations so we can keep track of endianness. > > > > Signed-off-by: Jeremy Kerr > > Does this mean that I should be using be32_to_cpu() whenever I > dereference a pointer to a u32 in the device tree? Currently, I do > this: > > const u32 *iprop; > const u32 num; > iprop = of_get_property(np, ...) > num = *iprop; > > Should I be doing this instead? > > const __be32 *iprop; > const u32 num; > iprop = of_get_property(np, ...) > num = be32_to_cpu(*iprop); Yes. Although, we should probably add a get_intprop() or similar helper that will do this for you. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson