Commit bab58350 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dt-fixes-for-3.7' of git://sources.calxeda.com/kernel/linux

Pull DeviceTree fixes from Rob Herring:
 "A handful of fixes:
   - a fix for dtc from upstream
   - sparse fixes in DeviceTree code
   - stub of_get_child_by_name for !OF builds"

* tag 'dt-fixes-for-3.7' of git://sources.calxeda.com/kernel/linux:
  dtc: fix for_each_*() to skip first object if deleted
  of/platform: sparse fix
  of/irq: sparse fixes
  of/address: sparse fixes
  of: add stub of_get_child_by_name for non-OF builds
parents ec351832 205a8eb7
......@@ -37,9 +37,9 @@ struct of_bus {
int (*match)(struct device_node *parent);
void (*count_cells)(struct device_node *child,
int *addrc, int *sizec);
u64 (*map)(u32 *addr, const __be32 *range,
u64 (*map)(__be32 *addr, const __be32 *range,
int na, int ns, int pna);
int (*translate)(u32 *addr, u64 offset, int na);
int (*translate)(__be32 *addr, u64 offset, int na);
unsigned int (*get_flags)(const __be32 *addr);
};
......@@ -56,7 +56,7 @@ static void of_bus_default_count_cells(struct device_node *dev,
*sizec = of_n_size_cells(dev);
}
static u64 of_bus_default_map(u32 *addr, const __be32 *range,
static u64 of_bus_default_map(__be32 *addr, const __be32 *range,
int na, int ns, int pna)
{
u64 cp, s, da;
......@@ -82,7 +82,7 @@ static u64 of_bus_default_map(u32 *addr, const __be32 *range,
return da - cp;
}
static int of_bus_default_translate(u32 *addr, u64 offset, int na)
static int of_bus_default_translate(__be32 *addr, u64 offset, int na)
{
u64 a = of_read_number(addr, na);
memset(addr, 0, na * 4);
......@@ -138,7 +138,7 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
return flags;
}
static u64 of_bus_pci_map(u32 *addr, const __be32 *range, int na, int ns,
static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
int pna)
{
u64 cp, s, da;
......@@ -165,7 +165,7 @@ static u64 of_bus_pci_map(u32 *addr, const __be32 *range, int na, int ns,
return da - cp;
}
static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
{
return of_bus_default_translate(addr + 1, offset, na - 1);
}
......@@ -247,7 +247,7 @@ static void of_bus_isa_count_cells(struct device_node *child,
*sizec = 1;
}
static u64 of_bus_isa_map(u32 *addr, const __be32 *range, int na, int ns,
static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
int pna)
{
u64 cp, s, da;
......@@ -270,7 +270,7 @@ static u64 of_bus_isa_map(u32 *addr, const __be32 *range, int na, int ns,
return da - cp;
}
static int of_bus_isa_translate(u32 *addr, u64 offset, int na)
static int of_bus_isa_translate(__be32 *addr, u64 offset, int na)
{
return of_bus_default_translate(addr + 1, offset, na - 1);
}
......@@ -338,7 +338,7 @@ static struct of_bus *of_match_bus(struct device_node *np)
}
static int of_translate_one(struct device_node *parent, struct of_bus *bus,
struct of_bus *pbus, u32 *addr,
struct of_bus *pbus, __be32 *addr,
int na, int ns, int pna, const char *rprop)
{
const __be32 *ranges;
......@@ -409,12 +409,12 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
* that can be mapped to a cpu physical address). This is not really specified
* that way, but this is traditionally the way IBM at least do things
*/
u64 __of_translate_address(struct device_node *dev, const __be32 *in_addr,
const char *rprop)
static u64 __of_translate_address(struct device_node *dev,
const __be32 *in_addr, const char *rprop)
{
struct device_node *parent = NULL;
struct of_bus *bus, *pbus;
u32 addr[OF_MAX_ADDR_CELLS];
__be32 addr[OF_MAX_ADDR_CELLS];
int na, ns, pna, pns;
u64 result = OF_BAD_ADDR;
......
......@@ -192,11 +192,13 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
/* Compare specifiers */
match = 1;
for (i = 0; i < addrsize && match; ++i) {
u32 mask = imask ? imask[i] : 0xffffffffu;
__be32 mask = imask ? imask[i]
: cpu_to_be32(0xffffffffu);
match = ((addr[i] ^ imap[i]) & mask) == 0;
}
for (; i < (addrsize + intsize) && match; ++i) {
u32 mask = imask ? imask[i] : 0xffffffffu;
__be32 mask = imask ? imask[i]
: cpu_to_be32(0xffffffffu);
match =
((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
}
......@@ -465,7 +467,7 @@ void __init of_irq_init(const struct of_device_id *matches)
pr_debug("of_irq_init: init %s @ %p, parent %p\n",
match->compatible,
desc->dev, desc->interrupt_parent);
irq_init_cb = match->data;
irq_init_cb = (of_irq_init_cb_t)match->data;
ret = irq_init_cb(desc->dev, desc->interrupt_parent);
if (ret) {
kfree(desc);
......
......@@ -76,7 +76,7 @@ void of_device_make_bus_id(struct device *dev)
{
static atomic_t bus_no_reg_magic;
struct device_node *node = dev->of_node;
const u32 *reg;
const __be32 *reg;
u64 addr;
const __be32 *addrp;
int magic;
......
......@@ -331,6 +331,13 @@ static inline bool of_have_populated_dt(void)
#define for_each_child_of_node(parent, child) \
while (0)
static inline struct device_node *of_get_child_by_name(
const struct device_node *node,
const char *name)
{
return NULL;
}
static inline int of_get_child_count(const struct device_node *np)
{
return 0;
......
......@@ -19,7 +19,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
* the address space flags too. The PCI version uses a BAR number
* instead of an absolute index
*/
extern const u32 *of_get_address(struct device_node *dev, int index,
extern const __be32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags);
#ifndef pci_address_to_pio
......@@ -44,7 +44,7 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
{
return NULL;
}
static inline const u32 *of_get_address(struct device_node *dev, int index,
static inline const __be32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags)
{
return NULL;
......
......@@ -58,8 +58,8 @@ static inline int of_irq_map_oldworld(struct device_node *device, int index,
#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
u32 ointsize, const u32 *addr,
extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
u32 ointsize, const __be32 *addr,
struct of_irq *out_irq);
extern int of_irq_map_one(struct device_node *device, int index,
struct of_irq *out_irq);
......
......@@ -161,51 +161,27 @@ struct node {
struct label *labels;
};
static inline struct label *for_each_label_next(struct label *l)
{
do {
l = l->next;
} while (l && l->deleted);
return l;
}
#define for_each_label(l0, l) \
for ((l) = (l0); (l); (l) = for_each_label_next(l))
#define for_each_label_withdel(l0, l) \
for ((l) = (l0); (l); (l) = (l)->next)
static inline struct property *for_each_property_next(struct property *p)
{
do {
p = p->next;
} while (p && p->deleted);
return p;
}
#define for_each_property(n, p) \
for ((p) = (n)->proplist; (p); (p) = for_each_property_next(p))
#define for_each_label(l0, l) \
for_each_label_withdel(l0, l) \
if (!(l)->deleted)
#define for_each_property_withdel(n, p) \
for ((p) = (n)->proplist; (p); (p) = (p)->next)
static inline struct node *for_each_child_next(struct node *c)
{
do {
c = c->next_sibling;
} while (c && c->deleted);
return c;
}
#define for_each_child(n, c) \
for ((c) = (n)->children; (c); (c) = for_each_child_next(c))
#define for_each_property(n, p) \
for_each_property_withdel(n, p) \
if (!(p)->deleted)
#define for_each_child_withdel(n, c) \
for ((c) = (n)->children; (c); (c) = (c)->next_sibling)
#define for_each_child(n, c) \
for_each_child_withdel(n, c) \
if (!(c)->deleted)
void add_label(struct label **labels, char *label);
void delete_labels(struct label **labels);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment