On Thu, Mar 29, 2012 at 5:01 AM, Huang Changming-R66093 <r66...@freescale.com> wrote: > Hi, all > > In function “of_find_node_with_property”, why use “raw_spin_lock_irqsave” to > disable preemption and disable interrupt?
Where do you see raw_spin_lock_irqsave? struct device_node *of_find_node_with_property(struct device_node *from, const char *prop_name) { struct device_node *np; struct property *pp; read_lock(&devtree_lock); np = from ? from->allnext : allnodes; for (; np; np = np->allnext) { for (pp = np->properties; pp != 0; pp = pp->next) { if (of_prop_cmp(pp->name, prop_name) == 0) { of_node_get(np); goto out; } } } out: of_node_put(from); read_unlock(&devtree_lock); return np; } We need a lock so that we don't parse the tree while it's being modified. That would cause the for-loop to fail in strange ways. -- Timur Tabi Linux kernel developer at Freescale _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev