linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Do we still need devtree_lock?
@ 2008-06-24 23:13 Timur Tabi
  2008-06-24 23:25 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Timur Tabi @ 2008-06-24 23:13 UTC (permalink / raw)
  To: linuxppc-dev

I'm trying to write a function that gets a list of all aliases

	aliases {
		serial0 = &serial0;
		serial1 = &serial1;
		pci0 = &pci0;
		pci1 = &pci1;
		pci2 = &pci2;
	};

That is, I do not know which aliases are in the /aliases node, so I need a
function that works somewhat like of_find_property(), but just returns the Nth
property instead of doing a strcmp.

I can't seem to find one, so I probably need to write one.  However, I noticed
that of_find_property() uses a lock:

	read_lock(&devtree_lock);
	for (pp = np->properties; pp != 0; pp = pp->next) {
		if (of_prop_cmp(pp->name, name) == 0) {
			if (lenp != 0)
				*lenp = pp->length;
			break;
		}
	}
	read_unlock(&devtree_lock);

But the comment for devtree_lock says this:

extern rwlock_t devtree_lock;	/* temporary while merging */

Since arch/ppc is going away, does this meant that the lock can go away do?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Do we still need devtree_lock?
  2008-06-24 23:13 Do we still need devtree_lock? Timur Tabi
@ 2008-06-24 23:25 ` Michael Ellerman
  2008-06-25  7:12   ` Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2008-06-24 23:25 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Tue, 2008-06-24 at 18:13 -0500, Timur Tabi wrote:
> I'm trying to write a function that gets a list of all aliases
> 
> 	aliases {
> 		serial0 = &serial0;
> 		serial1 = &serial1;
> 		pci0 = &pci0;
> 		pci1 = &pci1;
> 		pci2 = &pci2;
> 	};
> 
> That is, I do not know which aliases are in the /aliases node, so I need a
> function that works somewhat like of_find_property(), but just returns the Nth
> property instead of doing a strcmp.
> 
> I can't seem to find one, so I probably need to write one.  However, I noticed
> that of_find_property() uses a lock:
> 
> 	read_lock(&devtree_lock);
> 	for (pp = np->properties; pp != 0; pp = pp->next) {
> 		if (of_prop_cmp(pp->name, name) == 0) {
> 			if (lenp != 0)
> 				*lenp = pp->length;
> 			break;
> 		}
> 	}
> 	read_unlock(&devtree_lock);
> 
> But the comment for devtree_lock says this:
> 
> extern rwlock_t devtree_lock;	/* temporary while merging */
> 
> Since arch/ppc is going away, does this meant that the lock can go away do?

You wish :)  That /would/ make life easier.

I think the comment just refers to the extern declaration being in
the .c file, rather than a header - ie. now that the merge is done we
should clean it up and put it in a header.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Do we still need devtree_lock?
  2008-06-24 23:25 ` Michael Ellerman
@ 2008-06-25  7:12   ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2008-06-25  7:12 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Timur Tabi

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

On Wed, 25 Jun 2008 09:25:28 +1000 Michael Ellerman <michael@ellerman.id.au> wrote:
>
> > extern rwlock_t devtree_lock;	/* temporary while merging */
> > 
> > Since arch/ppc is going away, does this meant that the lock can go away do?
> 
> You wish :)  That /would/ make life easier.
> 
> I think the comment just refers to the extern declaration being in
> the .c file, rather than a header - ie. now that the merge is done we
> should clean it up and put it in a header.

The merge referred to is the merge between the Sparc and Powerpc device
tree accessing functions.  This is not complete and I need to get back to
it.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-25  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 23:13 Do we still need devtree_lock? Timur Tabi
2008-06-24 23:25 ` Michael Ellerman
2008-06-25  7:12   ` Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).