Skip to content

Commit

Permalink
Merge tag 'dt-for-3.6' of git://sources.calxeda.com/kernel/linux
Browse files Browse the repository at this point in the history
Pull devicetree updates from Rob Herring:
 "A small set of changes for devicetree:
   - Couple of Documentation fixes
   - Addition of new helper function of_node_full_name
   - Improve of_parse_phandle_with_args return values
   - Some NULL related sparse fixes"

Grant's busy packing.

* tag 'dt-for-3.6' of git://sources.calxeda.com/kernel/linux:
  of: mtd: nuke useless const qualifier
  devicetree: add helper inline for retrieving a node's full name
  of: return -ENOENT when no property
  usage-model.txt: fix typo machine_init->init_machine
  of: Fix null pointer related warnings in base.c file
  LED: Fix missing semicolon in OF documentation
  of: fix a few typos in the binding documentation
  • Loading branch information
Linus Torvalds committed Jul 24, 2012
2 parents 914311c + e95d8aa commit f14121a
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/gpio/led.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ run-control {
gpios = <&mpc8572 7 0>;
default-state = "on";
};
}
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/mtd/partition.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ flash@0 {
uimage@100000 {
reg = <0x0100000 0x200000>;
};
];
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/usage-model.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ device tree for the NVIDIA Tegra board.
};
};

At .machine_init() time, Tegra board support code will need to look at
At .init_machine() time, Tegra board support code will need to look at
this DT and decide which nodes to create platform_devices for.
However, looking at the tree, it is not immediately obvious what kind
of device each node represents, or even if a node represents a device
Expand Down
6 changes: 2 additions & 4 deletions arch/microblaze/pci/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
} else {
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
oirq.size, oirq.specifier[0], oirq.specifier[1],
oirq.controller ? oirq.controller->full_name :
"<default>");
of_node_full_name(oirq.controller));

virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
Expand Down Expand Up @@ -1493,8 +1492,7 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose)
struct pci_bus *bus;
struct device_node *node = hose->dn;

pr_debug("PCI: Scanning PHB %s\n",
node ? node->full_name : "<NO NAME>");
pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));

pcibios_setup_phb_resources(hose, &resources);

Expand Down
6 changes: 2 additions & 4 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
} else {
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
oirq.size, oirq.specifier[0], oirq.specifier[1],
oirq.controller ? oirq.controller->full_name :
"<default>");
of_node_full_name(oirq.controller));

virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
oirq.size);
Expand Down Expand Up @@ -1628,8 +1627,7 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
struct device_node *node = hose->dn;
int mode;

pr_debug("PCI: Scanning PHB %s\n",
node ? node->full_name : "<NO NAME>");
pr_debug("PCI: Scanning PHB %s\n", of_node_full_name(node));

/* Get some IO space for the new PHB */
pcibios_setup_phb_io_space(hose);
Expand Down
5 changes: 2 additions & 3 deletions arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,7 @@ static void __devinit vio_dev_release(struct device *dev)
struct iommu_table *tbl = get_iommu_table_base(dev);

if (tbl)
iommu_free_table(tbl, dev->of_node ?
dev->of_node->full_name : dev_name(dev));
iommu_free_table(tbl, of_node_full_name(dev->of_node));
of_node_put(dev->of_node);
kfree(to_vio_dev(dev));
}
Expand Down Expand Up @@ -1519,7 +1518,7 @@ static ssize_t devspec_show(struct device *dev,
{
struct device_node *of_node = dev->of_node;

return sprintf(buf, "%s\n", of_node ? of_node->full_name : "none");
return sprintf(buf, "%s\n", of_node_full_name(of_node));
}

static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/cell/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev)
iommu = cell_iommu_for_node(dev_to_node(dev));
if (iommu == NULL || list_empty(&iommu->windows)) {
printk(KERN_ERR "iommu: missing iommu for %s (node %d)\n",
dev->of_node ? dev->of_node->full_name : "?",
dev_to_node(dev));
of_node_full_name(dev->of_node), dev_to_node(dev));
return NULL;
}
window = list_entry(iommu->windows.next, struct iommu_window, list);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/pseries/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
if (!pdn || !PCI_DN(pdn)) {
printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: "
"no DMA window found for pci dev=%s dn=%s\n",
pci_name(dev), dn? dn->full_name : "<null>");
pci_name(dev), of_node_full_name(dn));
return;
}
pr_debug(" parent is %s\n", pdn->full_name);
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/of_device_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ static unsigned int __init build_one_device_irq(struct platform_device *op,
printk("%s: Apply [%s:%x] imap --> [%s:%x]\n",
op->dev.of_node->full_name,
pp->full_name, this_orig_irq,
(iret ? iret->full_name : "NULL"), irq);
of_node_full_name(iret), irq);

