* [PATCH] drivers/of: use __be32 types for big-endian device tree data
@ 2010-09-14 3:13 Jeremy Kerr
2010-09-14 3:20 ` Timur Tabi
2010-09-15 18:57 ` Grant Likely
0 siblings, 2 replies; 5+ messages in thread
From: Jeremy Kerr @ 2010-09-14 3:13 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Grant Likely
Use the sparse annotations so we can keep track of endianness.
Signed-off-by: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
drivers/of/address.c | 2 +-
drivers/of/base.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index fcadb72..3a1c7e7 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -163,7 +163,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
unsigned int *flags)
{
- const u32 *prop;
+ const __be32 *prop;
unsigned int psize;
struct device_node *parent;
struct of_bus *bus;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index aa80525..710b53b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -33,7 +33,7 @@ DEFINE_RWLOCK(devtree_lock);
int of_n_addr_cells(struct device_node *np)
{
- const int *ip;
+ const __be32 *ip;
do {
if (np->parent)
@@ -49,7 +49,7 @@ EXPORT_SYMBOL(of_n_addr_cells);
int of_n_size_cells(struct device_node *np)
{
- const int *ip;
+ const __be32 *ip;
do {
if (np->parent)
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] drivers/of: use __be32 types for big-endian device tree data
2010-09-14 3:13 [PATCH] drivers/of: use __be32 types for big-endian device tree data Jeremy Kerr
@ 2010-09-14 3:20 ` Timur Tabi
[not found] ` <AANLkTi=ODinhAG6L62FGiA61nZkDEYweSThWW9J8BwXb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-15 18:57 ` Grant Likely
1 sibling, 1 reply; 5+ messages in thread
From: Timur Tabi @ 2010-09-14 3:20 UTC (permalink / raw)
To: Jeremy Kerr; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On Mon, Sep 13, 2010 at 10:13 PM, Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
> Use the sparse annotations so we can keep track of endianness.
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
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);
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] drivers/of: use __be32 types for big-endian device tree data
2010-09-14 3:13 [PATCH] drivers/of: use __be32 types for big-endian device tree data Jeremy Kerr
2010-09-14 3:20 ` Timur Tabi
@ 2010-09-15 18:57 ` Grant Likely
1 sibling, 0 replies; 5+ messages in thread
From: Grant Likely @ 2010-09-15 18:57 UTC (permalink / raw)
To: Jeremy Kerr; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On Tue, Sep 14, 2010 at 11:13:51AM +0800, Jeremy Kerr wrote:
> Use the sparse annotations so we can keep track of endianness.
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Added to my test-devicetree branch
g.
>
> ---
> drivers/of/address.c | 2 +-
> drivers/of/base.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index fcadb72..3a1c7e7 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -163,7 +163,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
> const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
> unsigned int *flags)
> {
> - const u32 *prop;
> + const __be32 *prop;
> unsigned int psize;
> struct device_node *parent;
> struct of_bus *bus;
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index aa80525..710b53b 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -33,7 +33,7 @@ DEFINE_RWLOCK(devtree_lock);
>
> int of_n_addr_cells(struct device_node *np)
> {
> - const int *ip;
> + const __be32 *ip;
>
> do {
> if (np->parent)
> @@ -49,7 +49,7 @@ EXPORT_SYMBOL(of_n_addr_cells);
>
> int of_n_size_cells(struct device_node *np)
> {
> - const int *ip;
> + const __be32 *ip;
>
> do {
> if (np->parent)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-15 18:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-14 3:13 [PATCH] drivers/of: use __be32 types for big-endian device tree data Jeremy Kerr
2010-09-14 3:20 ` Timur Tabi
[not found] ` <AANLkTi=ODinhAG6L62FGiA61nZkDEYweSThWW9J8BwXb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-14 3:23 ` David Gibson
2010-09-14 3:29 ` Jeremy Kerr
2010-09-15 18:57 ` Grant Likely
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.