• Michael Ellerman's avatar
    [POWERPC] Add of_get_next_parent() · f4eb0107
    Michael Ellerman authored
    
    
    Iterating through a device node's parents is simple enough, but dealing
    with the refcounts properly is a little ugly, and replicating that logic
    is asking for someone to get it wrong or forget it all together, eg:
    
    while (dn != NULL) {
    	/* loop body */
    	tmp = of_get_parent(dn);
    	of_node_put(dn);
    	dn = tmp;
    }
    
    So add of_get_next_parent(), inspired by of_get_next_child().  The
    contract is that it returns the parent and drops the reference on the
    current node, this makes the loop look like:
    
    while (dn != NULL) {
    	/* loop body */
    	dn = of_get_next_parent(dn);
    }
    Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
    Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    f4eb0107