Skip to contentSkip to conversation

Do we still need devtree_lock?

DISCUSSION Timur Tabi 3 participants 3 messages Jun 24, 2008 – Jun 25, 2008

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

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?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#1 lore raw
Quoted 27 lines · Timur Tabi

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);
Quoted 5 lines

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

Signature · 8 lines
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
#2 lore raw
Quoted 10 lines · On Wed, 25 Jun 2008 09:25:28 +1000 Michael Ellerman <[email protected]>…
Quoted 4 lines

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.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/