if (!iret)
break;
Expand Down
10 changes: 5 additions & 5 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ struct property *of_find_property(const struct device_node *np,
return NULL;

read_lock(&devtree_lock);
for (pp = np->properties; pp != 0; pp = pp->next) {
for (pp = np->properties; pp; pp = pp->next) {
if (of_prop_cmp(pp->name, name) == 0) {
if (lenp != 0)
if (lenp)
*lenp = pp->length;
break;
}
Expand Down Expand Up @@ -497,7 +497,7 @@ struct device_node *of_find_node_with_property(struct device_node *from,
read_lock(&devtree_lock);
np = from ? from->allnext : allnodes;
for (; np; np = np->allnext) {
for (pp = np->properties; pp != 0; pp = pp->next) {
for (pp = np->properties; pp; pp = pp->next) {
if (of_prop_cmp(pp->name, prop_name) == 0) {
of_node_get(np);
goto out;
Expand Down Expand Up @@ -902,7 +902,7 @@ int of_parse_phandle_with_args(struct device_node *np, const char *list_name,
/* Retrieve the phandle list property */
list = of_get_property(np, list_name, &size);
if (!list)
return -EINVAL;
return -ENOENT;
list_end = list + size / sizeof(*list);

/* Loop over the phandles until all the requested entry is found */
Expand Down Expand Up @@ -1180,7 +1180,7 @@ static void of_alias_add(struct alias_prop *ap, struct device_node *np,
ap->stem[stem_len] = 0;
list_add_tail(&ap->link, &aliases_lookup);
pr_debug("adding DT alias:%s: stem=%s id=%i node=%s\n",
ap->alias, ap->stem, ap->id, np ? np->full_name : NULL);
ap->alias, ap->stem, ap->id, of_node_full_name(np));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,

skiplevel:
/* Iterate again with new parent */
pr_debug(" -> new parent: %s\n", newpar ? newpar->full_name : "<>");
pr_debug(" -> new parent: %s\n", of_node_full_name(newpar));
of_node_put(ipar);
ipar = newpar;
newpar = NULL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/of/of_mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static const char *nand_ecc_modes[] = {
* The function gets ecc mode string from property 'nand-ecc-mode',
* and return its index in nand_ecc_modes table, or errno in error case.
*/
const int of_get_nand_ecc_mode(struct device_node *np)
int of_get_nand_ecc_mode(struct device_node *np)
{
const char *pm;
int err, i;
Expand Down
10 changes: 10 additions & 0 deletions include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ static inline int of_node_to_nid(struct device_node *np) { return -1; }
#define of_node_to_nid of_node_to_nid
#endif

static inline const char* of_node_full_name(struct device_node *np)
{
return np ? np->full_name : "<no-node>";
}

extern struct device_node *of_find_node_by_name(struct device_node *from,
const char *name);
#define for_each_node_by_name(dn, name) \
Expand Down Expand Up @@ -302,6 +307,11 @@ const char *of_prop_next_string(struct property *prop, const char *cur);

#else /* CONFIG_OF */

static inline const char* of_node_full_name(struct device_node *np)
{
return "<no-node>";
}

static inline bool of_have_populated_dt(void)
{
return false;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/of_mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#ifdef CONFIG_OF_MTD
#include <linux/of.h>
extern const int of_get_nand_ecc_mode(struct device_node *np);
int of_get_nand_ecc_mode(struct device_node *np);
int of_get_nand_bus_width(struct device_node *np);
bool of_get_nand_on_flash_bbt(struct device_node *np);
#endif
Expand Down
8 changes: 4 additions & 4 deletions kernel/irq/irqdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain,
}

pr_debug("irq %lu on domain %s mapped to virtual irq %u\n",
hwirq, domain->of_node ? domain->of_node->full_name : "null", virq);
hwirq, of_node_full_name(domain->of_node), virq);

return virq;
}
Expand Down Expand Up @@ -477,7 +477,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
return intspec[0];
#endif
pr_warning("no irq domain found for %s !\n",
controller->full_name);
of_node_full_name(controller));
return 0;
}

Expand Down Expand Up @@ -725,8 +725,8 @@ static int virq_debug_show(struct seq_file *m, void *private)
data = irq_desc_get_chip_data(desc);
seq_printf(m, data ? "0x%p " : " %p ", data);

if (desc->irq_data.domain && desc->irq_data.domain->of_node)
p = desc->irq_data.domain->of_node->full_name;
if (desc->irq_data.domain)
p = of_node_full_name(desc->irq_data.domain->of_node);
else
p = none;
seq_printf(m, "%s\n", p);
Expand Down

0 comments on commit f14121a

Please sign in to comment.