lkml.org 
[lkml]   [1998]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Initializing non-static locks
Date
  "William R. Dirks" <dirks@netcom.com> writes:
> I hit this problem in my driver. The way I solved it was to make a
> static variable
> rwlock_t rw_lock_unlocked = RW_LOCK_UNLOCKED;
>
> Then use rw_lock_unlocked instead of RW_LOCK_UNLOCKED. Maybe that is an
> idea for the kernel?
>
No, the problem is that if you assign a struct to a variable (EXCEPT where
declaring the variable), you have to typecode the struct. The very idea of
assigning a constant struct to a variable is a GCC extension. Basically you
write it like this:

structure = ((struct foo) {x + y, 'a', 0});

The whole right side of this should have been in the definition of the
RW_LOCK_UNLOCKED macro, not just the part between-and-including the braces.

See also the "Constructors" node of gcc.info.

--
Matthias Urlichs | noris network GmbH | smurf@noris.de | ICQ: 20193661
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger.
-- Franklin P. Jones

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.047 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site